public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/50188] New: Optimizer doesn't take into account, that longjmp could lead to loops, which causes illegal code transformations.
@ 2011-08-25 15:58 michael.v.zolotukhin at gmail dot com
2011-08-25 17:18 ` [Bug tree-optimization/50188] " hjl.tools at gmail dot com
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: michael.v.zolotukhin at gmail dot com @ 2011-08-25 15:58 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50188
Bug #: 50188
Summary: Optimizer doesn't take into account, that longjmp
could lead to loops, which causes illegal code
transformations.
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: michael.v.zolotukhin@gmail.com
Created attachment 25104
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25104
Bug reproducer.
Setjmp/longjmp could form loops, like following:
int i = 0;
(void) setjmp (env);
i++;
if (i < 10)
longjmp (env, 0);
Optimizer removes check 'if(i<10)' and 'i++' (seemingly, as a dead code). In
this example after such transformations the loop becomes infinite.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/50188] Optimizer doesn't take into account, that longjmp could lead to loops, which causes illegal code transformations.
2011-08-25 15:58 [Bug tree-optimization/50188] New: Optimizer doesn't take into account, that longjmp could lead to loops, which causes illegal code transformations michael.v.zolotukhin at gmail dot com
@ 2011-08-25 17:18 ` hjl.tools at gmail dot com
2011-08-25 18:44 ` pinskia at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: hjl.tools at gmail dot com @ 2011-08-25 17:18 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50188
H.J. Lu <hjl.tools at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2011-08-25
Ever Confirmed|0 |1
Build|4.7.0 20110801, 4.5.1 |
|20100924 (Red Hat 4.5.1-4) |
--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> 2011-08-25 17:00:07 UTC ---
It also fails with GCC 4.1.2.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/50188] Optimizer doesn't take into account, that longjmp could lead to loops, which causes illegal code transformations.
2011-08-25 15:58 [Bug tree-optimization/50188] New: Optimizer doesn't take into account, that longjmp could lead to loops, which causes illegal code transformations michael.v.zolotukhin at gmail dot com
2011-08-25 17:18 ` [Bug tree-optimization/50188] " hjl.tools at gmail dot com
@ 2011-08-25 18:44 ` pinskia at gcc dot gnu.org
2011-08-25 18:47 ` pinskia at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-08-25 18:44 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50188
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-08-25 18:33:44 UTC ---
IIRC the variables need to be marked as volatile if you want them to be correct
over setjmp/longjmp.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/50188] Optimizer doesn't take into account, that longjmp could lead to loops, which causes illegal code transformations.
2011-08-25 15:58 [Bug tree-optimization/50188] New: Optimizer doesn't take into account, that longjmp could lead to loops, which causes illegal code transformations michael.v.zolotukhin at gmail dot com
2011-08-25 17:18 ` [Bug tree-optimization/50188] " hjl.tools at gmail dot com
2011-08-25 18:44 ` pinskia at gcc dot gnu.org
@ 2011-08-25 18:47 ` pinskia at gcc dot gnu.org
2011-08-25 20:34 ` michael.v.zolotukhin at gmail dot com
2011-08-26 11:29 ` jakub at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-08-25 18:47 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50188
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |INVALID
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-08-25 18:43:54 UTC ---
POSIX says this is correct behavior:
http://pubs.opengroup.org/onlinepubs/7908799/xsh/longjmp.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/50188] Optimizer doesn't take into account, that longjmp could lead to loops, which causes illegal code transformations.
2011-08-25 15:58 [Bug tree-optimization/50188] New: Optimizer doesn't take into account, that longjmp could lead to loops, which causes illegal code transformations michael.v.zolotukhin at gmail dot com
` (2 preceding siblings ...)
2011-08-25 18:47 ` pinskia at gcc dot gnu.org
@ 2011-08-25 20:34 ` michael.v.zolotukhin at gmail dot com
2011-08-26 11:29 ` jakub at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: michael.v.zolotukhin at gmail dot com @ 2011-08-25 20:34 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50188
--- Comment #4 from Michael Zolotukhin <michael.v.zolotukhin at gmail dot com> 2011-08-25 20:21:10 UTC ---
If I understand standard correctly, in this case behavior isn't undefined. Am I
right?
If so, then if behavior of optimized code (loop is infinite) is correct,
behavior of not optimized code isn't.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/50188] Optimizer doesn't take into account, that longjmp could lead to loops, which causes illegal code transformations.
2011-08-25 15:58 [Bug tree-optimization/50188] New: Optimizer doesn't take into account, that longjmp could lead to loops, which causes illegal code transformations michael.v.zolotukhin at gmail dot com
` (3 preceding siblings ...)
2011-08-25 20:34 ` michael.v.zolotukhin at gmail dot com
@ 2011-08-26 11:29 ` jakub at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-08-26 11:29 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50188
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-08-26 11:28:01 UTC ---
No, you misunderstood it. The values of non-volatile variables (meeting the
other conditions in POSIX) are indeterminate, so it is the testcase that is
wrong.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-08-26 11:28 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-25 15:58 [Bug tree-optimization/50188] New: Optimizer doesn't take into account, that longjmp could lead to loops, which causes illegal code transformations michael.v.zolotukhin at gmail dot com
2011-08-25 17:18 ` [Bug tree-optimization/50188] " hjl.tools at gmail dot com
2011-08-25 18:44 ` pinskia at gcc dot gnu.org
2011-08-25 18:47 ` pinskia at gcc dot gnu.org
2011-08-25 20:34 ` michael.v.zolotukhin at gmail dot com
2011-08-26 11:29 ` jakub at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).