public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/114664] New: -fno-omit-frame-pointer causes an ICE during the build of the greenlet package
@ 2024-04-09 18:42 bergner at gcc dot gnu.org
  2024-04-09 18:48 ` [Bug rtl-optimization/114664] " pinskia at gcc dot gnu.org
                   ` (16 more replies)
  0 siblings, 17 replies; 18+ messages in thread
From: bergner at gcc dot gnu.org @ 2024-04-09 18:42 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114664
           Summary: -fno-omit-frame-pointer causes an ICE during the build
                    of the greenlet package
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bergner at gcc dot gnu.org
  Target Milestone: ---

Current builds of the greenlet package on one specific distro, are seeing an
ICE on multiple architectures (ppc64le & riscv64) when being built with
-fno-omit-frame-pointer.  The upstream github issue is here:

  https://github.com/python-greenlet/greenlet/issues/395

A minimized test case on Power is:

bergner@ltcden2-lp1:$ cat bug.c 
void
bug (void)
{
  __asm__ volatile ("" : : : "r31");
}
bergner@ltcden2-lp1:$ /opt/gcc-nightly/trunk/bin/gcc -S -fno-omit-frame-pointer
bug.c
bug.c: In function ‘bug’:
bug.c:5:1: error: 31 cannot be used in ‘asm’ here
    5 | }
      | ^
bug.c:5:1: error: 31 cannot be used in ‘asm’ here

This is not a regression, as all gcc's I have easy access to (back to gcc v8)
ICE the same way.

The code that is ICEing here is in ira.c:ira_setup_eliminable_regset():

  /* Build the regset of all eliminable registers and show we can't
     use those that we already know won't be eliminated.  */
  for (i = 0; i < (int) ARRAY_SIZE (eliminables); i++)
    {
      bool cannot_elim
        = (! targetm.can_eliminate (eliminables[i].from, eliminables[i].to)
           || (eliminables[i].to == STACK_POINTER_REGNUM &&
frame_pointer_needed));

      if (!TEST_HARD_REG_BIT (crtl->asm_clobbers, eliminables[i].from))
        {
            SET_HARD_REG_BIT (eliminable_regset, eliminables[i].from);

            if (cannot_elim)
              SET_HARD_REG_BIT (ira_no_alloc_regs, eliminables[i].from);
        }
      else if (cannot_elim)
        error ("%s cannot be used in %<asm%> here",
               reg_names[eliminables[i].from]);
      else
        df_set_regs_ever_live (eliminables[i].from, true);
    }

On Power, targetm.can_eliminate(r31,r1) returns true (ie, the port will allow
us to eliminate r31 into r1) even in the face of -fno-omit-frame-pointer, but
it's the RA specific test (eliminables[i].to == STACK_POINTER_REGNUM &&
frame_pointer_needed) that is catching us here.

The question I have is, is it legal to mention the hard frame pointer register
in an asm clobber list when using -fno-omit-frame-pointer?  Ie, is this user
error or should the compiler be able to handle this?

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

end of thread, other threads:[~2024-04-10 15:37 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-09 18:42 [Bug rtl-optimization/114664] New: -fno-omit-frame-pointer causes an ICE during the build of the greenlet package bergner at gcc dot gnu.org
2024-04-09 18:48 ` [Bug rtl-optimization/114664] " pinskia at gcc dot gnu.org
2024-04-09 19:00 ` bergner at gcc dot gnu.org
2024-04-09 19:01 ` pinskia at gcc dot gnu.org
2024-04-09 19:02 ` bergner at gcc dot gnu.org
2024-04-09 19:04 ` bergner at gcc dot gnu.org
2024-04-09 19:06 ` pinskia at gcc dot gnu.org
2024-04-09 19:21 ` pinskia at gcc dot gnu.org
2024-04-09 19:48 ` bergner at gcc dot gnu.org
2024-04-10  3:14 ` linkw at gcc dot gnu.org
2024-04-10 12:52 ` bergner at gcc dot gnu.org
2024-04-10 13:24 ` rsandifo at gcc dot gnu.org
2024-04-10 13:42 ` bergner at gcc dot gnu.org
2024-04-10 13:53 ` rsandifo at gcc dot gnu.org
2024-04-10 14:03 ` bergner at gcc dot gnu.org
2024-04-10 14:04 ` rsandifo at gcc dot gnu.org
2024-04-10 14:15 ` bergner at gcc dot gnu.org
2024-04-10 15:37 ` segher 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).