tree-optimization/94163 constrain alignment set by PRE
authorRichard Biener <rguenther@suse.de>
Fri, 13 Mar 2020 12:56:26 +0000 (13:56 +0100)
committerRichard Biener <rguenther@suse.de>
Fri, 13 Mar 2020 12:57:41 +0000 (13:57 +0100)
This avoids HWI -> unsigned truncation to end up with zero alignment
which set_ptr_info_alignment ICEs on.

2020-03-13  Richard Biener  <rguenther@suse.de>

PR tree-optimization/94163
* tree-ssa-pre.c (create_expression_by_pieces): Check
whether alignment would be zero.

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

index 679296ffcaca91b0bce8300ecaed5d99060fe4d5..18745fb6a157f1095e6057699c0cb2438b6a67b4 100644 (file)
@@ -1,3 +1,9 @@
+2020-03-13  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/94163
+       * tree-ssa-pre.c (create_expression_by_pieces): Check
+       whether alignment would be zero.
+
 2020-03-13  Martin Liska  <mliska@suse.cz>
 
        PR lto/94157
index 29987d840fdb1b9fc92a71d314bfe3d5a77f16b0..0c1654f35809a0482360a5f8def5dc60f6bfc66a 100644 (file)
@@ -2815,7 +2815,8 @@ create_expression_by_pieces (basic_block block, pre_expr expr,
              unsigned HOST_WIDE_INT hmisalign
                = args.length () == 3 ? tree_to_uhwi (args[2]) : 0;
              if ((halign & (halign - 1)) == 0
-                 && (hmisalign & ~(halign - 1)) == 0)
+                 && (hmisalign & ~(halign - 1)) == 0
+                 && (unsigned int)halign != 0)
                set_ptr_info_alignment (get_ptr_info (forcedname),
                                        halign, hmisalign);
            }