aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vrp.c
diff options
context:
space:
mode:
authorMartin Sebor <msebor@redhat.com>2018-07-31 16:47:39 +0000
committerMartin Sebor <msebor@gcc.gnu.org>2018-07-31 10:47:39 -0600
commit8e73e6140d876c6ae8e1d67bb4dcd2e47c7914ec (patch)
tree01608338e335ffb796c5c8b825b244aafb00c554 /gcc/tree-vrp.c
parent4de3a1e16a86d23dec7cea6e5f7f710cf5769e71 (diff)
downloadgcc-8e73e6140d876c6ae8e1d67bb4dcd2e47c7914ec.zip
gcc-8e73e6140d876c6ae8e1d67bb4dcd2e47c7914ec.tar.gz
gcc-8e73e6140d876c6ae8e1d67bb4dcd2e47c7914ec.tar.bz2
PR tree-optimization/86741 - ICE in -Warray-bounds indexing into an object of incomplete type
gcc/ChangeLog: PR tree-optimization/86741 * tree-vrp.c (vrp_prop::check_mem_ref): Avoid incomplete types. gcc/testsuite/ChangeLog: PR tree-optimization/86741 * gcc.dg/Warray-bounds-33.c: New test. From-SVN: r263166
Diffstat (limited to 'gcc/tree-vrp.c')
-rw-r--r--gcc/tree-vrp.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 7ab8898..1944ae4 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -5048,9 +5048,12 @@ vrp_prop::check_mem_ref (location_t location, tree ref, bool ignore_off_by_one)
a reference/subscript via a pointer to an object that is not
an element of an array. References to members of structs and
unions are excluded because MEM_REF doesn't make it possible
- to identify the member where the reference originated. */
+ to identify the member where the reference originated.
+ Incomplete types are excluded as well because their size is
+ not known. */
tree reftype = TREE_TYPE (arg);
if (POINTER_TYPE_P (reftype)
+ || !COMPLETE_TYPE_P (reftype)
|| RECORD_OR_UNION_TYPE_P (reftype))
return;