The OpenBSD file zic.c causes g++ 4.0.1 to segfault, though plain gcc 4.0.1 does not. The plainest way to reproduce this is to get the OpenBSD version from <http://www.openbsd.org/cgi-bin/cvsweb/~checkout~/src/lib/libc/time/zic.c?rev=1.24&content- type=text/plain>, but I'll attach a Delta-reduced version of our modified copy. g++ 3.3.4 rejects it without crashing, but with "confused by earlier errors, bailing out," so this is presumably invalid code, though it seems to be a popular file. (Perhaps I should add OpenBSD to section I of my article :-) I'm not sure if this is the same as my two other segfault bugs: Running the --enable-checking version under GDB fails to catch the segfault, so I couldn't get a stacktrace. (I'm trying to build an -- enable-checking=all version, but it's taken more than twenty-four hours so far.)
Session: 74> /opt/gcc401chk/bin/g++ -v ../cpp/bugfiles/GCC_bugfiles/error/105198_zic_min.c Using built-in specs. Target: i686-pc-linux-gnu Configured with: ../configure --enable-checking --prefix=/opt/gcc401chk --enable-languages=c,c+ + Thread model: posix gcc version 4.0.1 /opt/gcc401chk/libexec/gcc/i686-pc-linux-gnu/4.0.1/cc1plus -quiet -v -D_GNU_SOURCE ../cpp/ bugfiles/GCC_bugfiles/error/105198_zic_min.c -quiet -dumpbase 105198_zic_min.c - mtune=pentiumpro -auxbase 105198_zic_min -version -o /tmp/ccGy60bj.s ignoring nonexistent directory "/opt/gcc401chk/lib/gcc/i686-pc-linux-gnu/4.0.1/../../../../i686-pc- linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /opt/gcc401chk/lib/gcc/i686-pc-linux-gnu/4.0.1/../../../../include/c++/4.0.1 /opt/gcc401chk/lib/gcc/i686-pc-linux-gnu/4.0.1/../../../../include/c++/4.0.1/i686-pc-linux-gnu /opt/gcc401chk/lib/gcc/i686-pc-linux-gnu/4.0.1/../../../../include/c++/4.0.1/backward /usr/local/include /opt/gcc401chk/include /opt/gcc401chk/lib/gcc/i686-pc-linux-gnu/4.0.1/include /usr/include End of search list. GNU C++ version 4.0.1 (i686-pc-linux-gnu) compiled by GNU C version 3.3.4 (pre 3.3.5 20040809). GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 ../cpp/bugfiles/GCC_bugfiles/error/105198_zic_min.c:1: error: expected unqualified-id before { token ../cpp/bugfiles/GCC_bugfiles/error/105198_zic_min.c:31: error: expected unqualified-id before { token ../cpp/bugfiles/GCC_bugfiles/error/105198_zic_min.c:36: error: expected unqualified-id before { token ../cpp/bugfiles/GCC_bugfiles/error/105198_zic_min.c:37: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. Delta-reduced file: { if (sscanf(cp, scheck(cp, "%d"), &year) != 1) { } while (j != year) { if (year > j) { } } while (j != month) { } { if (strcmp(cp, "") == 0) { /* infile() turns "-" into "" */ } } for (i = 0; i < zonecount; ++i) { if (zp->z_nrules == 0) { if (usestart) { if (useuntil) { if (k < 0 || jtime < ktime) { } } if (usestart) { if (ktime < starttime) { } } } } if (usestart) { } } } { (timecnt == 1 && attypes[0].at < min_time)) { } } int a; { } register const char * bp; PalmSource bug 105198. -- Summary: OpenBSD's zic.c causes g++ but not gcc to segfault Product: gcc Version: 4.0.1 Status: UNCONFIRMED Severity: minor Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: flash at pobox dot com CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23125