This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/82296] New: Wrong code with optimization -O2


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82296

            Bug ID: 82296
           Summary: Wrong code with optimization -O2
           Product: gcc
           Version: 7.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lundril at gmx dot de
  Target Milestone: ---

Created attachment 42226
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42226&action=edit
Compiling this code results in assembler which translates to "return 1;"

To reproduce
  gcc -O2 -S gcc_check.c

The attached C code seems to produce assembler code which just ALWAYs
implements "return 1;" everything else is optimized away.

I think this is wrong ?

I tried this with

* GCC 4.9.2 for x64
* GCC 5.4.0 for x64
* GCC 7.2.1 for x64
* GCC 4.8.4 for ARM
* GCC 6.3.1 for PowerPC

it seems all of these versions produce assembler code, which implements "return
1;".

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]