public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/101162] New: [12 Regression] ICE (verify_gimple failed) for switch returning pointer-to-members
@ 2021-06-22  8:40 reichelt at gcc dot gnu.org
  2021-06-22  8:45 ` [Bug c++/101162] " pinskia at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: reichelt at gcc dot gnu.org @ 2021-06-22  8:40 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101162
           Summary: [12 Regression] ICE (verify_gimple failed) for switch
                    returning pointer-to-members
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: reichelt at gcc dot gnu.org
  Target Milestone: ---

The following valid testcase triggers an ICE on trunk when compiled with "-O2":

===================================
struct A
{
  int i1, i2, i3, i4, i5, i6;
};

int A::* foo(int i)
{
  switch (i)
  {
    case 1: return &A::i1;
    case 2: return &A::i2;
    case 3: return &A::i3;
    case 4: return &A::i4;
    case 5: return &A::i5;
    case 6: return &A::i6;
  }

  return 0;
}
===================================

bug.cc: In function 'int A::* foo(int)':
bug.cc:19:1: error: invalid types for 'mult_expr'
   19 | }
      | ^
<<< Unknown tree: offset_type >>>
<<< Unknown tree: offset_type >>>
<<< Unknown tree: offset_type >>>
_7 = 4 * _6;
during GIMPLE pass: switchconv
bug.cc:19:1: internal compiler error: verify_gimple failed
0x11025aa verify_gimple_in_cfg(function*, bool)
        ../../gcc/gcc/tree-cfg.c:5531
0xfe1587 execute_function_todo
        ../../gcc/gcc/passes.c:2042
0xfe1fab execute_todo
        ../../gcc/gcc/passes.c:2096
Please submit a full bug report, [etc.]

This regression was introduced between 2021-06-14 and 2021-06-21.

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

* [Bug c++/101162] [12 Regression] ICE (verify_gimple failed) for switch returning pointer-to-members
  2021-06-22  8:40 [Bug c++/101162] New: [12 Regression] ICE (verify_gimple failed) for switch returning pointer-to-members reichelt at gcc dot gnu.org
@ 2021-06-22  8:45 ` pinskia at gcc dot gnu.org
  2021-06-22  8:47 ` [Bug tree-optimization/101162] " pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-06-22  8:45 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.0
                 CC|                            |pinskia at gcc dot gnu.org

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

* [Bug tree-optimization/101162] [12 Regression] ICE (verify_gimple failed) for switch returning pointer-to-members
  2021-06-22  8:40 [Bug c++/101162] New: [12 Regression] ICE (verify_gimple failed) for switch returning pointer-to-members reichelt at gcc dot gnu.org
  2021-06-22  8:45 ` [Bug c++/101162] " pinskia at gcc dot gnu.org
@ 2021-06-22  8:47 ` pinskia at gcc dot gnu.org
  2021-06-22  9:07 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-06-22  8:47 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c++                         |tree-optimization

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
>This regression was introduced between 2021-06-14 and 2021-06-21.

I added the extra checks during that time period.
But the problem was latent before hand.  Multiplying on offset_type does not
make sense.

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

* [Bug tree-optimization/101162] [12 Regression] ICE (verify_gimple failed) for switch returning pointer-to-members
  2021-06-22  8:40 [Bug c++/101162] New: [12 Regression] ICE (verify_gimple failed) for switch returning pointer-to-members reichelt at gcc dot gnu.org
  2021-06-22  8:45 ` [Bug c++/101162] " pinskia at gcc dot gnu.org
  2021-06-22  8:47 ` [Bug tree-optimization/101162] " pinskia at gcc dot gnu.org
@ 2021-06-22  9:07 ` jakub at gcc dot gnu.org
  2021-06-22  9:11 ` [Bug tree-optimization/101162] [12 Regression] ICE (verify_gimple failed) for switch returning pointer-to-members since r12-1608 pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-06-22  9:07 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |jakub at gcc dot gnu.org
                 CC|                            |jakub at gcc dot gnu.org
   Last reconfirmed|                            |2021-06-22

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

* [Bug tree-optimization/101162] [12 Regression] ICE (verify_gimple failed) for switch returning pointer-to-members since r12-1608
  2021-06-22  8:40 [Bug c++/101162] New: [12 Regression] ICE (verify_gimple failed) for switch returning pointer-to-members reichelt at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-06-22  9:07 ` jakub at gcc dot gnu.org
