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

--- Comment #2 from Jonathan Leffler <jonathan.leffler at gmail dot com> ---
(In reply to Martin Sebor from comment #1)
> The sizes used to trigger the warning are based on what it can determine
> from the representation of source code it sees.  ...

Thank you for the confirmation, explanation and workarounds.

For the time being, I'm changing the format string to the equivalent of
"%.128s/name/%.160s/abc1234", and including this bug's URL in the comments.

The original source file is about 3200 lines long and directly includes 31
headers (and doesn't directly include either of those used in the repro).  As
you must have guessed, the structure and function names have been anonymized. 
The function the code comes from is about 150 lines long.  Most of the 'real'
structures are bigger than in the reproduction.  There was a lot of reduction
work.

For the actual code, because the macros defining the array sizes are simple
integer values (#define ABC 128), I can use a series of macros to embed the
sizes into the format string; it isn't too awful.

So, I have an adequate workaround.

But ultimately, I think the false positive should be fixed if at all possible.

Thank you all for your efforts.

Reply via email to