(j3.2006) Comment 2 from TS Ballot

Malcolm Cohen malcolm
Tue Sep 11 04:07:54 EDT 2012


This seems overly complicated, needs better wording,
  ... do not use "allow" to make a requirement
overly restrictive - does not allow byte-level access to larger objects,
   e.g.
         /* x describes an object of size eltsize bytes. */
         unsigned char *p = x->base_addr;
         for (i=0; i<eltsize; i++) printf(" %x",p[i]);
not restrictive enough - does not prohibit access to storage not part of the 
described object
   e.g.
         /* x describes INTEGER BASE(10); X => BASE(::2) */
         struct { int c[2]; } *p = x->base_addr;
         printf("%d\n",p->c[1]); /* Not part of the described object. */
incredibly overly restrictive - prohibits use of unrelated pointers
  e.g.
         /* x describes INTEGER a(100), y describes a(10::2) */
         int *p1 = x->base_addr, *p2 => y->base_addr;
         printf("%d\n",*(p1+10)); /* within Y but cannot be obtained from 
CFI_address on Y */

Maybe something like
"If (blah), a pointer derived from the base_addr of that descriptor shall not be 
used to access memory that is not part of the object described by the 
descriptor."

Like Bill, I thought we already discussed this and had some words, but I did not 
spend any time looking for them.

Cheers,

-----Original Message----- 
From: Bader, Reinhold
Date: ?? 24?9?11? 6:47
To: fortran standards email list for J3
Cc: Bill Long
Subject: Re: (j3.2006) Comment 2 from TS Ballot

Answering my own response ...

If we have these additional words, we might as well drop references to
pointer arithmetic:

"If a formal parameter that is a pointer to CFI_cdesc_t corresponds to a dummy
argument in an interoperable procedure interface, indirection on a
pointer that is a valid address within the C object starting at base_addr
is allowed if and only if the value of that pointer can be obtained
by applying the function CFI_address (8.3.5.2) to the object or a subobject of 
it."


>
> "If a formal parameter that is a pointer to CFI_cdesc_t corresponds to a dummy
> argument in an interoperable procedure interface, indirection on a
> pointer derived from its base_addr member by pointer arithmetic that is
> a valid address within the C object starting at base_addr
>  is allowed if and only if the value of that pointer can be obtained
> by applying the function CFI_address (8.3.5.2) to the object or a subobject of 
> it."
>

_______________________________________________
J3 mailing list
J3 at mailman.j3-fortran.org
http://mailman.j3-fortran.org/mailman/listinfo/j3

________________________________________________________________________
This e-mail has been scanned for all viruses by Star.
________________________________________________________________________

-- 
................................Malcolm Cohen, Nihon NAG, Tokyo. 




More information about the J3 mailing list