Commit 1c09321c by Richard Guenther Committed by Richard Biener

re PR tree-optimization/45120 (-fipa-pta causes FAIL:…

re PR tree-optimization/45120 (-fipa-pta causes FAIL: gcc.c-torture/execute/pta-field-2.c execution)

2010-07-29  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/45120
	* tree-ssa-structalias.c (get_constraint_for_component_ref):
	Handle offset in DEREFs properly.
	(get_constraint_for_1): Handle MEM_REF offset properly.

	* gcc.dg/ipa/ipa-pta-15.c: New testcase.

From-SVN: r162676
parent 81fb8a48
2010-07-29 Richard Guenther <rguenther@suse.de> 2010-07-29 Richard Guenther <rguenther@suse.de>
PR tree-optimization/45120
* tree-ssa-structalias.c (get_constraint_for_component_ref):
Handle offset in DEREFs properly.
(get_constraint_for_1): Handle MEM_REF offset properly.
2010-07-29 Richard Guenther <rguenther@suse.de>
PR middle-end/45034 PR middle-end/45034
* convert.c (convert_to_integer): Always use an unsigned * convert.c (convert_to_integer): Always use an unsigned
type for narrowed negate and bitwise not. type for narrowed negate and bitwise not.
......
2010-07-29 Richard Guenther <rguenther@suse.de>
PR tree-optimization/45120
* gcc.dg/ipa/ipa-pta-15.c: New testcase.
2010-07-29 Mikael Morin <mikael@gcc.gnu.org> 2010-07-29 Mikael Morin <mikael@gcc.gnu.org>
PR fortran/42051 PR fortran/42051
......
/* { dg-do run } */
/* { dg-options "-O2 -fipa-pta" } */
struct Foo {
int *p;
int *q;
};
void __attribute__((noinline))
bar (int **x)
{
struct Foo *f = (struct Foo *)(x - 1);
*(f->p) = 0;
}
int foo(void)
{
struct Foo f;
int i = 1, j = 2;
f.p = &i;
f.q = &j;
bar(&f.q);
return i;
}
extern void abort (void);
int main()
{
if (foo () != 0)
abort ();
return 0;
}
...@@ -3208,10 +3208,11 @@ get_constraint_for_component_ref (tree t, VEC(ce_s, heap) **results, ...@@ -3208,10 +3208,11 @@ get_constraint_for_component_ref (tree t, VEC(ce_s, heap) **results,
at most one subfiled of any variable. */ at most one subfiled of any variable. */
if (bitpos == -1 if (bitpos == -1
|| bitsize != bitmaxsize || bitsize != bitmaxsize
|| AGGREGATE_TYPE_P (TREE_TYPE (orig_t))) || AGGREGATE_TYPE_P (TREE_TYPE (orig_t))
|| result->offset == UNKNOWN_OFFSET)
result->offset = UNKNOWN_OFFSET; result->offset = UNKNOWN_OFFSET;
else else
result->offset = bitpos; result->offset += bitpos;
} }
else if (result->type == ADDRESSOF) else if (result->type == ADDRESSOF)
{ {
...@@ -3345,8 +3346,8 @@ get_constraint_for_1 (tree t, VEC (ce_s, heap) **results, bool address_p) ...@@ -3345,8 +3346,8 @@ get_constraint_for_1 (tree t, VEC (ce_s, heap) **results, bool address_p)
{ {
case MEM_REF: case MEM_REF:
{ {
get_constraint_for_ptr_offset (TREE_OPERAND (t, 0), tree off = double_int_to_tree (sizetype, mem_ref_offset (t));
TREE_OPERAND (t, 1), results); get_constraint_for_ptr_offset (TREE_OPERAND (t, 0), off, results);
do_deref (results); do_deref (results);
return; return;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment