diff options
author | Richard Biener <rguenther@suse.de> | 2017-03-27 07:35:44 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2017-03-27 07:35:44 +0000 |
commit | 672d9f8eab3e81bd80098fc5b16eac116eec7658 (patch) | |
tree | fa108e9fd723010fb2d03e321b4ca9fc93c720fd /gcc/gimple-fold.c | |
parent | fbede6f9c01ab4d8dd7648ab681f364c35a983ad (diff) | |
download | gcc-672d9f8eab3e81bd80098fc5b16eac116eec7658.zip gcc-672d9f8eab3e81bd80098fc5b16eac116eec7658.tar.gz gcc-672d9f8eab3e81bd80098fc5b16eac116eec7658.tar.bz2 |
re PR tree-optimization/80171 (ICE (Segmentation fault) with optimization)
2017-03-27 Richard Biener <rguenther@suse.de>
PR middle-end/80171
* gimple-fold.c (fold_ctor_reference): Properly guard against
NULL return value from canonicalize_constructor_val.
* g++.dg/torture/pr80171.C: New testcase.
From-SVN: r246490
Diffstat (limited to 'gcc/gimple-fold.c')
-rw-r--r-- | gcc/gimple-fold.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index 9fd45d1..3094b54 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -6239,9 +6239,12 @@ fold_ctor_reference (tree type, tree ctor, unsigned HOST_WIDE_INT offset, && !compare_tree_int (TYPE_SIZE (TREE_TYPE (ctor)), size)) { ret = canonicalize_constructor_val (unshare_expr (ctor), from_decl); - ret = fold_unary (VIEW_CONVERT_EXPR, type, ret); if (ret) - STRIP_USELESS_TYPE_CONVERSION (ret); + { + ret = fold_unary (VIEW_CONVERT_EXPR, type, ret); + if (ret) + STRIP_USELESS_TYPE_CONVERSION (ret); + } return ret; } /* For constants and byte-aligned/sized reads try to go through |