public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/98758] New: ice in lambda_matrix_right_hermite
@ 2021-01-19 23:59 dcb314 at hotmail dot com
  2021-01-20  0:45 ` [Bug tree-optimization/98758] [11 Regression] " pinskia at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: dcb314 at hotmail dot com @ 2021-01-19 23:59 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98758
           Summary: ice in lambda_matrix_right_hermite
           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: ---

For this C code:

long *a, *b;
long c;
void d(void) {
  b = a;
  while (c) {
    *a = a += (long)1 << 54;
    c = b[0];
    b = a;
  }
}

compiled with recent gcc and compiler flag -O3 does this:

bug693.c:3:6: internal compiler error: in abs_hwi, at hwint.h:324
    3 | void d(void) {
      |      ^
0x18fbeed lambda_matrix_right_hermite(long**, int, int, long**, long**)
        ../../trunk.git/gcc/wide-int.h:0
0x18fbeed analyze_subscript_affine_affine(tree_node*, tree_node*,
conflict_funct
ion**, conflict_function**, tree_node**)
        ../../trunk.git/gcc/tree-data-ref.c:4413
0x18f980d analyze_siv_subscript(tree_node*, tree_node*, conflict_function**,
con
flict_function**, tree_node**, int)
        ../../trunk.git/gcc/tree-data-ref.c:4669
0x18f980d analyze_overlapping_iterations(tree_node*, tree_node*,
conflict_functi
on**, conflict_function**, tree_node**, loop*)
        ../../trunk.git/gcc/tree-data-ref.c:4915

The bug first seems to occur sometime from date 20210113 to 20210114.
Git hashes are  3ddc18251a821fe6 and aa3d33dccb57621b.

I'll have a go at running a git bisect tomorrow. There are 31 commits
to be bisected. In that range, only Richard's commit
2182274f510c180ea92a4f826a0f6cf5f1f55b66 mentions source code file
tree-data-ref.c, so that looks a hot candidate.

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

* [Bug tree-optimization/98758] [11 Regression] ice in lambda_matrix_right_hermite
  2021-01-19 23:59 [Bug c/98758] New: ice in lambda_matrix_right_hermite dcb314 at hotmail dot com
@ 2021-01-20  0:45 ` pinskia at gcc dot gnu.org
  2021-01-20  2:13 ` [Bug tree-optimization/98758] [9/10/11 Regression] ice in lambda_matrix_right_hermite by r9-3927 hjl.tools at gmail dot com
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-01-20  0:45 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|unknown                     |11.0
   Target Milestone|---                         |11.0
            Summary|ice in                      |[11 Regression] ice in
                   |lambda_matrix_right_hermite |lambda_matrix_right_hermite

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

* [Bug tree-optimization/98758] [9/10/11 Regression] ice in lambda_matrix_right_hermite by r9-3927
  2021-01-19 23:59 [Bug c/98758] New: ice in lambda_matrix_right_hermite dcb314 at hotmail dot com
  2021-01-20  0:45 ` [Bug tree-optimization/98758] [11 Regression] " pinskia at gcc dot gnu.org
@ 2021-01-20  2:13 ` hjl.tools at gmail dot com
  2021-01-20  7:34 ` rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: hjl.tools at gmail dot com @ 2021-01-20  2:13 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[11 Regression] ice in      |[9/10/11 Regression] ice in
                   |lambda_matrix_right_hermite |lambda_matrix_right_hermite
                   |                            |by r9-3927
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-01-20

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
1c8badf66bec4e0ff73ae24bf4f8cabbef8c137a is the first bad commit
commit 1c8badf66bec4e0ff73ae24bf4f8cabbef8c137a
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Nov 8 12:15:49 2018 +0000

    tree-data-ref.h (lambda_int): New typedef.

    2018-11-08  Richard Biener  <rguenther@suse.de>

            * tree-data-ref.h (lambda_int): New typedef.
            (lambda_vector_gcd): Adjust.
            (lambda_vector_new): Likewise.
            (lambda_matrix_new): Likewise.
            * tree-data-ref.c  (print_lambda_vector): Adjust.

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

* [Bug tree-optimization/98758] [9/10/11 Regression] ice in lambda_matrix_right_hermite by r9-3927
  2021-01-19 23:59 [Bug c/98758] New: ice in lambda_matrix_right_hermite dcb314 at hotmail dot com
  2021-01-20  0:45 ` [Bug tree-optimization/98758] [11 Regression] " pinskia at gcc dot gnu.org
  2021-01-20  2:13 ` [Bug tree-optimization/98758] [9/10/11 Regression] ice in lambda_matrix_right_hermite by r9-3927 hjl.tools at gmail dot com
@ 2021-01-20  7:34 ` rguenth at gcc dot gnu.org
  2021-01-20  8:38 ` cvs-commit at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-01-20  7:34 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Priority|P3                          |P2
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
   Target Milestone|11.0                        |9.4

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
I will investigate (the patch increased the value range so likely a slightly
different testcase is broken earlier).

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

