diff mbox

PATCH, testsuite]: Add test for PR 78248 (aka 78232)

Message ID CAFULd4a3xL2vbEVPT=EtvDbUfNmf4p7ZVoAn-XK9skdF9P_a+g@mail.gmail.com
State New
Headers show

Commit Message

Uros Bizjak Nov. 13, 2016, 6:34 p.m. UTC
Attached patch adds the testcase from (fixed) PR 78248.

2016-11-13  Uros Bizjak  <ubizjak@gmail.com>

        PR rtl-optimization/78232
        PR rtl-optimization/78248
        * gcc.dg/ubsan/pr78248.c: New test.

Tested on x86_64-linux-gnu {,-m32} and committed to mainline SVN.

Uros.
diff mbox

Patch

Index: gcc.dg/ubsan/pr78248.c
===================================================================
--- gcc.dg/ubsan/pr78248.c	(nonexistent)
+++ gcc.dg/ubsan/pr78248.c	(working copy)
@@ -0,0 +1,31 @@ 
+/* PR rtl-optimization/78232 */
+/* PR rtl-optimization/78248 */
+/* { dg-do run } */
+/* { dg-options "-fsanitize=undefined" } */
+
+static struct S
+{
+  int f0:15;
+} a;
+
+int b[1], c = 2, d, e, f, g;
+
+int main ()
+{
+  struct S h = { -2 };
+  for (; e < 640; e++)
+    for (; f < 1; f++)
+      {
+        if (c < 2)
+          {
+            d = b[e];
+            h = a;
+          }
+        g = c;
+        c = 1;
+        if (!h.f0)
+          break;
+        c = g;
+      }
+  return 0; 
+}