]> gcc.gnu.org Git - gcc.git/commitdiff
re PR middle-end/29584 (internal compiler error on optimization)
authorJakub Jelinek <jakub@redhat.com>
Fri, 17 Nov 2006 08:57:45 +0000 (09:57 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 17 Nov 2006 08:57:45 +0000 (09:57 +0100)
PR middle-end/29584
* tree-ssa-forwprop.c (simplify_switch_expr): Don't
optimize if DEF doesn't have integral type.

* gcc.dg/torture/pr29584.c: New test.

From-SVN: r118921

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr29584.c [new file with mode: 0644]
gcc/tree-ssa-forwprop.c

index 8a74dde70bde04d5a3da50e0abc914c7f000b985..968e679b9194f3e276a87e2c9343b55eb353db6a 100644 (file)
@@ -1,3 +1,9 @@
+2006-11-17  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/29584
+       * tree-ssa-forwprop.c (simplify_switch_expr): Don't
+       optimize if DEF doesn't have integral type.
+
 2006-11-16  Mike Stump  <mrs@apple.com>
 
        * config/darwin.h (LINK_COMMAND_SPEC): Don't do dwarf stuff on
index c58709639995517f89eb45b8b32c4087ebf23324..6ba65d40a585f38c9547e7f7f1ab115c67ddae2d 100644 (file)
@@ -1,3 +1,8 @@
+2006-11-17  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/29584
+       * gcc.dg/torture/pr29584.c: New test.
+
 2006-11-17  Joseph Myers  <joseph@codesourcery.com>
 
        * gcc.dg/tree-ssa/stdarg-2.c, gcc.dg/tree-ssa/stdarg-4.c:
diff --git a/gcc/testsuite/gcc.dg/torture/pr29584.c b/gcc/testsuite/gcc.dg/torture/pr29584.c
new file mode 100644 (file)
index 0000000..84bfddc
--- /dev/null
@@ -0,0 +1,28 @@
+/* PR middle-end/29584 */
+/* { dg-do compile } */
+
+extern void *foo1 (void);
+extern void foo2 (void);
+extern void foo3 (void *, void *);
+extern int foo4 (void);
+
+void
+bar (void)
+{
+  int i;
+  void *s;
+  for (i = 1; i < 4; i++)
+    {
+      if (foo4 ())
+       foo2 ();
+      switch (0x8000000UL + i * 0x400)
+       {
+       case 0x80000000UL ... 0x80000000UL + 0x3a000000UL - 1:
+         s = 0;
+         break;
+       default:
+         s = foo1 ();
+       }
+      foo3 ((void *) (0x8000000UL + i * 0x400), s);
+    }
+}
index e2c5ed48e709f392e1f0b17000c5f4440363e0b7..a3caf235062e8ce6e184bcb2053152737ade011e 100644 (file)
@@ -934,7 +934,9 @@ simplify_switch_expr (tree stmt)
 
              need_precision = TYPE_PRECISION (ti);
              fail = false;
-             if (TYPE_UNSIGNED (to) && !TYPE_UNSIGNED (ti))
+             if (! INTEGRAL_TYPE_P (ti))
+               fail = true;
+             else if (TYPE_UNSIGNED (to) && !TYPE_UNSIGNED (ti))
                fail = true;
              else if (!TYPE_UNSIGNED (to) && TYPE_UNSIGNED (ti))
                need_precision += 1;
This page took 0.176489 seconds and 5 git commands to generate.