Committed to master.
gcc/testsuite/ChangeLog:
PR target/55212
* gcc.target/sh/pr55212-c248.c: Move to ..
* gcc.target/sh/torture/pr55212-c248.c: .. here. Skip it for -O0.
From 552476a97b55ff86d95cb6ec23a93bb54f8eee18 Mon Sep 17 00:00:00 2001
From: Oleg Endo <[email protected]>
Date: Wed, 1 Jul 2026 11:58:29 +0900
Subject: [PATCH] SH: Move and adjust testcase pr55212-c248.c
gcc/testsuite/ChangeLog:
PR target/55212
* gcc.target/sh/pr55212-c248.c: Move to ..
* gcc.target/sh/torture/pr55212-c248.c: .. here. Skip it for -O0.
---
gcc/testsuite/gcc.target/sh/{pr55212-c248.c => torture/pr55212-c248.c} | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/gcc/testsuite/gcc.target/sh/pr55212-c248.c b/gcc/testsuite/gcc.target/sh/torture/pr55212-c248.c
similarity index 79%
rename from gcc/testsuite/gcc.target/sh/pr55212-c248.c
rename to gcc/testsuite/gcc.target/sh/torture/pr55212-c248.c
index 94fd6af..264f395 100644
--- a/gcc/testsuite/gcc.target/sh/pr55212-c248.c
+++ b/gcc/testsuite/gcc.target/sh/torture/pr55212-c248.c
@@ -1,17 +1,25 @@
/* { dg-do run } */
-/* { dg-options "-O2 -m4 -mlra -ffixed-r7 -ffixed-r8 -ffixed-r9 -ffixed-r10 -ffixed-r11 -ffixed-r12 -ffixed-r13" } */
+/* { dg-options "-ffixed-r7 -ffixed-r8 -ffixed-r9 -ffixed-r10 -ffixed-r11 -ffixed-r12 -ffixed-r13" } */
+/* { dg-skip-if "over-constrained regs when not optimizting" { *-*-* } { "-O0" } { "" } } */
+
+/* The 'block_lump_real_i4' insn that is emitted on SH4 will use up regs
+ r0~r6. With r7~r13 being artificially fixed for this test case, there
+ is only r14 (frame pointer) and r15 (stack pointer) left. When compiling
+ with -O0 the frame pointer is not eliminated and there are no free registers
+ remaining and it will ICE. */
+
#include <stdlib.h>
#include <string.h>
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)
+ if (q->c[0] != 0x12345678 || q->c[1] != 0xdeadbeef)
abort ();
}
void foo (obj *p)
--
libgit2 1.9.1