Commit 305406d3 by Georg-Johann Lay Committed by Georg-Johann Lay

re PR middle-end/51782 (-ftree-sra: Missing address-space information leads to wrong)

	PR middle-end/51782
	* gcc.target/avr/torture/pr51782-1.c: New test.

From-SVN: r184434
parent 8540e6e8
2012-02-21 Georg-Johann Lay <avr@gjlay.de>
PR middle-end/51782
* gcc.target/avr/torture/pr51782-1.c: New test.
2012-02-21 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/52318
......
/* PR middle-end/51782 */
/* { dg-do run } */
/* { dg-options { "-std=gnu99" } } */
#include <stdlib.h>
struct R { char r; };
struct RGB { char r,g,b; };
__flash const struct R r1 = { 12 };
__flash const struct RGB r3 = { 23, 56, 78 };
char __attribute__((noinline,noclone))
read1_bug (const __flash struct R *s)
{
struct R t = *s;
return t.r;
}
char __attribute__((noinline,noclone))
read1_ok (const __flash struct R *s)
{
return s->r;
}
char __attribute__((noinline,noclone))
read3_bug (const __flash struct RGB *s)
{
struct RGB t = *s;
return t.r + t.g + t.b;
}
char __attribute__((noinline,noclone))
read3_ok (const __flash struct RGB *s)
{
return s->r + s->g + s->b;
}
__flash const struct R * volatile p1 = &r1;
__flash const struct RGB * volatile p3 = &r3;
int main (void)
{
if (read1_bug (p1) != read1_ok (p1))
abort();
if (read3_bug (p3) != read3_ok (p3))
abort();
exit (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