xref: /netbsd-src/external/gpl3/gcc.old/dist/contrib/reghunt/bin/gcc-test-segfault-on-valid-code (revision 36ac495d2b3ea2b9d96377b2143ebfedac224b92)
1*36ac495dSmrg#! /bin/sh
2*36ac495dSmrg
3*36ac495dSmrg# Test an "ice-on-valid-code" GCC bug that results in a compiler
4*36ac495dSmrg# segfault, using environment variables set in several reghunt scripts
5*36ac495dSmrg# and configuration files.
6*36ac495dSmrg#
7*36ac495dSmrg# Copyright (C) 2007 Free Software Foundation.
8*36ac495dSmrg#
9*36ac495dSmrg# This file is free software; you can redistribute it and/or modify
10*36ac495dSmrg# it under the terms of the GNU General Public License as published by
11*36ac495dSmrg# the Free Software Foundation; either version 3 of the License, or
12*36ac495dSmrg# (at your option) any later version.
13*36ac495dSmrg#
14*36ac495dSmrg# This program is distributed in the hope that it will be useful,
15*36ac495dSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of
16*36ac495dSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17*36ac495dSmrg# GNU General Public License for more details.
18*36ac495dSmrg#
19*36ac495dSmrg# For a copy of the GNU General Public License, write the the
20*36ac495dSmrg# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21*36ac495dSmrg# Boston, MA 02111-1301, USA.
22*36ac495dSmrg
23*36ac495dSmrgID=$1
24*36ac495dSmrg
25*36ac495dSmrgLOGID=`printf "%04d" ${ID}`
26*36ac495dSmrgLOG=${BUGID}.${LOGID}.out
27*36ac495dSmrgMSGID="bug ${BUGID}, id ${ID}"
28*36ac495dSmrg
29*36ac495dSmrg$REG_TEST_COMPILER $REG_OPTS $REG_TESTCASE > ${LOG} 2>&1
30*36ac495dSmrg
31*36ac495dSmrgif [ $? -eq 0 ]; then
32*36ac495dSmrg    echo "`date`  test compiled successfully for ${MSGID}"
33*36ac495dSmrg    exit $REG_PASS
34*36ac495dSmrgfi
35*36ac495dSmrg
36*36ac495dSmrggrep -q 'No such file or directory' ${LOG}
37*36ac495dSmrgif [ $? -eq 0 ]; then
38*36ac495dSmrg    echo "`date`    unexpected failure: missing file for ${MSGID}"
39*36ac495dSmrg    exit $REG_ERROR
40*36ac495dSmrgfi
41*36ac495dSmrg
42*36ac495dSmrggrep -q 'egmentation fault' ${LOG}
43*36ac495dSmrgif [ $? -ne 0 ]; then
44*36ac495dSmrg    echo "`date`    unexpected failure: no segfault message for ${MSGID}"
45*36ac495dSmrg    exit $REG_ERROR
46*36ac495dSmrgfi
47*36ac495dSmrg
48*36ac495dSmrgecho "`date`  compilation failed for ${MSGID}"
49*36ac495dSmrgexit $REG_FAIL
50