public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/108095] New: powerpc-linux / powerpc64-linux: ICEs when building Linux's arch/powerpc/kernel/align.c (asm goto)
@ 2022-12-14  8:55 jbglaw@lug-owl.de
  2022-12-14  9:45 ` [Bug tree-optimization/108095] " marxin at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: jbglaw@lug-owl.de @ 2022-12-14  8:55 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108095
           Summary: powerpc-linux / powerpc64-linux: ICEs when building
                    Linux's arch/powerpc/kernel/align.c (asm goto)
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jbglaw@lug-owl.de
  Target Milestone: ---

Created attachment 54085
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54085&action=edit
Minimized testcase

For a number of ppc32 builds (using various Linux kernel defconfig
configurations) as well as for one 64bit build, I get these:

[mk all 2022-12-11 21:36:22]   powerpc64-linux-gcc
-Wp,-MMD,arch/powerpc/kernel/.align.o.d -nostdinc -I./arch/powerpc/include
-I./arch/powerpc/include/generated  -I./include -I./arch/powerpc/include/uapi
-I./arch/powerpc/include/generated/uapi -I./include/uapi
-I./include/generated/uapi -include ./include/linux/compiler-version.h -include
./include/linux/kconfig.h -include ./include/linux/compiler_types.h
-D__KERNEL__ -I ./arch/powerpc -DHAVE_AS_ATHIGH=1 -fmacro-prefix-map=./= -Wall
-Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing
-fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration
-Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu11
-mbig-endian -m64 -msoft-float -pipe -mtraceback=no -mabi=elfv1 -mcall-aixdesc
-mcmodel=medium -mno-pointers-to-nested-functions -mcpu=cell -mno-prefixed
-mno-pcrel -mno-altivec -mno-vsx -mno-mma -fno-asynchronous-unwind-tables
-mno-string -Wa,-maltivec -Wa,-mpower4 -Wa,-many -mabi=elfv1 -mcall-aixdesc
-mbig-endian -mstack-protector-guard=tls -mstack-protector-guard-reg=r13
-fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation
-Wno-format-overflow -Wno-address-of-packed-member -Os
-fno-allow-store-data-races -Wframe-larger-than=2048 -fstack-protector-strong
-Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable
-Wno-dangling-pointer -fomit-frame-pointer -ftrivial-auto-var-init=zero
-fno-stack-clash-protection -Wdeclaration-after-statement -Wvla
-Wno-pointer-sign -Wcast-function-type -Wno-stringop-truncation
-Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized
-Wno-alloc-size-larger-than -Wimplicit-fallthrough=5 -fno-strict-overflow
-fno-stack-check -fconserve-stack -Werror=date-time
-Werror=incompatible-pointer-types -Werror=designated-init
-Wno-packed-not-aligned -g -mstack-protector-guard-offset=752 -Werror   
-DKBUILD_MODFILE='"arch/powerpc/kernel/align"' -DKBUILD_BASENAME='"align"'
-DKBUILD_MODNAME='"align"' -D__KBUILD_MODNAME=kmod_align -c -o
arch/powerpc/kernel/align.o arch/powerpc/kernel/align.c  
[mk all 2022-12-11 21:36:23] during GIMPLE pass: ccp
[mk all 2022-12-11 21:36:23] arch/powerpc/kernel/align.c: In function
'__copy_inst_from_kernel_nofault':
[mk all 2022-12-11 21:36:23] arch/powerpc/kernel/align.c:364:1: internal
compiler error: in maybe_register_def, at tree-into-ssa.cc:1948
[mk all 2022-12-11 21:36:23]   364 | }
[mk all 2022-12-11 21:36:23]       | ^
[mk all 2022-12-11 21:36:23] 0x19f12c6 internal_error(char const*, ...)
[mk all 2022-12-11 21:36:23]    ???:0
[mk all 2022-12-11 21:36:23] 0x7be8e0 fancy_abort(char const*, int, char
const*)
[mk all 2022-12-11 21:36:23]    ???:0
[mk all 2022-12-11 21:36:23] 0x17a985e dom_walker::walk(basic_block_def*)
[mk all 2022-12-11 21:36:23]    ???:0
[mk all 2022-12-11 21:36:23] 0xe99460 update_ssa(unsigned int)
[mk all 2022-12-11 21:36:23]    ???:0
[mk all 2022-12-11 21:36:23] 0x1041df9 execute_update_addresses_taken()
[mk all 2022-12-11 21:36:23]    ???:0
[mk all 2022-12-11 21:36:23] Please submit a full bug report, with preprocessed
source (by using -freport-bug).
[mk all 2022-12-11 21:36:23] Please include the complete backtrace with any bug
report.
[mk all 2022-12-11 21:36:23] See <https://gcc.gnu.org/bugs/> for instructions.


This seems to be also an asm goto issue, but it is _not_ fixed with the
7676235f690e624b7e commit. (This issue can still be reproduced with
2dc5d6b1e7e.)

Minimum command line to produce the ICE is: `powerpc64-linux-gcc -Os -g -c -o
align.o align.i`. Removing either `-Os` or `-g` silences it.

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

* [Bug tree-optimization/108095] powerpc-linux / powerpc64-linux: ICEs when building Linux's arch/powerpc/kernel/align.c (asm goto)
  2022-12-14  8:55 [Bug tree-optimization/108095] New: powerpc-linux / powerpc64-linux: ICEs when building Linux's arch/powerpc/kernel/align.c (asm goto) jbglaw@lug-owl.de
@ 2022-12-14  9:45 ` marxin at gcc dot gnu.org
  2022-12-14  9:51 ` marxin at gcc dot gnu.org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-12-14  9:45 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

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

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
> 
> This seems to be also an asm goto issue, but it is _not_ fixed with the
> 7676235f690e624b7e commit. (This issue can still be reproduced with
> 2dc5d6b1e7e.)

g:7676235f690e624b7e
g:2dc5d6b1e7e

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

* [Bug tree-optimization/108095] powerpc-linux / powerpc64-linux: ICEs when building Linux's arch/powerpc/kernel/align.c (asm goto)
  2022-12-14  8:55 [Bug tree-optimization/108095] New: powerpc-linux / powerpc64-linux: ICEs when building Linux's arch/powerpc/kernel/align.c (asm goto) jbglaw@lug-owl.de
  2022-12-14  9:45 ` [Bug tree-optimization/108095] " marxin at gcc dot gnu.org
