public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/100284] New: gcc crash with -march=armv8.2-a+sve -O3
@ 2021-04-27  9:50 gilles.gouaillardet at gmail dot com
  2021-04-27 10:52 ` [Bug c/100284] " acoplan at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: gilles.gouaillardet at gmail dot com @ 2021-04-27  9:50 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100284
           Summary: gcc crash with -march=armv8.2-a+sve -O3
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gilles.gouaillardet at gmail dot com
  Target Milestone: ---

Created attachment 50686
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50686&action=edit
a reproducer

The attached (and self-contained) bug.c (trimmed from GROMACS 2021.1) can be
used to evidence this issue with the latest GCC from the master and
releases/gcc-11 branches:

gcc -march=armv8.2-a+sve -O3 -c bug.c

The crash occurs at -O3 (and no crash at -O2) and only with an aarch64+sve
target
(this is a compiler crash that can be evidenced on a *non* SVE capable hardware
too)

I ran a git bisect and it points to

# first bad commit: [cdb2e365fc0dba2ee052827e5ca65234ca82d605] SLP: support
entire BB.

GCC 10.3.0 is not affected.

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

* [Bug c/100284] gcc crash with -march=armv8.2-a+sve -O3
  2021-04-27  9:50 [Bug c/100284] New: gcc crash with -march=armv8.2-a+sve -O3 gilles.gouaillardet at gmail dot com
@ 2021-04-27 10:52 ` acoplan at gcc dot gnu.org
  2021-04-27 11:11 ` acoplan at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: acoplan at gcc dot gnu.org @ 2021-04-27 10:52 UTC (permalink / raw)
  To: gcc-bugs

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

Alex Coplan <acoplan at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
                 CC|                            |acoplan at gcc dot gnu.org
   Last reconfirmed|                            |2021-04-27
             Status|UNCONFIRMED                 |WAITING

--- Comment #1 from Alex Coplan <acoplan at gcc dot gnu.org> ---
Please can you provide a preprocessed testcase (using --save-temps or -E)?

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

* [Bug c/100284] gcc crash with -march=armv8.2-a+sve -O3
  2021-04-27  9:50 [Bug c/100284] New: gcc crash with -march=armv8.2-a+sve -O3 gilles.gouaillardet at gmail dot com
  2021-04-27 10:52 ` [Bug c/100284] " acoplan at gcc dot gnu.org
@ 2021-04-27 11:11 ` acoplan at gcc dot gnu.org
  2021-04-27 12:21 ` [Bug tree-optimization/100284] ICE in operation_could_trap_p " rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: acoplan at gcc dot gnu.org @ 2021-04-27 11:11 UTC (permalink / raw)
  To: gcc-bugs

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

Alex Coplan <acoplan at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW

--- Comment #2 from Alex Coplan <acoplan at gcc dot gnu.org> ---
Nevermind, confirmed on latest trunk with a native aarch64 build. Here's a
reduced testcase:

