public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/109520] New: compiler never terminate
@ 2023-04-15  5:53 yangyibiao at nju dot edu.cn
  2023-04-15  6:09 ` [Bug middle-end/109520] compiler never terminates with an inline-asm goto and an output with high register pressure pinskia at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: yangyibiao at nju dot edu.cn @ 2023-04-15  5:53 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109520
           Summary: compiler never terminate
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: yangyibiao at nju dot edu.cn
  Target Milestone: ---

Created attachment 54864
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54864&action=edit
triggering source code

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-pc-linux-gnu/13.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-git/configure --enable-languages=c,c++
--disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.0.0 20221107 (experimental) (GCC)

$ cat small.c
#if defined __x86_64__
#define ASM(s) asm (s)
#else
#define ASM(s)
#endif

int
foo (int a0, int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8,
     int a9, int a10, int a11, int a12, int a13, int a14, int a15, int a16)
{
  register int v0 ASM ("rax") = a3;
  register int v1 ASM ("rbx") = a4;
  register int v2 ASM ("rcx") = a5;
  register int v3 ASM ("rdx") = a6;
  register int v4 ASM ("rsi") = a7;
  register int v5 ASM ("rdi") = a8;
  register int v6 ASM ("r8") = a9;
  register int v7 ASM ("r9") = a10;
  register int v8 ASM ("r10") = a11;
  register int v9 ASM ("r11") = a12;
  register int v10 ASM ("r12") = a13;
  register int v11 ASM ("r13") = a14;
  register int v12 ASM ("r14") = a15;
  register int v13 ASM ("r15") = a16;
  int x;

  v0 += a0;
  v1 += a1;
  v2 += a2;
  v0 |= a0;
  v1 |= a1;
  v2 |= a2;
  v0 ^= a0;
  v1 ^= a1;
  v2 ^= a2;
  v0 &= a0;
  v1 &= a1;
  v2 &= a2;
  asm goto ("": "=r" (x) : : : lab);
  a1 ^= a0;
  a2 = a1;
  a0 |= a2;
  a0 |= x;
 lab:
  v0 += x + a0 + a1 + a2;
  v1 -= a0 - a1 - a2;
  v2 |= a0 | a1 | a2;
  v3 |= a0 & a1 & a2;
  v4 ^= a0 ^ a1 ^ a2;
  return  v0 + v1 + v2 + v3 + v4 + v5 + v6 + v7 + v8 + v9 + v10 + v11 + v12 +
v13 + a0 + a1 + a2;
}

$ gcc small.c

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

* [Bug middle-end/109520] compiler never terminates with an inline-asm goto and an output with high register pressure
  2023-04-15  5:53 [Bug c/109520] New: compiler never terminate yangyibiao at nju dot edu.cn
@ 2023-04-15  6:09 ` pinskia at gcc dot gnu.org
  2023-04-17  7:10 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-04-15  6:09 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|5.1.0                       |11.1.0
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-04-15

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed, not a regression.

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

* [Bug middle-end/109520] compiler never terminates with an inline-asm goto and an output with high register pressure
  2023-04-15  5:53 [Bug c/109520] New: compiler never terminate yangyibiao at nju dot edu.cn
  2023-04-15  6:09 ` [Bug middle-end/109520] compiler never terminates with an inline-asm goto and an output with high register pressure pinskia at gcc dot gnu.org
@ 2023-04-17  7:10 ` rguenth at gcc dot gnu.org
  2023-04-17 11:05 ` sjames at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-04-17  7:10 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vmakarov at gcc dot gnu.org

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
ISTR a duplicate.  We're looping in lra ()

          do
            {
...
              if (fails_p)
                {
                  /* It is a very rare case.  It is the last hope to
                     split a hard regno live range for a reload
                     pseudo.  */
                  if (live_p)
                    lra_clear_live_ranges ();
                  live_p = false;
                  if (! lra_split_hard_reg_for ())
                    break;
                  lra_hard_reg_split_p = true;
                }
            }
          while (fails_p && !lra_asm_error_p);

not sure if that's ever expected to execute the if (fails_p) case more
than once?  That is, lra_split_hard_reg_for for some reason does something
twice?

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

* [Bug middle-end/109520] compiler never terminates with an inline-asm goto and an output with high register pressure
  2023-04-15  5:53 [Bug c/109520] New: compiler never terminate yangyibiao at nju dot edu.cn
  2023-04-15  6:09 ` [Bug middle-end/109520] compiler never terminates with an inline-asm goto and an output with high register pressure pinskia at gcc dot gnu.org
  2023-04-17  7:10 ` rguenth at gcc dot gnu.org
@ 2023-04-17 11:05 ` sjames at gcc dot gnu.org
  2023-05-20 14:36 ` pinskia at gcc dot gnu.org
  2023-07-13 14:48 ` cvs-commit at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-04-17 11:05 UTC (permalink / raw)
  To: gcc-bugs

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

