public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/97032] New: [8/9/10/11 Regression] ICE output_operand: invalid use of register 'frame' since r8-1911
@ 2020-09-12 11:16 jakub at gcc dot gnu.org
  2020-09-12 11:16 ` [Bug target/97032] " jakub at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-09-12 11:16 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97032
           Summary: [8/9/10/11 Regression] ICE output_operand: invalid use
                    of register 'frame' since r8-1911
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

Since r8-1911-g35c95658180e67503f9de96567ab4d6e71b10a6e the following testcase
distilled from firefox:
#include <stdarg.h>

extern int *__errno_location (void);

long
sys_socketcall (int op, ...)
{
  long int res;
  va_list ap;
  va_start (ap, op);
  asm volatile ("push %%ebx; movl %2, %%ebx; int $0x80; pop %%ebx"
                : "=a" (res) : "0" (102), "ri" (16), "c" (ap) : "memory",
"esp");
  if (__builtin_expect (res > 4294963200UL, 0))
    *__errno_location () = -res;
  va_end (ap);
  return res;
}
ICEs on x86_64-linux or i686-linux with
-O2 -m32 -mincoming-stack-boundary=2 -fstack-protector-all

test.c: In function ‘sys_socketcall’:
test.c:11:3: warning: listing the stack pointer register ‘esp’ in a clobber
list is deprecated [-Wdeprecated]
   11 |   asm volatile ("push %%ebx; movl %2, %%ebx; int $0x80; pop %%ebx"
      |   ^~~
test.c:11:3: note: the value of the stack pointer after an ‘asm’ statement must
be the same as it was before the statement
during RTL pass: final
test.c:17:1: internal compiler error: output_operand: invalid use of register
'frame'
   17 | }
      | ^
0xd3b872 output_operand_lossage(char const*, ...)
        ../../gcc/final.c:3609
0x17e0869 print_reg(rtx_def*, int, _IO_FILE*)
        ../../gcc/config/i386/i386.c:12274
0x17e2fa1 ix86_print_operand_address_as
        ../../gcc/config/i386/i386.c:13311
0x17e22d2 ix86_print_operand(_IO_FILE*, rtx_def*, int)
        ../../gcc/config/i386/i386.c:13060
0xd3c92a output_operand(rtx_def*, int)
        ../../gcc/final.c:4051
0xd3c550 output_asm_insn(char const*, rtx_def**)
        ../../gcc/final.c:3963
0x1f325e1 output_1129
        ../../gcc/config/i386/i386.md:20656
0xd38b91 get_insn_template(int, rtx_insn*)
        ../../gcc/final.c:2070
0xd3a8b6 final_scan_insn_1
        ../../gcc/final.c:3039
0xd3ad3e final_scan_insn(rtx_insn*, _IO_FILE*, int, int, int*)
        ../../gcc/final.c:3152
0xd389c0 final_1
        ../../gcc/final.c:2020
0xd3dd0d rest_of_handle_final
        ../../gcc/final.c:4658
0xd3e06c execute
        ../../gcc/final.c:4736
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

Seems we set crtl->stack_realign_needed, which prevents elimination of frame
register to hard frame pointer, but have the frame register used in the IL and
therefore not eliminated.

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

* [Bug target/97032] [8/9/10/11 Regression] ICE output_operand: invalid use of register 'frame' since r8-1911
  2020-09-12 11:16 [Bug target/97032] New: [8/9/10/11 Regression] ICE output_operand: invalid use of register 'frame' since r8-1911 jakub at gcc dot gnu.org
@ 2020-09-12 11:16 ` jakub at gcc dot gnu.org
  2020-09-12 11:18 ` jakub at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-09-12 11:16 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |8.5
           Priority|P3                          |P2
           Keywords|                            |ice-on-valid-code
                 CC|                            |hjl.tools at gmail dot com,
                   |                            |uros at gcc dot gnu.org,
                   |                            |vmakarov at gcc dot gnu.org
   Last reconfirmed|                            |2020-09-12
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

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

* [Bug target/97032] [8/9/10/11 Regression] ICE output_operand: invalid use of register 'frame' since r8-1911
  2020-09-12 11:16 [Bug target/97032] New: [8/9/10/11 Regression] ICE output_operand: invalid use of register 'frame' since r8-1911 jakub at gcc dot gnu.org
  2020-09-12 11:16 ` [Bug target/97032] " jakub at gcc dot gnu.org
@ 2020-09-12 11:18 ` jakub at gcc dot gnu.org
  2020-09-12 14:16 ` hjl.tools at gmail dot com
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-09-12 11:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Note, eliminating the bogus deprecated "esp" clobber makes it compile
correctly.

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

