https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66377
--- Comment #2 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Tue, Jun 02, 2015 at 06:41:53PM +0000, kargl at gcc dot gnu.org wrote:
>
> Thus, there is something about the "arrayness" of x in
> the original testcase that matters. Off-by-one maybe?
>
There certainly is an appearance of off-by-one.
For the original testcase, if I use -fdump-tree-original
and remove the unessential portions of the dump, I get
another ()
{
static integer(kind=4) x1 [value-expr: constant.eq.1.x1];
static integer(kind=4) x[2] [value-expr: constant.eq.1.x];
}
test ()
{
static integer(kind=4) x1 [value-expr: constant.eq.0.x1];
static integer(kind=4) x2 [value-expr: constant.eq.0.x2];
static integer(kind=4) x[2] [value-expr: constant.eq.0.x];
}
If I change
subroutine another()
use constant, only : x1
if (x1 /= 1) call abort
end subroutine
to
subroutine another()
use constant, only : x1,x
if (x1 /= 1) call abort
end subroutine
everything works. The -fdump-tree-original then gives
another ()
{
static integer(kind=4) x1 [value-expr: constant.eq.0.x1];
static integer(kind=4) x2 [value-expr: constant.eq.0.x2];
static integer(kind=4) x[2] [value-expr: constant.eq.0.x];
}
with the same reduced test(). I haven't checked on what
constant.eq.0.x versus constant.eq.1.x means. Who's our
equivalence guru?