public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/114132] New: [avr] Code sets up a frame pointer without need
@ 2024-02-27 14:27 gjl at gcc dot gnu.org
  2024-02-27 14:28 ` [Bug target/114132] " gjl at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: gjl at gcc dot gnu.org @ 2024-02-27 14:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114132

            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=attiny40 

of 

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 == 0
          || get_frame_size () > 0);
}

Problem is that crtl->args.info.nregs == 0 does not discriminate between need
for arg pointer and no need for arg pointer (but all arg regs are used up, like
in the example).

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/114132] [avr] Code sets up a frame pointer without need
  2024-02-27 14:27 [Bug target/114132] New: [avr] Code sets up a frame pointer without need gjl at gcc dot gnu.org
@ 2024-02-27 14:28 ` gjl at gcc dot gnu.org
  2024-02-29 17:47 ` cvs-commit at gcc dot gnu.org
  2024-02-29 17:47 ` gjl at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: gjl at gcc dot gnu.org @ 2024-02-27 14:28 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114132

Georg-Johann Lay <gjl at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.0
           Priority|P3                          |P4
             Target|                            |avr

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/114132] [avr] Code sets up a frame pointer without need
  2024-02-27 14:27 [Bug target/114132] New: [avr] Code sets up a frame pointer without need gjl at gcc dot gnu.org
  2024-02-27 14:28 ` [Bug target/114132] " gjl at gcc dot gnu.org
@ 2024-02-29 17:47 ` cvs-commit at gcc dot gnu.org
  2024-02-29 17:47 ` gjl at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-02-29 17:47 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114132

--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Georg-Johann Lay <gjl@gcc.gnu.org>:

https://gcc.gnu.org/g:2f43ad6a60adb8dd4af9a3c78dfe78597e891c9e

commit r14-9241-g2f43ad6a60adb8dd4af9a3c78dfe78597e891c9e
Author: Georg-Johann Lay <avr@gjlay.de>
Date:   Thu Feb 29 18:08:45 2024 +0100

    AVR: target/114132 - Code sets up a frame pointer without need.

    The condition CUMULATIVE_ARGS.nregs == 0 in avr_frame_pointer_required_p()
    means that no more argument registers are left, but that's not the same
    condition that tells whether an argument pointer is required.

            PR target/114132
    gcc/
            * config/avr/avr.h (CUMULATIVE_ARGS) <has_stack_args>: New field.
            * config/avr/avr.cc (avr_init_cumulative_args): Initialize it.
            (avr_function_arg): Set it.
            (avr_frame_pointer_required_p): Use it instead of .nregs.

    gcc/testsuite/
            * gcc.target/avr/pr114132-1.c: New test.
            * gcc.target/avr/torture/pr114132-2.c: New test.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/114132] [avr] Code sets up a frame pointer without need
  2024-02-27 14:27 [Bug target/114132] New: [avr] Code sets up a frame pointer without need gjl at gcc dot gnu.org
  2024-02-27 14:28 ` [Bug target/114132] " gjl at gcc dot gnu.org
  2024-02-29 17:47 ` cvs-commit at gcc dot gnu.org
@ 2024-02-29 17:47 ` gjl at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: gjl at gcc dot gnu.org @ 2024-02-29 17:47 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114132

Georg-Johann Lay <gjl at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #2 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
Fixed in v14.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-02-29 17:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-27 14:27 [Bug target/114132] New: [avr] Code sets up a frame pointer without need gjl at gcc dot gnu.org
2024-02-27 14:28 ` [Bug target/114132] " gjl at gcc dot gnu.org
2024-02-29 17:47 ` cvs-commit at gcc dot gnu.org
2024-02-29 17:47 ` gjl at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).