[Bug tree-optimization/94734] [10 Regression] Program crashes when compiled with -O2 since r10-1892-gb9ef6a2e04bfd013

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Apr 23 23:24:20 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94734

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
+  int cstore_31;
+  int cstore_32;

   <bb 2> [local count: 114863530]:
   goto <bb 7>; [100.00%]

   <bb 3> [local count: 1014686026]:
   _1 = (long unsigned int) sum_a_7;
   _2 = _1 * 8;
   _3 = input_21(D) + _2;
   _4 = *_3;
   if (_4 == 0B)
     goto <bb 15>; [5.50%]
   else
     goto <bb 4>; [94.50%]

   <bb 4> [local count: 958878296]:
   if (sum_a_7 <= 1)
-    goto <bb 5>; [28.10%]
+    goto <bb 6>; [28.10%]
   else
-    goto <bb 6>; [71.90%]
+    goto <bb 5>; [71.90%]

-  <bb 5> [local count: 269444804]:
-  arr[sum_a_7] = 1;
+  <bb 5> [local count: 689433492]:
+  cstore_32 = MEM <int[2]> [(void *)&arr][sum_a_7];

   <bb 6> [local count: 958878296]:
+  # cstore_31 = PHI <1(4), cstore_32(5)>
+  MEM <int[2]> [(void *)&arr][sum_a_7] = cstore_31;
   sum_a_23 = sum_a_7 + 1;

done by cselim looks just plain wrong, there is no dominating load from that
memory, so even when the variable is an automatic variable, there is no
guarantee it won't be out of bounds and thus crash already on the load, or just
modify random unrelated memory.


More information about the Gcc-bugs mailing list