From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6E9093858C36; Tue, 27 Feb 2024 14:27:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6E9093858C36 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1709044075; bh=1acNWq63Dp8TnKz7WTMNTPYqRyD0IHvtlu1vkZ1zUZ4=; h=From:To:Subject:Date:From; b=tQyg6zo8k3OOF9rKlQH33za6I1osYdR2MZAmha3lJ8kzHF19HGTNOpV00KBbgon/m ECMnWw34s3QVQJ5h4Nm13UVbbEbzVb8m3L3OQ1B/zYmKR9xRc3hmO/QW42LjLwvkSk 9ay0yFjmD6SsTDojb3Nqr+Y7yTeiT7Yrs4M5jNzc= From: "gjl at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/114132] New: [avr] Code sets up a frame pointer without need Date: Tue, 27 Feb 2024 14:27:55 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 13.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: gjl 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: 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=3D114132 Bug ID: 114132 Summary: [avr] Code sets up a frame pointer without need Product: gcc Version: 13.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: gjl at gcc dot gnu.org Target Milestone: --- $ avr-gcc -S -Os -mmcu=3Dattiny40=20 of=20 void funcab_c (long x, char c) { } sets up a frame-pointer without need. Arguments x and c occupy all of the argument registers R25..R20, so that no= arg registers are left. Then there is this implementation of TARGET_FRAME_POINTER_REQUIRED in avr.cc: static bool avr_frame_pointer_required_p (void) { return (cfun->calls_alloca || cfun->calls_setjmp || cfun->has_nonlocal_label || crtl->args.info.nregs =3D=3D 0 || get_frame_size () > 0); } Problem is that crtl->args.info.nregs =3D=3D 0 does not discriminate betwee= n need for arg pointer and no need for arg pointer (but all arg regs are used up, = like in the example).=