public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/111414] New: ICE in verify_gimple failed since r14-3719-gb34f3736356
@ 2023-09-14 10:57 shaohua.li at inf dot ethz.ch
  2023-09-14 12:06 ` [Bug tree-optimization/111414] [14 Regression] " rguenth at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: shaohua.li at inf dot ethz.ch @ 2023-09-14 10:57 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111414
           Summary: ICE in verify_gimple failed since
                    r14-3719-gb34f3736356
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: shaohua.li at inf dot ethz.ch
  Target Milestone: ---

gcc at -O3 crashes on the following testcase.

Bisected to r14-3719-gb34f3736356

Compiler explorer: https://godbolt.org/z/xeh66znqd

$ cat a.c
int a, b, c, d, e, f, g;
int h(int i) { return b >= 2 ?: i >> b; }
void j() {
  int k;
  int *l = &c;
  for (; d; d++) {
    g = h(0 != j);
    f = g >> a;
    k = f << 7;
    e = k > 5 ? k : 0;
    *l ^= e;
  }
}
int main() {}
$
$ gcc -O2 a.c
a.c: In function 'j':
a.c:3:6: error: non-vector operands in vector comparison
    3 | void j() {
      |      ^
int
int
mask__21.44_181 = a.4_1 == 0;
during GIMPLE pass: vect
a,c:3:6: internal compiler error: verify_gimple failed
0x2206f8e internal_error(char const*, ...)
        ???:0
0x1129df9 verify_gimple_in_cfg(function*, bool, bool)
        ???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1

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

* [Bug tree-optimization/111414] [14 Regression] ICE in verify_gimple failed since r14-3719-gb34f3736356
  2023-09-14 10:57 [Bug tree-optimization/111414] New: ICE in verify_gimple failed since r14-3719-gb34f3736356 shaohua.li at inf dot ethz.ch
@ 2023-09-14 12:06 ` rguenth at gcc dot gnu.org
  2023-09-14 14:07 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-09-14 12:06 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu.org
            Summary|ICE in verify_gimple failed |[14 Regression] ICE in
                   |since r14-3719-gb34f3736356 |verify_gimple failed since
                   |                            |r14-3719-gb34f3736356
   Target Milestone|---                         |14.0

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

* [Bug tree-optimization/111414] [14 Regression] ICE in verify_gimple failed since r14-3719-gb34f3736356
  2023-09-14 10:57 [Bug tree-optimization/111414] New: ICE in verify_gimple failed since r14-3719-gb34f3736356 shaohua.li at inf dot ethz.ch
  2023-09-14 12:06 ` [Bug tree-optimization/111414] [14 Regression] " rguenth at gcc dot gnu.org
@ 2023-09-14 14:07 ` pinskia at gcc dot gnu.org
  2023-09-14 14:38 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-14 14:07 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I see what I did wrong.
Looks like I need to check to make sure the integer_onep is a non vector.

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

* [Bug tree-optimization/111414] [14 Regression] ICE in verify_gimple failed since r14-3719-gb34f3736356
  2023-09-14 10:57 [Bug tree-optimization/111414] New: ICE in verify_gimple failed since r14-3719-gb34f3736356 shaohua.li at inf dot ethz.ch
  2023-09-14 12:06 ` [Bug tree-optimization/111414] [14 Regression] " rguenth at gcc dot gnu.org
  2023-09-14 14:07 ` pinskia at gcc dot gnu.org