@ 2022-12-14  9:51 ` marxin at gcc dot gnu.org
  2022-12-14 10:09 ` marxin at gcc dot gnu.org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-12-14  9:51 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2022-12-14

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed.

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

* [Bug tree-optimization/108095] powerpc-linux / powerpc64-linux: ICEs when building Linux's arch/powerpc/kernel/align.c (asm goto)
  2022-12-14  8:55 [Bug tree-optimization/108095] New: powerpc-linux / powerpc64-linux: ICEs when building Linux's arch/powerpc/kernel/align.c (asm goto) jbglaw@lug-owl.de
  2022-12-14  9:45 ` [Bug tree-optimization/108095] " marxin at gcc dot gnu.org
  2022-12-14  9:51 ` marxin at gcc dot gnu.org
@ 2022-12-14 10:09 ` marxin at gcc dot gnu.org
  2022-12-14 11:36 ` jakub at gcc dot gnu.org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-12-14 10:09 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

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

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r11-5002-ge3b3b59683c1e7, where it was rejected before the
revision:

/tmp/ice.i: In function ‘__copy_inst_from_kernel_nofault’:
/tmp/ice.i:5:16: error: expected ‘:’ before string constant
    5 |   asm goto("" : "=r"(*(u32 *)&suffix) : : : Efault);

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

