[Bug c/103352] New: Wrong computation of -Wformat-truncation=2

2021-11-21 Thread julien at trigofacile dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103352

Bug ID: 103352
   Summary: Wrong computation of -Wformat-truncation=2
   Product: gcc
   Version: 10.2.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: julien at trigofacile dot com
  Target Milestone: ---

When building
https://raw.githubusercontent.com/InterNetNews/inn/main/lib/timer.c I have a
warning with -Wformat-truncation=2

len = 52 * timer_count + 27 + (prefix == NULL ? 0 : strlen(prefix)) + 1;
buf = xmalloc(len);
if (prefix == NULL)
rc = 0;
else
rc = snprintf(buf, len, "%s ", prefix);

timer.c: In function ‘TMRsummary’:
timer.c:395:36: warning: ‘ ’ directive output may be truncated writing 1 byte
into a region of size between 0 and 1 [-Wformat-truncation=]
  395 | rc = snprintf(buf, len, "%s ", prefix);
  |^
timer.c:395:14: note: ‘snprintf’ output 2 or more bytes (assuming 3) into a
destination of size 1
  395 | rc = snprintf(buf, len, "%s ", prefix);
  |  ^


It seems that "len" is considered to be of length 1.  I bet it comes from the
"+ 1" at the end of the declaration of "len".
If I move the "+ 27" at the end of the declaration of "len", the warning
disappears.

Isn't there something to improve in the way the computation is done for that
warning?

Thanks beforehand.

[Bug c/103352] Wrong computation of -Wformat-truncation=2

2021-11-21 Thread julien at trigofacile dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103352

Julien ÉLIE  changed:

   What|Removed |Added

 Resolution|--- |DUPLICATE
 Status|UNCONFIRMED |RESOLVED

--- Comment #1 from Julien ÉLIE  ---
Duplicate, sorry.

*** This bug has been marked as a duplicate of bug 83011 ***

[Bug c/83011] -Wformat-truncation=2 difficult to avoid for non-constant bounds

2021-11-21 Thread julien at trigofacile dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83011

--- Comment #7 from Julien ÉLIE  ---
*** Bug 103352 has been marked as a duplicate of this bug. ***

[Bug c/83011] -Wformat-truncation=2 difficult to avoid for non-constant bounds

2021-11-21 Thread julien at trigofacile dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83011

--- Comment #8 from Julien ÉLIE  ---
"I do agree that the warning in this case is too difficult to deal with and
should be adjusted so I'm going to confirm this report on that basis."
FWIW, the same warning is still present in GCC 10.2.1.

[Bug bootstrap/50064] Failure in stage 2 (lazy binding) on openbsd

2021-11-21 Thread julien at trigofacile dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50064

Julien ÉLIE  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |WONTFIX

--- Comment #1 from Julien ÉLIE  ---
Probably too old to be worth investigating.
As the author of the bug, I suggest to close it.

[Bug middle-end/82798] Inconsistent descriptions for warning options in documentation

2021-11-21 Thread julien at trigofacile dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82798

--- Comment #5 from Julien ÉLIE  ---
Following up on that bug report, I've checked GCC 11 documentation.
Only 3/, part of 5/ (-Wmultistatement-macros) and 6/ have been fixed.
Points 1/, 2/, 4/, part of 5/ (-Wreorder) and 7/ remain.
Thanks beforehand.

[Bug middle-end/85619] Inconsistent descriptions for new warning options in GCC 8.1.0

2021-11-21 Thread julien at trigofacile dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85619

--- Comment #4 from Julien ÉLIE  ---
Following up on that issue.  I've just checked against GCC 11 documentation.
The two points are still open.
Thanks beforehand.