Compatibility of array indexing for gcc 3.4.6 and gcc 4.4.7?
N.M. Maclaren
nmm1@cam.ac.uk
Fri Nov 1 13:01:00 GMT 2013
On Nov 1 2013, Janus Weil wrote:
>>> On Fri, 1 Nov 2013, Adam Hirst wrote:
>>>
>>>> Someone please do correct me if I'm wrong, but am I right in
>>>> thinking that behaviour like this is more-or-less utterly
>>>> standards non-compliant (and entirely implementation-dependent)?
No - it's nothing like that well-defined :-) It will sometimes behave
differently in runs of the same executable, often crash the program,
and (on some primitive systems like Windows 3.1) can crash the system.
>>> Still, I would like to understand where that behavoir (of returning
>>> the first element on gcc 3.4.6 and giving the segmentation fault in
>>> gcc.4.4.7) originates from, and why it was defined like that.
>>
>Where the g77 behavior originates from I have no idea. Many compilers
>allow weird things as an extension to the Fortran standard.
They do, but I don't think that mapping to the first element was ever
a property of g77, and I am pretty certain that it wasn't a property
of gcc 3.4.6. I have used perhaps a hundred Fortran compilers, from
Fortran II onwards, and don't think that any of them did that. Yes,
some other languages did. I suspect that the behaviour was just a
fluke.
Regards,
Nick Maclaren.
More information about the Fortran
mailing list