4

I need a little help: according to this site, there is a limit on the maximum number of continuation lines.

So I decided to test this. I wrote a jumbo FUNCTION where it computes colossal algebraic formula expressed in statement split into 17,146 continuation lines.

!test.f90  1.6 MB file
DOUBLE COMPLEX FUNCTION myfunction(a, b)

  DOUBLE COMPLEX, INTENT(IN) :: a
  DOUBLE COMPLEX, INTENT(IN) :: b

  myfunction = gd0/16.d0)*a*b*((a+b)**2)*((32.d0*DCONJG(f(4)))+(12&
&8.d0*DCONJG(f(11)))+(160.d0*DCONJG(f(24)))+(64.d0*DCONJG(f(46)))+(32.d0*DCONJG(f(3)))+(256.d0*DCON&
&JG(f(10)))+(480.d0*DCONJG(f(23)))+(256.d0*DCONJG(f(45)))+(32.d0*DCONJG(g(9)))+(128.d0*DCONJG(f(&
&9)))+(480.d0*DCONJG(f(22)))+(384.d0*DCONJG(f(44)))+(96.d0*DCONJG(g(21)))+(160.d0*DCONJG(f(21)))+(2&
&56.d0*DCONJG(f(43)))+(64.d0*DCONJG(g(42)))+(64.d0*DCONJG(f(42)))+(64.d0*DCONJG(f(8)))+(192.d0*DCON&
& (64.d0*DCONJG(g(42)) ! and so on and so forth...

END FUNCTION

I compiled this abomination with gfortran -c test.f90, and it returned an 11.4MB test.o file after 5 minutes, without any errors or warnings. I ran it, and it returned correct results.

Why isn't gfortran observing the maximum continuation lines rule?

QuantumDot
  • 293
  • 1
  • 3
  • 10
  • I think this is not required to be diagnosed even with options like -std=f95 -pedantic – tim18 Jul 21 '17 at 00:36
  • @tim18 I'm sorry; I don't understand what you mean. Are you saying my question is inappropriate for this site? – QuantumDot Jul 21 '17 at 01:13
  • He's saying that even with the [-pedantic option](https://gcc.gnu.org/onlinedocs/gfortran/Error-and-Warning-Options.html#Error-and-Warning-Options) there may be no warning message. I personally have no idea. – Matt P Jul 21 '17 at 02:00
  • 1
    So, you are complaining that `gfortran` allows you to do stuff that according to the specifications you shouldn't be able to do? Does this permissiveness impact your program in any way? – chw21 Jul 21 '17 at 04:54
  • 2
    it is a problem if you expect the compiler to warn you about potentially non portable code. – agentp Jul 21 '17 at 12:26

1 Answers1

6

Why isn't gfortran observing the maximum continuation lines rule?

This rule is not a constraint, the compiler is allowed by the standard to provide a larger limit as an extension, the standard sets a minimum for the max number of continuation lines. The compiler might report exceedence of the standard minimal value but it is not required and may require a flag.