re PR tree-optimization/36245 (internal compiler error: in build2_stat, at tree.c...
authorRichard Guenther <rguenther@suse.de>
Tue, 27 May 2008 13:10:18 +0000 (13:10 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 27 May 2008 13:10:18 +0000 (13:10 +0000)
2008-05-27  Richard Guenther  <rguenther@suse.de>

PR tree-optimization/36245
* tree-ssa-address.c (add_to_parts): Deal with non-pointer
bases.

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

From-SVN: r136029

gcc/ChangeLog
gcc/tree-ssa-address.c

index a6d1e210d1e0691c0f0cfc1174180f219a6be407..bbe6eec73f85e9ace6ba4cfec6ca523746d4053f 100644 (file)
@@ -1,3 +1,9 @@
+2008-05-27  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/36245
+       * tree-ssa-address.c (add_to_parts): Deal with non-pointer
+       bases.
+
 2008-05-27  Andreas Krebbel  <krebbel1@de.ibm.com>
 
        * config/s390/s390.md: Replace all occurences of the 'm'
index a5119d8c2bde5d53c854aa227c890554a62d77c9..55d43a5e362a7f59459f148abcc302f97dbaa888 100644 (file)
@@ -423,9 +423,13 @@ add_to_parts (struct mem_address *parts, tree elt)
 
   /* Add ELT to base.  */
   type = TREE_TYPE (parts->base);
-  parts->base = fold_build2 (POINTER_PLUS_EXPR, type,
-                            parts->base,
-                            fold_convert (sizetype, elt));
+  if (POINTER_TYPE_P (type))
+    parts->base = fold_build2 (POINTER_PLUS_EXPR, type,
+                              parts->base,
+                              fold_convert (sizetype, elt));
+  else
+    parts->base = fold_build2 (PLUS_EXPR, type,
+                              parts->base, elt);
 }
 
 /* Finds the most expensive multiplication in ADDR that can be