[Bug tree-optimization/56982] [4.8 Regression] Bad optimization with setjmp()

2014-12-10 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56982

Richard Biener rguenth at gcc dot gnu.org changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED
   Target Milestone|4.8.4   |4.9.0
  Known to fail||4.8.4

--- Comment #18 from Richard Biener rguenth at gcc dot gnu.org ---
wontfix for 4.8, the fix triggered very many latent issues.


[Bug tree-optimization/56982] [4.8 Regression] Bad optimization with setjmp()

2014-05-22 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56982

Richard Biener rguenth at gcc dot gnu.org changed:

   What|Removed |Added

   Target Milestone|4.8.3   |4.8.4

--- Comment #17 from Richard Biener rguenth at gcc dot gnu.org ---
GCC 4.8.3 is being released, adjusting target milestone.


[Bug tree-optimization/56982] [4.8 Regression] Bad optimization with setjmp()

2013-07-03 Thread bernd.edlinger at hotmail dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56982

--- Comment #15 from Bernd Edlinger bernd.edlinger at hotmail dot de ---
(In reply to Mikael Pettersson from comment #14)
 Your example is invalid C.  Referring to WG14 n1494.pdf (there may be more
 recent C1x documents, but it's the one I had available right now):
 
 - you violate 7.13.1.1 which specifies where setjmp() may be called, an
 assignment statement is not one of the permitted contexts
 
 - more importantly, your auto variable a is not volatile-qualified, which
 means that its value is indeterminate after the longjmp (7.13.2.1).
 
 Please fix these issues and check again if it yields wrong results.

Thanks for pointing that out.

When I add volatile to the auto variable, the code is OK.


[Bug tree-optimization/56982] [4.8 Regression] Bad optimization with setjmp()

2013-07-02 Thread bernd.edlinger at hotmail dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56982

--- Comment #13 from Bernd Edlinger bernd.edlinger at hotmail dot de ---
Created attachment 30431
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=30431action=edit
another example of wrong compilation

This is another example where the optimization can
go wrong.

The attached program produces expected results if
compiled with -O0:
x=0, a=1
x=1, a=1
a=1

But if compiled with -O3 and if the value a is placed
in a register the result is like this:
x=0, a=1
x=1, a=0
a=0

That is because longjmp has more semantic than just a branch:
It branches to the setjmp, and restores all callee saved registers to
the previos value.


[Bug tree-optimization/56982] [4.8 Regression] Bad optimization with setjmp()

2013-07-02 Thread mikpe at it dot uu.se
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56982

--- Comment #14 from Mikael Pettersson mikpe at it dot uu.se ---
(In reply to Bernd Edlinger from comment #13)
 Created attachment 30431 [details]
 another example of wrong compilation
 
 This is another example where the optimization can
 go wrong.
 
 The attached program produces expected results if
 compiled with -O0:
 x=0, a=1
 x=1, a=1
 a=1
 
 But if compiled with -O3 and if the value a is placed
 in a register the result is like this:
 x=0, a=1
 x=1, a=0
 a=0
 
 That is because longjmp has more semantic than just a branch:
 It branches to the setjmp, and restores all callee saved registers to
 the previos value.

Your example is invalid C.  Referring to WG14 n1494.pdf (there may be more
recent C1x documents, but it's the one I had available right now):

- you violate 7.13.1.1 which specifies where setjmp() may be called, an
assignment statement is not one of the permitted contexts

- more importantly, your auto variable a is not volatile-qualified, which means
that its value is indeterminate after the longjmp (7.13.2.1).

Please fix these issues and check again if it yields wrong results.


[Bug tree-optimization/56982] [4.8 Regression] Bad optimization with setjmp()

2013-06-20 Thread rguenth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56982

Bug 56982 depends on bug 57584, which changed state.

Bug 57584 Summary: [4.9 Regression] ice: SSA corruption: Unable to coalesce 
ssa_names
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57584

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED


[Bug tree-optimization/56982] [4.8 Regression] Bad optimization with setjmp()

2013-05-31 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56982

Jakub Jelinek jakub at gcc dot gnu.org changed:

   What|Removed |Added

   Target Milestone|4.8.1   |4.8.2

--- Comment #12 from Jakub Jelinek jakub at gcc dot gnu.org ---
GCC 4.8.1 has been released.


[Bug tree-optimization/56982] [4.8 Regression] Bad optimization with setjmp()

2013-05-22 Thread rguenth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56982

Bug 56982 depends on bug 57349, which changed state.

Bug 57349 Summary: [4.9 Regression] ICE on 253.perlbmk with pgo after r198096
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57349

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED


[Bug tree-optimization/56982] [4.8 Regression] Bad optimization with setjmp()

2013-04-19 Thread rguenth at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56982



Richard Biener rguenth at gcc dot gnu.org changed:



   What|Removed |Added



  Known to work||4.9.0

Summary|[4.8/4.9 Regression] Bad|[4.8 Regression] Bad

   |optimization with setjmp()  |optimization with setjmp()



--- Comment #11 from Richard Biener rguenth at gcc dot gnu.org 2013-04-19 
13:40:05 UTC ---

Author: rguenth

Date: Fri Apr 19 13:39:16 2013

New Revision: 198096



URL: http://gcc.gnu.org/viewcvs?rev=198096root=gccview=rev

Log:

2013-04-19  Richard Biener  rguent...@suse.de



PR tree-optimization/56982

* builtins.def (BUILT_IN_LONGJMP): longjmp is not a leaf

function.

* gimplify.c (gimplify_call_expr): Notice special calls.

(gimplify_modify_expr): Likewise.

* tree-cfg.c (make_abnormal_goto_edges): Handle setjmp-like

abnormal control flow receivers.

(call_can_make_abnormal_goto): Handle cfun-calls_setjmp

in the same way as cfun-has_nonlocal_labels.

(gimple_purge_dead_abnormal_call_edges): Likewise.

(stmt_starts_bb_p): Make setjmp-like abnormal control flow

receivers start a basic-block.



* gcc.c-torture/execute/pr56982.c: New testcase.



Added:

trunk/gcc/testsuite/gcc.c-torture/execute/pr56982.c

Modified:

trunk/gcc/ChangeLog

trunk/gcc/builtins.def

trunk/gcc/gimplify.c

trunk/gcc/testsuite/ChangeLog

trunk/gcc/tree-cfg.c