Bug 39115

Summary: [4.3 Regression] Value of variable is not read again
Product: gcc Reporter: Michael Tautschnig <mt>
Component: targetAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED FIXED    
Severity: normal CC: gcc-bugs
Priority: P2    
Version: 4.3.3   
Target Milestone: 4.4.0   
Host: s390-unknown-linux-gnu Target: s390-unknown-linux-gnu
Build: s390-unknown-linux-gnu Known to work: 4.2.4, 4.4.0
Known to fail: 4.3.3 Last reconfirmed:
Attachments: Not fully preprocessed source (includes <string>), compile with -DVOLATILE to see the correct behaviour
Fully preprocessed source, compile with -O2 to see wrong behaviour

Description Michael Tautschnig 2009-02-05 22:56:36 UTC
[The bug has been reported to the Debian BTS before:
http://bugs.debian.org/491137]

On s390, when using -O2, the attached code fails to throw an exception, apparently because it does not re-evaluate the value of a variable. If the variable is marked volatile, the code works as expected.

Best,
Michael
Comment 1 Michael Tautschnig 2009-02-05 23:01:07 UTC
Created attachment 17255 [details]
Not fully preprocessed source (includes <string>), compile with -DVOLATILE to see the correct behaviour
Comment 2 Michael Tautschnig 2009-02-05 23:02:28 UTC
Created attachment 17256 [details]
Fully preprocessed source, compile with -O2 to see wrong behaviour
Comment 3 Michael Tautschnig 2009-02-05 23:04:37 UTC
I should have added that this worked fine on 4.2 and was broken as of 4.3.1 at least, earlier versions (> 4.2) untested.
Comment 4 Richard Biener 2009-03-13 22:58:11 UTC
Does it work with GCC 4.4?
Comment 5 Michael Tautschnig 2009-03-16 08:27:40 UTC
Indeed, seems to be fixed in 4.4.0 (tested using Debian's gcc-snapshot, g++ (Debian 20090224-1) 4.4.0 20090224 (experimental)). Sorry for not testing using a fresh build from 4.4 sources, but I hope that is helpful nevertheless.

Best,
Michael
Comment 6 Richard Biener 2009-08-04 12:29:56 UTC
GCC 4.3.4 is being released, adjusting target milestone.
Comment 7 Richard Biener 2010-05-22 18:13:23 UTC
GCC 4.3.5 is being released, adjusting target milestone.
Comment 8 Richard Biener 2011-06-27 11:47:54 UTC
Fixed for 4.4.0.