public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/104119] New: Wrong -Werror=format-overflow= since r12-5014-g6b8b959675a3e14c
@ 2022-01-19 14:54 marxin at gcc dot gnu.org
  2022-01-19 14:55 ` [Bug tree-optimization/104119] " marxin at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-01-19 14:54 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104119
           Summary: Wrong -Werror=format-overflow= since
                    r12-5014-g6b8b959675a3e14c
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: aldyh at gcc dot gnu.org, amacleod at redhat dot com
  Target Milestone: ---

Since the revision I see (reduced from multipath-tools package)

$ cat devmapper.i
struct {
  char id[8];
  int needs_paths_uevent;
} *p;

void dm_addmap_create()
{
  char *str = __builtin_malloc((sizeof("mpath-") - 1) + __builtin_strlen(p->id)
+ 10);
  __builtin_sprintf(str, "mpath-%s", p->id);
}

$ gcc devmapper.i -c -m32 -O2 -Werror=format-overflow
devmapper.i: In function ‘dm_addmap_create’:
devmapper.i:9:33: error: ‘%s’ directive writing up to 2147483644 bytes into a
region of size 2147483641 [-Werror=format-overflow=]
    9 |   __builtin_sprintf(str, "mpath-%s", p->id);
      |                                 ^~
devmapper.i:9:3: note: ‘__builtin_sprintf’ output between 7 and 2147483651
bytes into a destination of size 2147483647
    9 |   __builtin_sprintf(str, "mpath-%s", p->id);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors

Note one needs -m32!

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-02-03 20:37 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-19 14:54 [Bug tree-optimization/104119] New: Wrong -Werror=format-overflow= since r12-5014-g6b8b959675a3e14c marxin at gcc dot gnu.org
2022-01-19 14:55 ` [Bug tree-optimization/104119] " marxin at gcc dot gnu.org
2022-01-19 17:44 ` [Bug tree-optimization/104119] unexpected -Wformat-overflow after strlen in ILP32 since Ranger integration msebor at gcc dot gnu.org
2022-01-19 17:59 ` pinskia at gcc dot gnu.org
2022-01-19 18:07 ` [Bug tree-optimization/104119] [12 Regression] " msebor at gcc dot gnu.org
2022-01-20  1:21 ` msebor at gcc dot gnu.org
2022-01-20  7:43 ` rguenth at gcc dot gnu.org
2022-02-03 20:31 ` cvs-commit at gcc dot gnu.org
2022-02-03 20:37 ` msebor at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).