@ 2023-09-14 14:38 ` pinskia at gcc dot gnu.org
  2023-09-14 17:49 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-14 14:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #1)
> I see what I did wrong.
> Looks like I need to check to make sure the integer_onep is a non vector.

That is:
diff --git a/gcc/match.pd b/gcc/match.pd
index 07ffd831132..97db0eb5f25 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -4206,8 +4206,9 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
  /* `(1 >> X) != 0` -> `X == 0` */
  /* `(1 >> X) == 0` -> `X != 0` */
  (simplify
-  (cmp (rshift integer_onep @0) integer_zerop)
-   (icmp @0 { build_zero_cst (TREE_TYPE (@0)); })))
+  (cmp (rshift integer_onep@1 @0) integer_zerop)
+   (if (INTEGRAL_TYPE_P (TREE_TYPE (@1)))
+    (icmp @0 { build_zero_cst (TREE_TYPE (@0)); }))))

 /* (CST1 << A) == CST2 -> A == ctz (CST2) - ctz (CST1)
    (CST1 << A) != CST2 -> A != ctz (CST2) - ctz (CST1)

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

* [Bug tree-optimization/111414] [14 Regression] ICE in verify_gimple failed since r14-3719-gb34f3736356
  2023-09-14 10:57 [Bug tree-optimization/111414] New: ICE in verify_gimple failed since r14-3719-gb34f3736356 shaohua.li at inf dot ethz.ch
                   ` (2 preceding siblings ...)
  2023-09-14 14:38 ` pinskia at gcc dot gnu.org
@ 2023-09-14 17:49 ` pinskia at gcc dot gnu.org
  2023-09-15 14:27 ` cvs-commit at gcc dot gnu.org
  2023-09-15 14:28 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-14 17:49 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

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

* [Bug tree-optimization/111414] [14 Regression] ICE in verify_gimple failed since r14-3719-gb34f3736356
  2023-09-14 10:57 [Bug tree-optimization/111414] New: ICE in verify_gimple failed since r14-3719-gb34f3736356 shaohua.li at inf dot ethz.ch
                   ` (3 preceding siblings ...)
  2023-09-14 17:49 ` pinskia at gcc dot gnu.org
@ 2023-09-15 14:27 ` cvs-commit at gcc dot gnu.org
  2023-09-15 14:28 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-09-15 14:27 UTC (permalink / raw)
  To: gcc-bugs

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

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

commit r14-4037-gba4c1f2bfc9ec063188b39d0281fae04c57b1416
Author: Andrew Pinski <apinski@marvell.com>
Date:   Thu Sep 14 07:39:31 2023 -0700

    MATCH: Fix `(1 >> X) != 0` pattern for vector types

    I had missed that integer_onep can match vector types with uniform constant
of `1`.
    This means the shifter could be an scalar type and then doing a comparison
against `0`
    would be an invalid transformation.
    This fixes the problem by adding a check for the type of the integer_onep
to make
    sure it is a INTEGRAL_TYPE_P (which does not match a vector type).

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

            PR tree-optimization/111414

    gcc/ChangeLog:

            * match.pd (`(1 >> X) != 0`): Check to see if
            the integer_onep was an integral type (not a vector type).

    gcc/testsuite/ChangeLog:

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

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

* [Bug tree-optimization/111414] [14 Regression] ICE in verify_gimple failed since r14-3719-gb34f3736356
  2023-09-14 10:57 [Bug tree-optimization/111414] New: ICE in verify_gimple failed since r14-3719-gb34f3736356 shaohua.li at inf dot ethz.ch
                   ` (4 preceding siblings ...)
  2023-09-15 14:27 ` cvs-commit at gcc dot gnu.org
@ 2023-09-15 14:28 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-15 14:28 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

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

end of thread, other threads:[~2023-09-15 14:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-14 10:57 [Bug tree-optimization/111414] New: ICE in verify_gimple failed since r14-3719-gb34f3736356 shaohua.li at inf dot ethz.ch
2023-09-14 12:06 ` [Bug tree-optimization/111414] [14 Regression] " rguenth at gcc dot gnu.org
2023-09-14 14:07 ` pinskia at gcc dot gnu.org
2023-09-14 14:38 ` pinskia at gcc dot gnu.org
2023-09-14 17:49 ` pinskia at gcc dot gnu.org
2023-09-15 14:27 ` cvs-commit at gcc dot gnu.org
2023-09-15 14:28 ` 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).