public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/53175] New: Fortran 4.8 undefined reference to a variable in a module
@ 2012-05-01 17:39 michael.a.richmond at nasa dot gov
  2012-05-02  6:00 ` [Bug fortran/53175] [4.8 Regression] link failure for private module variables used in function specification burnus at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: michael.a.richmond at nasa dot gov @ 2012-05-01 17:39 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 53175
           Summary: Fortran 4.8 undefined reference to a variable in a
                    module
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: michael.a.richmond@nasa.gov
              Host: i686-pc-linux-gnu
            Target: i686-pc-linux-gnu
             Build: i686-pc-linux-gnu


This error occurs only in gnu Fortran 4.8 dated 04/08/2012 or later.

If I type "gfortran main.f90 e.f90 s.f90" I get the following error message:

/tmp/ccwf6p16.o: In function `default_settings.1813':
s.f90:(.text+0x1b): undefined reference to `__energy_function_MOD_dim'
/tmp/ccwf6p16.o: In function `set_simplex_options.1815':
s.f90:(.text+0x1cd): undefined reference to `__energy_function_MOD_dim'
collect2: error: ld returned 1 exit status

If I concatenate e.f90 and s.f90 so that they are compiled as a single file,
the error goes away.

Listed below are the contents of these files:

main.f90

PROGRAM main
END PROGRAM main

e.f90

MODULE ENERGY_FUNCTION
   IMPLICIT NONE

   TYPE PARAM
      PRIVATE
         INTEGER :: WHICH_VECTOR
   END TYPE PARAM

   INTEGER, PRIVATE :: DIM
   CONTAINS

      FUNCTION ENERGY_FUNCTION_CURRENT_ARGS()
         INTEGER, DIMENSION(DIM) :: ENERGY_FUNCTION_CURRENT_ARGS
      END FUNCTION ENERGY_FUNCTION_CURRENT_ARGS

      FUNCTION ENERGY_FUNCTION_GET_PARAMS()
         TYPE(PARAM), DIMENSION(DIM) :: ENERGY_FUNCTION_GET_PARAMS
      END FUNCTION ENERGY_FUNCTION_GET_PARAMS   

END MODULE ENERGY_FUNCTION

s.f90

MODULE SEARCH_EMIN
   USE ENERGY_FUNCTION
   IMPLICIT NONE
   CONTAINS
     SUBROUTINE SEARCH_EMIN_START()
         TYPE(PARAM), DIMENSION(:), ALLOCATABLE  :: EF_PARAMS
         DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: START_PARAMETERS

         CALL SET_SIMPLEX_OPTIONS

         CONTAINS
            SUBROUTINE SET_SIMPLEX_OPTIONS
               EF_PARAMS = ENERGY_FUNCTION_GET_PARAMS()
               CALL DEFAULT_SETTINGS
            END SUBROUTINE SET_SIMPLEX_OPTIONS

            SUBROUTINE DEFAULT_SETTINGS
               START_PARAMETERS = ENERGY_FUNCTION_CURRENT_ARGS()
            END SUBROUTINE DEFAULT_SETTINGS

         END SUBROUTINE SEARCH_EMIN_START
END MODULE SEARCH_EMIN


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

end of thread, other threads:[~2012-05-04 19:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-01 17:39 [Bug fortran/53175] New: Fortran 4.8 undefined reference to a variable in a module michael.a.richmond at nasa dot gov
2012-05-02  6:00 ` [Bug fortran/53175] [4.8 Regression] link failure for private module variables used in function specification burnus at gcc dot gnu.org
2012-05-02 17:16 ` burnus at gcc dot gnu.org
2012-05-04 18:54 ` burnus at gcc dot gnu.org
2012-05-04 19:28 ` burnus at gcc dot gnu.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).