[Bug tree-optimization/101162] [12 Regression] ICE (verify_gimple failed) for switch returning pointer-to-members since r12-1608

2021-07-18 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101162

Jakub Jelinek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #6 from Jakub Jelinek  ---
Fixed.

[Bug tree-optimization/101162] [12 Regression] ICE (verify_gimple failed) for switch returning pointer-to-members since r12-1608

2021-06-22 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101162

--- Comment #5 from CVS Commits  ---
The master branch has been updated by Jakub Jelinek :

https://gcc.gnu.org/g:92d9c9e705f039f42734139c233202888d2bf01b

commit r12-1726-g92d9c9e705f039f42734139c233202888d2bf01b
Author: Jakub Jelinek 
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  
Andrew Pinski  

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

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

[Bug tree-optimization/101162] [12 Regression] ICE (verify_gimple failed) for switch returning pointer-to-members since r12-1608

2021-06-22 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101162

Martin Liška  changed:

   What|Removed |Added

 CC||marxin at gcc dot gnu.org

--- Comment #4 from Martin Liška  ---
Just for the record, started with r12-1608-g2f1686ff70b25fce.

[Bug tree-optimization/101162] [12 Regression] ICE (verify_gimple failed) for switch returning pointer-to-members since r12-1608

2021-06-22 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101162

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

Untested fix.

[Bug tree-optimization/101162] [12 Regression] ICE (verify_gimple failed) for switch returning pointer-to-members since r12-1608

2021-06-22 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101162

--- Comment #2 from Andrew Pinski  ---
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;
 }