aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/torture/pr120242.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/torture/pr120242.c')
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr120242.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/torture/pr120242.c b/gcc/testsuite/gcc.dg/torture/pr120242.c
new file mode 100644
index 0000000..2d0f7de
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr120242.c
@@ -0,0 +1,30 @@
+/* { dg-do run } */
+/* { dg-additional-options "-fsigned-char -fno-strict-aliasing -fwrapv" } */
+
+char f1(char a, char b) {
+ return b == 0 ? a : b;
+}
+int f2(int a, int b) {
+ return b ? a : 0;
+}
+struct l {
+ unsigned m;
+ int n;
+};
+struct l ae;
+char af = -2;
+unsigned ah = 4;
+int aj = 8;
+int *test = &aj;
+int main() {
+ao:
+ if (f2(f1(4, af++), *test) <= 0) {
+ for (; ae.n; ae.n++)
+ ;
+ if (ah)
+ goto ao;
+ }
+ if (af != 1)
+ __builtin_abort ();
+ __builtin_exit (0);
+}