]> gcc.gnu.org Git - gcc.git/commitdiff
re PR middle-end/12002 (internal compiler error: in gen_lowpart, at emit-rtl.c:1374)
authorRoger Sayle <roger@eyesopen.com>
Tue, 26 Aug 2003 21:44:46 +0000 (21:44 +0000)
committerRoger Sayle <sayle@gcc.gnu.org>
Tue, 26 Aug 2003 21:44:46 +0000 (21:44 +0000)
PR middle-end/12002
* tree.h (SCALAR_FLOAT_TYPE_P, COMPLEX_FLOAT_TYPE_P): New macros.
(FLOAT_TYPE_P): Define in terms of these two new macros.
* fold-const.c (fold <PLUS_EXPR>): Don't convert x+x into x*2.0
for complex floating point types.

* g77.f-torture/compile/12002.f: New test case.

From-SVN: r70821

gcc/ChangeLog
gcc/fold-const.c
gcc/testsuite/ChangeLog
gcc/testsuite/g77.f-torture/compile/12002.f [new file with mode: 0644]
gcc/tree.h

index 746dec528af77f84cd4d4da0678566ad36ce973a..6830aeef16d2d884c6b053a62ecd2702a3b0ef5e 100644 (file)
@@ -1,3 +1,11 @@
+2003-08-26  Roger Sayle  <roger@eyesopen.com>
+
+       PR middle-end/12002
+       * tree.h (SCALAR_FLOAT_TYPE_P, COMPLEX_FLOAT_TYPE_P): New macros.
+       (FLOAT_TYPE_P): Define in terms of these two new macros.
+       * fold-const.c (fold <PLUS_EXPR>): Don't convert x+x into x*2.0
+       for complex floating point types.
+
 2003-08-26  Ulrich Weigand  <uweigand@de.ibm.com>
 
        * config/s390/s390.c (emit_prologue): Don't check literal pool size.
index efa2db966373309896db2dcedaef9cfe7e7e2db8..68a92a2ed3837a94eee75d8e1ced40dbd2ef8b81 100644 (file)
@@ -5713,7 +5713,8 @@ fold (tree expr)
            return non_lvalue (convert (type, arg1));
 
          /* Convert x+x into x*2.0.  */
-         if (operand_equal_p (arg0, arg1, 0))
+         if (operand_equal_p (arg0, arg1, 0)
+             && SCALAR_FLOAT_TYPE_P (type))
            return fold (build (MULT_EXPR, type, arg0,
                                build_real (type, dconst2)));
 
index ba803a16550bf1f0b9301470e0dde2f5b2ad47b7..2cabf3401661dd8dd2698e8cdb2d85f11344280c 100644 (file)
@@ -1,3 +1,8 @@
+2003-08-26  Roger Sayle  <roger@eyesopen.com>
+
+       PR middle-end/12002
+       * g77.f-torture/compile/12002.f: New test case.
+
 2003-08-26  Roger Sayle  <roger@eyesopen.com>
 
        * gcc.dg/20030826-1.c: New test case.
diff --git a/gcc/testsuite/g77.f-torture/compile/12002.f b/gcc/testsuite/g77.f-torture/compile/12002.f
new file mode 100644 (file)
index 0000000..cd66145
--- /dev/null
@@ -0,0 +1,5 @@
+C      PR middle-end/12002
+       COMPLEX TE1
+       TE1=-2.
+       TE1=TE1+TE1
+       END
index 6bceb7cc1d40cb560983f2802b5697efe15af504..892057d98995c4c831af3be5dfa3c656b0e8d574 100644 (file)
@@ -446,13 +446,21 @@ extern void tree_operand_check_failed (int, enum tree_code,
   (TREE_CODE (TYPE) == INTEGER_TYPE || TREE_CODE (TYPE) == ENUMERAL_TYPE  \
    || TREE_CODE (TYPE) == BOOLEAN_TYPE || TREE_CODE (TYPE) == CHAR_TYPE)
 
+/* Nonzero if TYPE represents a scalar floating-point type.  */
+
+#define SCALAR_FLOAT_TYPE_P(TYPE) (TREE_CODE (TYPE) == REAL_TYPE)
+
+/* Nonzero if TYPE represents a complex floating-point type.  */
+
+#define COMPLEX_FLOAT_TYPE_P(TYPE)     \
+  (TREE_CODE (TYPE) == COMPLEX_TYPE    \
+   && TREE_CODE (TREE_TYPE (TYPE)) == REAL_TYPE)
+
 /* Nonzero if TYPE represents a floating-point type, including complex
    floating-point types.  */
 
 #define FLOAT_TYPE_P(TYPE)             \
-  (TREE_CODE (TYPE) == REAL_TYPE       \
-   || (TREE_CODE (TYPE) == COMPLEX_TYPE \
-       && TREE_CODE (TREE_TYPE (TYPE)) == REAL_TYPE))
+  (SCALAR_FLOAT_TYPE_P (TYPE) || COMPLEX_FLOAT_TYPE_P (TYPE))
 
 /* Nonzero if TYPE represents an aggregate (multi-component) type.  */
 
This page took 0.118718 seconds and 5 git commands to generate.