https://gcc.gnu.org/g:71a5babb361165f0be6848e6ad8fb209d486684e
commit r17-2352-g71a5babb361165f0be6848e6ad8fb209d486684e Author: Kyrylo Tkachov <[email protected]> Date: Thu Jul 9 02:35:26 2026 -0700 aarch64: Add C++ testcase for aligned may_alias types [PR124146] 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]> Diff: --- gcc/testsuite/g++.target/aarch64/pr124146.C | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/gcc/testsuite/g++.target/aarch64/pr124146.C b/gcc/testsuite/g++.target/aarch64/pr124146.C new file mode 100644 index 000000000000..d53141488bc4 --- /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); +}
