http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54340

             Bug #: 54340
           Summary: internal compiler error: Illegal instruction (int
                    main() returns nothing, only when -O2/-O3 used)
    Classification: Unclassified
           Product: gcc
           Version: 4.6.3
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: socketp...@gmail.com


$ gcc --version
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ gcc test.c 

$ LANG=C gcc -O2 test.c 
test.c: In function 'main':
test.c:6:1: internal compiler error: Illegal instruction
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.
Preprocessed source stored into /tmp/ccYojEN6.out file, please attach this to
your bugreport.

$ cat test.c 
int main (void)
{
  volatile int a;
  if (a == 42)
    return 1;
}

--------------------------------
If I add "return 0;" to the end of function - problem is fixed. I understand,
that program is not correct, but, as I think, gcc should not fail on that. It
seems, it is optimizer bug.

Reply via email to