public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: De Beukelaer Fabrice <sfc@village.uunet.be> To: gcc-bugs@gcc.gnu.org Subject: ice on valid code: switch in a while with -O2 Date: Thu, 12 Aug 2004 20:40:00 -0000 [thread overview] Message-ID: <1092343211.3873.1.camel@mars.celie.net> (raw) Hello, The following code: =================== 1 /* bug.c */ 2 #include <stdlib.h> 3 4 int bar(void); 5 6 int main(void) 7 { 8 int foo; 9 10 while ((foo = bar())) { 11 switch (foo) { 12 default: 13 exit(EXIT_FAILURE); 14 } 15 } 16 17 return EXIT_SUCCESS; 18 } causes: ======= % gcc -O2 -c bug.c bug.c: In function `main': bug.c:18: internal compiler error: Segmentation Fault Please submit a full bug report, with preprocessed source if appropriate. on : ==== SunOS sun.celie.net 5.9 Generic_112233-05 sun4u sparc SUNW,Ultra-1 output of gcc -v -save-temps -O2 -c bug.c ========================================== Reading specs from /export/opt/pkg/gcc-3.4.1/bin/../lib/gcc/sparc-sun-solaris2.9/3.4.1/specs Configured with: ../configure --prefix=/opt/pkg/gcc-3.4.1 --enable-languages=c,c++ --disable-nls --with-cpu=v9 Thread model: posix gcc version 3.4.1 /export/opt/pkg/gcc-3.4.1/bin/../libexec/gcc/sparc-sun-solaris2.9/3.4.1/cc1 -E -quiet -v -iprefix /export/opt/pkg/gcc-3.4.1/bin/../lib/gcc/sparc-sun-solaris2.9/3.4.1/ -D__sparcv8 bug.c -mcpu=v9 -O2 -o bug.i ignoring nonexistent directory "/export/opt/pkg/gcc-3.4.1/bin/../lib/gcc/sparc-sun-solaris2.9/3.4.1/../../../../sparc-sun-solaris2.9/include" ignoring duplicate directory "/opt/pkg/gcc-3.4.1/lib/gcc/sparc-sun-solaris2.9/3.4.1/include" ignoring nonexistent directory "/opt/pkg/gcc-3.4.1/lib/gcc/sparc-sun-solaris2.9/3.4.1/../../../../sparc-sun-solaris2.9/include" #include "..." search starts here: #include <...> search starts here: /export/opt/pkg/gcc-3.4.1/bin/../lib/gcc/sparc-sun-solaris2.9/3.4.1/include /usr/local/include /opt/pkg/gcc-3.4.1/include /usr/include End of search list. /export/opt/pkg/gcc-3.4.1/bin/../libexec/gcc/sparc-sun-solaris2.9/3.4.1/cc1 -fpreprocessed bug.i -quiet -dumpbase bug.c -mcpu=v9 -auxbase bug -O2 -version -o bug.s GNU C version 3.4.1 (sparc-sun-solaris2.9) compiled by GNU C version 3.4.1. GGC heuristics: --param ggc-min-expand=56 --param ggc-min-heapsize=49152 bug.c: In function `main': bug.c:18: 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. notes: ====== The segmentation fault occurs only with -O2. With no optimization or with -O1, -O3, -O4 there are no problems. The bug was also in 3.4.0. Thanks for your work dbk <sfc@village.uunet.be> preprocessed file bug.i: ======================== # 1 "bug.c" # 1 "<built-in>" # 1 "<command line>" # 1 "bug.c" # 1 "/usr/include/stdlib.h" 1 3 4 # 16 "/usr/include/stdlib.h" 3 4 #pragma ident "@(#)stdlib.h 1.48 00/04/13 SMI" # 1 "/usr/include/iso/stdlib_iso.h" 1 3 4 # 28 "/usr/include/iso/stdlib_iso.h" 3 4 #pragma ident "@(#)stdlib_iso.h 1.3 01/03/09 SMI" # 1 "/usr/include/sys/feature_tests.h" 1 3 4 # 13 "/usr/include/sys/feature_tests.h" 3 4 #pragma ident "@(#)feature_tests.h 1.18 99/07/26 SMI" # 1 "/usr/include/sys/isa_defs.h" 1 3 4 # 9 "/usr/include/sys/isa_defs.h" 3 4 #pragma ident "@(#)isa_defs.h 1.20 99/05/04 SMI" # 16 "/usr/include/sys/feature_tests.h" 2 3 4 # 31 "/usr/include/iso/stdlib_iso.h" 2 3 4 extern unsigned char __ctype[]; # 48 "/usr/include/iso/stdlib_iso.h" 3 4 typedef struct { int quot; int rem; } div_t; typedef struct { long quot; long rem; } ldiv_t; typedef unsigned int size_t; # 84 "/usr/include/iso/stdlib_iso.h" 3 4 typedef long wchar_t; extern void abort(void); extern int abs(int); extern int atexit(void (*)(void)); extern double atof(const char *); extern int atoi(const char *); extern long int atol(const char *); extern void *bsearch(const void *, const void *, size_t, size_t, int (*)(const void *, const void *)); extern void *calloc(size_t, size_t); extern div_t div(int, int); extern void exit(int); extern void free(void *); extern char *getenv(const char *); extern long int labs(long); extern ldiv_t ldiv(long, long); extern void *malloc(size_t); extern int mblen(const char *, size_t); extern size_t mbstowcs(wchar_t *, const char *, size_t); extern int mbtowc(wchar_t *, const char *, size_t); extern void qsort(void *, size_t, size_t, int (*)(const void *, const void *)); extern int rand(void); extern void *realloc(void *, size_t); extern void srand(unsigned int); extern double strtod(const char *, char **); extern long int strtol(const char *, char **, int); extern unsigned long int strtoul(const char *, char **, int); extern int system(const char *); extern int wctomb(char *, wchar_t); extern size_t wcstombs(char *, const wchar_t *, size_t); # 19 "/usr/include/stdlib.h" 2 3 4 # 68 "/usr/include/stdlib.h" 3 4 typedef struct { long long quot; long long rem; } lldiv_t; typedef long uid_t; # 112 "/usr/include/stdlib.h" 3 4 extern void _exithandle(void); extern double drand48(void); extern double erand48(unsigned short *); extern long jrand48(unsigned short *); extern void lcong48(unsigned short *); extern long lrand48(void); extern long mrand48(void); extern long nrand48(unsigned short *); extern unsigned short *seed48(unsigned short *); extern void srand48(long); extern int putenv(char *); extern void setkey(const char *); # 140 "/usr/include/stdlib.h" 3 4 typedef int ssize_t; extern void swab(const char *, char *, ssize_t); extern int mkstemp(char *); extern int mkstemp64(char *); extern long a64l(const char *); extern char *ecvt(double, int, int *, int *); extern char *fcvt(double, int, int *, int *); extern char *gcvt(double, int, char *); extern int getsubopt(char **, char *const *, char **); extern int grantpt(int); extern char *initstate(unsigned, char *, size_t); extern char *l64a(long); extern char *mktemp(char *); extern char *ptsname(int); extern long random(void); extern char *realpath(const char *, char *); extern char *setstate(const char *); extern void srandom(unsigned); extern int ttyslot(void); extern int unlockpt(int); extern void *valloc(size_t); extern void closefrom(int); extern int dup2(int, int); extern int fdwalk(int (*)(void *, int), void *); extern char *qecvt(long double, int, int *, int *); extern char *qfcvt(long double, int, int *, int *); extern char *qgcvt(long double, int, char *); extern char *getcwd(char *, size_t); extern const char *getexecname(void); extern char *getlogin(void); extern int getopt(int, char *const *, const char *); extern char *optarg; extern int optind, opterr, optopt; extern char *getpass(const char *); extern char *getpassphrase(const char *); extern int getpw(uid_t, char *); extern int isatty(int); extern void *memalign(size_t, size_t); extern char *ttyname(int); extern long long atoll(const char *); extern long long llabs(long long); extern lldiv_t lldiv(long long, long long); extern char *lltostr(long long, char *); extern long long strtoll(const char *, char **, int); extern unsigned long long strtoull(const char *, char **, int); extern char *ulltostr(unsigned long long, char *); # 2 "bug.c" 2 int bar(void); int main(void) { int foo; while ((foo = bar())) { switch (foo) { default: exit(1); } } return 0; }
next reply other threads:[~2004-08-12 20:40 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2004-08-12 20:40 De Beukelaer Fabrice [this message] 2004-08-13 9:42 ` Eric Botcazou
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1092343211.3873.1.camel@mars.celie.net \ --to=sfc@village.uunet.be \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).