* [Bug target/97032] [8/9/10/11 Regression] ICE output_operand: invalid use of register 'frame' since r8-1911
  2020-09-12 11:16 [Bug target/97032] New: [8/9/10/11 Regression] ICE output_operand: invalid use of register 'frame' since r8-1911 jakub at gcc dot gnu.org
  2020-09-12 11:16 ` [Bug target/97032] " jakub at gcc dot gnu.org
  2020-09-12 11:18 ` jakub at gcc dot gnu.org
@ 2020-09-12 14:16 ` hjl.tools at gmail dot com
  2020-09-12 17:12 ` hjl.tools at gmail dot com
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hjl.tools at gmail dot com @ 2020-09-12 14:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> ---
Created attachment 49212
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49212&action=edit
A patch

I am testing this.

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

* [Bug target/97032] [8/9/10/11 Regression] ICE output_operand: invalid use of register 'frame' since r8-1911
  2020-09-12 11:16 [Bug target/97032] New: [8/9/10/11 Regression] ICE output_operand: invalid use of register 'frame' since r8-1911 jakub at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2020-09-12 14:16 ` hjl.tools at gmail dot com
@ 2020-09-12 17:12 ` hjl.tools at gmail dot com
  2020-09-16 12:31 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hjl.tools at gmail dot com @ 2020-09-12 17:12 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |https://gcc.gnu.org/piperma
                   |                            |il/gcc-patches/2020-Septemb
                   |                            |er/553792.html
           Keywords|                            |patch

--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> ---
A patch is posted at

https://gcc.gnu.org/pipermail/gcc-patches/2020-September/553792.html

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

* [Bug target/97032] [8/9/10/11 Regression] ICE output_operand: invalid use of register 'frame' since r8-1911
  2020-09-12 11:16 [Bug target/97032] New: [8/9/10/11 Regression] ICE output_operand: invalid use of register 'frame' since r8-1911 jakub at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2020-09-12 17:12 ` hjl.tools at gmail dot com
@ 2020-09-16 12:31 ` cvs-commit at gcc dot gnu.org
  2020-09-24 16:05 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-09-16 12:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by H.J. Lu <hjl@gcc.gnu.org>:

https://gcc.gnu.org/g:453a20c65722719b9e2d84339f215e7ec87692dc

commit r11-3229-g453a20c65722719b9e2d84339f215e7ec87692dc
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Sep 14 08:52:27 2020 -0700

    rtl_data: Add sp_is_clobbered_by_asm

    Add sp_is_clobbered_by_asm to rtl_data to inform backends that the stack
    pointer is clobbered by asm statement.

    gcc/

            PR target/97032
            * cfgexpand.c (asm_clobber_reg_kind): Set sp_is_clobbered_by_asm
            to true if the stack pointer is clobbered by asm statement.
            * emit-rtl.h (rtl_data): Add sp_is_clobbered_by_asm.
            * config/i386/i386.c (ix86_get_drap_rtx): Set need_drap to true
            if the stack pointer is clobbered by asm statement.

    gcc/testsuite/

            PR target/97032
            * gcc.target/i386/pr97032.c: New test.

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

* [Bug target/97032] [8/9/10/11 Regression] ICE output_operand: invalid use of register 'frame' since r8-1911
  2020-09-12 11:16 [Bug target/97032] New: [8/9/10/11 Regression] ICE output_operand: invalid use of register 'frame' since r8-1911 jakub at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2020-09-16 12:31 ` cvs-commit at gcc dot gnu.org
@ 2020-09-24 16:05 ` cvs-commit at gcc dot gnu.org
  2020-09-24 16:16 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-09-24 16:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by H.J. Lu <hjl@gcc.gnu.org>:

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

commit r10-8796-gf0baed1fb6cd6ed7c7a3dce1f555d3f72b1575a5
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Sep 14 08:52:27 2020 -0700

    rtl_data: Add sp_is_clobbered_by_asm

    Add sp_is_clobbered_by_asm to rtl_data to inform backends that the stack
    pointer is clobbered by asm statement.

    gcc/

            PR target/97032
            * cfgexpand.c (asm_clobber_reg_kind): Set sp_is_clobbered_by_asm
            to true if the stack pointer is clobbered by asm statement.
            * emit-rtl.h (rtl_data): Add sp_is_clobbered_by_asm.
            * config/i386/i386.c (ix86_get_drap_rtx): Set need_drap to true
            if the stack pointer is clobbered by asm statement.

    gcc/testsuite/

            PR target/97032
            * gcc.target/i386/pr97032.c: New test.

    (cherry picked from commit 453a20c65722719b9e2d84339f215e7ec87692dc)

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

