Illegal instruction (int main() returns nothing, only when -O2/-O3 used)

Bug #1039401 reported by Коренберг Марк
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Linaro GCC
Invalid
Undecided
Unassigned
gcc-4.6 (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

$ 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

$ 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.

The problem does not appear in upstream (look at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54340 )

description: updated
Revision history for this message
Matthias Klose (doko) wrote :

I can't even reproduce this with 4.6.3-1ubuntu5 on precise on amd64.

Changed in gcc-4.6 (Ubuntu):
status: New → Incomplete
Revision history for this message
Zhenqiang Chen (zhenqiang-chen) wrote :

Thank you for the bug report. I can not reproduce this with gcc-linaro-4.6-2012.08 and gcc-linaro-4.7-2012.08 on ARM.

Changed in gcc-linaro:
status: New → Incomplete
Matthias Klose (doko)
Changed in gcc-4.6 (Ubuntu):
status: Incomplete → Invalid
Revision history for this message
Viktor (vchong) wrote :

Closing per above comments and end of support.

Changed in gcc-linaro:
status: Incomplete → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.