public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/45852] New: volatile structs are broken!
@ 2010-10-01 3:10 regehr at cs dot utah.edu
2010-10-01 3:40 ` [Bug c/45852] " regehr at cs dot utah.edu
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: regehr at cs dot utah.edu @ 2010-10-01 3:10 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45852
Summary: volatile structs are broken!
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: regehr@cs.utah.edu
CC: chenyang@cs.utah.edu
gcc should not be optimizing away the read from or write to this struct.
regehr@john-home:~$ current-gcc -v
Using built-in specs.
COLLECT_GCC=current-gcc
COLLECT_LTO_WRAPPER=/home/regehr/z/compiler-install/gcc-r164818-install/libexec/gcc/i686-pc-linux-gnu/4.6.0/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: ../configure --with-libelf=/usr/local --enable-lto
--prefix=/home/regehr/z/compiler-install/gcc-r164818-install
--program-prefix=r164818- --enable-languages=c,c++
Thread model: posix
gcc version 4.6.0 20100930 (experimental) (GCC)
regehr@john-home:~$ current-gcc -S -o - -O1 small.c
.file "small.c"
.text
.globl func_1
.type func_1, @function
func_1:
.LFB0:
.cfi_startproc
rep
ret
.cfi_endproc
.LFE0:
.size func_1, .-func_1
.globl g_18
.data
.align 4
.type g_18, @object
.size g_18, 4
g_18:
.long -6
.ident "GCC: (GNU) 4.6.0 20100930 (experimental)"
.section .note.GNU-stack,"",@progbits
regehr@john-home:~$ cat small.c
struct S1
{
int f0;
};
volatile struct S1 g_18 = { -6 };
void
func_1 (void)
{
g_18 = g_18;
}
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c/45852] volatile structs are broken!
2010-10-01 3:10 [Bug c/45852] New: volatile structs are broken! regehr at cs dot utah.edu
@ 2010-10-01 3:40 ` regehr at cs dot utah.edu
2010-10-01 10:27 ` [Bug rtl-optimization/45852] " rguenth at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: regehr at cs dot utah.edu @ 2010-10-01 3:40 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45852
--- Comment #1 from John Regehr <regehr at cs dot utah.edu> 2010-10-01 03:40:43 UTC ---
This problem has been there for some time: none of 3.0.0, 3.1.0, 3.2.0, 3.3.0,
3.4.0, 4.0.0, 4.1.0, 4.2.0, 4.3.0, 4.4.0, or 4.5.0 for x86 generates the right
code.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug rtl-optimization/45852] volatile structs are broken!
2010-10-01 3:10 [Bug c/45852] New: volatile structs are broken! regehr at cs dot utah.edu
2010-10-01 3:40 ` [Bug c/45852] " regehr at cs dot utah.edu
@ 2010-10-01 10:27 ` rguenth at gcc dot gnu.org
2010-12-14 13:44 ` [Bug middle-end/45852] " jakub at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-10-01 10:27 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45852
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
Status|UNCONFIRMED |NEW
Last reconfirmed| |2010.10.01 10:27:24
Component|c |rtl-optimization
Ever Confirmed|0 |1
--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-10-01 10:27:24 UTC ---
The expander throws away the assignment.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/45852] volatile structs are broken!
2010-10-01 3:10 [Bug c/45852] New: volatile structs are broken! regehr at cs dot utah.edu
2010-10-01 3:40 ` [Bug c/45852] " regehr at cs dot utah.edu
2010-10-01 10:27 ` [Bug rtl-optimization/45852] " rguenth at gcc dot gnu.org
@ 2010-12-14 13:44 ` jakub at gcc dot gnu.org
2010-12-14 14:55 ` amonakov at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2010-12-14 13:44 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45852
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
AssignedTo|unassigned at gcc dot |jakub at gcc dot gnu.org
|gnu.org |
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2010-12-14 13:43:42 UTC ---
Created attachment 22753
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22753
gcc46-pr45852.patch
Untested fix. Alternatively if alt_rtl (or target?) has side-effects, we could
ignore it in store_expr.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/45852] volatile structs are broken!
2010-10-01 3:10 [Bug c/45852] New: volatile structs are broken! regehr at cs dot utah.edu
` (2 preceding siblings ...)
2010-12-14 13:44 ` [Bug middle-end/45852] " jakub at gcc dot gnu.org
@ 2010-12-14 14:55 ` amonakov at gcc dot gnu.org
2010-12-21 8:35 ` jakub at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: amonakov at gcc dot gnu.org @ 2010-12-14 14:55 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45852
Alexander Monakov <amonakov at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |amonakov at gcc dot gnu.org
--- Comment #4 from Alexander Monakov <amonakov at gcc dot gnu.org> 2010-12-14 14:54:38 UTC ---
There's a couple of related bugs:
Optimizes away access to volatile field (unconfirmed):
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46762
Does not use volatile MEMs for assignments of structs with volatile fields:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45472
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/45852] volatile structs are broken!
2010-10-01 3:10 [Bug c/45852] New: volatile structs are broken! regehr at cs dot utah.edu
` (3 preceding siblings ...)
2010-12-14 14:55 ` amonakov at gcc dot gnu.org
@ 2010-12-21 8:35 ` jakub at gcc dot gnu.org
2011-01-16 20:27 ` jakub at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2010-12-21 8:35 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45852
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2010-12-21 08:35:19 UTC ---
Author: jakub
Date: Tue Dec 21 08:35:16 2010
New Revision: 168105
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=168105
Log:
PR middle-end/45852
* expr.c (store_expr): Ignore alt_rtl if equal to target,
but has side-effects.
* gcc.target/i386/pr45852.c: New test.
Added:
trunk/gcc/testsuite/gcc.target/i386/pr45852.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/expr.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/45852] volatile structs are broken!
2010-10-01 3:10 [Bug c/45852] New: volatile structs are broken! regehr at cs dot utah.edu
` (4 preceding siblings ...)
2010-12-21 8:35 ` jakub at gcc dot gnu.org
@ 2011-01-16 20:27 ` jakub at gcc dot gnu.org
2011-01-17 0:37 ` jakub at gcc dot gnu.org
2011-01-17 8:05 ` jakub at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-01-16 20:27 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45852
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-01-16 20:23:04 UTC ---
Author: jakub
Date: Sun Jan 16 20:23:01 2011
New Revision: 168867
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=168867
Log:
Backport from mainline
2010-12-21 Jakub Jelinek <jakub@redhat.com>
PR middle-end/45852
* expr.c (store_expr): Ignore alt_rtl if equal to target,
but has side-effects.
* gcc.target/i386/pr45852.c: New test.
Added:
branches/gcc-4_5-branch/gcc/testsuite/gcc.target/i386/pr45852.c
Modified:
branches/gcc-4_5-branch/gcc/ChangeLog
branches/gcc-4_5-branch/gcc/expr.c
branches/gcc-4_5-branch/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/45852] volatile structs are broken!
2010-10-01 3:10 [Bug c/45852] New: volatile structs are broken! regehr at cs dot utah.edu
` (5 preceding siblings ...)
2011-01-16 20:27 ` jakub at gcc dot gnu.org
@ 2011-01-17 0:37 ` jakub at gcc dot gnu.org
2011-01-17 8:05 ` jakub at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-01-17 0:37 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45852
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-01-16 22:56:13 UTC ---
Author: jakub
Date: Sun Jan 16 22:56:10 2011
New Revision: 168879
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=168879
Log:
Backport from mainline
2010-12-21 Jakub Jelinek <jakub@redhat.com>
PR middle-end/45852
* expr.c (store_expr): Ignore alt_rtl if equal to target,
but has side-effects.
* gcc.target/i386/pr45852.c: New test.
Added:
branches/gcc-4_4-branch/gcc/testsuite/gcc.target/i386/pr45852.c
Modified:
branches/gcc-4_4-branch/gcc/ChangeLog
branches/gcc-4_4-branch/gcc/expr.c
branches/gcc-4_4-branch/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/45852] volatile structs are broken!
2010-10-01 3:10 [Bug c/45852] New: volatile structs are broken! regehr at cs dot utah.edu
` (6 preceding siblings ...)
2011-01-17 0:37 ` jakub at gcc dot gnu.org
@ 2011-01-17 8:05 ` jakub at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-01-17 8:05 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45852
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-01-17 08:01:41 UTC ---
Fixed for 4.4+.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2011-01-17 8:02 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-01 3:10 [Bug c/45852] New: volatile structs are broken! regehr at cs dot utah.edu
2010-10-01 3:40 ` [Bug c/45852] " regehr at cs dot utah.edu
2010-10-01 10:27 ` [Bug rtl-optimization/45852] " rguenth at gcc dot gnu.org
2010-12-14 13:44 ` [Bug middle-end/45852] " jakub at gcc dot gnu.org
2010-12-14 14:55 ` amonakov at gcc dot gnu.org
2010-12-21 8:35 ` jakub at gcc dot gnu.org
2011-01-16 20:27 ` jakub at gcc dot gnu.org
2011-01-17 0:37 ` jakub at gcc dot gnu.org
2011-01-17 8:05 ` 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).