I was giving LTO a play and trying to look at some of the testsuite failures.
One of the failures that I am seeing is an ICE when I try to compile an empty
function. I reduced this from the ICE for c-torture/compile/20021204-1.c


void t(void)
{

}


The ICE occurs in cc1 with and without LTO 

ram...@numenor:~/cos/build-try/gcc$ ./cc1 ~/20021204-1.i

/home/ramana/20021204-1.i:6: internal compiler error: in start_function, at
c-decl.c:6225
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.


Doing a bt shows that 
#0  fancy_abort (file=0xb7849834 ")\003\204", line=178460604, function=0x1
<Address 0x1 out of bounds>) at ../../lto/gcc/diagnostic.c:711
#1  0x08067ac3 in start_function (declspecs=0xaa31720, declarator=0xaa317bc,
attributes=0x0) at ../../lto/gcc/c-decl.c:6225
#2  0x080c765a in c_parser_declaration_or_fndef (parser=0xb7849834,
fndef_ok=<value optimized out>, empty_ok=<value optimized out>, nested=0 '\0',
start_attr_ok=<value optimized out>) at ../../lto/gcc/c-parser.c:1278
#3  0x080c96b6 in c_parser_external_declaration (parser=0xb7849834) at
../../lto/gcc/c-parser.c:1076
#4  0x080ca4bb in c_parse_file () at ../../lto/gcc/c-parser.c:979
#5  0x080b0005 in c_common_parse_file (set_yydebug=0) at
../../lto/gcc/c-opts.c:1251
#6  0x08389371 in toplev_main (argc=2, argv=0xbf8535d4) at
../../lto/gcc/toplev.c:980
#7  0x080d8a0b in main (argc=2, argv=0xbf8535d4) at ../../lto/gcc/main.c:35


And the ICE is because of this particular line in c-decl.c : 6226. The comment
indicates that DECL_ASSEMBLER_NAME should not be set up at this point of time. 

Ofcourse removing the assert helps this case go through, but the original test
seems to silently generate wrong code. 

In gcc/c-decl.c:6225

  /* This is the earliest point at which we might know the assembler
     name of the function.  Thus, if it's set before this, die horribly.  */
  gcc_assert (!DECL_ASSEMBLER_NAME_SET_P (decl1));


Simply removing the assert as expected doesn't help with the original test
failure because it ICE's elsewhere as a result of this change. 


ram...@numenor:~/cos/build-try/gcc$ ./xgcc -v
Using built-in specs.
COLLECT_GCC=./xgcc
Target: i686-pc-linux-gnu
Configured with: ../lto/configure --enable-languages=c,c++,lto
Thread model: posix
gcc version 4.4.0 20090127 (experimental) (lto merged with rev 143693) 

Built with svn revision 143833.


-- 
           Summary: ICE with an empty function
           Product: gcc
           Version: lto
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ramana dot r at gmail dot com
 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=39049

Reply via email to