Sam James <sjames at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=109137
                 CC|                            |sjames at gcc dot gnu.org

--- Comment #3 from Sam James <sjames at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #2)
> ISTR a duplicate.  We're looping in lra ()

My guess is PR109137.

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

* [Bug middle-end/109520] compiler never terminates with an inline-asm goto and an output with high register pressure
  2023-04-15  5:53 [Bug c/109520] New: compiler never terminate yangyibiao at nju dot edu.cn
                   ` (2 preceding siblings ...)
  2023-04-17 11:05 ` sjames at gcc dot gnu.org
@ 2023-05-20 14:36 ` pinskia at gcc dot gnu.org
  2023-07-13 14:48 ` cvs-commit at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-20 14:36 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |141242068 at smail dot nju.edu.cn

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 109917 has been marked as a duplicate of this bug. ***

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

* [Bug middle-end/109520] compiler never terminates with an inline-asm goto and an output with high register pressure
  2023-04-15  5:53 [Bug c/109520] New: compiler never terminate yangyibiao at nju dot edu.cn
                   ` (3 preceding siblings ...)
  2023-05-20 14:36 ` pinskia at gcc dot gnu.org
@ 2023-07-13 14:48 ` cvs-commit at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-07-13 14:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Vladimir Makarov <vmakarov@gcc.gnu.org>:

https://gcc.gnu.org/g:b175b4887f928118af997f6d4d75097a64dcec5d

commit r14-2500-gb175b4887f928118af997f6d4d75097a64dcec5d
Author: Vladimir N. Makarov <vmakarov@redhat.com>
Date:   Thu Jul 13 10:42:17 2023 -0400

    [RA][PR109520]: Catch error when there are no enough registers for asm insn

    Asm insn unlike other insns can have so many operands whose
    constraints can not be satisfied.  It results in LRA cycling for such
    test case.  The following patch catches such situation and reports the
    problem.

            PR middle-end/109520

    gcc/ChangeLog:

            * lra-int.h (lra_insn_recog_data): Add member asm_reloads_num.
            (lra_asm_insn_error): New prototype.
            * lra.cc: Include rtl_error.h.
            (lra_set_insn_recog_data): Initialize asm_reloads_num.
            (lra_asm_insn_error): New func whose code is taken from ...
            * lra-assigns.cc (lra_split_hard_reg_for): ... here.  Use
lra_asm_insn_error.
            * lra-constraints.cc (curr_insn_transform): Check reloads nummber
for asm.

    gcc/testsuite/ChangeLog:

            * gcc.target/i386/pr109520.c: New test.

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

end of thread, other threads:[~2023-07-13 14:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-15  5:53 [Bug c/109520] New: compiler never terminate yangyibiao at nju dot edu.cn
2023-04-15  6:09 ` [Bug middle-end/109520] compiler never terminates with an inline-asm goto and an output with high register pressure pinskia at gcc dot gnu.org
2023-04-17  7:10 ` rguenth at gcc dot gnu.org
2023-04-17 11:05 ` sjames at gcc dot gnu.org
2023-05-20 14:36 ` pinskia at gcc dot gnu.org
2023-07-13 14:48 ` cvs-commit 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).