re PR middle-end/45687 (possible wrong code bug)

gcc/:
	PR middle-end/45687
	* ipa-prop.c (ipa_modify_call_arguments): Correct type of MEM_REF
	offset.
gcc/testsuite:
	* gcc.c-torture/execute/20101025-1.c: New test.

From-SVN: r165964
This commit is contained in:
Ian Lance Taylor 2010-10-26 13:39:37 +00:00 committed by Ian Lance Taylor
parent 7675ad4f6a
commit 76d8a30aaf
4 changed files with 44 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2010-10-26 Ian Lance Taylor <iant@google.com>
PR middle-end/45687
* ipa-prop.c (ipa_modify_call_arguments): Correct type of MEM_REF
offset.
2010-10-25 Rodrigo Rivas Costa <rodrigorivascosta@gmail.com>
Implement opaque-enum-specifiesr for C++0x

View File

@ -2186,7 +2186,7 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gimple stmt,
if (TREE_CODE (base) == ADDR_EXPR
&& DECL_P (TREE_OPERAND (base, 0)))
off = build_int_cst (reference_alias_ptr_type (base),
off = build_int_cst (TREE_TYPE (base),
adj->offset / BITS_PER_UNIT);
else if (TREE_CODE (base) != ADDR_EXPR
&& POINTER_TYPE_P (TREE_TYPE (base)))
@ -2209,7 +2209,7 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gimple stmt,
}
else if (TREE_CODE (base) == MEM_REF)
{
off = build_int_cst (TREE_TYPE (TREE_OPERAND (base,1)),
off = build_int_cst (TREE_TYPE (TREE_OPERAND (base, 1)),
base_offset
+ adj->offset / BITS_PER_UNIT);
off = int_const_binop (PLUS_EXPR, TREE_OPERAND (base, 1),
@ -2218,7 +2218,7 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gimple stmt,
}
else
{
off = build_int_cst (reference_alias_ptr_type (base),
off = build_int_cst (reference_alias_ptr_type (prev_base),
base_offset
+ adj->offset / BITS_PER_UNIT);
base = build_fold_addr_expr (base);

View File

@ -1,3 +1,8 @@
2010-10-26 Ian Lance Taylor <iant@google.com>
PR middle-end/45687
* gcc.c-torture/execute/20101025-1.c: New test.
2010-10-26 Tobias Burnus <burnus@net-b.de>
PR fortran/45451

View File

@ -0,0 +1,30 @@
static int g_7;
static int *volatile g_6 = &g_7;
int g_3;
static int f1 (int *p_58)
{
return *p_58;
}
void f2 (int i) __attribute__ ((noinline));
void f2 (int i)
{
g_3 = i;
}
int f3 (void) __attribute__ ((noinline));
int f3 (void)
{
*g_6 = 1;
f2 (f1 (&g_7));
return 0;
}
int main ()
{
f3 ();
if (g_3 != 1)
abort ();
exit (0);
}