This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/44265] Link error with reference to parameter array in specification expression


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44265

--- Comment #8 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
While trying to package the patch in comment 5, I stumbled on the following
problem in 32 mode: the following code

MODULE Fruits
  IMPLICIT NONE    
  PRIVATE
  PUBLIC :: Get
CONTAINS
  FUNCTION Get(i) RESULT(s)    
    CHARACTER(len=7), PARAMETER :: names(3) = [  &
        'Apple  ',  &
        'Orange ',  &
        'Mango  ' ];              
    INTEGER, INTENT(IN) :: i
    CHARACTER(LEN_TRIM(names(i))) :: s    
    !****    
    s = names(i)    
    print *, len(s)
  END FUNCTION Get
END MODULE Fruits

PROGRAM WheresThatbLinkingConstantGone
  USE Fruits  
  IMPLICIT NONE
  integer :: i
  i = len(Get(1))
  print *, i
END PROGRAM WheresThatbLinkingConstantGone

outputs at run time

           5
           5

when compiled with -m64, but

           5
           7

when compiled with -m32 (x86_64-apple-darwin15).

The function Get(i) works as expected when used as a contained proc or through
an interface.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]