Re: Are f.p. manipulation functions only used in initialization?



"Tobias Burnus" <burnus@xxxxxxxx> wrote in message
news:24b0ceab-d3e9-4b68-b578-e4b09d7f893b@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Confirmed. The problem is that in the function "point" a temporary
array is created to contain the repacked data of the dummy argument
"x". Thus, the pointer points to the temporary array and not to the
dummy array.

Solution: Do not repack dummy arguments with the TARGET attribute. I
filled now http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36059

I think that both the actual argument and the dummy argument must
have the target attribute for a problem to arise. If the actual
argument doesn't have the target attribute any pointers that think
they are associated with it have in fact undefined association
status, and same for the dummy. Since the interface must be explicit
if the dummy argument has the target attribute (N1601.pdf, section
12.3.1.1 (2)(a)) the compiler knows when it is deciding whether to
repack the array (i.e. when compiling the caller) whether or not
both actual and dummy arguments have the target attribute.

Another possibility would be to tolerate the nonstandard behavior
but call attention to the possibility in the documentation. There
are examples of compilers that do this. Actually gfortran is more
benign in this regard because the nonstandard switch is not the
default.

Thanks for the bug report. (Maybe I should re-read at some point the
gfortran documentation, there are options I have never heard of.)

Thank you for your attention to this notification. Keep up the
good (volunteer) work.

--
write(*,*) transfer((/17.392111325966148d0,6.5794487871554595D-85, &
6.0134700243160014d-154/),(/'x'/)); end


.



Relevant Pages

  • Re: TARGET and INTENT(IN)
    ... you can use a pointer to point at something and then modify it through the pointer. ... A pointer is very much like a dummy argument. ... With this meaning of "TARGET" for INTENTdummys I don't see the point - the compiler still doesn't do anything different than for INTENTdummys without TARGET. ... I've been known to have wrapper routines that try to make life simpler for both the routines that calls them and the lower-level routines that they call. ...
    (comp.lang.fortran)
  • Re: Copy-in/Copy-out
    ... subscript, the dummy argument is scalar or assumed-shape, and both ... have the target attribute. ... I think this means that if I allocate memory to a pointer ... the array can never be ...
    (comp.lang.fortran)
  • Re: Pointers in structure constructors
    ... the actual argument will be an appropriate target, ... It is the compiler's tolerance for inappropriate use of my provided "structure constructor" that is bothering me. ... dummy argument, the actual argument may not be a null pointer. ...
    (comp.lang.fortran)
  • Re: TARGET and INTENT(IN)
    ... dummy argument, then at any time during the execution of the ... the dummy argument has the POINTER attribute, ... the actual argument is a target other than an array section ... by a style tool, though like many style choices, it can be limiting at times. ...
    (comp.lang.fortran)
  • Re: TARGET and INTENT(IN)
    ... dummy argument, then at any time during the execution of the ... the dummy argument has the POINTER attribute, ... the actual argument is a target other than an array section ... intentdummies are allowed in the standard and this isn't likely to ...
    (comp.lang.fortran)