From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 512423858C56; Sat, 20 Jan 2024 00:18:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 512423858C56 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1705709885; bh=o51LaMpwPOXfLvI7FCjVuGlZvcIW6d33HTIefcQEOWs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=P0l/4wlwigIWtHNsywwFe4TWTsBylL0ZvVqCflQCodivorixxLjyP1eG7mk0u8/oV 7/mfd9cml5s0e7+Wwhrbz4jAaHn4Y8a/fJ20D97w6K5kno7PH2+a6d37QfS+Pcs4U0 wFaVLcY+3jiAZ1/cCwPIRuIZLkDlX/IKTaHzO/kM= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/113514] Wrong __builtin_dynamic_object_size when using a set local variable Date: Sat, 20 Jan 2024 00:18:00 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia 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: 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D113514 --- Comment #2 from Andrew Pinski --- In the case of the constant proping into `&f.bar[argc][0]`, it is not know = if you are doing an offset of the original struct or an offset into the array. GCC's internal IR changes into the former as it is more canonical form while with the constant already there is known at front-end time. With respect of a non-constant one, GCC's IR keeps the array form address around which allows the answer of still 40. I can't explain clang/LLVM's behavior for `,3` though.=