[Bug tree-optimization/92765] [10 Regression] Wrong code caused by folding of -Wstring-compare since r276773

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Dec 3 14:44:00 GMT 2019


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

--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Jeffrey A. Law from comment #8)
> Perhaps related to:
> 
> https://gcc.gnu.org/ml/gcc-patches/2019-10/msg01874.html

Yes, that is pretty much the same thing.  One thing is whether it is safe or
unsafe to use what determine_min_objsize does for the purposes Qing introduced
(probably unsafe, if we e.g. consider what GCC uses for tree/rtl/gimple, unions
containing members with different sizes and where the mapped size is actually
just the size of the corresponding member; if VN would see first
&ptr->member.elt
of some larger element and then &ptr->smaller_member which has the same
address,
Qing's code could assume at least that many bytes are mapped and perform *_eq).
And another thing as the #c7 testcase shows that it is wrong to use minimum
object size, whatever exact definition it has, at least for code generation
purposes, it has to consider maximum object size instead, as the code tries to
optimize the str{,n}cmp into not equal if one object is small enough and the
other object is too large to fit in there.


More information about the Gcc-bugs mailing list