diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr29584.c | 28 | ||||
-rw-r--r-- | gcc/tree-ssa-forwprop.c | 4 |
4 files changed, 42 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8a74dde..968e679 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c587096..6ba65d4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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 index 0000000..84bfddc --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr29584.c @@ -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); + } +} diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c index e2c5ed4..a3caf23 100644 --- a/gcc/tree-ssa-forwprop.c +++ b/gcc/tree-ssa-forwprop.c @@ -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; |