Commit 84cf4ab6 by Jakub Jelinek Committed by Jakub Jelinek

re PR rtl-optimization/58365 (likely wrong code bug)

	PR rtl-optimization/58365
	* cfgcleanup.c (merge_memattrs): Also clear MEM_READONLY_P
	resp. MEM_NOTRAP_P if they differ, or set MEM_VOLATILE_P if
	it differs.

	* gcc.c-torture/execute/pr58365.c: New test.

From-SVN: r202434
parent 447dd906
2013-09-10 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/58365
* cfgcleanup.c (merge_memattrs): Also clear MEM_READONLY_P
resp. MEM_NOTRAP_P if they differ, or set MEM_VOLATILE_P if
it differs.
2013-09-10 Richard Biener <rguenther@suse.de>
* tree-data-ref.h (build_rdg): Drop all parameters but loop.
......
......@@ -925,6 +925,24 @@ merge_memattrs (rtx x, rtx y)
set_mem_align (y, MEM_ALIGN (x));
}
}
if (code == MEM)
{
if (MEM_READONLY_P (x) != MEM_READONLY_P (y))
{
MEM_READONLY_P (x) = 0;
MEM_READONLY_P (y) = 0;
}
if (MEM_NOTRAP_P (x) != MEM_NOTRAP_P (y))
{
MEM_NOTRAP_P (x) = 0;
MEM_NOTRAP_P (y) = 0;
}
if (MEM_VOLATILE_P (x) != MEM_VOLATILE_P (y))
{
MEM_VOLATILE_P (x) = 1;
MEM_VOLATILE_P (y) = 1;
}
}
fmt = GET_RTX_FORMAT (code);
for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
......
2013-09-10 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/58365
* gcc.c-torture/execute/pr58365.c: New test.
2013-09-10 Michael Zolotukhin <michael.v.zolotukhin@gmail.com>
* gcc.dg/torture/memcpy-1.c: New test.
......
/* PR rtl-optimization/58365 */
extern void abort (void);
struct S
{
volatile int a;
int b, c, d, e;
} f;
static struct S g, h;
int i = 1;
char
foo (void)
{
return i;
}
static struct S
bar (void)
{
if (foo ())
return f;
return g;
}
int
main ()
{
h = bar ();
f.b = 1;
if (h.b != 0)
abort ();
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