From: Kyrylo Tkachov <[email protected]>

The existing tests exercise C.  Add a C++ counterpart to the original
reproducer, which ICEs without the fix and compiles successfully with it.

Pushing to trunk.

gcc/testsuite/ChangeLog:

        PR target/124146
        * g++.target/aarch64/pr124146.C: New test.

Signed-off-by: Kyrylo Tkachov <[email protected]>
---
 gcc/testsuite/g++.target/aarch64/pr124146.C | 25 +++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 gcc/testsuite/g++.target/aarch64/pr124146.C

diff --git a/gcc/testsuite/g++.target/aarch64/pr124146.C 
b/gcc/testsuite/g++.target/aarch64/pr124146.C
new file mode 100644
index 00000000000..d53141488bc
--- /dev/null
+++ b/gcc/testsuite/g++.target/aarch64/pr124146.C
@@ -0,0 +1,25 @@
+/* PR target/124146 */
+/* { dg-do compile } */
+/* { dg-options "-O1" } */
+
+/* Verify that the C++ version of the original reproducer does not ICE.  */
+
+long a;
+void *b;
+char c;
+
+long
+foo (void *)
+{
+  typedef __attribute__((__aligned__))
+    __attribute__((__may_alias__)) unsigned long T;
+  a = *(T *) b;
+  return a;
+}
+
+void
+bar (unsigned long)
+{
+  long d = foo (&c);
+  bar (d);
+}
-- 
2.50.1 (Apple Git-155)

Reply via email to