* [Bug tree-optimization/98758] [9/10/11 Regression] ice in lambda_matrix_right_hermite by r9-3927
  2021-01-19 23:59 [Bug c/98758] New: ice in lambda_matrix_right_hermite dcb314 at hotmail dot com
                   ` (2 preceding siblings ...)
  2021-01-20  7:34 ` rguenth at gcc dot gnu.org
@ 2021-01-20  8:38 ` cvs-commit at gcc dot gnu.org
  2021-01-20  8:38 ` [Bug tree-optimization/98758] [9/10 " rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-01-20  8:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 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:34599780d0de72faf5719ea08d11a061722b9d19

commit r11-6811-g34599780d0de72faf5719ea08d11a061722b9d19
Author: Richard Biener <rguenther@suse.de>
Date:   Wed Jan 20 08:48:34 2021 +0100

    tree-optimization/98758 - fix integer arithmetic in data-ref analysis

    This fixes some int arithmetic issues and a bogus truncation.

    2021-01-20  Richard Biener  <rguenther@suse.de>

            PR tree-optimization/98758
            * tree-data-ref.c (int_divides_p): Use lambda_int arguments.
            (lambda_matrix_right_hermite): Avoid undefinedness with
            signed integer abs and multiplication.
            (analyze_subscript_affine_affine): Use lambda_int.

            * gcc.dg/torture/pr98758.c: New testcase.

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

* [Bug tree-optimization/98758] [9/10 Regression] ice in lambda_matrix_right_hermite by r9-3927
  2021-01-19 23:59 [Bug c/98758] New: ice in lambda_matrix_right_hermite dcb314 at hotmail dot com
                   ` (3 preceding siblings ...)
  2021-01-20  8:38 ` cvs-commit at gcc dot gnu.org
@ 2021-01-20  8:38 ` rguenth at gcc dot gnu.org
  2021-01-20  8:47 ` dcb314 at hotmail dot com
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-01-20  8:38 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[9/10/11 Regression] ice in |[9/10 Regression] ice in
                   |lambda_matrix_right_hermite |lambda_matrix_right_hermite
                   |by r9-3927                  |by r9-3927
      Known to fail|                            |10.2.0
      Known to work|                            |11.0

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

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

* [Bug tree-optimization/98758] [9/10 Regression] ice in lambda_matrix_right_hermite by r9-3927
  2021-01-19 23:59 [Bug c/98758] New: ice in lambda_matrix_right_hermite dcb314 at hotmail dot com
                   ` (4 preceding siblings ...)
  2021-01-20  8:38 ` [Bug tree-optimization/98758] [9/10 " rguenth at gcc dot gnu.org
@ 2021-01-20  8:47 ` dcb314 at hotmail dot com
  2021-01-20  8:54 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: dcb314 at hotmail dot com @ 2021-01-20  8:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from David Binderman <dcb314 at hotmail dot com> ---
Minor quibble over the patch. I notice that integer division by abs_b occurs.

Belt and braces, but is zero a legal value for abs_b ? 

If so, it might be worth putting in some code to avoid divide by zero.

If not, it might be worth putting in some code to show the future
readers of the code that integer division by zero doesn't happen.

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

* [Bug tree-optimization/98758] [9/10 Regression] ice in lambda_matrix_right_hermite by r9-3927
  2021-01-19 23:59 [Bug c/98758] New: ice in lambda_matrix_right_hermite dcb314 at hotmail dot com
                   ` (5 preceding siblings ...)
  2021-01-20  8:47 ` dcb314 at hotmail dot com
@ 2021-01-20  8:54 ` rguenth at gcc dot gnu.org
  2021-03-03 10:36 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-01-20  8:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to David Binderman from comment #5)
> Minor quibble over the patch. I notice that integer division by abs_b occurs.
> 
> Belt and braces, but is zero a legal value for abs_b ? 
> 
> If so, it might be worth putting in some code to avoid divide by zero.
> 
> If not, it might be worth putting in some code to show the future
> readers of the code that integer division by zero doesn't happen.

The code is (more fully quoted)

              while (S[i][j] != 0)
                {
                  lambda_int sigma, factor, a, b;

                  a = S[i-1][j];
                  b = S[i][j];
                  sigma = ((a < 0) ^ (b < 0)) ? -1: 1;
                  unsigned HOST_WIDE_INT abs_a = absu_hwi (a);
                  unsigned HOST_WIDE_INT abs_b = absu_hwi (b);
                  factor = sigma * (lambda_int)(abs_a / abs_b);

                  lambda_matrix_row_add (S, n, i, i-1, -factor);
                  std::swap (S[i], S[i-1]); 

                  lambda_matrix_row_add (U, m, i, i-1, -factor);
                  std::swap (U[i], U[i-1]); 
                }

so b is not zero.  I'm investigating how to handle possible overflow
in lambda_matrix_row_add still.

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

* [Bug tree-optimization/98758] [9/10 Regression] ice in lambda_matrix_right_hermite by r9-3927
  2021-01-19 23:59 [Bug c/98758] New: ice in lambda_matrix_right_hermite dcb314 at hotmail dot com
                   ` (6 preceding siblings ...)
  2021-01-20  8:54 ` rguenth at gcc dot gnu.org
@ 2021-03-03 10:36 ` cvs-commit at gcc dot gnu.org
  2021-03-17  9:35 ` [Bug tree-optimization/98758] [9 " cvs-commit at gcc dot gnu.org
  2021-03-17  9:37 ` rguenth at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-03 10:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 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:85977f624a34eac309f9d77a58164553dfc82975

commit r10-9408-g85977f624a34eac309f9d77a58164553dfc82975
Author: Richard Biener <rguenther@suse.de>
Date:   Wed Jan 20 08:48:34 2021 +0100

    tree-optimization/98758 - fix integer arithmetic in data-ref analysis

    This fixes some int arithmetic issues and a bogus truncation.

    2021-01-20  Richard Biener  <rguenther@suse.de>

            PR tree-optimization/98758
            * tree-data-ref.c (int_divides_p): Use lambda_int arguments.
            (lambda_matrix_right_hermite): Avoid undefinedness with
            signed integer abs and multiplication.
            (analyze_subscript_affine_affine): Use lambda_int.

            * gcc.dg/torture/pr98758.c: New testcase.

    (cherry picked from commit 34599780d0de72faf5719ea08d11a061722b9d19)

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

* [Bug tree-optimization/98758] [9 Regression] ice in lambda_matrix_right_hermite by r9-3927
  2021-01-19 23:59 [Bug c/98758] New: ice in lambda_matrix_right_hermite dcb314 at hotmail dot com
                   ` (7 preceding siblings ...)
  2021-03-03 10:36 ` cvs-commit at gcc dot gnu.org
@ 2021-03-17  9:35 ` cvs-commit at gcc dot gnu.org
  2021-03-17  9:37 ` rguenth at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-17  9:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 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:396cc56368a68d25456ea5a29c24069e46ae5f46

commit r9-9290-g396cc56368a68d25456ea5a29c24069e46ae5f46
Author: Richard Biener <rguenther@suse.de>
Date:   Wed Jan 20 08:48:34 2021 +0100

    tree-optimization/98758 - fix integer arithmetic in data-ref analysis

    This fixes some int arithmetic issues and a bogus truncation.

    2021-01-20  Richard Biener  <rguenther@suse.de>

            PR tree-optimization/98758
            * tree-data-ref.c (int_divides_p): Use lambda_int arguments.
            (lambda_matrix_right_hermite): Avoid undefinedness with
            signed integer abs and multiplication.
            (analyze_subscript_affine_affine): Use lambda_int.

            * gcc.dg/torture/pr98758.c: New testcase.

    (cherry picked from commit 85977f624a34eac309f9d77a58164553dfc82975)

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

* [Bug tree-optimization/98758] [9 Regression] ice in lambda_matrix_right_hermite by r9-3927
  2021-01-19 23:59 [Bug c/98758] New: ice in lambda_matrix_right_hermite dcb314 at hotmail dot com
                   ` (8 preceding siblings ...)
  2021-03-17  9:35 ` [Bug tree-optimization/98758] [9 " cvs-commit at gcc dot gnu.org
@ 2021-03-17  9:37 ` rguenth at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-03-17  9:37 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
      Known to fail|                            |9.3.0
             Status|ASSIGNED                    |RESOLVED
      Known to work|                            |9.3.1

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

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

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

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-19 23:59 [Bug c/98758] New: ice in lambda_matrix_right_hermite dcb314 at hotmail dot com
2021-01-20  0:45 ` [Bug tree-optimization/98758] [11 Regression] " pinskia at gcc dot gnu.org
2021-01-20  2:13 ` [Bug tree-optimization/98758] [9/10/11 Regression] ice in lambda_matrix_right_hermite by r9-3927 hjl.tools at gmail dot com
2021-01-20  7:34 ` rguenth at gcc dot gnu.org
2021-01-20  8:38 ` cvs-commit at gcc dot gnu.org
2021-01-20  8:38 ` [Bug tree-optimization/98758] [9/10 " rguenth at gcc dot gnu.org
2021-01-20  8:47 ` dcb314 at hotmail dot com
2021-01-20  8:54 ` rguenth at gcc dot gnu.org
2021-03-03 10:36 ` cvs-commit at gcc dot gnu.org
2021-03-17  9:35 ` [Bug tree-optimization/98758] [9 " cvs-commit at gcc dot gnu.org
2021-03-17  9:37 ` 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).