public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/35474]  New: [4.3/4.4 regression] Reading module file with COMMON and EQUIVALENCE
@ 2008-03-05 15:07 fxcoudert at gcc dot gnu dot org
  2008-03-05 15:11 ` [Bug fortran/35474] " fxcoudert at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2008-03-05 15:07 UTC (permalink / raw)
  To: gcc-bugs

$ cat test_mod.f90 
module h5global
  integer i
  integer j
  common /c/ i
  equivalence (i, j)
  private
end module h5global

program bug
  use h5global
end

$ gfortran -c test_mod.f90
test_mod.f90:10.14:

  use h5global
             1
Internal Error at (1):
free_pi_tree(): Unresolved fixup

$ gfortran -v
Using built-in specs.
Target: i386-apple-darwin8.10.1
Configured with: /tmp/gfortran-20080221/ibin/../gcc/configure
--prefix=/usr/local/gfortran --enable-languages=c,fortran
--with-gmp=/tmp/gfortran-20080221/gfortran_libs --enable-bootstrap
Thread model: posix
gcc version 4.4.0 20080221 (experimental) [trunk revision 132519] (GCC) 


It requires the interaction of common, equivalence and private to make it fail.
This is a 4.3/4.4 regression, and probably a bad one because it can be
triggered by HDF, which is widely used.


-- 
           Summary: [4.3/4.4 regression] Reading module file with COMMON and
                    EQUIVALENCE
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: fxcoudert at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35474


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug fortran/35474] [4.3/4.4 regression] Reading module file with COMMON and EQUIVALENCE
  2008-03-05 15:07 [Bug fortran/35474] New: [4.3/4.4 regression] Reading module file with COMMON and EQUIVALENCE fxcoudert at gcc dot gnu dot org
@ 2008-03-05 15:11 ` fxcoudert at gcc dot gnu dot org
  2008-03-05 15:33 ` burnus at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2008-03-05 15:11 UTC (permalink / raw)
  To: gcc-bugs



-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-03-05 15:08:55
               date|                            |
   Target Milestone|---                         |4.3.1


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35474


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug fortran/35474] [4.3/4.4 regression] Reading module file with COMMON and EQUIVALENCE
  2008-03-05 15:07 [Bug fortran/35474] New: [4.3/4.4 regression] Reading module file with COMMON and EQUIVALENCE fxcoudert at gcc dot gnu dot org
  2008-03-05 15:11 ` [Bug fortran/35474] " fxcoudert at gcc dot gnu dot org
@ 2008-03-05 15:33 ` burnus at gcc dot gnu dot org
  2008-03-06 19:04 ` burnus at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-03-05 15:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2008-03-05 15:32 -------
Possibly caused by the following patch. It fails for me around 30/31 May.

Patch: http://gcc.gnu.org/ml/fortran/2007-05/msg00504.html
r125216 | pault | 2007-05-31 09:45:50 +0200 (Thu, 31 May 2007) | 13 lines
2007-05-31  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/32103
        * module.c (mio_symtree_ref): If an equivalence group member
        is not used, give it a hidden symbol and set the pointer_info.
        (load_equiv): Only free the equivalence if none of the members
        are used.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35474


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug fortran/35474] [4.3/4.4 regression] Reading module file with COMMON and EQUIVALENCE
  2008-03-05 15:07 [Bug fortran/35474] New: [4.3/4.4 regression] Reading module file with COMMON and EQUIVALENCE fxcoudert at gcc dot gnu dot org
  2008-03-05 15:11 ` [Bug fortran/35474] " fxcoudert at gcc dot gnu dot org
  2008-03-05 15:33 ` burnus at gcc dot gnu dot org
@ 2008-03-06 19:04 ` burnus at gcc dot gnu dot org
  2008-03-08 15:11 ` pault at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-03-06 19:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from burnus at gcc dot gnu dot org  2008-03-06 19:03 -------
Paul, do you have an idea?

The ICE happens when reading the .mod for p->u.wsym.sym->name == "i" in
free_pi_tree:
  if (p->fixup != NULL)
    gfc_internal_error ("free_pi_tree(): Unresolved fixup");

