Bug 45052

Summary: [4.5 Regression] volatile ignored
Product: gcc Reporter: Andreas Kaiser <a.kaiser>
Component: tree-optimizationAssignee: Richard Biener <rguenth>
Status: RESOLVED FIXED    
Severity: normal CC: a.kaiser, gcc-bugs
Priority: P3 Keywords: wrong-code
Version: 4.5.0   
Target Milestone: 4.5.2   
Host: yagarto 01.05.2010 Target: arm-none-eabi
Build: Known to work: 4.3.2 4.4.1 4.4.2 4.5.2 4.6.0
Known to fail: 4.5.0 4.5.1 Last reconfirmed: 2010-07-24 14:37:40
Attachments: Source code
Bad result

Description Andreas Kaiser 2010-07-24 10:51:05 UTC
"volatile" seems to have no effect. ReadByte should be called 4 times with results merged in a word, instead it is called once and replicated 4 times.

arm-none-eabi-gcc -S -Os -mcpu=arm926ej-s src.c

-O0, -O2, -O3 are fine, -O1 and -Os are bad.
Comment 1 Andreas Kaiser 2010-07-24 10:52:35 UTC
Created attachment 21297 [details]
Source code
Comment 2 Andreas Kaiser 2010-07-24 10:53:57 UTC
Created attachment 21298 [details]
Bad result
Comment 3 Andreas Kaiser 2010-07-24 11:44:17 UTC
Also fine: -Os -fno-ipa-pure-const
Comment 4 Richard Biener 2010-07-24 14:37:40 UTC
Confirmed.  I have a patch.
Comment 5 Richard Biener 2010-07-26 09:27:08 UTC
Subject: Bug 45052

Author: rguenth
Date: Mon Jul 26 09:26:43 2010
New Revision: 162528

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=162528
Log:
2010-07-26  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/45052
	* ipa-pure-const.c (check_stmt): Check volatileness.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/ipa-pure-const.c

Comment 6 Richard Biener 2010-07-31 09:30:00 UTC
GCC 4.5.1 is being released, adjusting target milestone.
Comment 7 Richard Biener 2010-07-31 12:12:54 UTC
Fixed.
Comment 8 Richard Biener 2010-07-31 12:13:06 UTC
Subject: Bug 45052

Author: rguenth
Date: Sat Jul 31 12:12:43 2010
New Revision: 162781

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=162781
Log:
2010-07-31  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/45052
	* ipa-pure-const.c (check_stmt): Check volatileness.

Modified:
    branches/gcc-4_5-branch/gcc/ChangeLog
    branches/gcc-4_5-branch/gcc/ipa-pure-const.c