public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/98629] New: ice during GIMPLE pass: widening_mul
@ 2021-01-11 21:32 dcb314 at hotmail dot com
  2021-01-11 21:49 ` [Bug c/98629] " dcb314 at hotmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: dcb314 at hotmail dot com @ 2021-01-11 21:32 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98629
           Summary: ice during GIMPLE pass: widening_mul
           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 reduced C code:

unsigned int a;
int b, c;
void d() {
  unsigned int *e = &a;
  (a /= a |= b) - (0 <= (*e += *e)) * (c *= *e);
}

does this with recent gcc trunk:

$ /home/dcb/gcc/results.20210111/bin/gcc -c -w -O2 bug689.c
during GIMPLE pass: widening_mul
bug689.c: In function ‘d’:
bug689.c:3:6: internal compiler error: Segmentation fault
    3 | void d() {
      |      ^
0xcd63f9 crash_signal(int)
        ../../trunk.git/gcc/toplev.c:327
0xe7b538 gimple_code(gimple const*)
        ../../trunk.git/gcc/gimple.h:1782
0xe7b538 is_gimple_assign(gimple const*)
        ../../trunk.git/gcc/gimple.h:2529
0xe7b538 gimple_assign_cast_p(gimple const*)
        ../../trunk.git/gcc/gimple.h:2870

The bug first seems to appear sometime between date 20210108
and today i.e. 20210111.

Hashes for those dates are bdcde15045027195 and 9a6c37e6ae520534.
with 32 commits between them.

Jakub's recent changes to widening_mul look a likely candidate.
I don't see much point in doing a git bisect, although I can
if requested.


Jakub's

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

* [Bug c/98629] ice during GIMPLE pass: widening_mul
  2021-01-11 21:32 [Bug c/98629] New: ice during GIMPLE pass: widening_mul dcb314 at hotmail dot com
@ 2021-01-11 21:49 ` dcb314 at hotmail dot com
  2021-01-11 22:47 ` [Bug tree-optimization/98629] [11 Regression] " jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: dcb314 at hotmail dot com @ 2021-01-11 21:49 UTC (permalink / raw)
  To: gcc-bugs

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

David Binderman <dcb314 at hotmail dot com> changed:

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

--- Comment #1 from David Binderman <dcb314 at hotmail dot com> ---
Jakub's best advice sought.

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

* [Bug tree-optimization/98629] [11 Regression] ice during GIMPLE pass: widening_mul
  2021-01-11 21:32 [Bug c/98629] New: ice during GIMPLE pass: widening_mul dcb314 at hotmail dot com
  2021-01-11 21:49 ` [Bug c/98629] " dcb314 at hotmail dot com
@ 2021-01-11 22:47 ` jakub at gcc dot gnu.org
  2021-01-11 23:03 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-01-11 22:47 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |ASSIGNED
            Summary|ice during GIMPLE pass:     |[11 Regression] ice during
                   |widening_mul                |GIMPLE pass: widening_mul
   Last reconfirmed|                            |2021-01-11
           Priority|P3                          |P1
   Target Milestone|---                         |11.0
           Assignee|unassigned at gcc dot gnu.org      |jakub at gcc dot gnu.org
          Component|c                           |tree-optimization

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Indeed, started with my r11-6580-g9febe9e4be7812519258ea3ed4f38bbc1a61624b
change.

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

* [Bug tree-optimization/98629] [11 Regression] ice during GIMPLE pass: widening_mul
  2021-01-11 21:32 [Bug c/98629] New: ice during GIMPLE pass: widening_mul dcb314 at hotmail dot com
  2021-01-11 21:49 ` [Bug c/98629] " dcb314 at hotmail dot com
  2021-01-11 22:47 ` [Bug tree-optimization/98629] [11 Regression] " jakub at gcc dot gnu.org
@ 2021-01-11 23:03 ` jakub at gcc dot gnu.org
  2021-01-12 10:05 ` cvs-commit at gcc dot gnu.org
  2021-01-15  0:46 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-01-11 23:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 49941
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49941&action=edit
gcc11-pr98629.patch

Untested fix.

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

* [Bug tree-optimization/98629] [11 Regression] ice during GIMPLE pass: widening_mul
  2021-01-11 21:32 [Bug c/98629] New: ice during GIMPLE pass: widening_mul dcb314 at hotmail dot com
                   ` (2 preceding siblings ...)
  2021-01-11 23:03 ` jakub at gcc dot gnu.org
@ 2021-01-12 10:05 ` cvs-commit at gcc dot gnu.org
  2021-01-15  0:46 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-01-12 10:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 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:24ea113f75cfad38894dc1ad16b23c0538ef17d4

commit r11-6610-g24ea113f75cfad38894dc1ad16b23c0538ef17d4
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Jan 12 11:04:46 2021 +0100

    widening_mul: Fix up ICE caused by my signed multiplication overflow
pattern recognition changes [PR98629]

    As the testcase shows, my latest changes caused ICE on that testcase.
    The problem is that arith_overflow_check_p now can change the use_stmt
    argument (has a reference), so that if it succeeds (returns non-zero),
    it points it to the GIMPLE_COND or EQ/NE or COND_EXPR assignment from the
    TRUNC_DIV_EXPR assignment.
    The problem was that it would change use_stmt also if it returned 0 in some
    cases, such as multiple imm uses of the division, and in one of the callers
    if arith_overflow_check_p returns 0 it looks at use_stmt again and performs
    other checks, which of course assumes that use_stmt is the one passed
    to arith_overflow_check_p and not e.g. NULL instead or some other unrelated
    stmt.

    The following patch fixes that by only changing use_stmt when we are about
    to return non-zero (for the MULT_EXPR case, which is the only one with the
    need to use different use_stmt).

    2021-01-12  Jakub Jelinek  <jakub@redhat.com>

            PR tree-optimization/98629
            * tree-ssa-math-opts.c (arith_overflow_check_p): Don't update
use_stmt
            unless returning non-zero.

            * gcc.c-torture/compile/pr98629.c: New test.

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

* [Bug tree-optimization/98629] [11 Regression] ice during GIMPLE pass: widening_mul
  2021-01-11 21:32 [Bug c/98629] New: ice during GIMPLE pass: widening_mul dcb314 at hotmail dot com
                   ` (3 preceding siblings ...)
  2021-01-12 10:05 ` cvs-commit at gcc dot gnu.org
@ 2021-01-15  0:46 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-01-15  0:46 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2021-01-15  0:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-11 21:32 [Bug c/98629] New: ice during GIMPLE pass: widening_mul dcb314 at hotmail dot com
2021-01-11 21:49 ` [Bug c/98629] " dcb314 at hotmail dot com
2021-01-11 22:47 ` [Bug tree-optimization/98629] [11 Regression] " jakub at gcc dot gnu.org
2021-01-11 23:03 ` jakub at gcc dot gnu.org
2021-01-12 10:05 ` cvs-commit at gcc dot gnu.org
2021-01-15  0:46 ` 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).