OSDN Git Service

2009-05-20 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 20 May 2009 08:19:50 +0000 (08:19 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 20 May 2009 08:19:50 +0000 (08:19 +0000)
* expr.c (expand_expr_real_1): Avoid calling do_store_flag
with mismatched comparison modes.

* gcc.c-torture/compile/20090518-1.c: New testcase.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@147731 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/expr.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/20090518-1.c [new file with mode: 0644]

index b64bdce..19a59b5 100644 (file)
@@ -1,3 +1,8 @@
+2009-05-20  Richard Guenther  <rguenther@suse.de>
+
+       * expr.c (expand_expr_real_1): Avoid calling do_store_flag
+       with mismatched comparison modes.
+
 2009-05-20  Ramana Radhakrishnan  <ramana.radhakrishnan@arm.com>
     
        * config/arm/arm.md (*arm_iorsi3): Refactored for only ARM.
index aca8c57..73fde71 100644 (file)
@@ -9042,7 +9042,12 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
     case LTGT_EXPR:
       temp = do_store_flag (exp,
                            modifier != EXPAND_STACK_PARM ? target : NULL_RTX,
-                           tmode != VOIDmode ? tmode : mode);
+                           (tmode != VOIDmode
+                            /* do_store_flag does not handle target modes
+                               of a different class than the comparison mode.
+                               Avoid ICEing in convert_move.  */
+                            && GET_MODE_CLASS (tmode) == GET_MODE_CLASS (mode))
+                           ? tmode : mode);
       if (temp != 0)
        return temp;
 
index 6b462b6..cca56e5 100644 (file)
@@ -1,3 +1,7 @@
+2009-05-20  Richard Guenther  <rguenther@suse.de>
+
+       * gcc.c-torture/compile/20090518-1.c: New testcase.
+
 2009-05-19  Zdenek Dvorak  <ook@ucw.cz>
 
        PR tree-optimization/40087
diff --git a/gcc/testsuite/gcc.c-torture/compile/20090518-1.c b/gcc/testsuite/gcc.c-torture/compile/20090518-1.c
new file mode 100644 (file)
index 0000000..709504c
--- /dev/null
@@ -0,0 +1,6 @@
+float
+foo(int i)
+{
+  int j = i == 42;
+  return *(float *)&j;
+}