From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 39651385840C; Mon, 22 Jan 2024 13:59:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 39651385840C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1705931940; bh=6TRpodZJUaJmRYaz4jm6ab8b7IL7AXlPNyWqmjyIu5k=; h=From:To:Subject:Date:In-Reply-To:References:From; b=eUomBYk3AtcxHg3VOeB0XGfp0ZV6eR7XV891851+OZPW4H0u2/iUD4TR3jQni2hGw krZMpLvQh6twABTK34whwNMp8OKYqi4uwNgf4k2bJ6ou4erj9z4rALsYbfxNfx5kr9 Tnu4FPBmMDUEczB8veXc8VW4q8ZT9lusQVbnAWa8= From: "siddhesh 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: Mon, 22 Jan 2024 13:58:59 +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: siddhesh 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 #5 from Siddhesh Poyarekar --- What seems to be happening is that early_objsz bails out since the subobject size at that point is not a constant; I remember concluding that it's safes= t to stick to constant sizes here, but I can't remember why I came to that conclusion. Then in constant propagation (literally the next pass in -O2),= the reference gets folded into a MEM_REF and we have the classic case of the subobject reference being lost, due to which we see the whole object size t= here instead of the subobject size. I need to try and remember why I decided against generating expressions in early_objsz.=