* [Bug tree-optimization/108095] powerpc-linux / powerpc64-linux: ICEs when building Linux's arch/powerpc/kernel/align.c (asm goto)
  2022-12-14  8:55 [Bug tree-optimization/108095] New: powerpc-linux / powerpc64-linux: ICEs when building Linux's arch/powerpc/kernel/align.c (asm goto) jbglaw@lug-owl.de
                   ` (2 preceding siblings ...)
  2022-12-14 10:09 ` marxin at gcc dot gnu.org
@ 2022-12-14 11:36 ` jakub at gcc dot gnu.org
  2022-12-14 13:46 ` jakub at gcc dot gnu.org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-12-14 11:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Slightly cleaned up, ICEs also on x86_64-linux, -Os -g:
int v;
typedef unsigned T;

void
foo (void)
{
  unsigned s;
  asm goto ("" : "=r" (*(T *) &s) : : : lab);
  v = 0;
lab:
}

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

* [Bug tree-optimization/108095] powerpc-linux / powerpc64-linux: ICEs when building Linux's arch/powerpc/kernel/align.c (asm goto)
  2022-12-14  8:55 [Bug tree-optimization/108095] New: powerpc-linux / powerpc64-linux: ICEs when building Linux's arch/powerpc/kernel/align.c (asm goto) jbglaw@lug-owl.de
                   ` (3 preceding siblings ...)
  2022-12-14 11:36 ` jakub at gcc dot gnu.org
@ 2022-12-14 13:46 ` jakub at gcc dot gnu.org
  2022-12-14 15:12 ` jbglaw@lug-owl.de
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-12-14 13:46 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |jakub at gcc dot gnu.org

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 54090
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54090&action=edit
gcc13-pr108095.patch

Untested fix.  The addition of phi_nodes check was done because otherwise
gsi_insert_on_edge_immediate could split the edge, which is highly undesirable
for -fcompare-debug purposes.

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

* [Bug tree-optimization/108095] powerpc-linux / powerpc64-linux: ICEs when building Linux's arch/powerpc/kernel/align.c (asm goto)
  2022-12-14  8:55 [Bug tree-optimization/108095] New: powerpc-linux / powerpc64-linux: ICEs when building Linux's arch/powerpc/kernel/align.c (asm goto) jbglaw@lug-owl.de
                   ` (4 preceding siblings ...)
  2022-12-14 13:46 ` jakub at gcc dot gnu.org
@ 2022-12-14 15:12 ` jbglaw@lug-owl.de
  2022-12-14 17:50 ` jbglaw@lug-owl.de
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jbglaw@lug-owl.de @ 2022-12-14 15:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Jan-Benedict Glaw <jbglaw@lug-owl.de> ---
I'll give that patch a spin, build the cross-compilers and try to build the
affected Linux configurations.

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

* [Bug tree-optimization/108095] powerpc-linux / powerpc64-linux: ICEs when building Linux's arch/powerpc/kernel/align.c (asm goto)
  2022-12-14  8:55 [Bug tree-optimization/108095] New: powerpc-linux / powerpc64-linux: ICEs when building Linux's arch/powerpc/kernel/align.c (asm goto) jbglaw@lug-owl.de
                   ` (5 preceding siblings ...)
  2022-12-14 15:12 ` jbglaw@lug-owl.de
@ 2022-12-14 17:50 ` jbglaw@lug-owl.de
  2022-12-15  8:28 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jbglaw@lug-owl.de @ 2022-12-14 17:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Jan-Benedict Glaw <jbglaw@lug-owl.de> ---
(In reply to Jakub Jelinek from comment #5)
> Created attachment 54090 [details]
> gcc13-pr108095.patch

Compiler builds for me and the ICE went away for all affected Linux
configurations. Though I cannot verify whether or not the generated code is
correct.

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

* [Bug tree-optimization/108095] powerpc-linux / powerpc64-linux: ICEs when building Linux's arch/powerpc/kernel/align.c (asm goto)
  2022-12-14  8:55 [Bug tree-optimization/108095] New: powerpc-linux / powerpc64-linux: ICEs when building Linux's arch/powerpc/kernel/align.c (asm goto) jbglaw@lug-owl.de
                   ` (6 preceding siblings ...)
  2022-12-14 17:50 ` jbglaw@lug-owl.de
@ 2022-12-15  8:28 ` cvs-commit at gcc dot gnu.org
  2022-12-16  9:24 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-12-15  8:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

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

