public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug analyzer/115380] New: Missing MUL_OVERFLOW support in analayzer Date: Fri, 07 Jun 2024 02:09:57 +0000 [thread overview] Message-ID: <bug-115380-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115380 Bug ID: 115380 Summary: Missing MUL_OVERFLOW support in analayzer Product: gcc Version: 15.0 Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: analyzer Assignee: dmalcolm at gcc dot gnu.org Reporter: pinskia at gcc dot gnu.org Blocks: 109896 Target Milestone: --- Take (which is a modified version of g++.dg/analyzer/placement-new-size.C): ``` /* { dg-additional-options "-Wno-placement-new -Wno-analyzer-use-of-uninitialized-value" } */ #include <new> #include <stdlib.h> #include <stdint.h> void static_buffer_too_short (int t) { int n = t*4; int n1 = (t+1); if (__builtin_mul_overflow(n1, 4, &n1)) __builtin_abort(); char buf[n]; char *p = new (buf) char[n1]; /* { dg-warning "stack-based buffer overflow" } */ } void static_buffer_too_short1 (int t) { int n = t*4; int n1 = (t+1); n1 = n1*4; char buf[n]; char *p = new (buf) char[n1]; /* { dg-warning "stack-based buffer overflow" } */ } ``` static_buffer_too_short should warn the same way as static_buffer_too_short1 currently does. Note this was found while looking into the regressions developing of the patch for PR 109896. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109896 [Bug 109896] Missed optimisation: overflow detection in multiplication instructions for operator new
reply other threads:[~2024-06-07 2:09 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-115380-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).