Committed to master.

Best regards,
Oleg Endo

gcc/testsuite/ChangeLog:

        PR target/34777
        * gcc.target/sh/torture/pr34777-1.c: New test.


From ca97c747850478628fcdd25b747fe2f8bc725738 Mon Sep 17 00:00:00 2001
From: Oleg Endo <[email protected]>
Date: Fri, 3 Jul 2026 14:41:07 +0900
Subject: [PATCH] SH: Add another testcase for PR 34777

gcc/testsuite/ChangeLog:

	PR target/34777
	* gcc.target/sh/torture/pr34777-1.c: New test.
---
 gcc/testsuite/gcc.target/sh/torture/pr34777-1.c | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100644 gcc/testsuite/gcc.target/sh/torture/pr34777-1.c

diff --git a/gcc/testsuite/gcc.target/sh/torture/pr34777-1.c b/gcc/testsuite/gcc.target/sh/torture/pr34777-1.c
new file mode 100644
index 0000000..8d58456
--- /dev/null
+++ b/gcc/testsuite/gcc.target/sh/torture/pr34777-1.c
@@ -0,0 +1,31 @@
+/* { dg-do compile }  */
+/* { dg-additional-options "-fschedule-insns -fPIC -mprefergot" }  */
+
+static __inline __attribute__ ((__always_inline__)) void *
+_dl_mmap (void * start, int length, int prot, int flags, int fd,
+	  int offset, int xx)
+{
+  register long __sc3 __asm__ ("r3") = 90;
+  register long __sc4 __asm__ ("r4") = (long) start;
+  register long __sc5 __asm__ ("r5") = (long) length;
+  register long __sc6 __asm__ ("r6") = (long) prot;
+  register long __sc7 __asm__ ("r7") = (long) flags;
+  register long __sc0 __asm__ ("r0") = (long) fd;
+  register long __sc1 __asm__ ("r1") = (long) offset;
+
+  if (xx & 3)
+    __asm__ __volatile__ ("trapa	%1"
+			: "=z" (__sc0)
+			: "i" (0x10 + 6), "0" (__sc0), "r" (__sc4),
+			  "r" (__sc5), "r" (__sc6), "r" (__sc7),
+			  "r" (__sc3), "r" (__sc1)
+			: "memory" );
+}
+
+extern int _dl_pagesize;
+void
+_dl_dprintf(int fd, const char *fmt, ...)
+{
+  static char *buf;
+  buf = _dl_mmap ((void *) 0, _dl_pagesize, 0x1 | 0x2, 0x02 | 0x20, -1, 0, fd);
+}
--
libgit2 1.9.0

Reply via email to