[Bug c/59156] New: code miscompiled with -O2 -fpeel-loops
mjt+gcc at tls dot msk.ru
gcc-bugzilla@gcc.gnu.org
Sat Nov 16 20:20:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59156
Bug ID: 59156
Summary: code miscompiled with -O2 -fpeel-loops
Product: gcc
Version: 4.7.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: mjt+gcc at tls dot msk.ru
Created attachment 31231
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31231&action=edit
code demonstrating the issue
Attached is a code which shows different results when compiled with -O2 (wrong)
or -O1 (right). Initially it was -O2 -funroll-loops which triggered the issue,
but after reducing the code further I managed to get the same result with -O1
vs -O2 without any additional options.
Tested with debian gcc 4.7.2-5 x86-65 (wheezy), confirmed with 4.8.1-10
(debian/testing, also 64bits). 32bit code is not affected.
The code does not have any preprocessor directives.
I tried to reduce it further but it is a bit fragile - for example, removing a
single call to free() makes the code generated to be correct.
More information about the Gcc-bugs
mailing list