From eedda4e160856b7ac0c533ac9445161d0fd88660 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 2 Feb 2021 10:01:40 +0100 Subject: [PATCH] testsuite: Add testcase for already fixed PR [PR97960] This testcase has been fixed by r11-5904-g4cf70c20cb10acd6fb1016611d05540728176b60 so I'm checking it in so that we can close the PR. 2021-02-02 Jakub Jelinek PR tree-optimization/97960 * g++.dg/torture/pr97960.C: New test. --- gcc/testsuite/g++.dg/torture/pr97960.C | 30 ++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 gcc/testsuite/g++.dg/torture/pr97960.C diff --git a/gcc/testsuite/g++.dg/torture/pr97960.C b/gcc/testsuite/g++.dg/torture/pr97960.C new file mode 100644 index 00000000000..c6c068ea12e --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr97960.C @@ -0,0 +1,30 @@ +// PR tree-optimization/97960 +// { dg-do run } + +#if __CHAR_BIT__ == 8 && __SIZEOF_INT__ == 4 +const int & +foo (const int &d, const int &f) +{ + if (d < f) + return f; + return d; +} + +short a[575]; +unsigned b[25]; +unsigned char g; +#endif + +int +main () +{ +#if __CHAR_BIT__ == 8 && __SIZEOF_INT__ == 4 + for (int e = 0; e < 23; ++e) + a[e * 23] = 16137; + for (signed char h = (unsigned char) (foo (g, 253) + 3); h < 24; h++) + b[h] = 1064739102; + for (int e = 0; e < 23; ++e) + if (a[e * 23] != 16137) + __builtin_abort (); +#endif +} -- 2.30.2