This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/82296] New: Wrong code with optimization -O2
- From: "lundril at gmx dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 22 Sep 2017 12:36:44 +0000
- Subject: [Bug c/82296] New: Wrong code with optimization -O2
- Auto-submitted: auto-generated
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;".