the following program gives an internal compiler error with Compaq
Visual Fortran 6.6C
(I know, it is no longer supported) but the Intel Visual Fortran
compiler is rather too
happy to compile it IMHO:
! Check a particular compiler error
! (Happens in CVF 6.6C)
!
program chkdata
character(len=20), dimension(4) :: string
data ( string(i) ,i=1,5 ) / &
'A', 'B', 'C', 'D', 'E' /
write(*,*) string
end program chkdata
The CVF error message is:
Assertion failure: Compiler internal error - please submit problem
report
GEM ASSERTION, Compiler internal error - please submit problem report
f90: Fatal: There has been an internal compiler error (E0000003).
Error executing df.exe.
chkdata.exe - 3 error(s), 0 warning(s)
The output when using IVF on Linux:
> chkd
A B C
D
As you can see, the effect seems to be that it simply truncates the
array of
strings to fit into the declared array.
Is there a flag for IVF to warn about this type of error?
(I found the cause of the error by running g95 on the source code that
initially
caused this. At the moment I do not know what version, but a version
from 2005
clearly does not detect it).
Regards,
Arjen
character(20) :: string(4) = ['A', 'B', 'C', 'D']
<g>
"Arjen Markus" <arjen....@wldelft.nl> wrote in message
news:1181638583.9...@o11g2000prd.googlegroups.com...
The problem is not so much the verbosity as the fact that
there is a mismatch in the number of elements and the compilers
do not indicate that in a clear/meaningful way.
Regards,
Arjen
This is a bug. I entered a bug report on this issue. This actually
causes an internal compiler error on the newer 9.1 compilers and the
just-released 10.0 compiler. I'll make sure it gets fixed.
ron
G95 as of May 29 2007 does correctly diagnose the program error. So do
both NAG and Sun f95. But Compaq Fortran Compiler V5.5-1877-48BBF
(pretty old by now) gives the same wrong output as Intel.
-- John Harper, School of Mathematics, Statistics and Computer Science,
Victoria University, PO Box 600, Wellington 6140, New Zealand
e-mail john....@vuw.ac.nz phone (+64)(4)463 5341 fax (+64)(4)463 5045
>
> This is a bug. I entered a bug report on this issue. This actually
> causes an internal compiler error on the newer 9.1 compilers and the
> just-released 10.0 compiler. I'll make sure it gets fixed.
>
> ron
Thanks. I was not sure whether the Intel compiler was correcting the
problem "automatically" by ignoring the extra elements or not.
Regards,
Arjen
The program contains an error, namely,
that STRING has 4 elements, while the DATA statement
attempt to initialize it with 5 elements.
Sure, but in the original program the compiler threw an internal error
with no indication of the cause (a different compiler did detect the
error) and it turns out that yet a third has problems with this type
of errors too. So my question/post was related to the compiler
problem,
not so much to the problem with the program as such.
Regards,
Arjen