public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/111442] New: ICE on valid code at -O{s,2,3}: Segmentation fault signal terminated program cc1
@ 2023-09-17  8:55 zhendong.su at inf dot ethz.ch
  2023-09-17  9:02 ` [Bug tree-optimization/111442] " pinskia at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: zhendong.su at inf dot ethz.ch @ 2023-09-17  8:55 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111442
           Summary: ICE on valid code at -O{s,2,3}: Segmentation fault
                    signal terminated program cc1
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zhendong.su at inf dot ethz.ch
  Target Milestone: ---

This appears to be a recent regression.

Compiler Explorer: https://godbolt.org/z/TY6sWMvcv

[542] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/local/home/suz/suz-local/software/local/gcc-trunk/bin/../libexec/gcc/x86_64-pc-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--enable-checking=yes --prefix=/local/suz-local/software/local/gcc-trunk
--enable-sanitizers --enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.0 20230917 (experimental) (GCC) 
[543] % 
[543] % gcctk -Os small.c
small.c: In function ‘main’:
small.c:5:15: warning: division by zero [-Wdiv-by-zero]
    5 |     e = a ? 0 % 0 : 0;
      |               ^
gcctk: internal compiler error: Segmentation fault signal terminated program
cc1
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
See <https://gcc.gnu.org/bugs/> for instructions.
[544] % 
[544] % cat small.c
int *a, b;
int main() {
  int d = 1, e;
  if (d)
    e = a ? 0 % 0 : 0;
  if (d)
    a = &d;
  d = -1;
  b = d & e;
  b = 2 * e ^ 1;
  return 0;
}

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

* [Bug tree-optimization/111442] ICE on valid code at -O{s,2,3}: Segmentation fault signal terminated program cc1
  2023-09-17  8:55 [Bug tree-optimization/111442] New: ICE on valid code at -O{s,2,3}: Segmentation fault signal terminated program cc1 zhendong.su at inf dot ethz.ch
@ 2023-09-17  9:02 ` pinskia at gcc dot gnu.org
  2023-09-17  9:04 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-17  9:02 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 111435.

*** This bug has been marked as a duplicate of bug 111435 ***

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

* [Bug tree-optimization/111442] ICE on valid code at -O{s,2,3}: Segmentation fault signal terminated program cc1
  2023-09-17  8:55 [Bug tree-optimization/111442] New: ICE on valid code at -O{s,2,3}: Segmentation fault signal terminated program cc1 zhendong.su at inf dot ethz.ch
  2023-09-17  9:02 ` [Bug tree-optimization/111442] " pinskia at gcc dot gnu.org
@ 2023-09-17  9:04 ` pinskia at gcc dot gnu.org
  2023-09-17  9:05 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-17  9:04 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
         Resolution|DUPLICATE                   |---
   Last reconfirmed|                            |2023-09-17
           Assignee|unassigned at gcc dot gnu.org      |pinskia at gcc dot gnu.org
           Keywords|                            |ice-on-valid-code
             Status|RESOLVED                    |ASSIGNED

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So it is the same issue but and has the same issue ...

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

* [Bug tree-optimization/111442] ICE on valid code at -O{s,2,3}: Segmentation fault signal terminated program cc1
  2023-09-17  8:55 [Bug tree-optimization/111442] New: ICE on valid code at -O{s,2,3}: Segmentation fault signal terminated program cc1 zhendong.su at inf dot ethz.ch
  2023-09-17  9:02 ` [Bug tree-optimization/111442] " pinskia at gcc dot gnu.org
  2023-09-17  9:04 ` pinskia at gcc dot gnu.org
@ 2023-09-17  9:05 ` pinskia at gcc dot gnu.org
  2023-09-17  9:09 ` [Bug tree-optimization/111442] [14 Regression] " pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-17  9:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
What I meant was the match for bit_and case has the same issue as convert.
Though I can't don't understand exactly how though but basically any match
can't be recusive after all.

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

* [Bug tree-optimization/111442] [14 Regression] ICE on valid code at -O{s,2,3}: Segmentation fault signal terminated program cc1
  2023-09-17  8:55 [Bug tree-optimization/111442] New: ICE on valid code at -O{s,2,3}: Segmentation fault signal terminated program cc1 zhendong.su at inf dot ethz.ch
                   ` (2 preceding siblings ...)
  2023-09-17  9:05 ` pinskia at gcc dot gnu.org