* [Bug target/97032] [8/9/10/11 Regression] ICE output_operand: invalid use of register 'frame' since r8-1911
  2020-09-12 11:16 [Bug target/97032] New: [8/9/10/11 Regression] ICE output_operand: invalid use of register 'frame' since r8-1911 jakub at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2020-09-24 16:05 ` cvs-commit at gcc dot gnu.org
@ 2020-09-24 16:16 ` cvs-commit at gcc dot gnu.org
  2020-09-24 17:40 ` cvs-commit at gcc dot gnu.org
  2020-09-24 17:44 ` hjl.tools at gmail dot com
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-09-24 16:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by H.J. Lu <hjl@gcc.gnu.org>:

https://gcc.gnu.org/g:3bec35d813cc706b3334bd0b0edbd51869b0f725

commit r9-8937-g3bec35d813cc706b3334bd0b0edbd51869b0f725
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Sep 14 08:52:27 2020 -0700

    rtl_data: Add sp_is_clobbered_by_asm

    Add sp_is_clobbered_by_asm to rtl_data to inform backends that the stack
    pointer is clobbered by asm statement.

    gcc/

            PR target/97032
            * cfgexpand.c (asm_clobber_reg_kind): Set sp_is_clobbered_by_asm
            to true if the stack pointer is clobbered by asm statement.
            * emit-rtl.h (rtl_data): Add sp_is_clobbered_by_asm.
            * config/i386/i386.c (ix86_get_drap_rtx): Set need_drap to true
            if the stack pointer is clobbered by asm statement.

    gcc/testsuite/

            PR target/97032
            * gcc.target/i386/pr97032.c: New test.

    (cherry picked from commit 453a20c65722719b9e2d84339f215e7ec87692dc)

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

* [Bug target/97032] [8/9/10/11 Regression] ICE output_operand: invalid use of register 'frame' since r8-1911
  2020-09-12 11:16 [Bug target/97032] New: [8/9/10/11 Regression] ICE output_operand: invalid use of register 'frame' since r8-1911 jakub at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2020-09-24 16:16 ` cvs-commit at gcc dot gnu.org
@ 2020-09-24 17:40 ` cvs-commit at gcc dot gnu.org
  2020-09-24 17:44 ` hjl.tools at gmail dot com
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-09-24 17:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-8 branch has been updated by H.J. Lu <hjl@gcc.gnu.org>:

https://gcc.gnu.org/g:97c34eb5f57bb1d37f3feddefefa5f553bcea9fc

commit r8-10533-g97c34eb5f57bb1d37f3feddefefa5f553bcea9fc
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Sep 14 08:52:27 2020 -0700

    rtl_data: Add sp_is_clobbered_by_asm

    Add sp_is_clobbered_by_asm to rtl_data to inform backends that the stack
    pointer is clobbered by asm statement.

    gcc/

            PR target/97032
            * cfgexpand.c (expand_asm_stmt): Set sp_is_clobbered_by_asm to
            true if the stack pointer is clobbered by asm statement.
            * emit-rtl.h (rtl_data): Add sp_is_clobbered_by_asm.
            * config/i386/i386.c (ix86_get_drap_rtx): Set need_drap to true
            if the stack pointer is clobbered by asm statement.

    gcc/testsuite/

            PR target/97032
            * gcc.target/i386/pr97032.c: New test.

    (cherry picked from commit 453a20c65722719b9e2d84339f215e7ec87692dc)

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

* [Bug target/97032] [8/9/10/11 Regression] ICE output_operand: invalid use of register 'frame' since r8-1911
  2020-09-12 11:16 [Bug target/97032] New: [8/9/10/11 Regression] ICE output_operand: invalid use of register 'frame' since r8-1911 jakub at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2020-09-24 17:40 ` cvs-commit at gcc dot gnu.org
@ 2020-09-24 17:44 ` hjl.tools at gmail dot com
  8 siblings, 0 replies; 10+ messages in thread
From: hjl.tools at gmail dot com @ 2020-09-24 17:44 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

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

--- Comment #8 from H.J. Lu <hjl.tools at gmail dot com> ---
Fixed for GCC 11, GCC 10.3, GCC 9.4 and GCC 8.5.

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

end of thread, other threads:[~2020-09-24 17:44 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-12 11:16 [Bug target/97032] New: [8/9/10/11 Regression] ICE output_operand: invalid use of register 'frame' since r8-1911 jakub at gcc dot gnu.org
2020-09-12 11:16 ` [Bug target/97032] " jakub at gcc dot gnu.org
2020-09-12 11:18 ` jakub at gcc dot gnu.org
2020-09-12 14:16 ` hjl.tools at gmail dot com
2020-09-12 17:12 ` hjl.tools at gmail dot com
2020-09-16 12:31 ` cvs-commit at gcc dot gnu.org
2020-09-24 16:05 ` cvs-commit at gcc dot gnu.org
2020-09-24 16:16 ` cvs-commit at gcc dot gnu.org
2020-09-24 17:40 ` cvs-commit at gcc dot gnu.org
2020-09-24 17:44 ` hjl.tools at gmail dot com

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).