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/33298] Wrong code for SPREAD on zero sized dummy arguments



------- Comment #4 from toon at moene dot indiv dot nluug dot nl  2007-09-04 10:15 -------
Second try, now with interface and using zero sized arrays:

$ cat spread.f
      INTERFACE SUB
      SUBROUTINE SUB(P,Q)
      REAL, INTENT(OUT) :: P(:,:)
      REAL, INTENT(IN)  :: Q(:)
      END SUBROUTINE
      END INTERFACE
      REAL, ALLOCATABLE :: X(:,:), Y(:)
      ALLOCATE(X(0,3))
      ALLOCATE(Y(0))
!     Y=[1.,2.]
      CALL SUB(X,Y)
      DO I = 1, 3
         PRINT*,X(:,I)
      ENDDO
      END
      SUBROUTINE SUB(A,B)
      REAL, INTENT(OUT) :: A(:,:)
      REAL, INTENT(IN)  :: B(:)
      A(:,:) = SPREAD(B(:),2,SIZE(A,2))
      END

$ /usr/snp/bin/gfortran -g -O2 -static -fbacktrace spread.f
$ ./a.out

Program received signal 11 (SIGSEGV): Segmentation fault.

Backtrace for this error:
  + function __restore_rt (0x4185D0)
    from file libgcc2.c
  + function memcpy (0x432D85)
  + function spread_internal (0x40A50F)
    at line 145 of file spread_generic.c
  + function sub_ (0x400404)
    at line 16 of file spread.f
  + in the main program
    at line 11 of file spread.f
  + function __libc_start_main (0x4138E7)


-- 

toon at moene dot indiv dot nluug dot nl changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |
            Summary|Wrong code for SPREAD on    |Wrong code for SPREAD on
                   |dummy arguments             |zero sized dummy arguments


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


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