[PATCH] better handle MIN/MAX_EXPR of unrelated objects [PR102200]

Martin Sebor msebor@gmail.com
Fri Sep 17 00:28:55 GMT 2021

When computing the size of an object pointed to by the result of
a MIN/MAX_EXPR, the handle_min_max_size() function tries to deal
gracefully with operands that designate distinct objects.  But
the handling fails to consider an edge case when one of
the operands is a PHI one of whose operands references the same
MIN/MAX_EXPR.  This ultimately results in attempting to cache
as the result of the MIN/MAX_EXPR two different object references,
which triggers an ICE in the cache consistency checking.

The attached fix avoids the problem by instead caching the SSA_NAME
that's the result of the MIN/MAX_EXPR when its operands might
reference distinct objects, and by enhancing the infor_access()
function to handle this case.  Besides the absence if the ICE
the two additional tests verify that the right subobject of
the MIN/MAX_EXPR is used under the various combinations
of conditions.

Tested on x86_64-linux.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcc-102200.diff
Type: text/x-patch
Size: 18861 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20210916/d568692d/attachment.bin>

More information about the Gcc-patches mailing list