public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/96370] New: ice with -ffast-math
@ 2020-07-29 14:23 dcb314 at hotmail dot com
  2020-07-30  6:00 ` [Bug tree-optimization/96370] " rguenth at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: dcb314 at hotmail dot com @ 2020-07-29 14:23 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96370
           Summary: ice with -ffast-math
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

Recent gcc trunk, with this C source code:

a() {
  _Decimal128 b;
  c(-b * b);
}

and compiler flag -O2 -ffast-math, does this:

during GIMPLE pass: reassoc
bug633.c: In function ‘a’:
bug633.c:1:1: internal compiler error: in gimple_build_assign_1, at
gimple.c:455
    1 | a() {
      | ^
0x96e82e gimple_build_assign_1(tree_node*, tree_code, tree_node*, tree_node*,
tr
ee_node*)
        ../../trunk.git/gcc/gimple.c:455
0xec0a0b rewrite_expr_tree(gimple*, unsigned int, vec<operand_entry*, va_heap,
v
l_ptr>, bool, bool)
        ../../trunk.git/gcc/tree-ssa-reassoc.c:4963
0xec0828 rewrite_expr_tree(gimple*, unsigned int, vec<operand_entry*, va_heap,
v
l_ptr>, bool, bool)
        ../../trunk.git/gcc/tree-ssa-reassoc.c:5007
0xeb6d9e reassociate_bb(basic_block_def*)
        ../../trunk.git/gcc/tree-ssa-reassoc.c:6480

The bug seems to have existed since sometime before 20200630.

Thanks to cvise for reducing the code quickly.

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

* [Bug tree-optimization/96370] ice with -ffast-math
  2020-07-29 14:23 [Bug c/96370] New: ice with -ffast-math dcb314 at hotmail dot com
@ 2020-07-30  6:00 ` rguenth at gcc dot gnu.org
  2020-07-30  7:28 ` marxin at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-07-30  6:00 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |tree-optimization
             Status|UNCONFIRMED                 |ASSIGNED
            Version|unknown                     |11.0
   Last reconfirmed|                            |2020-07-30
           Keywords|                            |ice-on-valid-code
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.

#1  0x0000000000e1d0d9 in gimple_build_assign_1 (lhs=
    <ssa_name 0x7ffff6574f30 6>, subcode=NEGATE_EXPR, 
    op1=<ssa_name 0x7ffff6574d80 3>, op2=<ssa_name 0x7ffff6574d80 3>, 
    op3=<tree 0x0>) at ../../src/test/gcc/gimple.c:455
455           gcc_assert (num_ops > 2);

#3  0x00000000016294ee in rewrite_expr_tree (
    stmt=<gimple_assign 0x7ffff66adaa0>, opindex=1, ops=..., changed=true, 
    next_changed=false) at ../../src/test/gcc/tree-ssa-reassoc.c:4963
4963                    = gimple_build_assign (lhs, gimple_assign_rhs_code
(stmt),
(gdb) l
4958                {
4959                  gimple *insert_point
4960                    = find_insert_point (stmt, oe1->op, oe2->op);
4961                  lhs = make_ssa_name (TREE_TYPE (lhs));
4962                  stmt
4963                    = gimple_build_assign (lhs, gimple_assign_rhs_code
(stmt),
4964                                           oe1->op, oe2->op);

so the rhs code is a negate while we expect sth else.  I will have a look.

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

* [Bug tree-optimization/96370] ice with -ffast-math
  2020-07-29 14:23 [Bug c/96370] New: ice with -ffast-math dcb314 at hotmail dot com
  2020-07-30  6:00 ` [Bug tree-optimization/96370] " rguenth at gcc dot gnu.org
@ 2020-07-30  7:28 ` marxin at gcc dot gnu.org
  2020-07-30  7:35 ` [Bug tree-optimization/96370] ICE with -ffast-math since r7-950-g8a85cee26eabf5cf marxin at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-07-30  7:28 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
