public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/41317] New: folding causes strict aliasing violation
@ 2009-09-09 11:37 rguenth at gcc dot gnu dot org
2009-09-09 11:43 ` [Bug middle-end/41317] " rguenth at gcc dot gnu dot org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-09-09 11:37 UTC (permalink / raw)
To: gcc-bugs
extern void abort (void);
struct A
{
int i;
};
struct B
{
struct A a;
int j;
};
static void
foo (struct B *p)
{
((struct A *)p)->i = 1;
}
int main()
{
struct A a;
a.i = 0;
foo ((struct B *)&a);
if (a.i != 1)
abort ();
return 0;
}
Folding (struct A *)p to &p->a causes us to see
a.i = 0;
a.0_1 = (struct B *) &a;
a.0_1->a.i = 1;
D.2703_2 = a.i;
where the store a.0_1->a.i does not alias a.i because of TBAA on the base
object (you can't access an object of type A via a pointer to type B).
This blocks the fix for PR41316.
--
Summary: folding causes strict aliasing violation
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Keywords: wrong-code, alias
Severity: normal
Priority: P3
Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rguenth at gcc dot gnu dot org
OtherBugsDependingO 41316
nThis:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41317
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/41317] folding causes strict aliasing violation
2009-09-09 11:37 [Bug middle-end/41317] New: folding causes strict aliasing violation rguenth at gcc dot gnu dot org
@ 2009-09-09 11:43 ` rguenth at gcc dot gnu dot org
2009-09-09 12:17 ` rguenth at gcc dot gnu dot org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-09-09 11:43 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 312 bytes --]
------- Comment #1 from rguenth at gcc dot gnu dot org 2009-09-09 11:42 -------
4.4 rightfully complains:
t.i: In function main:
t.i:16: warning: dereferencing pointer a.0 does break strict-aliasing rules
t.i:23: note: initialized from here
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41317
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/41317] folding causes strict aliasing violation
2009-09-09 11:37 [Bug middle-end/41317] New: folding causes strict aliasing violation rguenth at gcc dot gnu dot org
2009-09-09 11:43 ` [Bug middle-end/41317] " rguenth at gcc dot gnu dot org
@ 2009-09-09 12:17 ` rguenth at gcc dot gnu dot org
2009-09-09 14:37 ` rguenth at gcc dot gnu dot org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-09-09 12:17 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from rguenth at gcc dot gnu dot org 2009-09-09 12:16 -------
Mine.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |rguenth at gcc dot gnu dot
|dot org |org
Status|UNCONFIRMED |ASSIGNED
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2009-09-09 12:16:29
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41317
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/41317] folding causes strict aliasing violation
2009-09-09 11:37 [Bug middle-end/41317] New: folding causes strict aliasing violation rguenth at gcc dot gnu dot org
2009-09-09 11:43 ` [Bug middle-end/41317] " rguenth at gcc dot gnu dot org
2009-09-09 12:17 ` rguenth at gcc dot gnu dot org
@ 2009-09-09 14:37 ` rguenth at gcc dot gnu dot org
2009-09-09 14:38 ` rguenth at gcc dot gnu dot org
2009-11-09 19:39 ` jakub at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-09-09 14:37 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from rguenth at gcc dot gnu dot org 2009-09-09 14:36 -------
Fixed.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41317
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/41317] folding causes strict aliasing violation
2009-09-09 11:37 [Bug middle-end/41317] New: folding causes strict aliasing violation rguenth at gcc dot gnu dot org
` (2 preceding siblings ...)
2009-09-09 14:37 ` rguenth at gcc dot gnu dot org
@ 2009-09-09 14:38 ` rguenth at gcc dot gnu dot org
2009-11-09 19:39 ` jakub at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-09-09 14:38 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from rguenth at gcc dot gnu dot org 2009-09-09 14:37 -------
Subject: Bug 41317
Author: rguenth
Date: Wed Sep 9 14:35:51 2009
New Revision: 151559
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=151559
Log:
2009-09-09 Richard Guenther <rguenther@suse.de>
PR middle-end/41317
* tree-ssa-ccp.c (maybe_fold_offset_to_component_ref): Remove
code dealing with plain pointer bases.
(maybe_fold_offset_to_reference): Likewise.
(maybe_fold_stmt_addition): Adjust.
* gcc.c-torture/execute/pr41317.c: New testcase.
* gcc.dg/tree-ssa/forwprop-11.c: XFAIL.
* gcc.dg/tree-ssa/forwprop-12.c: Likewise.
Added:
trunk/gcc/testsuite/gcc.c-torture/execute/pr41317.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.dg/tree-ssa/forwprop-11.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/forwprop-12.c
trunk/gcc/tree-ssa-ccp.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41317
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/41317] folding causes strict aliasing violation
2009-09-09 11:37 [Bug middle-end/41317] New: folding causes strict aliasing violation rguenth at gcc dot gnu dot org
` (3 preceding siblings ...)
2009-09-09 14:38 ` rguenth at gcc dot gnu dot org
@ 2009-11-09 19:39 ` jakub at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-11-09 19:39 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from jakub at gcc dot gnu dot org 2009-11-09 19:38 -------
Subject: Bug 41317
Author: jakub
Date: Mon Nov 9 19:38:29 2009
New Revision: 154046
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=154046
Log:
PR middle-end/40946
Backport from mainline
2009-09-09 Richard Guenther <rguenther@suse.de>
PR middle-end/41317
* tree-ssa-ccp.c (maybe_fold_offset_to_component_ref): Remove
code dealing with plain pointer bases.
(maybe_fold_offset_to_reference): Likewise.
(maybe_fold_stmt_addition): Adjust.
PR middle-end/40946
* gcc.dg/pr40946.c: New test.
Backport from mainline
2009-09-09 Richard Guenther <rguenther@suse.de>
PR middle-end/41317
* gcc.c-torture/execute/pr41317.c: New testcase.
Added:
branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/execute/pr41317.c
branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/pr40946.c
Modified:
branches/gcc-4_4-branch/gcc/ChangeLog
branches/gcc-4_4-branch/gcc/testsuite/ChangeLog
branches/gcc-4_4-branch/gcc/tree-ssa-ccp.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41317
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-11-09 19:39 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-09 11:37 [Bug middle-end/41317] New: folding causes strict aliasing violation rguenth at gcc dot gnu dot org
2009-09-09 11:43 ` [Bug middle-end/41317] " rguenth at gcc dot gnu dot org
2009-09-09 12:17 ` rguenth at gcc dot gnu dot org
2009-09-09 14:37 ` rguenth at gcc dot gnu dot org
2009-09-09 14:38 ` rguenth at gcc dot gnu dot org
2009-11-09 19:39 ` jakub at gcc dot gnu dot 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).