From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2BC3C382C43A; Mon, 12 Jul 2021 11:21:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2BC3C382C43A From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/101419] [9/10/11/12 Regression] collapsing memset() calls can break __builtin_object_size() Date: Mon, 12 Jul 2021 11:21:24 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub 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: 9.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: 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: Mon, 12 Jul 2021 11:21:25 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101419 --- Comment #8 from Jakub Jelinek --- --- gcc/tree-pass.h.jj 2021-01-27 10:10:00.525903635 +0100 +++ gcc/tree-pass.h 2021-07-12 13:10:59.621933276 +0200 @@ -208,6 +208,7 @@ protected: #define PROP_gimple_lcf (1 << 1) /* lowered control = flow */ #define PROP_gimple_leh (1 << 2) /* lowered eh */ #define PROP_cfg (1 << 3) +#define PROP_objsz (1 << 4) /* object sizes computed */ #define PROP_ssa (1 << 5) #define PROP_no_crit_edges (1 << 6) #define PROP_rtl (1 << 7) --- gcc/tree-object-size.c.jj 2021-01-04 10:25:39.911221618 +0100 +++ gcc/tree-object-size.c 2021-07-12 13:19:50.021568629 +0200 @@ -1450,6 +1450,8 @@ pass_object_sizes::execute (function *fu } fini_object_sizes (); + if (!insert_min_max_p) + fun->curr_properties |=3D PROP_objsz; return 0; } --- gcc/tree-ssa-sccvn.c.jj 2021-06-09 10:20:08.988342285 +0200 +++ gcc/tree-ssa-sccvn.c 2021-07-12 13:14:33.482962387 +0200 @@ -925,12 +925,10 @@ copy_reference_ops_from_ref (tree ref, v + (wi::to_offset (bit_offset) >> LOG2_BITS_PER_UNI= T)); /* Probibit value-numbering zero offset components of addresses the same before the pass folding - __builtin_object_size had a chance to run - (checking cfun->after_inlining does the - trick here). */ + __builtin_object_size had a chance to run. */ if (TREE_CODE (orig) !=3D ADDR_EXPR || maybe_ne (off, 0) - || cfun->after_inlining) + || (cfun->curr_properties & PROP_objsz)) off.to_shwi (&temp.off); } } seems to work for both testcases.=