commit r13-4713-gbf3ce6f84a7a994a0fc87419b383b9ce4efed442
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Dec 15 09:26:44 2022 +0100

    into-ssa: Fix emitting debug stmts after asm goto [PR108095]

    The following testcase ICEs, because ccp1 replaced
      s.0_1 = &s;
      __asm__ goto("" : "=r" MEM[(T *)s.0_1] :  :  : "lab" lab);
    with
      __asm__ goto("" : "=r" s :  :  : "lab" lab);
    and because s is no longer addressable, we are rewriting it into
    ssa and want
      __asm__ goto("" : "=r" s_7 :  :  : "lab" lab);
    plus debug stmt
      # DEBUG s => s_7
    The code assumes that there is at most one non-EH edge in that
    case, but with the addition of outputs to asm goto that is no longer the
    case, we can have many outgoing edges.

    The patch keeps the checking assertion that there is at most one such
    edge for everything but asm goto, but moves the addition of the debug
    stmt into the loop, so that it can be added on all edges where it is
    possible, not just one of them.

    Furthermore, looking at gsi_insert_on_edge_immediate
    -> gimple_find_edge_insert_loc, the conditions to insert stmt there
    to the destination block are
      if (single_pred_p (dest)
          && gimple_seq_empty_p (phi_nodes (dest))
          && dest != EXIT_BLOCK_PTR_FOR_FN (cfun))
    (plus there is code to insert it in the previous block but that is
    never true when the pred is known to be stmt_ends_bb_p), while
    mayube_register_def was just checking
                     if (ef && single_pred_p (ef->dest)
                         && ef->dest != EXIT_BLOCK_PTR_FOR_FN (cfun))
    so if for whatever reason ef->dest had any PHIs, we'd split the
    edge for -g and not for -g0, something we must avoid for -fcompare-debug
    stability.  So, I've added the no phi_nodes check too.

    2022-12-15  Jakub Jelinek  <jakub@redhat.com>

            PR tree-optimization/108095
            * tree-into-ssa.cc (maybe_register_def): Insert debug stmt
            on all non-EH edges from asm goto if they have a single
            predecessor rather than asserting there is at most one such edge.
            Test whether there are no PHI nodes next to the single predecessor
            test.

            * gcc.dg/pr108095.c: New test.

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

* [Bug tree-optimization/108095] powerpc-linux / powerpc64-linux: ICEs when building Linux's arch/powerpc/kernel/align.c (asm goto)
  2022-12-14  8:55 [Bug tree-optimization/108095] New: powerpc-linux / powerpc64-linux: ICEs when building Linux's arch/powerpc/kernel/align.c (asm goto) jbglaw@lug-owl.de
                   ` (7 preceding siblings ...)
  2022-12-15  8:28 ` cvs-commit at gcc dot gnu.org
@ 2022-12-16  9:24 ` jakub at gcc dot gnu.org
  2023-02-10 17:44 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-12-16  9:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed on the trunk so far.

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

* [Bug tree-optimization/108095] powerpc-linux / powerpc64-linux: ICEs when building Linux's arch/powerpc/kernel/align.c (asm goto)
  2022-12-14  8:55 [Bug tree-optimization/108095] New: powerpc-linux / powerpc64-linux: ICEs when building Linux's arch/powerpc/kernel/align.c (asm goto) jbglaw@lug-owl.de
                   ` (8 preceding siblings ...)
  2022-12-16  9:24 ` jakub at gcc dot gnu.org
@ 2023-02-10 17:44 ` cvs-commit at gcc dot gnu.org
  2023-05-02 20:12 ` cvs-commit at gcc dot gnu.org
  2023-05-03 11:47 ` jakub at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-02-10 17:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:7e54e5a2bba69dc7fcbc88fe8cb20c91aaafabd2

