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

Martin Liška <marxin at gcc dot gnu.org> changed:

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

--- Comment #6 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to Martin Sebor from comment #4)
> The warning is triggered by the excessive size argument in the strncpy call.
> The excessive size makes the call invalid regardless of the values of the
> two pointer arguments.
> 
> This happens both with the reduced test case in comment #0 and with the
> translation unit and -m32.  The warning code just looks at the call:
> 
>   __builtin_strncpy (_65, buf_30, 4294967295);
> 
> I don't see much the warning code alone can do to handle this case.  We have
> talked about at least two approaches to dealing these invalid calls earlier.

I see.

> Jeff's preference is to replace them with traps.  Others have suggested
> replacing them with __builtin_unreachable().

Btw. can't we just use __builtin_unreachable and provide an option (similar to
-fsanitize-undefined-trap-on-error) which will intrument all these with
__builtin_trap? I guess it's the topic Alexander was trying to address at this
year's Cauldron?

Reply via email to