$ cat test.c
int *a;
int b;
void c() {
  int e;
  for (int d; d; d++)
    if (a[d])
      e++;
  if (e)
    b = 0;
}
$ gcc/xgcc -B gcc test.c -c -O3 -march=armv8.2-a+sve
during GIMPLE pass: vrp
test.c: In function ‘c’:
test.c:3:6: internal compiler error: in operation_could_trap_p, at
tree-eh.c:2546
    3 | void c() {
      |      ^
0xe725cb operation_could_trap_p(tree_code, bool, bool, tree_node*)
        /home/alecop01/toolchain/src/gcc/gcc/tree-eh.c:2546
0x12df947 maybe_resimplify_conditional_op
        /home/alecop01/toolchain/src/gcc/gcc/gimple-match-head.c:156
0x12df49b gimple_resimplify3
        /home/alecop01/toolchain/src/gcc/gcc/gimple-match-head.c:404
0x13383a3 gimple_simplify_381
        /home/alecop01/toolchain/builds/rel/gcc/gimple-match.c:20829
0x1339bab gimple_simplify_PLUS_EXPR
        /home/alecop01/toolchain/builds/rel/gcc/gimple-match.c:58341
0x14586db gimple_simplify
        /home/alecop01/toolchain/builds/rel/gcc/gimple-match.c:135430
0x1459cfb gimple_resimplify2
        /home/alecop01/toolchain/src/gcc/gcc/gimple-match-head.c:318
0x147f50b try_conditional_simplification
        /home/alecop01/toolchain/src/gcc/gcc/gimple-match-head.c:872
0x147f50b gimple_simplify(gimple*, gimple_match_op*, gimple**, tree_node*
(*)(tree_node*), tree_node* (*)(tree_node*))
        /home/alecop01/toolchain/src/gcc/gcc/gimple-match-head.c:1046
0xaaf51f fold_stmt_1
        /home/alecop01/toolchain/src/gcc/gcc/gimple-fold.c:6204
0xff5f8b substitute_and_fold_dom_walker::before_dom_children(basic_block_def*)
        /home/alecop01/toolchain/src/gcc/gcc/tree-ssa-propagate.c:859
0x195b313 dom_walker::walk(basic_block_def*)
        /home/alecop01/toolchain/src/gcc/gcc/domwalk.c:309
0xff4dbb substitute_and_fold_engine::substitute_and_fold(basic_block_def*)
        /home/alecop01/toolchain/src/gcc/gcc/tree-ssa-propagate.c:987
0x11408fb execute_vrp
        /home/alecop01/toolchain/src/gcc/gcc/tree-vrp.c:4531
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.

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

* [Bug tree-optimization/100284] ICE in operation_could_trap_p with -march=armv8.2-a+sve -O3
  2021-04-27  9:50 [Bug c/100284] New: gcc crash with -march=armv8.2-a+sve -O3 gilles.gouaillardet at gmail dot com
  2021-04-27 10:52 ` [Bug c/100284] " acoplan at gcc dot gnu.org
  2021-04-27 11:11 ` acoplan at gcc dot gnu.org
@ 2021-04-27 12:21 ` rguenth at gcc dot gnu.org
  2021-04-27 12:41 ` rsandifo at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-04-27 12:21 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
On trunk I'd suspect g:35b2be219fc1934ae040d045e355680a83d839c4 but that's not
on the branch...

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

* [Bug tree-optimization/100284] ICE in operation_could_trap_p with -march=armv8.2-a+sve -O3
  2021-04-27  9:50 [Bug c/100284] New: gcc crash with -march=armv8.2-a+sve -O3 gilles.gouaillardet at gmail dot com
                   ` (2 preceding siblings ...)
  2021-04-27 12:21 ` [Bug tree-optimization/100284] ICE in operation_could_trap_p " rguenth at gcc dot gnu.org
@ 2021-04-27 12:41 ` rsandifo at gcc dot gnu.org
  2021-04-27 15:25 ` acoplan at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rsandifo at gcc dot gnu.org @ 2021-04-27 12:41 UTC (permalink / raw)
  To: gcc-bugs

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

rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> changed:

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

--- Comment #4 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #3)
> On trunk I'd suspect g:35b2be219fc1934ae040d045e355680a83d839c4 but that's
> not on the branch...
Yeah, all is not well in SVE land after that commit.  E.g.:

FAIL: gcc.c-torture/compile/pr81003.c   -O3 -fomit-frame-pointer -funroll-loops
-fpeel-loops -ftracer -finline-functions  (internal compiler error)
FAIL: gcc.c-torture/compile/pr81003.c   -O3 -fomit-frame-pointer -funroll-loops
-fpeel-loops -ftracer -finline-functions  (test for excess errors)
FAIL: gcc.c-torture/compile/pr81003.c   -O3 -g  (internal compiler error)
FAIL: gcc.c-torture/compile/pr81003.c   -O3 -g  (test for excess errors)
FAIL: gcc.c-torture/execute/20050224-1.c   -O3 -fomit-frame-pointer
-funroll-loops -fpeel-loops -ftracer -finline-functions  (internal compiler
error)
FAIL: gcc.c-torture/execute/20050224-1.c   -O3 -fomit-frame-pointer
-funroll-loops -fpeel-loops -ftracer -finline-functions  (test for excess
errors)
UNRESOLVED: gcc.c-torture/execute/20050224-1.c   -O3 -fomit-frame-pointer
-funroll-loops -fpeel-loops -ftracer -finline-functions  compilation failed to
produce
executable
FAIL: gcc.c-torture/execute/20050224-1.c   -O3 -g  (internal compiler error)
FAIL: gcc.c-torture/execute/20050224-1.c   -O3 -g  (test for excess errors)
UNRESOLVED: gcc.c-torture/execute/20050224-1.c   -O3 -g  compilation failed to
produce executable
FAIL: gcc.c-torture/execute/20071030-1.c   -O3 -fomit-frame-pointer
-funroll-loops -fpeel-loops -ftracer -finline-functions  (internal compiler
error)
FAIL: gcc.c-torture/execute/20071030-1.c   -O3 -fomit-frame-pointer
-funroll-loops -fpeel-loops -ftracer -finline-functions  (test for excess
errors)
UNRESOLVED: gcc.c-torture/execute/20071030-1.c   -O3 -fomit-frame-pointer
-funroll-loops -fpeel-loops -ftracer -finline-functions  compilation failed to
produce executable
FAIL: gcc.c-torture/execute/20071030-1.c   -O3 -g  (internal compiler error)
FAIL: gcc.c-torture/execute/20071030-1.c   -O3 -g  (test for excess errors)
UNRESOLVED: gcc.c-torture/execute/20071030-1.c   -O3 -g  compilation failed to
produce executable
etc.

I think the bug that Gilles reported is different, but for trunk we'll
need to fix the above failures to get back to the original problem.

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

* [Bug tree-optimization/100284] ICE in operation_could_trap_p with -march=armv8.2-a+sve -O3
  2021-04-27  9:50 [Bug c/100284] New: gcc crash with -march=armv8.2-a+sve -O3 gilles.gouaillardet at gmail dot com
                   ` (3 preceding siblings ...)
  2021-04-27 12:41 ` rsandifo at gcc dot gnu.org
@ 2021-04-27 15:25 ` acoplan at gcc dot gnu.org
  2021-04-27 17:30 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: acoplan at gcc dot gnu.org @ 2021-04-27 15:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Alex Coplan <acoplan at gcc dot gnu.org> ---
Ok, so Gilles: it would still be useful if you could attach a preprocessed
testcase and post the backtrace you're seeing with GCC 11.

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

* [Bug tree-optimization/100284] ICE in operation_could_trap_p with -march=armv8.2-a+sve -O3
  2021-04-27  9:50 [Bug c/100284] New: gcc crash with -march=armv8.2-a+sve -O3 gilles.gouaillardet at gmail dot com
                   ` (4 preceding siblings ...)
  2021-04-27 15:25 ` acoplan at gcc dot gnu.org
@ 2021-04-27 17:30 ` cvs-commit at gcc dot gnu.org
  2021-04-28  5:49 ` gilles.gouaillardet at gmail dot com
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-27 17:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Sandiford <rsandifo@gcc.gnu.org>:

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

commit r12-168-gd0a57b030f1c7df33c6bc3c661d16c9cb79e96dd
Author: Richard Sandiford <richard.sandiford@arm.com>
Date:   Tue Apr 27 18:30:36 2021 +0100

    Fix handling of VEC_COND_EXPR trap tests [PR100284]

    Now that VEC_COND_EXPR has normal unnested operands,
    operation_could_trap_p can treat it like any other expression.

    This fixes many testsuite ICEs for SVE, but it turns out that none
    of the tests in gcc.target/aarch64/sve were affected.  Anyone testing
    on non-SVE aarch64 therefore wouldn't have seen it.

    gcc/
            PR middle-end/100284
            * gimple.c (gimple_could_trap_p_1): Remove VEC_COND_EXPR test.
            * tree-eh.c (operation_could_trap_p): Handle VEC_COND_EXPR rather
            than asserting on it.

    gcc/testsuite/
            PR middle-end/100284
            * gcc.target/aarch64/sve/pr81003.c: New test.

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

* [Bug tree-optimization/100284] ICE in operation_could_trap_p with -march=armv8.2-a+sve -O3
  2021-04-27  9:50 [Bug c/100284] New: gcc crash with -march=armv8.2-a+sve -O3 gilles.gouaillardet at gmail dot com
                   ` (5 preceding siblings ...)
  2021-04-27 17:30 ` cvs-commit at gcc dot gnu.org
@ 2021-04-28  5:49 ` gilles.gouaillardet at gmail dot com
  2021-04-28  7:41 ` gilles.gouaillardet at gmail dot com
  2021-04-28  8:34 ` rsandifo at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: gilles.gouaillardet at gmail dot com @ 2021-04-28  5:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Gilles Gouaillardet <gilles.gouaillardet at gmail dot com> ---
Created attachment 50695
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50695&action=edit
preprocessed reproducer

$ ~/local/gcc-11.1.0/bin/gcc -march=armv8.2-a+sve -O3 -c bug.i

The bug has been fixed in master, thanks for the quick action!

I have attached the preprocessed bug.i, and here is the stack trace on the just
released gcc 11.1.0

during GIMPLE pass: vrp
bug.c: In function 'Ptngc_pack_array_xtc3':
bug.c:107:16: internal compiler error: in operation_could_trap_p, at
tree-eh.c:2546
  107 | unsigned char *Ptngc_pack_array_xtc3(int *input, int *length, const int
natoms, int speed)
      |                ^~~~~~~~~~~~~~~~~~~~~
0xda9a07 operation_could_trap_p(tree_code, bool, bool, tree_node*)
        ../../../src/gcc/gcc/tree-eh.c:2546
0x11c0497 maybe_resimplify_conditional_op
        ../../../src/gcc/gcc/gimple-match-head.c:156
0x11c0153 gimple_resimplify3
        ../../../src/gcc/gcc/gimple-match-head.c:404
0x11c1317 gimple_match_op::resimplify(gimple**, tree_node* (*)(tree_node*))
        ../../../src/gcc/gcc/gimple-match-head.c:493
0x11c1317 gimple_simplify_383
        /home/users/u0001043/build/gcc-11.1.0/gcc/gimple-match.c:21030
0x11c399b gimple_simplify_PLUS_EXPR
        /home/users/u0001043/build/gcc-11.1.0/gcc/gimple-match.c:58341
0x11d2a27 gimple_resimplify2
        ../../../src/gcc/gcc/gimple-match-head.c:318
0x121847b try_conditional_simplification
        ../../../src/gcc/gcc/gimple-match-head.c:872
0x121847b gimple_simplify(gimple*, gimple_match_op*, gimple**, tree_node*
(*)(tree_node*), tree_node* (*)(tree_node*))
        ../../../src/gcc/gcc/gimple-match-head.c:1046
0xa320ab fold_stmt_1
        ../../../src/gcc/gcc/gimple-fold.c:6001
0xf0e80b substitute_and_fold_dom_walker::before_dom_children(basic_block_def*)
        ../../../src/gcc/gcc/tree-ssa-propagate.c:1155
0x17fd477 dom_walker::walk(basic_block_def*)
        ../../../src/gcc/gcc/domwalk.c:309
0xf0d7a3 substitute_and_fold_engine::substitute_and_fold(basic_block_def*)
        ../../../src/gcc/gcc/tree-ssa-propagate.c:1283
0x103edb7 execute_vrp
        ../../../src/gcc/gcc/tree-vrp.c:4531
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.

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

* [Bug tree-optimization/100284] ICE in operation_could_trap_p with -march=armv8.2-a+sve -O3
  2021-04-27  9:50 [Bug c/100284] New: gcc crash with -march=armv8.2-a+sve -O3 gilles.gouaillardet at gmail dot com
                   ` (6 preceding siblings ...)
  2021-04-28  5:49 ` gilles.gouaillardet at gmail dot com
@ 2021-04-28  7:41 ` gilles.gouaillardet at gmail dot com
  2021-04-28  8:34 ` rsandifo at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: gilles.gouaillardet at gmail dot com @ 2021-04-28  7:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Gilles Gouaillardet <gilles.gouaillardet at gmail dot com> ---
I made a mistake when building GCC 11.1.0, and I am happy to make the following
correction: GCC 11.1.0 is *not* affected by this issue. The stack trace came
from the master branch.

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

* [Bug tree-optimization/100284] ICE in operation_could_trap_p with -march=armv8.2-a+sve -O3
  2021-04-27  9:50 [Bug c/100284] New: gcc crash with -march=armv8.2-a+sve -O3 gilles.gouaillardet at gmail dot com
                   ` (7 preceding siblings ...)
  2021-04-28  7:41 ` gilles.gouaillardet at gmail dot com
@ 2021-04-28  8:34 ` rsandifo at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: rsandifo at gcc dot gnu.org @ 2021-04-28  8:34 UTC (permalink / raw)
  To: gcc-bugs

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

rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> changed:

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

--- Comment #9 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> ---
Thanks Gilles, that's good news.  Hopefully yesterday's patch should
be the only fix needed in that case.

Thanks for reporting the bug.

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

end of thread, other threads:[~2021-04-28  8:34 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-27  9:50 [Bug c/100284] New: gcc crash with -march=armv8.2-a+sve -O3 gilles.gouaillardet at gmail dot com
2021-04-27 10:52 ` [Bug c/100284] " acoplan at gcc dot gnu.org
2021-04-27 11:11 ` acoplan at gcc dot gnu.org
2021-04-27 12:21 ` [Bug tree-optimization/100284] ICE in operation_could_trap_p " rguenth at gcc dot gnu.org
2021-04-27 12:41 ` rsandifo at gcc dot gnu.org
2021-04-27 15:25 ` acoplan at gcc dot gnu.org
2021-04-27 17:30 ` cvs-commit at gcc dot gnu.org
2021-04-28  5:49 ` gilles.gouaillardet at gmail dot com
2021-04-28  7:41 ` gilles.gouaillardet at gmail dot com
2021-04-28  8:34 ` rsandifo 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).