From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D6056384605A; Thu, 6 Aug 2020 15:51:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D6056384605A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1596729072; bh=cV77yojsFrF/gm2eRpxHUHHBnrJxu3ugtP8W1m9q1kE=; h=From:To:Subject:Date:From; b=k/uM3OTWvx/NxENNu3iBTUCpf58yHGz3sk2vhvBrgOuLBFRDRS0xeRBYaVDaUZY0m v5wFvYSgLaMJGOeyMYeSk3kjpEMf4GK6Ohc8wVOXmrlw8IdDCU0RIF4WFE3VtorJsA NM4KZYDp8EPSWVCdH4p1DszDjxPR8x42SaIodIes= From: "msebor at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug ipa/96503] New: attribute alloc_size effect lost after inlining Date: Thu, 06 Aug 2020 15:51:12 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: ipa X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: msebor at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Aug 2020 15:51:12 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96503 Bug ID: 96503 Summary: attribute alloc_size effect lost after inlining Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: ipa Assignee: unassigned at gcc dot gnu.org Reporter: msebor at gcc dot gnu.org CC: marxin at gcc dot gnu.org Target Milestone: --- Similar to pr96502, the test case below shows that the effect of attribute alloc_size on warnings is also lost after inlining. I open this as a separ= ate bug (and expect to raise others) because I expect the "fixes" to be differe= nt in each case. Like pr96502, this also came up in the following discussion: https://gcc.gnu.org/pipermail/gcc-patches/2020-August/551526.html $ cat x.c && gcc -O2 -S -Wall -Wextra -fdump-tree-optimized=3D/dev/stdout x= .c int* f (int); __attribute__ ((alloc_size (1), noinline)) int* f0 (int n) { return f (n); } void h0 (void) { int *p =3D f0 (3); __builtin_memset (p, 0, 3 * sizeof p); // warning (good) } __attribute__ ((alloc_size (1))) int* f1 (int n) { return f (n); } void h1 (void) {=20 int *p =3D f1 (3); __builtin_memset (p, 0, 3 * sizeof p); // missing warning } x.c: In function =E2=80=98h0=E2=80=99: x.c:9:3: warning: =E2=80=98__builtin_memset=E2=80=99 forming offset [3, 23]= is out of the bounds [0, 3] [-Warray-bounds] 9 | __builtin_memset (p, 0, 3 * sizeof p); // warning (good) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=