Bug 17908 - [4.0 Regression] ICE: tree check: expected function_decl, have continue_stmt in c_expand_body, at /c-decl.c:6328
Summary: [4.0 Regression] ICE: tree check: expected function_decl, have continue_stmt ...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.0.0
: P2 critical
Target Milestone: 4.0.0
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code, wrong-code
Depends on:
Blocks:
 
Reported: 2004-10-09 11:54 UTC by Andreas Jaeger
Modified: 2005-07-23 22:49 UTC (History)
2 users (show)

See Also:
Host: x86_64-linux-gnu
Target: x86_64-linux-gnu
Build: x
Known to work:
Known to fail:
Last reconfirmed:


Attachments
Preprocessed source file (from x86-64) (62.23 KB, text/plain)
2004-10-09 11:55 UTC, Andreas Jaeger
Details
Preprocessed source file - i386 compilation (62.26 KB, text/plain)
2004-10-10 08:20 UTC, Andreas Jaeger
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Jaeger 2004-10-09 11:54:28 UTC
/opt/gcc/4.0-devel/bin/gcc -fpreprocessed parse.i -O2  -c pars 
e.i  -v 
Reading specs from /opt/gcc/4.0-devel/lib/gcc/x86_64-suse-linux-gnu/4.0.0/specs 
Configured with: /cvs/gcc/configure --prefix=/opt/gcc/4.0-devel --disable-nls 
--enable-threads=posix --enable-clocale=gnu --enable-__cxa_atexit 
--enable-shared--enable-languages=c,c++,treelang,java,f95,objc 
--with-system-zlib x86_64-suse-linux-gnu 
Thread model: posix 
gcc version 4.0.0 20041007 (experimental) 
 /opt/gcc/4.0-devel/libexec/gcc/x86_64-suse-linux-gnu/4.0.0/cc1 -fpreprocessed 
parse.i -quiet -dumpbase parse.i -mtune=k8 -auxbase parse -O2 -version 
-fpreprocessed -o /tmp/ccnrYTh0.s 
GNU C version 4.0.0 20041007 (experimental) (x86_64-suse-linux-gnu) 
        compiled by GNU C version 4.0.0 20041007 (experimental). 
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 
parse.i: In function 'ruby_yyparse': 
parse.i:13581: internal compiler error: tree check: expected function_decl, 
have continue_stmt in c_expand_body, at /c-decl.c:6328 
Please submit a full bug report, 
with preprocessed source if appropriate. 
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
Comment 1 Andreas Jaeger 2004-10-09 11:55:29 UTC
Created attachment 7314 [details]
Preprocessed source file (from x86-64)
Comment 2 Andrew Pinski 2004-10-09 15:33:02 UTC
I cannot reproduce this on powerpc-darwin but that does not mean it is not still a bug.
Comment 3 Andrew Pinski 2004-10-09 16:33:42 UTC
I cannot rreproduce this with a cross to x86_64-linux-gnu from powerpc-darwin so this is either 
wrong-code produced by the bootstrapping or a GC problem.
Comment 4 Andreas Jaeger 2004-10-10 06:43:33 UTC
I see the ICE only on i586 and x86_64.  ia64 and ppc compile this file fine. 
 
Do you want preprocessed i586 code? 
Comment 5 Andreas Jaeger 2004-10-10 08:20:48 UTC
Created attachment 7318 [details]
Preprocessed source file - i386 compilation

On i586 I get the same ICE - here's the preprocessed source file.  Hope this
helps.
Comment 6 Volker Reichelt 2004-10-11 11:47:41 UTC
Here's a reduced testcase:

===========================
int foo()
{
    unsigned char c;
    switch ((int)c)
    {
      case -1:
      case 0:
      case 4:
      case 5:
      case 42:
        return 0;
    }
}
===========================

parse.i: In function 'foo':
parse.i:13: internal compiler error: tree check: expected function_decl, have
error_mark in c_expand_body, at /c-decl.c:6334
Please submit a full bug report, [etc.]

If I replace the 42 with 39 for example, I get a segfault instead.

This might be related to PR 17657.
Comment 7 Andrew Pinski 2004-10-11 13:45:46 UTC
Note that I can reproduce it with a full bootstrap compiler but not with just stage 1 so something is 
causing wrong code somewhere.
Comment 8 Andrew Pinski 2004-10-12 12:56:56 UTC
Fixed by the same patch which fixed PR 17657.