commit r12-9126-g7e54e5a2bba69dc7fcbc88fe8cb20c91aaafabd2
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Dec 15 09:26:44 2022 +0100

    into-ssa: Fix emitting debug stmts after asm goto [PR108095]

    The following testcase ICEs, because ccp1 replaced
      s.0_1 = &s;
      __asm__ goto("" : "=r" MEM[(T *)s.0_1] :  :  : "lab" lab);
    with
      __asm__ goto("" : "=r" s :  :  : "lab" lab);
    and because s is no longer addressable, we are rewriting it into
    ssa and want
      __asm__ goto("" : "=r" s_7 :  :  : "lab" lab);
    plus debug stmt
      # DEBUG s => s_7
    The code assumes that there is at most one non-EH edge in that
    case, but with the addition of outputs to asm goto that is no longer the
    case, we can have many outgoing edges.

    The patch keeps the checking assertion that there is at most one such
    edge for everything but asm goto, but moves the addition of the debug
    stmt into the loop, so that it can be added on all edges where it is
    possible, not just one of them.

    Furthermore, looking at gsi_insert_on_edge_immediate
    -> gimple_find_edge_insert_loc, the conditions to insert stmt there
    to the destination block are
      if (single_pred_p (dest)
          && gimple_seq_empty_p (phi_nodes (dest))
          && dest != EXIT_BLOCK_PTR_FOR_FN (cfun))
    (plus there is code to insert it in the previous block but that is
    never true when the pred is known to be stmt_ends_bb_p), while
    mayube_register_def was just checking
                     if (ef && single_pred_p (ef->dest)
                         && ef->dest != EXIT_BLOCK_PTR_FOR_FN (cfun))
    so if for whatever reason ef->dest had any PHIs, we'd split the
    edge for -g and not for -g0, something we must avoid for -fcompare-debug
    stability.  So, I've added the no phi_nodes check too.

    2022-12-15  Jakub Jelinek  <jakub@redhat.com>

            PR tree-optimization/108095
            * tree-into-ssa.cc (maybe_register_def): Insert debug stmt
            on all non-EH edges from asm goto if they have a single
            predecessor rather than asserting there is at most one such edge.
            Test whether there are no PHI nodes next to the single predecessor
            test.

            * gcc.dg/pr108095.c: New test.

    (cherry picked from commit bf3ce6f84a7a994a0fc87419b383b9ce4efed442)

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

* [Bug tree-optimization/108095] powerpc-linux / powerpc64-linux: ICEs when building Linux's arch/powerpc/kernel/align.c (asm goto)
  2022-12-14  8:55 [Bug tree-optimization/108095] New: powerpc-linux / powerpc64-linux: ICEs when building Linux's arch/powerpc/kernel/align.c (asm goto) jbglaw@lug-owl.de
                   ` (9 preceding siblings ...)
  2023-02-10 17:44 ` cvs-commit at gcc dot gnu.org
@ 2023-05-02 20:12 ` cvs-commit at gcc dot gnu.org
  2023-05-03 11:47 ` jakub at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-05-02 20:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:9b580f5d7cb3c23866cdbd19e3c1bfc407e9e9c5

