3 ms·
> The problem is that the current gcc gfortran front-end doesn't do this for CHARACTER* 1 strings, and there's C code expecting that extra string length argumen
by AnssiH 7y ago
> The problem is that the current gcc gfortran front-end doesn't do this for CHARACTER* 1 strings, and there's C code expecting that extra string length argument.
Is it? My reading of the article is that gcc gfortran expects the length argument for CHARACTER* 1 to be provided as usual, but there is a lot of C code that does not provide that when calling Fortran functions.
- jabl 7y agoExactly this. And no, without breaking standard conforming Fortran code it's not possible to special case CHARACTER(len=1) arguments.
- malaxii 7y agoRight, gfortran does not special-case length-1 strings. The actual problem however is that it still works in simple cases --- when the Fortran code doesn't access the string length (and apparently, doesn't do tail-calls) --- even when the extra integer length arguments are omitted from the call. Because of this it was possible for the mistake to spread widely...
- acqq 7y agoThat's how I read it too. The existing C code which is not passing the expected parameter was a result of "hey I've tried it without and it worked" approach. It "worked" at the moment, and only for that specific compiler, but once the compiler started to rely on the "fact" that the parameter is "by definition there" some the previously "working" programs started to break. And this outcome is in fact nothing special to C and Fortran. I can just as well write a shell script (or any other) which "expects" that there is a parameter and if I don't use it and I later start to depend on it I'm sure there will be some other scripts calling that one and passing something else than what was "defined" as expected to be passed. On that topic, erverybody should read ryl00's comment here. Having more than one really different target is the only practically effective path to immunize from these kinds of dependencies. For me, it's one of good arguments against the "monoculture" software targets.