From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BE4963857732; Wed, 24 May 2023 11:07:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BE4963857732 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684926421; bh=YUZpDWhNkObSFFv5EUS1jcTzyF5BOF6VTuEvU8Y+BUw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=fQ+iPCcegaiaGiLaQX3Tve/IubNyU72LByS5HkS9NGH9Gn+QNlKRoFw2i8ay9sljg F7//xRmD12AkG82ZdhUiQLY2vVQKC+51nBhBRS7HAPYaDu6HkuuTHaxBcOOh26nMk6 W2807Ns3u1mw+m+cMw7sc1YSfzsofe6nG8OI60MM= From: "gjl at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/101188] [AVR] Miscompilation and function pointers Date: Wed, 24 May 2023 11:07:00 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 11.1.0 X-Bugzilla-Keywords: ra, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: gjl at gcc dot gnu.org X-Bugzilla-Status: NEW 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=3D101188 --- Comment #5 from Georg-Johann Lay --- It happens in postreload.cc::reload_cse_move2add() when (insn 45 16 17 2 (set (reg/f:HI 30 r30 [60]) (reg/v/f:HI 16 r16 [orig:51 self ] [51])) "fail1.c":29:9 101 {*movhi_split} (nil)) (insn 17 45 18 2 (parallel [ (set (reg/f:HI 30 r30 [60]) (plus:HI (reg/f:HI 30 r30 [60]) (const_int 66 [0x42]))) (clobber (scratch:QI)) ]) "fail1.c":29:9 175 {addhi3_clobber} (nil)) is transformed to: (insn 17 16 18 2 (set (reg/f:HI 30 r30 [60]) (plus:HI (reg/f:HI 30 r30 [60]) (const_int 2 [0x2]))) "fail1.c":29:9 165 {*addhi3_split} (nil)) The wrong setting of "success" is in postreload.cc:2028 as of the following= , so the condition that leads to there is bogus. https://gcc.gnu.org/git/?p=3Dgcc.git;a=3Dblame;f=3Dgcc/postreload.cc;h=3Dfb= 392651e1b6a60e12bf3d36bc302bf9be8bc608;hb=3D03c7c418baa01f0642817bc9b44192d= 134102aa9#l2028=