@ 2023-09-17  9:09 ` pinskia at gcc dot gnu.org
  2023-09-17 21:41 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-17  9:09 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|ICE on valid code at        |[14 Regression] ICE on
                   |-O{s,2,3}: Segmentation     |valid code at -O{s,2,3}:
                   |fault signal terminated     |Segmentation fault signal
                   |program cc1                 |terminated program cc1
   Target Milestone|---                         |14.0

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

* [Bug tree-optimization/111442] [14 Regression] ICE on valid code at -O{s,2,3}: Segmentation fault signal terminated program cc1
  2023-09-17  8:55 [Bug tree-optimization/111442] New: ICE on valid code at -O{s,2,3}: Segmentation fault signal terminated program cc1 zhendong.su at inf dot ethz.ch
                   ` (3 preceding siblings ...)
  2023-09-17  9:09 ` [Bug tree-optimization/111442] [14 Regression] " pinskia at gcc dot gnu.org
@ 2023-09-17 21:41 ` pinskia at gcc dot gnu.org
  2023-09-18 20:46 ` cvs-commit at gcc dot gnu.org
  2023-09-18 20:46 ` pinskia at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-17 21:41 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |https://gcc.gnu.org/piperma
                   |                            |il/gcc-patches/2023-Septemb
                   |                            |er/630695.html
           Keywords|                            |patch

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Patch posted:
https://gcc.gnu.org/pipermail/gcc-patches/2023-September/630695.html

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

* [Bug tree-optimization/111442] [14 Regression] ICE on valid code at -O{s,2,3}: Segmentation fault signal terminated program cc1
  2023-09-17  8:55 [Bug tree-optimization/111442] New: ICE on valid code at -O{s,2,3}: Segmentation fault signal terminated program cc1 zhendong.su at inf dot ethz.ch
                   ` (4 preceding siblings ...)
  2023-09-17 21:41 ` pinskia at gcc dot gnu.org
@ 2023-09-18 20:46 ` cvs-commit at gcc dot gnu.org
  2023-09-18 20:46 ` pinskia at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-09-18 20:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <pinskia@gcc.gnu.org>:

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

commit r14-4114-g7ea501d3ea698e1c845fb61e3487f4cd949e6253
Author: Andrew Pinski <apinski@marvell.com>
Date:   Sun Sep 17 11:20:36 2023 -0700

    MATCH: Make zero_one_valued_p non-recursive fully

    So it turns out VN can't handle any kind of recursion for match. In this
    case we have `b = a & -1` and we try to match a as being zero_one_valued_p
    and VN returns b as being the value and we just go into an infinite loop at
    this point.

    OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

    Note genmatch should warn (or error out) if this gets detected so I filed
PR 111446
    which I will be looking into next week or the week after so we don't run
into
    this issue again.

            PR tree-optimization/111442

    gcc/ChangeLog:

            * match.pd (zero_one_valued_p): Have the bit_and match not be
            recursive.

    gcc/testsuite/ChangeLog:

            * gcc.c-torture/compile/pr111442-1.c: New test.

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

* [Bug tree-optimization/111442] [14 Regression] ICE on valid code at -O{s,2,3}: Segmentation fault signal terminated program cc1
  2023-09-17  8:55 [Bug tree-optimization/111442] New: ICE on valid code at -O{s,2,3}: Segmentation fault signal terminated program cc1 zhendong.su at inf dot ethz.ch
                   ` (5 preceding siblings ...)
  2023-09-18 20:46 ` cvs-commit at gcc dot gnu.org
@ 2023-09-18 20:46 ` pinskia at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-18 20:46 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2023-09-18 20:46 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-17  8:55 [Bug tree-optimization/111442] New: ICE on valid code at -O{s,2,3}: Segmentation fault signal terminated program cc1 zhendong.su at inf dot ethz.ch
2023-09-17  9:02 ` [Bug tree-optimization/111442] " pinskia at gcc dot gnu.org
2023-09-17  9:04 ` pinskia at gcc dot gnu.org
2023-09-17  9:05 ` pinskia at gcc dot gnu.org
2023-09-17  9:09 ` [Bug tree-optimization/111442] [14 Regression] " pinskia at gcc dot gnu.org
2023-09-17 21:41 ` pinskia at gcc dot gnu.org
2023-09-18 20:46 ` cvs-commit at gcc dot gnu.org
2023-09-18 20:46 ` pinskia 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).