* [Bug c++/63140] wrong code generation probably due to optimization problem
2014-09-02 15:51 [Bug c++/63140] New: wrong code generation probably due to optimization problem gcc at boomerangsworld dot de
@ 2014-09-02 15:54 ` gcc at boomerangsworld dot de
2014-09-02 17:54 ` gcc at boomerangsworld dot de
` (11 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: gcc at boomerangsworld dot de @ 2014-09-02 15:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63140
--- Comment #1 from Ralf Hoffmann <gcc at boomerangsworld dot de> ---
Created attachment 33436
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33436&action=edit
(gzipped) preprocessed input file
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/63140] wrong code generation probably due to optimization problem
2014-09-02 15:51 [Bug c++/63140] New: wrong code generation probably due to optimization problem gcc at boomerangsworld dot de
2014-09-02 15:54 ` [Bug c++/63140] " gcc at boomerangsworld dot de
@ 2014-09-02 17:54 ` gcc at boomerangsworld dot de
2014-09-03 9:03 ` rguenth at gcc dot gnu.org
` (10 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: gcc at boomerangsworld dot de @ 2014-09-02 17:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63140
--- Comment #2 from Ralf Hoffmann <gcc at boomerangsworld dot de> ---
Small update: The working 32 bit target was gcc 4.7, so it's not related to
this bug.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/63140] wrong code generation probably due to optimization problem
2014-09-02 15:51 [Bug c++/63140] New: wrong code generation probably due to optimization problem gcc at boomerangsworld dot de
2014-09-02 15:54 ` [Bug c++/63140] " gcc at boomerangsworld dot de
2014-09-02 17:54 ` gcc at boomerangsworld dot de
@ 2014-09-03 9:03 ` rguenth at gcc dot gnu.org
2014-09-03 9:45 ` jakub at gcc dot gnu.org
` (9 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-09-03 9:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63140
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
You might want to try -fsanitize=undefined and/or -fno-strict-overflow as it
sounds like you may be invoking undefined behavior.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/63140] wrong code generation probably due to optimization problem
2014-09-02 15:51 [Bug c++/63140] New: wrong code generation probably due to optimization problem gcc at boomerangsworld dot de
` (2 preceding siblings ...)
2014-09-03 9:03 ` rguenth at gcc dot gnu.org
@ 2014-09-03 9:45 ` jakub at gcc dot gnu.org
2014-09-03 10:30 ` gcc at boomerangsworld dot de
` (8 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-09-03 9:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63140
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Or -fno-aggressive-loop-optimizations. From your description it is hard to
figure what exactly to look for in the assembly, so e.g. bisecting compiler
where it stopped working is not easy.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/63140] wrong code generation probably due to optimization problem
2014-09-02 15:51 [Bug c++/63140] New: wrong code generation probably due to optimization problem gcc at boomerangsworld dot de
` (3 preceding siblings ...)
2014-09-03 9:45 ` jakub at gcc dot gnu.org
@ 2014-09-03 10:30 ` gcc at boomerangsworld dot de
2014-09-03 12:12 ` jakub at gcc dot gnu.org
` (7 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: gcc at boomerangsworld dot de @ 2014-09-03 10:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63140
--- Comment #5 from Ralf Hoffmann <gcc at boomerangsworld dot de> ---
Thanks for the feedback, I am also suspecting I have some problem in my code
regarding undefined behavior.
What I do for testing is to compile my tool Worker
(http://www.boomerangsworld.de/cms/worker/index.html, version 3.5.0) with
make clean
LDFLAGS="-fsanitize=undefined" CPPFLAGS="-fsanitize=undefined" ./configure
make
and then start the program (src/worker), click on top left "A" button for
the about dialog and click on the down arrow to scroll down the option list.
It then either works, or the process hangs in the endless loop.
I tried to use "-fsanitize=undefined" and it actually makes a difference. There
is no compiler output pointing out some problem and also no runtime output when
reaching the test point mentioned above. But with this option, it behaves
normally and the endless loop does not occur.
When using the options -fno-strict-overflow or
-fno-aggressive-loop-optimizations the problem still occurs.
I would like to help bisecting the compiler if you could give me
a hint where to start. As far as I see, there is no git repo which
would make it easier.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/63140] wrong code generation probably due to optimization problem
2014-09-02 15:51 [Bug c++/63140] New: wrong code generation probably due to optimization problem gcc at boomerangsworld dot de
` (4 preceding siblings ...)
2014-09-03 10:30 ` gcc at boomerangsworld dot de
@ 2014-09-03 12:12 ` jakub at gcc dot gnu.org
2014-09-03 12:57 ` gcc at boomerangsworld dot de
` (6 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-09-03 12:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63140
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
There is a git mirror of the svn repo.
Anyway, -fsanitize=undefined enables -fno-delete-null-pointer-checks, perhaps
you could try that option alone if it makes a difference.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/63140] wrong code generation probably due to optimization problem
2014-09-02 15:51 [Bug c++/63140] New: wrong code generation probably due to optimization problem gcc at boomerangsworld dot de
` (5 preceding siblings ...)
2014-09-03 12:12 ` jakub at gcc dot gnu.org
@ 2014-09-03 12:57 ` gcc at boomerangsworld dot de
2014-09-03 12:59 ` gcc at boomerangsworld dot de
` (5 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: gcc at boomerangsworld dot de @ 2014-09-03 12:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63140
--- Comment #7 from Ralf Hoffmann <gcc at boomerangsworld dot de> ---
Created attachment 33442
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33442&action=edit
simplified example file 1
simple example containing the code piece which triggers the behavior
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/63140] wrong code generation probably due to optimization problem
2014-09-02 15:51 [Bug c++/63140] New: wrong code generation probably due to optimization problem gcc at boomerangsworld dot de
` (6 preceding siblings ...)
2014-09-03 12:57 ` gcc at boomerangsworld dot de
@ 2014-09-03 12:59 ` gcc at boomerangsworld dot de
2014-09-03 13:00 ` gcc at boomerangsworld dot de
` (4 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: gcc at boomerangsworld dot de @ 2014-09-03 12:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63140
--- Comment #8 from Ralf Hoffmann <gcc at boomerangsworld dot de> ---
Created attachment 33443
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33443&action=edit
aguixtest.cc
file with helper functions, not related to the problem, but required to execute
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/63140] wrong code generation probably due to optimization problem
2014-09-02 15:51 [Bug c++/63140] New: wrong code generation probably due to optimization problem gcc at boomerangsworld dot de
` (7 preceding siblings ...)
2014-09-03 12:59 ` gcc at boomerangsworld dot de
@ 2014-09-03 13:00 ` gcc at boomerangsworld dot de
2014-09-03 13:01 ` gcc at boomerangsworld dot de
` (3 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: gcc at boomerangsworld dot de @ 2014-09-03 13:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63140
--- Comment #9 from Ralf Hoffmann <gcc at boomerangsworld dot de> ---
Created attachment 33444
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33444&action=edit
aguixtest.hh
file with helper functions, not related to the problem, but required to execute
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/63140] wrong code generation probably due to optimization problem
2014-09-02 15:51 [Bug c++/63140] New: wrong code generation probably due to optimization problem gcc at boomerangsworld dot de
` (8 preceding siblings ...)
2014-09-03 13:00 ` gcc at boomerangsworld dot de
@ 2014-09-03 13:01 ` gcc at boomerangsworld dot de
2014-09-03 13:05 ` gcc at boomerangsworld dot de
` (2 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: gcc at boomerangsworld dot de @ 2014-09-03 13:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63140
--- Comment #10 from Ralf Hoffmann <gcc at boomerangsworld dot de> ---
Created attachment 33445
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33445&action=edit
build
build script used to create executable test program
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/63140] wrong code generation probably due to optimization problem
2014-09-02 15:51 [Bug c++/63140] New: wrong code generation probably due to optimization problem gcc at boomerangsworld dot de
` (9 preceding siblings ...)
2014-09-03 13:01 ` gcc at boomerangsworld dot de
@ 2014-09-03 13:05 ` gcc at boomerangsworld dot de
2014-09-03 16:35 ` jakub at gcc dot gnu.org
2021-07-22 16:50 ` pinskia at gcc dot gnu.org
12 siblings, 0 replies; 14+ messages in thread
From: gcc at boomerangsworld dot de @ 2014-09-03 13:05 UTC (permalink / raw)
To: gcc-bugs
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.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/63140] wrong code generation probably due to optimization problem
2014-09-02 15:51 [Bug c++/63140] New: wrong code generation probably due to optimization problem gcc at boomerangsworld dot de
` (10 preceding siblings ...)
2014-09-03 13:05 ` gcc at boomerangsworld dot de
@ 2014-09-03 16:35 ` jakub at gcc dot gnu.org
2021-07-22 16:50 ` pinskia at gcc dot gnu.org
12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-09-03 16:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63140
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |hubicka at gcc dot gnu.org
--- Comment #12 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
With that reduced testcase, I've bisected it to r208831, before inlining pass
there are no differences, and starting with r208831 the inliner changes
3 calls to __builtin_unreachable - __dynamic_cast, AWindow2::isParent and
fwrite. Haven't yet looked why the inliner considers those unreachable, if
there is some undefined behavior that makes those unreachable, or something
else.
Honza?
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/63140] wrong code generation probably due to optimization problem
2014-09-02 15:51 [Bug c++/63140] New: wrong code generation probably due to optimization problem gcc at boomerangsworld dot de
` (11 preceding siblings ...)
2014-09-03 16:35 ` jakub at gcc dot gnu.org
@ 2021-07-22 16:50 ` pinskia at gcc dot gnu.org
12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-22 16:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63140
--- Comment #13 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This might be fixed already just it was not marked as a regression.
^ permalink raw reply [flat|nested] 14+ messages in thread