This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/63140] wrong code generation probably due to optimization problem
- From: "gcc at boomerangsworld dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 03 Sep 2014 13:04:59 +0000
- Subject: [Bug c++/63140] wrong code generation probably due to optimization problem
- Auto-submitted: auto-generated
- References: <bug-63140-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63140
--- Comment #11 from Ralf Hoffmann <gcc at boomerangsworld dot de> ---
I managed to create a standalone test program. Attachment "aguix.cc" contains
the stripped down critical code segments. The two other files "aguixtest.cc"
and "aguixtest.hh" are just to make a runnable binary. The attached script
"build" can be used to create the binary.
The expected output is:
wait4mess2 called
waittime2: 5
Worker: msg lock element lost!
Worker: msg lock element lost!
wait4mess2 called
(this is what the binary does with gcc 4.8.1)
while with gcc 4.9.1 it will loop forever:
wait4mess2 called
waittime2: 5
waittime2: 5
waittime2: 5
waittime2: 5
....
Compiled with -O1 instead of -O2 the example program crashes.
Adding -fsanitize=undefined on the other hand will make it work again
regardless of O1 or O2.