diff options
author | Tom de Vries <tom@codesourcery.com> | 2013-11-27 10:00:30 +0000 |
---|---|---|
committer | Tom de Vries <vries@gcc.gnu.org> | 2013-11-27 10:00:30 +0000 |
commit | e934916c8647d1e343eaacf114fdbff22dfa07a4 (patch) | |
tree | f44d3af2f2bc8bececb8139a727cb2e3d0ec9069 /gcc/fold-const.c | |
parent | ca85aa4ae60f35ae7d490abc7d3e7c68b599eb79 (diff) | |
download | gcc-e934916c8647d1e343eaacf114fdbff22dfa07a4.zip gcc-e934916c8647d1e343eaacf114fdbff22dfa07a4.tar.gz gcc-e934916c8647d1e343eaacf114fdbff22dfa07a4.tar.bz2 |
Don't create out-of-bounds BIT_FIELD_REF.
2013-11-27 Tom de Vries <tom@codesourcery.com>
Marc Glisse <marc.glisse@inria.fr>
PR middle-end/59037
* semantics.c (cxx_fold_indirect_ref): Don't create out-of-bounds
BIT_FIELD_REF.
* fold-const.c (fold_indirect_ref_1): Don't create out-of-bounds
BIT_FIELD_REF.
* gimple-fold.c (gimple_fold_indirect_ref): Same.
* tree-cfg.c (verify_expr): Give error if BIT_FIELD_REF is
out-of-bounds.
* c-c++-common/pr59037.c: New testcase.
Co-Authored-By: Marc Glisse <marc.glisse@inria.fr>
From-SVN: r205438
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 2289ba4..d56b355 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -16720,7 +16720,7 @@ fold_indirect_ref_1 (location_t loc, tree type, tree op0) unsigned HOST_WIDE_INT indexi = offset * BITS_PER_UNIT; tree index = bitsize_int (indexi); - if (offset/part_widthi <= TYPE_VECTOR_SUBPARTS (op00type)) + if (offset / part_widthi < TYPE_VECTOR_SUBPARTS (op00type)) return fold_build3_loc (loc, BIT_FIELD_REF, type, op00, part_width, index); |