]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR middle-end/39824 (ice in fold-const.c)
authorRichard Guenther <rguenther@suse.de>
Wed, 22 Apr 2009 15:41:48 +0000 (15:41 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 22 Apr 2009 15:41:48 +0000 (15:41 +0000)
2009-04-22  Richard Guenther  <rguenther@suse.de>

PR tree-optimization/39824
* tree-ssa-ccp.c (fold_const_aggregate_ref): For INDIRECT_REFs
make sure the types are compatible.

* gcc.c-torture/compile/pr39824.c: New testcase.

From-SVN: r146592

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr39824.c [new file with mode: 0644]
gcc/tree-ssa-ccp.c

index f037097d36e849d6946c1f5d840bb79e2d4855e1..18a3573a33843ff52071d1b00e62c637dec89cca 100644 (file)
@@ -1,3 +1,9 @@
+2009-04-22  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/39824
+       * tree-ssa-ccp.c (fold_const_aggregate_ref): For INDIRECT_REFs
+       make sure the types are compatible.
+
 2009-04-22  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>
 
        PR c++/14875
index 386ce8cae69486b8b4d2036c31ea65f7d0a4be7b..d2ef13c8332fe472739f6b97d3cc2fbb04549dec 100644 (file)
@@ -1,3 +1,8 @@
+2009-04-22  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/39824
+       * gcc.c-torture/compile/pr39824.c: New testcase.
+
 2009-04-22  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>
 
        PR c++/14875
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39824.c b/gcc/testsuite/gcc.c-torture/compile/pr39824.c
new file mode 100644 (file)
index 0000000..362fb17
--- /dev/null
@@ -0,0 +1,26 @@
+static const double internalEndianMagic = 7.949928895127363e-275;
+static const unsigned char ieee_754_mantissa_mask[] = { 0x00, 0x0F, 0xFF, 0xFF,
+    0xFF, 0xFF, 0xFF, 0xFF };
+static inline int 
+trio_isnan (double number)
+{
+  int has_mantissa = 0;
+  unsigned int i;
+  unsigned char current;
+  for (i = 0; i < (unsigned int)sizeof(double); i++)
+    {
+      current = ((unsigned char *)&number)[(((unsigned char
+                                             *)&internalEndianMagic)[7-(i)])];
+      has_mantissa |= (current & ieee_754_mantissa_mask[i]);
+    }
+  return has_mantissa;
+}
+void
+xmlXPathEqualNodeSetFloat(int nodeNr, double v)
+{
+  int i;
+  for (i=0; i<nodeNr; i++)
+    if (!trio_isnan(v))
+      break;
+}
+
index 9cf2f83546b70a2618395d6c4de4618b3d2f53cd..437d4267dd35cc5dd4aa324622b5f115417d5359 100644 (file)
@@ -1329,7 +1329,9 @@ fold_const_aggregate_ref (tree t)
        if (TREE_CODE (base) == SSA_NAME
            && (value = get_value (base))
            && value->lattice_val == CONSTANT
-           && TREE_CODE (value->value) == ADDR_EXPR)
+           && TREE_CODE (value->value) == ADDR_EXPR
+           && useless_type_conversion_p (TREE_TYPE (t),
+                                         TREE_TYPE (TREE_TYPE (value->value))))
          return fold_const_aggregate_ref (TREE_OPERAND (value->value, 0));
        break;
       }