Print

Print


Thorsten Ohl wrote:

> Until today, I have used the following hack to declare PARAMETER
> arrays with DIMENSION(N), where N can be 0.
>
> module foo
>   integer, dimension(0), parameter :: bar0 = reshape ((/ 0 /), (/ 0 /))
>   integer, dimension(1), parameter :: bar1 = reshape ((/ 1, 0 /), (/ 1 /))
> end module foo

> This is done by an automatic code generator, where uniformly adding
> the sentinel 0 is more convenient than treating the special case.
>
> Today I have learned that Compaq has recently `fixed' their compiler
> (Compaq Fortran X5.3-1155) and that my users can't compile their code
> anymore.  E.g.:

We would appreciate your reporting such problems to us first - we'd be glad
to give you our prompt opinion on such matters.  For our UNIX compiler, you
may use [log in to unmask] for such reports.

My interpretation of this is that the behavior you note is a bug, which we
shall fix at the earliest opportunity.  I have to say that the wording of
the standard isn't explicit, in my reading, about what happens if SOURCE has
more elements than are necessary to accomodate SHAPE, but I think that the
strong implication is that the excess elements are discarded.  I also note
that this appears to be an issue with us for PARAMETERs only - if you use
such a RESHAPE elsewhere, even as an initialization expression for a
variable, it works as you expect.

Again, in the future, if you believe you have found an error in a vendor's
implementation, please contact the vendor first.  We, and I know most other
vendors, are more than happy to receive and respond to such reports.

Steve Lionel
Compaq Fortran Engineering
http://www.compaq.com/fortran


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%