public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug regression/50472] New: Volatile qualification in data is not enough to avoid optimization over pointer to data
@ 2011-09-21 8:24 Paulo.Matos at csr dot com
2011-09-21 9:41 ` [Bug regression/50472] " mikpe at it dot uu.se
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: Paulo.Matos at csr dot com @ 2011-09-21 8:24 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50472
Bug #: 50472
Summary: Volatile qualification in data is not enough to avoid
optimization over pointer to data
Classification: Unclassified
Product: gcc
Version: 4.6.1
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: regression
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: Paulo.Matos@csr.com
Given the following code:
static const unsigned int foo = 1;
unsigned int test( void )
{
const volatile unsigned int *bar = &foo;
return ( *bar );
}
GCC46 is generating:
$ local/gcc-4.6.1/bin/gcc -Os -S vol.c
$ cat vol.s
...
test:
.LFB0:
.cfi_startproc
movl $1, %eax
ret
.cfi_endproc
...
This is optimizing away bar even though the data bar points to is being
qualified as volatile. The way to ensure this doesn't happen requires
qualifying the pointer as a volatile too:
static const unsigned int foo = 1;
unsigned int test( void )
{
const volatile unsigned int * volatile bar = &foo;
return ( *bar );
}
$ local/gcc-4.6.1/bin/gcc -Os -S vol.c
$ cat vol.s
...
test:
.LFB0:
.cfi_startproc
movq $foo, -8(%rsp)
movq -8(%rsp), %rax
movl (%rax), %eax
ret
.cfi_endproc
...
This is a regression to what GCC45 used to do. Qualification of the data as
volatile used to be enough to block the optimization.
Posting this to the mailing list revealed Ian agrees this is a regression:
http://gcc.gnu.org/ml/gcc/2011-09/msg00197.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug regression/50472] Volatile qualification in data is not enough to avoid optimization over pointer to data
2011-09-21 8:24 [Bug regression/50472] New: Volatile qualification in data is not enough to avoid optimization over pointer to data Paulo.Matos at csr dot com
@ 2011-09-21 9:41 ` mikpe at it dot uu.se
2011-09-23 13:21 ` Paulo.Matos at csr dot com
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: mikpe at it dot uu.se @ 2011-09-21 9:41 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50472
--- Comment #1 from Mikael Pettersson <mikpe at it dot uu.se> 2011-09-21 08:29:07 UTC ---
Duplicate of PR50078?
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug regression/50472] Volatile qualification in data is not enough to avoid optimization over pointer to data
2011-09-21 8:24 [Bug regression/50472] New: Volatile qualification in data is not enough to avoid optimization over pointer to data Paulo.Matos at csr dot com
2011-09-21 9:41 ` [Bug regression/50472] " mikpe at it dot uu.se
@ 2011-09-23 13:21 ` Paulo.Matos at csr dot com
2011-09-23 13:30 ` Paulo.Matos at csr dot com
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Paulo.Matos at csr dot com @ 2011-09-23 13:21 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50472
--- Comment #2 from Paulo J. Matos <Paulo.Matos at csr dot com> 2011-09-23 13:18:10 UTC ---
(In reply to comment #1)
> Duplicate of PR50078?
Might be but I can't confirm. Surely we will know once Mat fixes PR50078.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug regression/50472] Volatile qualification in data is not enough to avoid optimization over pointer to data
2011-09-21 8:24 [Bug regression/50472] New: Volatile qualification in data is not enough to avoid optimization over pointer to data Paulo.Matos at csr dot com
2011-09-21 9:41 ` [Bug regression/50472] " mikpe at it dot uu.se
2011-09-23 13:21 ` Paulo.Matos at csr dot com
@ 2011-09-23 13:30 ` Paulo.Matos at csr dot com
2011-09-25 11:55 ` rguenth at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Paulo.Matos at csr dot com @ 2011-09-23 13:30 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50472
Paulo J. Matos <Paulo.Matos at csr dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |Paulo.Matos at csr dot com
--- Comment #3 from Paulo J. Matos <Paulo.Matos at csr dot com> 2011-09-23 13:20:57 UTC ---
Richard raised concerns about this PR being an old bug and already fixed.
Initially I only confirmed it in 4.6.1 but I can reproduce it in git head
36181f98f (that's from 30mins ago).
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug regression/50472] Volatile qualification in data is not enough to avoid optimization over pointer to data
2011-09-21 8:24 [Bug regression/50472] New: Volatile qualification in data is not enough to avoid optimization over pointer to data Paulo.Matos at csr dot com
` (2 preceding siblings ...)
2011-09-23 13:30 ` Paulo.Matos at csr dot com
@ 2011-09-25 11:55 ` rguenth at gcc dot gnu.org
2011-09-26 13:52 ` rguenth at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-09-25 11:55 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50472
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2011-09-25
AssignedTo|unassigned at gcc dot |rguenth at gcc dot gnu.org
|gnu.org |
Ever Confirmed|0 |1
--- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-09-25 11:52:49 UTC ---
CCP optimizes the load from the static const foo via fold_stmt. I will have a
look.
Folding statement: D.2758_2 ={v} *bar_1;
Folded into: D.2758_2 = 1;
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug regression/50472] Volatile qualification in data is not enough to avoid optimization over pointer to data
2011-09-21 8:24 [Bug regression/50472] New: Volatile qualification in data is not enough to avoid optimization over pointer to data Paulo.Matos at csr dot com
` (3 preceding siblings ...)
2011-09-25 11:55 ` rguenth at gcc dot gnu.org
@ 2011-09-26 13:52 ` rguenth at gcc dot gnu.org
2011-09-26 14:41 ` rguenth at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-09-26 13:52 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50472
--- Comment #5 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-09-26 12:59:02 UTC ---
Author: rguenth
Date: Mon Sep 26 12:58:35 2011
New Revision: 179196
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=179196
Log:
2011-09-26 Richard Guenther <rguenther@suse.de>
PR tree-optimization/50472
* gimple-fold.c (fold_const_aggregate_ref_1): Do not fold
volatile references.
* gcc.dg/torture/pr50472.c: New testcase.
Added:
trunk/gcc/testsuite/gcc.dg/torture/pr50472.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/gimple-fold.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug regression/50472] Volatile qualification in data is not enough to avoid optimization over pointer to data
2011-09-21 8:24 [Bug regression/50472] New: Volatile qualification in data is not enough to avoid optimization over pointer to data Paulo.Matos at csr dot com
` (4 preceding siblings ...)
2011-09-26 13:52 ` rguenth at gcc dot gnu.org
@ 2011-09-26 14:41 ` rguenth at gcc dot gnu.org
2011-09-26 14:42 ` [Bug tree-optimization/50472] " rguenth at gcc dot gnu.org
2012-06-12 2:33 ` amker at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-09-26 14:41 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50472
--- Comment #6 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-09-26 14:09:04 UTC ---
Author: rguenth
Date: Mon Sep 26 14:08:53 2011
New Revision: 179200
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=179200
Log:
2011-09-26 Richard Guenther <rguenther@suse.de>
PR tree-optimization/50472
* tree-ssa-ccp.c (fold_const_aggregate_ref): Do not fold
volatile references.
* gcc.dg/torture/pr50472.c: New testcase.
Added:
branches/gcc-4_6-branch/gcc/testsuite/gcc.dg/torture/pr50472.c
Modified:
branches/gcc-4_6-branch/gcc/ChangeLog
branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
branches/gcc-4_6-branch/gcc/tree-ssa-ccp.c
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/50472] Volatile qualification in data is not enough to avoid optimization over pointer to data
2011-09-21 8:24 [Bug regression/50472] New: Volatile qualification in data is not enough to avoid optimization over pointer to data Paulo.Matos at csr dot com
` (5 preceding siblings ...)
2011-09-26 14:41 ` rguenth at gcc dot gnu.org
@ 2011-09-26 14:42 ` rguenth at gcc dot gnu.org
2012-06-12 2:33 ` amker at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-09-26 14:42 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50472
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Component|regression |tree-optimization
Resolution| |FIXED
Target Milestone|--- |4.6.2
--- Comment #7 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-09-26 14:09:49 UTC ---
Fixed for 4.6.2.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/50472] Volatile qualification in data is not enough to avoid optimization over pointer to data
2011-09-21 8:24 [Bug regression/50472] New: Volatile qualification in data is not enough to avoid optimization over pointer to data Paulo.Matos at csr dot com
` (6 preceding siblings ...)
2011-09-26 14:42 ` [Bug tree-optimization/50472] " rguenth at gcc dot gnu.org
@ 2012-06-12 2:33 ` amker at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: amker at gcc dot gnu.org @ 2012-06-12 2:33 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50472
--- Comment #8 from amker at gcc dot gnu.org 2012-06-12 02:33:29 UTC ---
Author: amker
Date: Tue Jun 12 02:33:23 2012
New Revision: 188414
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=188414
Log:
Backport r179200 from GCC-4.6 branch
2011-09-26 Richard Guenther <rguenther@suse.de>
PR tree-optimization/50472
* tree-ssa-ccp.c (fold_const_aggregate_ref): Do not fold
volatile references.
PR tree-optimization/50472
* gcc.dg/torture/pr50472.c: New testcase.
Added:
branches/ARM/embedded-4_6-branch/gcc/testsuite/gcc.dg/torture/pr50472.c
Modified:
branches/ARM/embedded-4_6-branch/gcc/ChangeLog.arm
branches/ARM/embedded-4_6-branch/gcc/testsuite/ChangeLog.arm
branches/ARM/embedded-4_6-branch/gcc/tree-ssa-ccp.c
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2012-06-12 2:33 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-21 8:24 [Bug regression/50472] New: Volatile qualification in data is not enough to avoid optimization over pointer to data Paulo.Matos at csr dot com
2011-09-21 9:41 ` [Bug regression/50472] " mikpe at it dot uu.se
2011-09-23 13:21 ` Paulo.Matos at csr dot com
2011-09-23 13:30 ` Paulo.Matos at csr dot com
2011-09-25 11:55 ` rguenth at gcc dot gnu.org
2011-09-26 13:52 ` rguenth at gcc dot gnu.org
2011-09-26 14:41 ` rguenth at gcc dot gnu.org
2011-09-26 14:42 ` [Bug tree-optimization/50472] " rguenth at gcc dot gnu.org
2012-06-12 2:33 ` amker 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).