commit r11-10688-g9b580f5d7cb3c23866cdbd19e3c1bfc407e9e9c5
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Dec 15 09:26:44 2022 +0100

    into-ssa: Fix emitting debug stmts after asm goto [PR108095]

    The following testcase ICEs, because ccp1 replaced
      s.0_1 = &s;
      __asm__ goto("" : "=r" MEM[(T *)s.0_1] :  :  : "lab" lab);
    with
      __asm__ goto("" : "=r" s :  :  : "lab" lab);
    and because s is no longer addressable, we are rewriting it into
    ssa and want
      __asm__ goto("" : "=r" s_7 :  :  : "lab" lab);
    plus debug stmt
      # DEBUG s => s_7
    The code assumes that there is at most one non-EH edge in that
    case, but with the addition of outputs to asm goto that is no longer the
    case, we can have many outgoing edges.

    The patch keeps the checking assertion that there is at most one such
    edge for everything but asm goto, but moves the addition of the debug
    stmt into the loop, so that it can be added on all edges where it is
    possible, not just one of them.

    Furthermore, looking at gsi_insert_on_edge_immediate
    -> gimple_find_edge_insert_loc, the conditions to insert stmt there
    to the destination block are
      if (single_pred_p (dest)
          && gimple_seq_empty_p (phi_nodes (dest))
          && dest != EXIT_BLOCK_PTR_FOR_FN (cfun))
    (plus there is code to insert it in the previous block but that is
    never true when the pred is known to be stmt_ends_bb_p), while
    mayube_register_def was just checking
                     if (ef && single_pred_p (ef->dest)
                         && ef->dest != EXIT_BLOCK_PTR_FOR_FN (cfun))
    so if for whatever reason ef->dest had any PHIs, we'd split the
    edge for -g and not for -g0, something we must avoid for -fcompare-debug
    stability.  So, I've added the no phi_nodes check too.

    2022-12-15  Jakub Jelinek  <jakub@redhat.com>

            PR tree-optimization/108095
            * tree-into-ssa.c (maybe_register_def): Insert debug stmt
            on all non-EH edges from asm goto if they have a single
            predecessor rather than asserting there is at most one such edge.
            Test whether there are no PHI nodes next to the single predecessor
            test.

            * gcc.dg/pr108095.c: New test.

    (cherry picked from commit bf3ce6f84a7a994a0fc87419b383b9ce4efed442)

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

* [Bug tree-optimization/108095] powerpc-linux / powerpc64-linux: ICEs when building Linux's arch/powerpc/kernel/align.c (asm goto)
  2022-12-14  8:55 [Bug tree-optimization/108095] New: powerpc-linux / powerpc64-linux: ICEs when building Linux's arch/powerpc/kernel/align.c (asm goto) jbglaw@lug-owl.de
                   ` (10 preceding siblings ...)
  2023-05-02 20:12 ` cvs-commit at gcc dot gnu.org
@ 2023-05-03 11:47 ` jakub at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-05-03 11:47 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #12 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed for 11.4 and 12.3 as well (gcc 10 didn't support asm goto with outputs).

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

end of thread, other threads:[~2023-05-03 11:47 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-14  8:55 [Bug tree-optimization/108095] New: powerpc-linux / powerpc64-linux: ICEs when building Linux's arch/powerpc/kernel/align.c (asm goto) jbglaw@lug-owl.de
2022-12-14  9:45 ` [Bug tree-optimization/108095] " marxin at gcc dot gnu.org
2022-12-14  9:51 ` marxin at gcc dot gnu.org
2022-12-14 10:09 ` marxin at gcc dot gnu.org
2022-12-14 11:36 ` jakub at gcc dot gnu.org
2022-12-14 13:46 ` jakub at gcc dot gnu.org
2022-12-14 15:12 ` jbglaw@lug-owl.de
2022-12-14 17:50 ` jbglaw@lug-owl.de
2022-12-15  8:28 ` cvs-commit at gcc dot gnu.org
2022-12-16  9:24 ` jakub at gcc dot gnu.org
2023-02-10 17:44 ` cvs-commit at gcc dot gnu.org
2023-05-02 20:12 ` cvs-commit at gcc dot gnu.org
2023-05-03 11:47 ` jakub 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).