This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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]

Strange compiler behaviour.


Compiling the following code on x86_64-unknown-linux-gnu (Debian
testing as of last Saturday):

      PROGRAM test
!
      IMPLICIT NONE
!
      REAL, POINTER             :: r(:)
!
      r => ralloc (10)
      print*,'size r ', SIZE(r,DIM=1)
      print*,'r = ',r
!
      STOP
      CONTAINS
!
      FUNCTION ralloc (n) RESULT (r)
!
      IMPLICIT NONE
!
      INTEGER                :: n      ! array dimension
      REAL, POINTER          :: r(:)   ! allocated array
      INTEGER                :: ierr   ! allocation error flag
!
      ALLOCATE (r(n), STAT=ierr)
      IF (ierr /= 0) THEN
         print*,'Array allocation error'
         STOP
      END IF
!
      r(:) = 0.0
!
      RETURN
      END FUNCTION ralloc

   END PROGRAM test

No problem for me:

$ /usr/snp/bin/gfortran -v -static ralloc.f90
Driving: /usr/snp/bin/gfortran -v -static ralloc.f90 -lgfortranbegin -lgfortran -lm
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../trunk/configure --disable-nls --disable-multilib --prefix=/usr/snp --enable-languages=ada,c,c++,objc,fortran,java,obj-c++
Thread model: posix
gcc version 4.2.0 20051221 (experimental)
 /usr/snp/libexec/gcc/x86_64-unknown-linux-gnu/4.2.0/f951 ralloc.f90 -quiet -dumpbase ralloc.f90 -mtune=k8 -auxbase ralloc -version -o /tmp/ccMmnb9j.s
GNU F95 version 4.2.0 20051221 (experimental) (x86_64-unknown-linux-gnu)
	compiled by GNU C version 4.2.0 20051221 (experimental).
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
 as -V -Qy -o /tmp/ccrnqhDq.o /tmp/ccMmnb9j.s
GNU assembler version 2.16.91 (x86_64-linux-gnu) using BFD version 2.16.91 20051117 Debian GNU/Linux
 /usr/snp/libexec/gcc/x86_64-unknown-linux-gnu/4.2.0/collect2 -m elf_x86_64 -static /usr/lib/../lib64/crt1.o /usr/lib/../lib64/crti.o /usr/snp/lib/gcc/x86_64-unknown-linux-gnu/4.2.0/crtbeginT.o -L/usr/snp/lib/gcc/x86_64-unknown-linux-gnu/4.2.0 -L/usr/snp/lib/gcc/x86_64-unknown-linux-gnu/4.2.0/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/snp/lib/gcc/x86_64-unknown-linux-gnu/4.2.0/../../.. /tmp/ccrnqhDq.o -lgfortranbegin -lgfortran -lm --start-group -lgcc -lgcc_eh -lc --end-group /usr/snp/lib/gcc/x86_64-unknown-linux-gnu/4.2.0/crtend.o /usr/lib/../lib64/crtn.o
$ ./a.out
 size r           10
 r =    0.000000       0.000000       0.000000       0.000000       0.000000       0.000000       0.000000       0.000000       0.000000       0.000000    

Hope this is OK.

-- 
Toon Moene - e-mail: toon@moene.indiv.nluug.nl - phone: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
A maintainer of GNU Fortran 95: http://gcc.gnu.org/fortran/


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