[Bug tree-optimization/101419] [9/10/11/12 Regression] collapsing memset() calls can break __builtin_object_size()

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jul 12 09:03:58 GMT 2021


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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #2)
> Started with r9-2635-g78ea9abc2018243af7f7ada6135144ac90c6ad27
> I wonder if objsz pass when insert_min_max_p shouldn't in addition to adding
> MIN_EXPR or MAX_EXPR around the result of __bos also drop the least
> significant bit from the __bos second argument.

But then isn't this wrong as well?  Btw, I never get what the second bit means,
it's documented as

"The second bit determines if maximum or minimum of remaining bytes
is computed."

but does it compute the maximum size when the bit is set or when it is not set?
For the least significant bit the situation is better:

"If the least significant
bit is clear, objects are whole variables, if it is set, a closest
surrounding subobject is considered the object a pointer points to."

Unfortunately the examples also only use 0 and 1.


More information about the Gcc-bugs mailing list