@ 2021-06-22  9:11 ` pinskia at gcc dot gnu.org
  2021-06-22  9:12 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-06-22  9:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I was just about to assign this to myself as I had just came up with a fix:
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 85e90f42b8e..5e4bdeace1e 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -5361,7 +5361,7 @@ range_check_type (tree etype)
       else
        return NULL_TREE;
     }
-  else if (POINTER_TYPE_P (etype))
+  else if (POINTER_TYPE_P (etype) || TREE_CODE (etype) == OFFSET_TYPE)
     etype = unsigned_type_for (etype);
   return etype;
 }

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

* [Bug tree-optimization/101162] [12 Regression] ICE (verify_gimple failed) for switch returning pointer-to-members since r12-1608
  2021-06-22  8:40 [Bug c++/101162] New: [12 Regression] ICE (verify_gimple failed) for switch returning pointer-to-members reichelt at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2021-06-22  9:11 ` [Bug tree-optimization/101162] [12 Regression] ICE (verify_gimple failed) for switch returning pointer-to-members since r12-1608 pinskia at gcc dot gnu.org
@ 2021-06-22  9:12 ` jakub at gcc dot gnu.org
  2021-06-22 12:30 ` marxin at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-06-22  9:12 UTC (permalink / raw)
  To: gcc-bugs

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

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

Untested fix.

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

* [Bug tree-optimization/101162] [12 Regression] ICE (verify_gimple failed) for switch returning pointer-to-members since r12-1608
  2021-06-22  8:40 [Bug c++/101162] New: [12 Regression] ICE (verify_gimple failed) for switch returning pointer-to-members reichelt at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2021-06-22  9:12 ` jakub at gcc dot gnu.org
@ 2021-06-22 12:30 ` marxin at gcc dot gnu.org
  2021-06-22 13:23 ` cvs-commit at gcc dot gnu.org
  2021-07-18 10:41 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-06-22 12:30 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #4 from Martin Liška <marxin at gcc dot gnu.org> ---
Just for the record, started with r12-1608-g2f1686ff70b25fce.

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

* [Bug tree-optimization/101162] [12 Regression] ICE (verify_gimple failed) for switch returning pointer-to-members since r12-1608
  2021-06-22  8:40 [Bug c++/101162] New: [12 Regression] ICE (verify_gimple failed) for switch returning pointer-to-members reichelt at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2021-06-22 12:30 ` marxin at gcc dot gnu.org
@ 2021-06-22 13:23 ` cvs-commit at gcc dot gnu.org
  2021-07-18 10:41 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-22 13:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 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:92d9c9e705f039f42734139c233202888d2bf01b

commit r12-1726-g92d9c9e705f039f42734139c233202888d2bf01b
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Jun 22 15:20:14 2021 +0200

    fold-const: Return corresponding integral type for OFFSET_TYPE in
range_check_type [PR101162]

    Andrew's recent r12-1608-g2f1686ff70b25fceb04ca2ffc0a450fb682913ef change
    to fail verification on various unary and binary operations with
OFFSET_TYPE
    revealed that e.g. switchconv happily performs multiplications and
additions
    in OFFSET_TYPE.

    2021-06-22  Jakub Jelinek  <jakub@redhat.com>
                Andrew Pinski  <apinski@marvell.com>

            PR tree-optimization/101162
            * fold-const.c (range_check_type): Handle OFFSET_TYPE like pointer
            types.

            * g++.dg/opt/pr101162.C: New test.

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

* [Bug tree-optimization/101162] [12 Regression] ICE (verify_gimple failed) for switch returning pointer-to-members since r12-1608
  2021-06-22  8:40 [Bug c++/101162] New: [12 Regression] ICE (verify_gimple failed) for switch returning pointer-to-members reichelt at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2021-06-22 13:23 ` cvs-commit at gcc dot gnu.org
@ 2021-07-18 10:41 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-07-18 10:41 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

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

end of thread, other threads:[~2021-07-18 10:41 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-22  8:40 [Bug c++/101162] New: [12 Regression] ICE (verify_gimple failed) for switch returning pointer-to-members reichelt at gcc dot gnu.org
2021-06-22  8:45 ` [Bug c++/101162] " pinskia at gcc dot gnu.org
2021-06-22  8:47 ` [Bug tree-optimization/101162] " pinskia at gcc dot gnu.org
2021-06-22  9:07 ` jakub at gcc dot gnu.org
2021-06-22  9:11 ` [Bug tree-optimization/101162] [12 Regression] ICE (verify_gimple failed) for switch returning pointer-to-members since r12-1608 pinskia at gcc dot gnu.org
2021-06-22  9:12 ` jakub at gcc dot gnu.org
2021-06-22 12:30 ` marxin at gcc dot gnu.org
2021-06-22 13:23 ` cvs-commit at gcc dot gnu.org
2021-07-18 10:41 ` 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).