From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 678633858D28; Mon, 28 Aug 2023 12:12:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 678633858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1693224725; bh=zqEJ8rYp3WTAnmfySF7yxfMNoxUiZktXZ/QT6vjh3yI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=XFYT105YK6E1Sr2HorkI3s4w5VUkl3l+o8tmFMVa9KhSwwPB8mt0d+43WNmlngiYA 484AfuMjrkzGNkvZ1BE/2JmAeJ7BUDLkVdZ0myE8XeDlugbvVLBVyfIdstqycgsxiq E1FNfR+QbiCcu72YNjtPeeq7L6zV3R84nY6Bhpoc= From: "jamborm at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug ipa/111157] [14 Regression] 416.gamess fails with a run-time abort when compiled with -O2 -flto after r14-3226-gd073e2d75d9ed4 Date: Mon, 28 Aug 2023 12:12:04 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: ipa X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jamborm at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: jamborm at gcc dot gnu.org X-Bugzilla-Target-Milestone: 14.0 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=3D111157 --- Comment #6 from Martin Jambor --- (In reply to Richard Biener from comment #5) > I think if IPA modref declares the argument dead at the call site then IPA > CP/SRA cannot declare it known constant. It is declared "killed" by the function. I still need to figure out whether that is all I need or whether the fact that it is not read either is the combination I am after. But I agree that IPA-CP should refrain from propagating clearly unneeded info in that case. >=20 > Now, I wonder why IPA CP/SRA does not replace the known constant parameter > with an automatic var like >=20 > point.constprop.isra (double ISRA.1740, int & restrict ipoint, double & > restrict x, double & restrict y, double & restrict z, int & restrict ista= t) > { > ... > const int istat.local =3D 0; > istat =3D &istat.local; >=20 > ? So if not all uses of 'istat' get resolved we avoid generating wrong > code. The expense is a constant pool entry (if not all uses are removed), > but I think that's OK. It would also work for aggregates. It would also > relieve IPA-CP modification phase from doing anything but trival value > replacement (in case the arg isn't apointer). I'm afraid I don't understand. Even in this particular case, istat is checked by the caller and the callee can assign to it also other values, not just the one which happens to be what it it initialized to by the caller - and in the original code it does when there is an error - those writes cannot be redirected to a local variable.=