aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorAlan Lawrence <alan.lawrence@arm.com>2016-03-10 12:19:45 +0000
committerAlan Lawrence <alalaw01@gcc.gnu.org>2016-03-10 12:19:45 +0000
commit71017a7b7837a4eeb1d1c0b2b155c6567f4f3d95 (patch)
tree53a07b60bfba985927686a3c1f4608c6205aaca9 /gcc/tree.c
parent4b2066179084192b65d8e56e51c29bccaef4cfe9 (diff)
downloadgcc-71017a7b7837a4eeb1d1c0b2b155c6567f4f3d95.zip
gcc-71017a7b7837a4eeb1d1c0b2b155c6567f4f3d95.tar.gz
gcc-71017a7b7837a4eeb1d1c0b2b155c6567f4f3d95.tar.bz2
Add -funconstrained-commons to work around PR/69368 (and others) in SPEC2006
gcc/: * common.opt (funconstrained-commons, flag_unconstrained_commons): New. * tree.c (array_at_struct_end_p): Do not limit to size of decl for DECL_COMMONS if flag_unconstrained_commons is set. * tree-dfa.c (get_ref_base_and_extent): Likewise. * doc/invoke.texi (Optimize Options): Add -funconstrained-commons. (funconstrained-commons): Document. gcc/testsuite: * gfortran.dg/unconstrained_commons.f: New. Co-Authored-By: Jakub Jelinek <jakub@redhat.com> From-SVN: r234106
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index b8333d4..7d0cb03 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -12952,8 +12952,10 @@ array_at_struct_end_p (tree ref)
}
/* If the reference is based on a declared entity, the size of the array
- is constrained by its given domain. */
- if (DECL_P (ref))
+ is constrained by its given domain. (Do not trust commons PR/69368). */
+ if (DECL_P (ref)
+ && !(flag_unconstrained_commons
+ && TREE_CODE (ref) == VAR_DECL && DECL_COMMON (ref)))
return false;
return true;