From: Kaz Kojima Date: Fri, 20 Sep 2024 09:36:22 +0000 (+0900) Subject: SH: A test case for the wrong-code with -mlra PR55212 c#248. X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=c5a639c84c15adf402d5b664184628ff809a5bb0;p=thirdparty%2Fgcc.git SH: A test case for the wrong-code with -mlra PR55212 c#248. gcc/testsuite/ChangeLog: * gcc.target/sh/pr55212-c248.c: New test. --- diff --git a/gcc/testsuite/gcc.target/sh/pr55212-c248.c b/gcc/testsuite/gcc.target/sh/pr55212-c248.c new file mode 100644 index 000000000000..94fd6afaab3c --- /dev/null +++ b/gcc/testsuite/gcc.target/sh/pr55212-c248.c @@ -0,0 +1,31 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -m4 -mlra -ffixed-r7 -ffixed-r8 -ffixed-r9 -ffixed-r10 -ffixed-r11 -ffixed-r12 -ffixed-r13" } */ +#include +#include + +typedef struct { int c[64]; } obj; +obj obj0; +obj obj1; + +void __attribute__ ((noinline)) +bar (int a, int b, int c, int d, obj *q) +{ + if (q->c[0] != 0x12345678 || q->c[1] != 0xdeadbeef) + abort (); +} + +void foo (obj *p) +{ + obj bobj; + bobj = *p; + bar (0, 0, 0, 0, &bobj); +} + +int +main () +{ + obj0.c[0] = 0x12345678; + obj0.c[1] = 0xdeadbeef; + foo (&obj0); + exit (0); +}