Fortran line continuation, where it can not be used?




I thought I can use line continuation & any where I want to
break a statment?

But this program compiles ok with gfortran

-----------------------------------
program foo
integer, dimension(3,3) :: a
a = reshape( (/ 1, 2, 3, &
4, 5, 6, &
7, 8, 9/), &
(/ 3, 3 /))
end program foo
-------------------------------

but not this one:

------------------------
program foo
integer, dimension(3,3) :: b
b = reshape( (/ 1, 2, 3, &
4, 5, 6, &
7, 8, 9/ &
), &
(/ 3, 3 /))
end program foo
---------------------

$gfortran bug.f90
bug.f90:6.25:
7, 8, 9/ &
1
Error: Syntax error in array constructor at (1)

$gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/4.6.1/lto-wrapper
Target: i686-linux-gnu
gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3)
$

What are the places where one can't use & to break
a Fortran statment?

thanks,
--Nasser
.



Relevant Pages

  • Re: substrings and array sections
    ... end program foo ... Then it runs fine with gfortran and produces the "expected" result (if ... There are also quite a few other things different about strings and ... illustrated above, you can have arrays of strings, making for ...
    (comp.lang.fortran)
  • Re: Are scalar elements of assumed-shape dummy arrays C interoperable
    ... I'm having trouble getting the following to compile with gfortran ... subroutine bar ... end program foo ...
    (comp.lang.fortran)
  • Re: substrings and array sections
    ... There are several asymmetries. ... end program foo ... It fails when compiling with gfortran: ... Syntax error in PRINT statement at ...
    (comp.lang.fortran)