(j3.2006) Did we intend to prevent this?

Van Snyder Van.Snyder
Wed Nov 9 21:33:53 EST 2011


On Wed, 2011-11-09 at 17:20 -0800, Malcolm Cohen wrote:
> >Why do we need to fix F08?
> >
> >I don't understand why

Surry, but I didn't get much illumination from this explanation.

I still don't understand why

  character(len=42), target, save :: A
  type :: t
    character(len=:), pointer :: P => A
  end type t

isn't a problem, and

  type(t) :: Z = t(a)

isn't a problem, and

  type(t), parameter :: Z = t()

isn't a problem, but

  type(t), parameter :: Z = t(a)

is a problem.  In all cases, the P component of Z gets initially
associated with A.

Since the target of a pointer component of a named constant isn't a
constant expression, I don't see a problem caused by the linker filling
the address into the pointer component of the named constant.  How is
this different from the linker filling the address into the pointer
component of a variable?

Is the problem caused by the possibility that TRANSFER might appear in a
constant expression?  Offhand, I'd say that if the argument of TRANSFER
is a pointer or has an ultimate component that's a pointer, the argument
isn't a constant, and therefore the reference to TRANSFER isn't a
constant expression.  Is that the kind of repair we need to make to
7.1.12p1(3)(b)?  If so, I agree it's not easy.  Maybe replace
7.1.12p1(6) with

  (6) a reference to a transformational standard intrinsic function
other than COMMAND ARGUMENT_COUNT, NULL, NUM IMAGES, THIS IMAGE, or
TRANSFER, where each argument is a constant expression,
  (6a) a reference to the transformational standard intrinsic function
TRANSFER where each argument is a constant expression that does not have
a pointer ultimate component,

> 
> Yes, I know that, which I why I tried to explain it in my previous messages.
> 
> To recap:
> 
> - Link-time values are filled in by the linker.
> 
> - The linker cannot do arbitrary things to those values.
> 
> - The user is permitted to to arbitrary things to constants (like arithmetic as 
> demonstrated).
> 
> - Therefore link-time values are fine for initialisation, but no good for 
> constants.
> 
> This feature as apparently described in F2008 is fundamentally incompatible with 
> separate compilation.  Some special cases can be handled, but not the general 
> case.
> 
> As I said before, this feature is not really new, it has been around for decades 
> in other languages.  Unfortunately we appear to have made rather a mess of 
> copying it.
> 
> Cheers,




More information about the J3 mailing list