From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2BFFA3858D1E; Sat, 8 Apr 2023 09:21:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2BFFA3858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1680945699; bh=TzetimsTI2siBTp/PIG5IkeR4/k7UMnPE3zj8V/r9LA=; h=From:To:Subject:Date:From; b=cnPhLjYH58CuCm7ZtSrh+AAxU41JqKa+JDYjoxsWdIHDckWaAsaXJcXV/riInEp+T sn6oIouaTVTzstw1PXrcKzhXpWdcVYJuPRAhTDYjWWSJtsPOZinX2NtozM4P+Nmzll BpOo+OYJhyRaFecEEk0ljCDVReOk9NiAetPD0Ml8= From: "muecker at gwdg dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/109450] New: Wrong code for VLA in struct sithe size expression Date: Sat, 08 Apr 2023 09:21:38 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: muecker at gwdg dot de 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 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109450 Bug ID: 109450 Summary: Wrong code for VLA in struct sithe size expression Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: muecker at gwdg dot de Target Milestone: --- The following code should return 1 but returns two.=20 int bar(int n, struct foo* x) { int a =3D n; struct foo { char buf[n++]; }* p =3D x; return a; } int main() { return bar(1, 0); } https://godbolt.org/z/e94dsfhc9 I noticed this when working on a fix for PR107557 and PR108423. Already affects 4.7.3 and maybe earlier.=