diff mbox series

[committed] Fix ICE in equal_mem_array_ref_p (PR c++/90484)

Message ID 20190516214853.GD19695@tucnak
State New
Headers show
Series [committed] Fix ICE in equal_mem_array_ref_p (PR c++/90484) | expand

Commit Message

Jakub Jelinek May 16, 2019, 9:48 p.m. UTC
Hi!

As mentioned in the PR, if we are very unlucky and have a hash collision
not just when hash % hash table size is equal, but when the whole 32-bit
hash is equal, we can actually end up with compatible types (bool vs.
unsigned : 1 on the testcase), but sz0 != sz1 (one is 1-bit, the other
8-bit), as one expression is a COMPONENT_REF with a bitfield and the other
is a bool MEM_REF.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
preapproved by Richard on IRC, committed to trunk.

Testcase is not included, as it is not reduceable.

2019-05-16  Jakub Jelinek  <jakub@redhat.com>

	PR c++/90484
	* tree-ssa-scopedtables.c (equal_mem_array_ref_p): Don't assert that
	sz0 is equal to sz1, instead return false in that case.


	Jakub
diff mbox series

Patch

--- gcc/tree-ssa-scopedtables.c.jj	2019-05-07 13:56:54.342933630 +0200
+++ gcc/tree-ssa-scopedtables.c	2019-05-16 14:35:23.353145695 +0200
@@ -537,13 +537,10 @@  equal_mem_array_ref_p (tree t0, tree t1)
       || maybe_ne (sz1, max1))
     return false;
 
-  if (rev0 != rev1)
+  if (rev0 != rev1 || maybe_ne (sz0, sz1) || maybe_ne (off0, off1))
     return false;
 
-  /* Types were compatible, so this is a sanity check.  */
-  gcc_assert (known_eq (sz0, sz1));
-
-  return known_eq (off0, off1) && operand_equal_p (base0, base1, 0);
+  return operand_equal_p (base0, base1, 0);
 }
 
 /* Compare two hashable_expr structures for equivalence.  They are