I got somehow lost in module.c when trying to track 'fixup'. See comment 1 for
your patch which caused the regression. Still, I cannot see anything which is
obviously wrong.

Just for fun, I set p->fixup = NULL in mio_symtree_ref (see your patch), then
one gets the error that COMMON 'c' does not exist.


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pault at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35474


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug fortran/35474] [4.3/4.4 regression] Reading module file with COMMON and EQUIVALENCE
  2008-03-05 15:07 [Bug fortran/35474] New: [4.3/4.4 regression] Reading module file with COMMON and EQUIVALENCE fxcoudert at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2008-03-06 19:04 ` burnus at gcc dot gnu dot org
@ 2008-03-08 15:11 ` pault at gcc dot gnu dot org
  2008-03-08 20:35 ` pault at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pault at gcc dot gnu dot org @ 2008-03-08 15:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pault at gcc dot gnu dot org  2008-03-08 15:11 -------
(In reply to comment #2)
> Paul, do you have an idea?
> 
> The ICE happens when reading the .mod for p->u.wsym.sym->name == "i" in
> free_pi_tree:
>   if (p->fixup != NULL)
>     gfc_internal_error ("free_pi_tree(): Unresolved fixup");
> 
> I got somehow lost in module.c when trying to track 'fixup'. See comment 1 for
> your patch which caused the regression. Still, I cannot see anything which is
> obviously wrong.
> 
> Just for fun, I set p->fixup = NULL in mio_symtree_ref (see your patch), then
> one gets the error that COMMON 'c' does not exist.
> 

I have started work on this, as a bit of light relief. Doing the latter,
prevents any members from being added to the COMMON and so it fails to come
into existence.

Oddly, reverting my patch for 32103 by hand does not get rid of the fault:) I
am beginning to think that we need fixups for the common block references to
the symbols... Anyway, I'll make a start on it.

Paul


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pault at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2008-03-05 15:08:55         |2008-03-08 15:11:14
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35474


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug fortran/35474] [4.3/4.4 regression] Reading module file with COMMON and EQUIVALENCE
  2008-03-05 15:07 [Bug fortran/35474] New: [4.3/4.4 regression] Reading module file with COMMON and EQUIVALENCE fxcoudert at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2008-03-08 15:11 ` pault at gcc dot gnu dot org
@ 2008-03-08 20:35 ` pault at gcc dot gnu dot org
  2008-03-09 19:40 ` pault at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pault at gcc dot gnu dot org @ 2008-03-08 20:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pault at gcc dot gnu dot org  2008-03-08 20:34 -------
(In reply to comment #3)
> (In reply to comment #2)

> Oddly, reverting my patch for 32103 by hand does not get rid of the fault:) I
> am beginning to think that we need fixups for the common block references to
> the symbols... Anyway, I'll make a start on it.
> 

That turns out to be spot on.  The patch below is going on to regtest in just a
moment.

Paul

Index: gcc/fortran/module.c
===================================================================
*** gcc/fortran/module.c        (revision 132798)
--- gcc/fortran/module.c        (working copy)
*************** mio_symtree_ref (gfc_symtree **stp)
*** 2310,2315 ****
--- 2310,2321 ----
          p->u.rsym.symtree->n.sym = p->u.rsym.sym;
          p->u.rsym.symtree->n.sym->refs++;
          p->u.rsym.referenced = 1;
+
+         /* If the symbol is PRIVATE and in COMMON, load_commons will
+            generate a fixup symbol, which must be associated.  */
+         if (p->fixup)
+           resolve_fixups (p->fixup, p->u.rsym.sym);
+         p->fixup = NULL;
        }

        if (p->type == P_UNKNOWN)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35474


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug fortran/35474] [4.3/4.4 regression] Reading module file with COMMON and EQUIVALENCE
  2008-03-05 15:07 [Bug fortran/35474] New: [4.3/4.4 regression] Reading module file with COMMON and EQUIVALENCE fxcoudert at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2008-03-08 20:35 ` pault at gcc dot gnu dot org
@ 2008-03-09 19:40 ` pault at gcc dot gnu dot org
  2008-03-14 13:20 ` [Bug fortran/35474] [4.3 " pault at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pault at gcc dot gnu dot org @ 2008-03-09 19:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pault at gcc dot gnu dot org  2008-03-09 19:39 -------
Subject: Bug 35474

Author: pault
Date: Sun Mar  9 19:38:51 2008
New Revision: 133063

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=133063
Log:
2008-03-09  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/35474
        * module.c (mio_symtree_ref): After providing a symbol for a
        missing equivalence member, resolve and NULL the fixups.

2008-03-09  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/35474
        * gfortran.dg/module_commons_2.f90 : New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/module_commons_2.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/module.c
    trunk/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35474


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug fortran/35474] [4.3 regression] Reading module file with COMMON and EQUIVALENCE
  2008-03-05 15:07 [Bug fortran/35474] New: [4.3/4.4 regression] Reading module file with COMMON and EQUIVALENCE fxcoudert at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2008-03-09 19:40 ` pault at gcc dot gnu dot org
