diff options
author | Richard Biener <rguenther@suse.de> | 2017-02-28 15:31:30 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2017-02-28 15:31:30 +0000 |
commit | 587240d2494dae65fd67d5bd642a6123ecc89738 (patch) | |
tree | fb6b142c18c450fd08dd5ca487b0e78cf0a099e9 /gcc/fold-const.c | |
parent | 324ff1a07f9ddde87f91acfa7b16a3c24ba6895c (diff) | |
download | gcc-587240d2494dae65fd67d5bd642a6123ecc89738.zip gcc-587240d2494dae65fd67d5bd642a6123ecc89738.tar.gz gcc-587240d2494dae65fd67d5bd642a6123ecc89738.tar.bz2 |
re PR c/79731 (ICE: verify_gimple failed)
2017-02-28 Richard Biener <rguenther@suse.de>
PR middle-end/79731
* fold-const.c (decode_field_reference): Reject out-of-bound
accesses.
* c-c++-common/torture/pr79731.c: New testcase.
From-SVN: r245779
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index ad4770b..3d63836 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -4133,7 +4133,11 @@ decode_field_reference (location_t loc, tree *exp_, HOST_WIDE_INT *pbitsize, punsignedp, preversep, pvolatilep); if ((inner == exp && and_mask == 0) || *pbitsize < 0 || offset != 0 - || TREE_CODE (inner) == PLACEHOLDER_EXPR) + || TREE_CODE (inner) == PLACEHOLDER_EXPR + /* Reject out-of-bound accesses (PR79731). */ + || (! AGGREGATE_TYPE_P (TREE_TYPE (inner)) + && compare_tree_int (TYPE_SIZE (TREE_TYPE (inner)), + *pbitpos + *pbitsize) < 0)) return 0; *exp_ = exp; |