Re: Are f.p. manipulation functions only used in initialization?
- From: "James Van Buskirk" <not_valid@xxxxxxxxxxx>
- Date: Sat, 26 Apr 2008 20:55:30 -0600
"James Van Buskirk" <not_valid@xxxxxxxxxxx> wrote in message
news:QdCdnaPuP40qNo7VnZ2dnUVZ_hWdnZ2d@xxxxxxxxxxxxxx
I ran into another problem that may be with the documentation.
Here's another item from the docs:
http://gcc.gnu.org/onlinedocs/gfortran/Code-Gen-Options.html#Code-Gen-Options
"-frepack-arrays
In some circumstances GNU Fortran may pass assumed shape array
sections via a descriptor describing a noncontiguous area of memory.
This option adds code to the function prologue to repack the data
into a contiguous block at runtime.
This should result in faster accesses to the array. However it can
introduce significant overhead to the function call, especially when
the passed data is noncontiguous."
It is not mentioned here that this is one of the options that makes
the program behave contrary to the standard:
C:\gfortran\james\archpi>type repack_test.f90
module test1
use ISO_C_BINDING, only: C_PTR, C_LOC
implicit none
contains
function point(x)
real, intent(in), target :: x(:)
type(C_PTR) point
real, pointer :: p
p => x(2)
point = C_LOC(p)
end function point
end module test1
program test2
use test1
use ISO_C_BINDING
implicit none
real, target :: x(7)
type(C_PTR) cp1, cp2
integer(C_INTPTR_T) ip
x = 42
cp1 = C_LOC(x(3))
cp2 = point(x(::2))
write(*,'(2(z16.16:1x))') transfer(cp1,ip), transfer(cp2,ip)
write(*,'(L1)') C_ASSOCIATED(cp1,cp2)
end program test2
C:\gfortran\james\archpi>c:\gcc_equation\bin\x86_64-pc-mingw32-gfortran -std=f20
03 repack_test.f90 -orepack_test
C:\gfortran\james\archpi>repack_test
000000000022FE48 000000000022FE48
T
C:\gfortran\james\archpi>c:\gcc_equation\bin\x86_64-pc-mingw32-gfortran -frepack
-arrays -std=f2003 repack_test.f90 -orepack_test
C:\gfortran\james\archpi>repack_test
000000000022FE48 00000000004A5A04
F
It would be nice to have a warning either in the documentation for
-frepack-arrays or at compile time when -std=f2003 is in force
that the result is generated code that is inconsistent with the
standard.
--
write(*,*) transfer((/17.392111325966148d0,6.5794487871554595D-85, &
6.0134700243160014d-154/),(/'x'/)); end
.
- Follow-Ups:
- Re: Are f.p. manipulation functions only used in initialization?
- From: Tobias Burnus
- Re: Are f.p. manipulation functions only used in initialization?
- References:
- Are f.p. manipulation functions only used in initialization?
- From: James Van Buskirk
- Re: Are f.p. manipulation functions only used in initialization?
- From: Steven G. Kargl
- Re: Are f.p. manipulation functions only used in initialization?
- From: James Van Buskirk
- Are f.p. manipulation functions only used in initialization?
- Prev by Date: Re: Are f.p. manipulation functions only used in initialization?
- Next by Date: Re: Using external subroutines in OpenMP?
- Previous by thread: Re: Are f.p. manipulation functions only used in initialization?
- Next by thread: Re: Are f.p. manipulation functions only used in initialization?
- Index(es):