This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/66377] [F95] Wrong-code with equivalenced array in module
- From: "sgk at troutmask dot apl.washington.edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 02 Jun 2015 23:37:27 +0000
- Subject: [Bug fortran/66377] [F95] Wrong-code with equivalenced array in module
- Auto-submitted: auto-generated
- References: <bug-66377-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66377
--- Comment #3 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Tue, Jun 02, 2015 at 07:04:21PM +0000, sgk at troutmask dot
apl.washington.edu wrote:
> 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];
> }
>
OK. Digging a little deeper. The problem is in
module.c (load_equiv). There is a section of code
(lines 4526-4534) that tries to avoid loading unused
equivalenced symbols. If those lines are commented
out, the original code works.
In looking at these lines and neighboring code, it looks
like an singly-linked list is constructed from the
equivalence in the module file, but it is compressed due
to the missing (ie unused symbols). So, it still suspect
a counting problem.