Commit 21117a17 by Jakub Jelinek Committed by Jakub Jelinek

re PR c/5681 (gcc 3.0.3 produces wrong assembler code)

	PR c/5681:
	* expr.c (safe_from_p): Pass VOIDmode to true_dependence instead of
	GET_MODE (x).

	* gcc.c-torture/execute/20020213-1.c: New test.

From-SVN: r49746
parent ec65b2e3
2002-02-13 Jakub Jelinek <jakub@redhat.com>
PR c/5681:
* expr.c (safe_from_p): Pass VOIDmode to true_dependence instead of
GET_MODE (x).
2002-02-13 Jakub Jelinek <jakub@redhat.com>
PR optimization/5547:
* config/i386/i386.c (i386_simplify_dwarf_addr): Simplify
all valid IA-32 address modes involving non-scaled %ebx and
......
......@@ -5728,7 +5728,7 @@ safe_from_p (x, exp, top_p)
are memory and they conflict. */
return ! (rtx_equal_p (x, exp_rtl)
|| (GET_CODE (x) == MEM && GET_CODE (exp_rtl) == MEM
&& true_dependence (exp_rtl, GET_MODE (x), x,
&& true_dependence (exp_rtl, VOIDmode, x,
rtx_addr_varies_p)));
}
......
......@@ -2,6 +2,8 @@
* g++.dg/other/debug3.C: New test.
* gcc.c-torture/execute/20020213-1.c: New test.
2002-02-13 Richard Smith <richard@ex-parrot.com>
* g++.old-deja/g++.other/thunk1.C: New test.
......
/* PR c/5681
This testcase failed on IA-32 at -O0, because safe_from_p
incorrectly assumed it is safe to first write into a.a2 b-1
and then read the original value from it. */
int bar (float);
struct A {
float a1;
int a2;
} a;
int b;
void foo (void)
{
a.a2 = bar (a.a1);
a.a2 = a.a2 < b - 1 ? a.a2 : b - 1;
if (a.a2 >= b - 1)
abort ();
}
int bar (float x)
{
return 2241;
}
int main()
{
a.a1 = 1.0f;
b = 3384;
foo ();
return 0;
}
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