aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-chkp.c
diff options
context:
space:
mode:
authorAlexander Ivchenko <alexander.ivchenko@intel.com>2016-12-27 13:31:43 +0000
committerAlexander Ivchenko <aivchenk@gcc.gnu.org>2016-12-27 13:31:43 +0000
commit8ba4f506395ff50be7ecf788734676c9f4cfd200 (patch)
treef1e12d47165d6fd6b71f33d3c80dcef9aa8c9325 /gcc/tree-chkp.c
parent5735741b128fecd49f45170b8a85e12ee7771371 (diff)
downloadgcc-8ba4f506395ff50be7ecf788734676c9f4cfd200.zip
gcc-8ba4f506395ff50be7ecf788734676c9f4cfd200.tar.gz
gcc-8ba4f506395ff50be7ecf788734676c9f4cfd200.tar.bz2
c.opt (flag_chkp_flexible_struct_trailing_arrays): Add new option.
2016-12-27 Alexander Ivchenko <alexander.ivchenko@intel.com> * c-family/c.opt (flag_chkp_flexible_struct_trailing_arrays): Add new option. (fchkp-narrow-to-innermost-array): Fix typo. * doc/cpp.texi (flag_chkp_flexible_struct_trailing_arrays): Ditto. * tree-chkp.c (chkp_may_narrow_to_field ): Forbid narrowing when flag_chkp_flexible_struct_trailing_arrays is used and the field is the last array field in the structure. 2016-12-27 Alexander Ivchenko <alexander.ivchenko@intel.com> * gcc.target/i386/mpx/vla-trailing-1-lbv.c: New test. * gcc.target/i386/mpx/vla-trailing-1-nov.c: Ditto. * gcc.target/i386/mpx/vla-trailing-1-ubv.c: Ditto. From-SVN: r243936
Diffstat (limited to 'gcc/tree-chkp.c')
-rw-r--r--gcc/tree-chkp.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/tree-chkp.c b/gcc/tree-chkp.c
index 2769682..6c7862c 100644
--- a/gcc/tree-chkp.c
+++ b/gcc/tree-chkp.c
@@ -3272,6 +3272,9 @@ chkp_may_narrow_to_field (tree field)
{
return DECL_SIZE (field) && TREE_CODE (DECL_SIZE (field)) == INTEGER_CST
&& tree_to_uhwi (DECL_SIZE (field)) != 0
+ && !(flag_chkp_flexible_struct_trailing_arrays
+ && TREE_CODE(TREE_TYPE(field)) == ARRAY_TYPE
+ && !DECL_CHAIN (field))
&& (!DECL_FIELD_OFFSET (field)
|| TREE_CODE (DECL_FIELD_OFFSET (field)) == INTEGER_CST)
&& (!DECL_FIELD_BIT_OFFSET (field)