This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug lto/82027] New: wrong code with -O3 -flto
- From: "ssbssa at yahoo dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 29 Aug 2017 19:20:19 +0000
- Subject: [Bug lto/82027] New: wrong code with -O3 -flto
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82027
Bug ID: 82027
Summary: wrong code with -O3 -flto
Product: gcc
Version: 7.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: lto
Assignee: unassigned at gcc dot gnu.org
Reporter: ssbssa at yahoo dot de
CC: marxin at gcc dot gnu.org
Target Milestone: ---
Created attachment 42082
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42082&action=edit
test case
With the attached file I get a division by 0 when using "-O3 -flto", but not
with "-O2 -flto" or just "-O3".
Fails with 7.1.0 and 7.2.0, but not with 6.3.0.
$ g++ -O3 -flto -g -odiv0 div0.cpp
$ gdb -q div0
Reading symbols from div0...done.
(gdb) r
Starting program: C:\qiewer\div0.exe
[New Thread 1768.0x4e0]
Program received signal SIGFPE, Arithmetic exception.
0x000000000040f8f3 in calcPercent (name=0x411000 "", size=0, pos=4263936,
this=0x3b1f60) at div0.cpp:49
49 int percent = 100*pos/size;
(gdb) bt
#0 0x000000000040f8f3 in calcPercent (name=0x411000 "", size=0, pos=4263936,
this=0x3b1f60) at div0.cpp:49
#1 Looper::loop() () at div0.cpp:23
#2 main (argc=<optimized out>, argv=<optimized out>) at div0.cpp:64
(gdb) kill
Kill the program being debugged? (y or n) [answered Y; input not from terminal]
(gdb) quit