> 
> Thanks to cvise for reducing the code quickly.

Glad to hear you used cvise!

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

* [Bug tree-optimization/96370] ICE with -ffast-math since r7-950-g8a85cee26eabf5cf
  2020-07-29 14:23 [Bug c/96370] New: ice with -ffast-math dcb314 at hotmail dot com
  2020-07-30  6:00 ` [Bug tree-optimization/96370] " rguenth at gcc dot gnu.org
  2020-07-30  7:28 ` marxin at gcc dot gnu.org
@ 2020-07-30  7:35 ` marxin at gcc dot gnu.org
  2020-07-30  8:02 ` rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-07-30  7:35 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kugan at gcc dot gnu.org
            Summary|ice with -ffast-math        |ICE with -ffast-math since
                   |                            |r7-950-g8a85cee26eabf5cf

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r7-950-g8a85cee26eabf5cf.

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

* [Bug tree-optimization/96370] ICE with -ffast-math since r7-950-g8a85cee26eabf5cf
  2020-07-29 14:23 [Bug c/96370] New: ice with -ffast-math dcb314 at hotmail dot com
                   ` (2 preceding siblings ...)
  2020-07-30  7:35 ` [Bug tree-optimization/96370] ICE with -ffast-math since r7-950-g8a85cee26eabf5cf marxin at gcc dot gnu.org
@ 2020-07-30  8:02 ` rguenth at gcc dot gnu.org
  2020-07-30  8:15 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-07-30  8:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
More "complete" testcase:

void c(_Decimal128);
void a(_Decimal128 b)
{
  c(-b * b);
}

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

* [Bug tree-optimization/96370] ICE with -ffast-math since r7-950-g8a85cee26eabf5cf
  2020-07-29 14:23 [Bug c/96370] New: ice with -ffast-math dcb314 at hotmail dot com
                   ` (3 preceding siblings ...)
  2020-07-30  8:02 ` rguenth at gcc dot gnu.org
@ 2020-07-30  8:15 ` rguenth at gcc dot gnu.org
  2020-07-30  9:36 ` cvs-commit at gcc dot gnu.org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-07-30  8:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
OK, so rewrite_expr_tree isn't prepared to see ops with a three component
"leaf" as try_special_add_to_ops produces which turns { -b, b } into
{ b, b, -1 }.  Instead it recurses into the apperant non-leaf _1 which
is the negate.

  /* Recurse on the LHS of the binary operator, which is guaranteed to
     be the non-leaf side.  */
  tree new_rhs1
    = rewrite_expr_tree (SSA_NAME_DEF_STMT (rhs1), opindex + 1, ops,
                         changed || oe->op != rhs2 || next_changed,
                         false);

But I have a simple fix.

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

* [Bug tree-optimization/96370] ICE with -ffast-math since r7-950-g8a85cee26eabf5cf
  2020-07-29 14:23 [Bug c/96370] New: ice with -ffast-math dcb314 at hotmail dot com
                   ` (4 preceding siblings ...)
  2020-07-30  8:15 ` rguenth at gcc dot gnu.org
@ 2020-07-30  9:36 ` cvs-commit at gcc dot gnu.org
  2020-07-30  9:46 ` [Bug tree-optimization/96370] [8/9/10 Regression] " rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-07-30  9:36 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:2c558d2655cb22f472c83e8296b5cd2a92365cd3

commit r11-2424-g2c558d2655cb22f472c83e8296b5cd2a92365cd3
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Jul 30 10:24:42 2020 +0200

    tree-optimization/96370 - make reassoc expr rewrite more robust

    In the face of the more complex tricks in reassoc with respect
    to negate processing it can happen that the expression rewrite
    is fooled to recurse on a leaf and pick up a bogus expression
    code.  The following patch makes the expression rewrite more
    robust in providing the expression code to it directly since
    it is the same for all operations in a chain.

    2020-07-30  Richard Biener  <rguenther@suse.de>

            PR tree-optimization/96370
            * tree-ssa-reassoc.c (rewrite_expr_tree): Add operation
            code parameter and use it instead of picking it up from
            the stmt that is being rewritten.
            (reassociate_bb): Pass down the operation code.

            * gcc.dg/pr96370.c: New testcase.

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

* [Bug tree-optimization/96370] [8/9/10 Regression] ICE with -ffast-math since r7-950-g8a85cee26eabf5cf
  2020-07-29 14:23 [Bug c/96370] New: ice with -ffast-math dcb314 at hotmail dot com
                   ` (5 preceding siblings ...)
  2020-07-30  9:36 ` cvs-commit at gcc dot gnu.org
@ 2020-07-30  9:46 ` rguenth at gcc dot gnu.org
  2020-09-11 12:12 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-07-30  9:46 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|ICE with -ffast-math since  |[8/9/10 Regression] ICE
                   |r7-950-g8a85cee26eabf5cf    |with -ffast-math since
                   |                            |r7-950-g8a85cee26eabf5cf
           Priority|P3                          |P2
      Known to work|                            |11.0
   Target Milestone|---                         |8.5

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed on trunk sofar.

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

