Explicitly typing (:) not allowed?

mattias alveteg Mattias.Alveteg@chemeng.lth.se
Fri Oct 6 14:03:00 GMT 2006


Hi,

I'm rather new to Gfortran, and have not yet learned to use bugzilla  
for Gfortran, so my apologies if this is mail is redundant. Anyway,  
I've noticed that Gfortran does not (always) accept the programming  
style I'm used to. I usually type out "(:)" in equations to remind me  
when I'm fiddling around with arrays rather than scalars. Below  
you'll find a sample code that produces a compiler error on my  
machine. Strangely enough Gfortran seems happy with my explicit (:)  
notation in some circumstances.

BTW, Absoft compilers (Mac & Win), IBM XLF (Mac) and an ancient CVF  
compiler (Win) eats my code happily.

/mattias



MODULE A
	implicit none
        integer, parameter:: NN=7
        integer, parameter :: c(NN) =(/2,2,1,1,3,4,2 /)
END MODULE A

module B
	implicit none
contains
subroutine sub_B(x,e,N)
	use A
	implicit none
	integer,intent(in) :: N
	real, intent(in) :: x(N)
	real, intent(out) :: e(NN)
	integer mineral,i
	
	e=0.0
	DO mineral=1,N
		IF(x(mineral)>1) THEN
			! This line causes internal compiler error: Bus error
			e(:)= e(:)+c(:)*1.2
			! This alternative formulation works
			do i=1,NN
				e(i)= e(i)+c(i)*1.2
			end do
			! This also works
			e= e+c*1.2
		END IF
	END DO
end subroutine sub_B

end module B

PS
I'm using Mac OS X 10.4.8. Typing gcc -v and gfortran -v produces the  
following (a bit unsure what information is needed for bug  
specification):

gcc -v
Using built-in specs.
Target: powerpc-apple-darwin8
Configured with: /private/var/tmp/gcc/gcc-5363.obj~28/src/configure -- 
disable-checking -enable-werror --prefix=/usr --mandir=/share/man -- 
enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg] 
[^.-]*$/s/$/-4.0/ --with-gxx-include-dir=/include/c++/4.0.0 --with- 
slibdir=/usr/lib --build=powerpc-apple-darwin8 --host=powerpc-apple- 
darwin8 --target=powerpc-apple-darwin8
Thread model: posix
gcc version 4.0.1 (Apple Computer, Inc. build 5363)

gfortran -v
Using built-in specs.
Target: powerpc-apple-darwin8
Configured with: ../gcc/configure --prefix=/usr/local/gfortran -- 
enable-languages=c,fortran --with-gmp=/tmp/gfortran-20060713/ 
gfortran_libs --enable-bootstrap --build=powerpc-apple-darwin8 -- 
host=powerpc-apple-darwin8 --target=powerpc-apple-darwin8 :  
(reconfigured) ../gcc/configure --prefix=/usr/local/gfortran --enable- 
languages=c,fortran --with-gmp=/tmp/gfortran-20060713/gfortran_libs -- 
enable-bootstrap --build=powerpc-apple-darwin8 --host=powerpc-apple- 
darwin8 --target=powerpc-apple-darwin8 --disable-multilib
Thread model: posix
gcc version 4.2.0 20060713 (experimental)

(I'm a bit worried about the "experimental" part, perhaps I installed  
something wrong…)
DS






More information about the Fortran mailing list