[Bug fortran/69368] [6 Regression] spec2006 test case 416.gamess fails with the g++ 6.0 compiler starting with r232508
rguenther at suse dot de
gcc-bugzilla@gcc.gnu.org
Tue Feb 23 12:00:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69368
--- Comment #72 from rguenther at suse dot de <rguenther at suse dot de> ---
On Tue, 23 Feb 2016, Richard Biener wrote:
> On Tue, 23 Feb 2016, jakub at gcc dot gnu.org wrote:
>
> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69368
> >
> > --- Comment #70 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
> > If you want to go this way, I'd at least key it off DECL_COMMON on the decl.
> > And instead of multiplying max_size by 2 perhaps just add BITS_PER_UNIT?
>
> Works for me.
>
> > And only if it is equal to size?
>
> That's already done.
Patch as posted passed bootstrap & regtest. Adjusted according to
comments but not tested otherwise - please somebody throw at
unpatched 416.gamess.
Index: gcc/tree-dfa.c
===================================================================
--- gcc/tree-dfa.c (revision 233620)
+++ gcc/tree-dfa.c (working copy)
@@ -617,7 +617,20 @@ get_ref_base_and_extent (tree exp, HOST_
if (maxsize == -1
&& DECL_SIZE (exp)
&& TREE_CODE (DECL_SIZE (exp)) == INTEGER_CST)
- maxsize = wi::to_offset (DECL_SIZE (exp)) - bit_offset;
+ {
+ maxsize = wi::to_offset (DECL_SIZE (exp)) - bit_offset;
+ /* If we've seen a variable array ref and the above adjusted
+ maxsize to size make sure the caller doesn't mistake this
+ as a non-variable access by adjusting maxsize slightly.
+ ??? This is strictly pessimizing the case where a
+ one element array is accessed with a variable index
+ which should be a rare case in practice but hits legacy
+ fortran code - see PR69368 for example. */
+ if (seen_variable_array_ref
+ && maxsize == bitsize
+ && DECL_COMMON (exp))
+ maxsize += BITS_PER_UNIT;
+ }
}
else if (CONSTANT_CLASS_P (exp))
{
More information about the Gcc-bugs
mailing list