@ 2008-03-14 13:20 ` pault at gcc dot gnu dot org
  2008-03-14 13:21 ` pault at gcc dot gnu dot org
  2008-03-14 13:22 ` pault at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: pault at gcc dot gnu dot org @ 2008-03-14 13:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pault at gcc dot gnu dot org  2008-03-14 13:19 -------
Subject: Bug 35474

Author: pault
Date: Fri Mar 14 13:18:49 2008
New Revision: 133214

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=133214
Log:
2008-03-14  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/35474
        * module.c (mio_symtree_ref): After providing a symbol for a
        missing equivalence member, resolve and NULL the fixups.

2008-03-14  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/35474
        * gfortran.dg/module_commons_2.f90 : New test.

Added:
    branches/gcc-4_3-branch/gcc/testsuite/gfortran.dg/module_commons_2.f90
Modified:
    branches/gcc-4_3-branch/gcc/fortran/ChangeLog
    branches/gcc-4_3-branch/gcc/fortran/module.c
    branches/gcc-4_3-branch/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35474


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug fortran/35474] [4.3 regression] Reading module file with COMMON and EQUIVALENCE
  2008-03-05 15:07 [Bug fortran/35474] New: [4.3/4.4 regression] Reading module file with COMMON and EQUIVALENCE fxcoudert at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2008-03-14 13:20 ` [Bug fortran/35474] [4.3 " pault at gcc dot gnu dot org
@ 2008-03-14 13:21 ` pault at gcc dot gnu dot org
  2008-03-14 13:22 ` pault at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: pault at gcc dot gnu dot org @ 2008-03-14 13:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pault at gcc dot gnu dot org  2008-03-14 13:20 -------
Fixed on trunk and 4.3

Paul


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35474


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug fortran/35474] [4.3 regression] Reading module file with COMMON and EQUIVALENCE
  2008-03-05 15:07 [Bug fortran/35474] New: [4.3/4.4 regression] Reading module file with COMMON and EQUIVALENCE fxcoudert at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2008-03-14 13:21 ` pault at gcc dot gnu dot org
@ 2008-03-14 13:22 ` pault at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: pault at gcc dot gnu dot org @ 2008-03-14 13:22 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from pault at gcc dot gnu dot org  2008-03-14 13:21 -------
Fixed on trunk and 4.3

Paul


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35474


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2008-03-14 13:22 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-05 15:07 [Bug fortran/35474] New: [4.3/4.4 regression] Reading module file with COMMON and EQUIVALENCE fxcoudert at gcc dot gnu dot org
2008-03-05 15:11 ` [Bug fortran/35474] " fxcoudert at gcc dot gnu dot org
2008-03-05 15:33 ` burnus at gcc dot gnu dot org
2008-03-06 19:04 ` burnus at gcc dot gnu dot org
2008-03-08 15:11 ` pault at gcc dot gnu dot org
2008-03-08 20:35 ` pault at gcc dot gnu dot org
2008-03-09 19:40 ` pault at gcc dot gnu dot org
2008-03-14 13:20 ` [Bug fortran/35474] [4.3 " pault at gcc dot gnu dot org
2008-03-14 13:21 ` pault at gcc dot gnu dot org
2008-03-14 13:22 ` pault at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).