diff options
author | Martin Sebor <msebor@redhat.com> | 2018-05-22 15:22:16 +0000 |
---|---|---|
committer | Martin Sebor <msebor@gcc.gnu.org> | 2018-05-22 09:22:16 -0600 |
commit | 9f855c10d6be14e4ac73fc55625d4799ca939cf8 (patch) | |
tree | 26f442f9bb35bd3f8a13db2039ee7a8396748413 /gcc/gimple-ssa-warn-restrict.c | |
parent | f141b40a181eea1546d0b6930c4eb386cd28241f (diff) | |
download | gcc-9f855c10d6be14e4ac73fc55625d4799ca939cf8.zip gcc-9f855c10d6be14e4ac73fc55625d4799ca939cf8.tar.gz gcc-9f855c10d6be14e4ac73fc55625d4799ca939cf8.tar.bz2 |
PR tree-optimization/85826 - ICE in gimple-ssa-warn-restruct on
PR tree-optimization/85826 - ICE in gimple-ssa-warn-restruct on
a variable-length struct
gcc/ChangeLog:
PR tree-optimization/85826
* gimple-ssa-warn-restrict.c (builtin_memref::builtin_memref): Avoid
assuming that a DECL necesarily has a constant size.
gcc/testsuite/ChangeLog:
PR tree-optimization/85826
* gcc.dg/Wrestrict-17.c: New test.
From-SVN: r260537
Diffstat (limited to 'gcc/gimple-ssa-warn-restrict.c')
-rw-r--r-- | gcc/gimple-ssa-warn-restrict.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/gimple-ssa-warn-restrict.c b/gcc/gimple-ssa-warn-restrict.c index 9f23f57..637ed3c 100644 --- a/gcc/gimple-ssa-warn-restrict.c +++ b/gcc/gimple-ssa-warn-restrict.c @@ -278,7 +278,10 @@ builtin_memref::builtin_memref (tree expr, tree size) && array_at_struct_end_p (ref)) ; /* Use the maximum possible offset for last member arrays. */ else if (tree basesize = TYPE_SIZE_UNIT (basetype)) - maxoff = wi::to_offset (basesize); + if (TREE_CODE (basesize) == INTEGER_CST) + /* Size could be non-constant for a variable-length type such + as a struct with a VLA member (a GCC extension). */ + maxoff = wi::to_offset (basesize); if (offrange[0] >= 0) { |