aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2021-11-02 09:58:00 +0100
committerRichard Biener <rguenther@suse.de>2021-11-02 14:17:08 +0100
commit268b43d2592c196ea101946d7063156a914b2713 (patch)
tree3cdfc73d8c35a206cc4e7aea218f84bb0412ac60 /gcc/fold-const.c
parentd5c6604f42034e36b149f899c5ddb93025a645b4 (diff)
downloadgcc-268b43d2592c196ea101946d7063156a914b2713.zip
gcc-268b43d2592c196ea101946d7063156a914b2713.tar.gz
gcc-268b43d2592c196ea101946d7063156a914b2713.tar.bz2
middle-end/103038 - avoid ICE with -ftrivial-auto-var-init=pattern
This avoids ICEing with expanding a VIEW_CONVERT_EXRP of a SSA name on the LHS by making sure we can native-interpret OFFSET_TYPE and by never building such a LHS but instead view-converting the RHS for SSA LHS. 2021-11-02 Richard Biener <rguenther@suse.de> PR middle-end/103038 * fold-const.c (native_interpret_expr): Handle OFFSET_TYPE. (can_native_interpret_type_p): Likewise. * internal-fn.c (expand_DEFERRED_INIT): View-convert the RHS if the LHS is an SSA name. * g++.dg/pr103038.C: New testcase.
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 54f91f0..2d3ba07 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -8791,6 +8791,7 @@ native_interpret_expr (tree type, const unsigned char *ptr, int len)
case BOOLEAN_TYPE:
case POINTER_TYPE:
case REFERENCE_TYPE:
+ case OFFSET_TYPE:
return native_interpret_int (type, ptr, len);
case REAL_TYPE:
@@ -8827,6 +8828,7 @@ can_native_interpret_type_p (tree type)
case REAL_TYPE:
case COMPLEX_TYPE:
case VECTOR_TYPE:
+ case OFFSET_TYPE:
return true;
default:
return false;