* [Bug tree-optimization/96370] [8/9/10 Regression] ICE with -ffast-math since r7-950-g8a85cee26eabf5cf
  2020-07-29 14:23 [Bug c/96370] New: ice with -ffast-math dcb314 at hotmail dot com
                   ` (6 preceding siblings ...)
  2020-07-30  9:46 ` [Bug tree-optimization/96370] [8/9/10 Regression] " rguenth at gcc dot gnu.org
@ 2020-09-11 12:12 ` cvs-commit at gcc dot gnu.org
  2020-12-02 12:21 ` [Bug tree-optimization/96370] [8/9 " cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-09-11 12:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:819fc71b49af8366e6b23d2b57ebb6fb66f1a292

commit r10-8748-g819fc71b49af8366e6b23d2b57ebb6fb66f1a292
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Jul 30 10:24:42 2020 +0200

    tree-optimization/96370 - make reassoc expr rewrite more robust

    In the face of the more complex tricks in reassoc with respect
    to negate processing it can happen that the expression rewrite
    is fooled to recurse on a leaf and pick up a bogus expression
    code.  The following patch makes the expression rewrite more
    robust in providing the expression code to it directly since
    it is the same for all operations in a chain.

    2020-07-30  Richard Biener  <rguenther@suse.de>

            PR tree-optimization/96370
            * tree-ssa-reassoc.c (rewrite_expr_tree): Add operation
            code parameter and use it instead of picking it up from
            the stmt that is being rewritten.
            (reassociate_bb): Pass down the operation code.

            * gcc.dg/pr96370.c: New testcase.

    (cherry picked from commit 2c558d2655cb22f472c83e8296b5cd2a92365cd3)

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

* [Bug tree-optimization/96370] [8/9 Regression] ICE with -ffast-math since r7-950-g8a85cee26eabf5cf
  2020-07-29 14:23 [Bug c/96370] New: ice with -ffast-math dcb314 at hotmail dot com
                   ` (7 preceding siblings ...)
  2020-09-11 12:12 ` cvs-commit at gcc dot gnu.org
@ 2020-12-02 12:21 ` cvs-commit at gcc dot gnu.org
  2021-03-17 11:14 ` [Bug tree-optimization/96370] [8 " cvs-commit at gcc dot gnu.org
  2021-03-17 11:15 ` rguenth at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-12-02 12:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:

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

commit r9-9087-ga5fff78405c3bfea287434e7711c6f10a770cb0a
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Jul 30 10:24:42 2020 +0200

    tree-optimization/96370 - make reassoc expr rewrite more robust

    In the face of the more complex tricks in reassoc with respect
    to negate processing it can happen that the expression rewrite
    is fooled to recurse on a leaf and pick up a bogus expression
    code.  The following patch makes the expression rewrite more
    robust in providing the expression code to it directly since
    it is the same for all operations in a chain.

    2020-07-30  Richard Biener  <rguenther@suse.de>

            PR tree-optimization/96370
            * tree-ssa-reassoc.c (rewrite_expr_tree): Add operation
            code parameter and use it instead of picking it up from
            the stmt that is being rewritten.
            (reassociate_bb): Pass down the operation code.

            * gcc.dg/pr96370.c: New testcase.

    (cherry picked from commit 2c558d2655cb22f472c83e8296b5cd2a92365cd3)

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

* [Bug tree-optimization/96370] [8 Regression] ICE with -ffast-math since r7-950-g8a85cee26eabf5cf
  2020-07-29 14:23 [Bug c/96370] New: ice with -ffast-math dcb314 at hotmail dot com
                   ` (8 preceding siblings ...)
  2020-12-02 12:21 ` [Bug tree-optimization/96370] [8/9 " cvs-commit at gcc dot gnu.org
@ 2021-03-17 11:14 ` cvs-commit at gcc dot gnu.org
  2021-03-17 11:15 ` rguenth at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-17 11:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-8 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:0307275acc789491bcc33dc67948009ec7d9c51d

commit r8-10804-g0307275acc789491bcc33dc67948009ec7d9c51d
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Jul 30 10:24:42 2020 +0200

    tree-optimization/96370 - make reassoc expr rewrite more robust

    In the face of the more complex tricks in reassoc with respect
    to negate processing it can happen that the expression rewrite
    is fooled to recurse on a leaf and pick up a bogus expression
    code.  The following patch makes the expression rewrite more
    robust in providing the expression code to it directly since
    it is the same for all operations in a chain.

    2020-07-30  Richard Biener  <rguenther@suse.de>

            PR tree-optimization/96370
            * tree-ssa-reassoc.c (rewrite_expr_tree): Add operation
            code parameter and use it instead of picking it up from
            the stmt that is being rewritten.
            (reassociate_bb): Pass down the operation code.

            * gcc.dg/pr96370.c: New testcase.

    (cherry picked from commit a5fff78405c3bfea287434e7711c6f10a770cb0a)

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

* [Bug tree-optimization/96370] [8 Regression] ICE with -ffast-math since r7-950-g8a85cee26eabf5cf
  2020-07-29 14:23 [Bug c/96370] New: ice with -ffast-math dcb314 at hotmail dot com
                   ` (9 preceding siblings ...)
  2021-03-17 11:14 ` [Bug tree-optimization/96370] [8 " cvs-commit at gcc dot gnu.org
@ 2021-03-17 11:15 ` rguenth at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-03-17 11:15 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |8.4.0
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED
      Known to work|                            |8.4.1

--- Comment #11 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2021-03-17 11:15 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-29 14:23 [Bug c/96370] New: ice with -ffast-math dcb314 at hotmail dot com
2020-07-30  6:00 ` [Bug tree-optimization/96370] " rguenth at gcc dot gnu.org
2020-07-30  7:28 ` marxin at gcc dot gnu.org
2020-07-30  7:35 ` [Bug tree-optimization/96370] ICE with -ffast-math since r7-950-g8a85cee26eabf5cf marxin at gcc dot gnu.org
2020-07-30  8:02 ` rguenth at gcc dot gnu.org
2020-07-30  8:15 ` rguenth at gcc dot gnu.org
2020-07-30  9:36 ` cvs-commit at gcc dot gnu.org
2020-07-30  9:46 ` [Bug tree-optimization/96370] [8/9/10 Regression] " rguenth at gcc dot gnu.org
2020-09-11 12:12 ` cvs-commit at gcc dot gnu.org
2020-12-02 12:21 ` [Bug tree-optimization/96370] [8/9 " cvs-commit at gcc dot gnu.org
2021-03-17 11:14 ` [Bug tree-optimization/96370] [8 " cvs-commit at gcc dot gnu.org
2021-03-17 11:15 ` rguenth 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).