re PR fortran/22607 (Elemental character functions don't work)
fortran/ 2005-12-30 Erik Edelmann <eedelman@gcc.gnu.org> PR fortran/22607 * trans-decl.c(gfc_get_extern_function_decl): Don't set DECL_IS_PURE (fndecl) = 1 for return-by-reference functions. fortran/PR 25396 * interface.c (gfc_extend_expr): Initialize e->value.function.name to NULL. testsuite/ 2005-12-30 Erik Edelmann <eedelman@gcc.gnu.org> PR fortran/22607 * gfortran-dg/pure_byref_3.f90: New. fortran/PR 25396 * gfortran.dg/userdef_operator_1.f90: New. From-SVN: r109171
This commit is contained in:
parent
ae21215e5c
commit
cf013e9fdb
6 changed files with 89 additions and 1 deletions
|
@ -1,3 +1,14 @@
|
|||
2005-12-30 Erik Edelmann <eedelman@gcc.gnu.org>
|
||||
|
||||
PR fortran/22607
|
||||
* trans-decl.c(gfc_get_extern_function_decl): Don't set
|
||||
DECL_IS_PURE (fndecl) = 1 for return-by-reference
|
||||
functions.
|
||||
|
||||
fortran/PR 25396
|
||||
* interface.c (gfc_extend_expr): Initialize
|
||||
e->value.function.name to NULL.
|
||||
|
||||
2005-12-29 Paul Thomas <pault@gcc.gnu.org>
|
||||
|
||||
PR fortran/25532
|
||||
|
|
|
@ -1718,6 +1718,7 @@ gfc_extend_expr (gfc_expr * e)
|
|||
e->value.function.actual = actual;
|
||||
e->value.function.esym = NULL;
|
||||
e->value.function.isym = NULL;
|
||||
e->value.function.name = NULL;
|
||||
|
||||
if (gfc_pure (NULL) && !gfc_pure (sym))
|
||||
{
|
||||
|
|
|
@ -1093,7 +1093,7 @@ gfc_get_extern_function_decl (gfc_symbol * sym)
|
|||
sense. */
|
||||
if (sym->attr.pure || sym->attr.elemental)
|
||||
{
|
||||
if (sym->attr.function)
|
||||
if (sym->attr.function && !gfc_return_by_reference (sym))
|
||||
DECL_IS_PURE (fndecl) = 1;
|
||||
/* TODO: check if pure SUBROUTINEs don't have INTENT(OUT)
|
||||
parameters and don't use alternate returns (is this
|
||||
|
|
|
@ -1,3 +1,11 @@
|
|||
2005-12-30 Erik Edelmann <eedelman@gcc.gnu.org>
|
||||
|
||||
PR fortran/22607
|
||||
* gfortran-dg/pure_byref_3.f90: New.
|
||||
|
||||
fortran/PR 25396
|
||||
* gfortran.dg/userdef_operator_1.f90: New.
|
||||
|
||||
2005-12-29 Nathan Sidwell <nathan@codesourcery.com>
|
||||
|
||||
* g++.dg/abi/thunk3.C: New.
|
||||
|
|
33
gcc/testsuite/gfortran.dg/pure_byref_3.f90
Normal file
33
gcc/testsuite/gfortran.dg/pure_byref_3.f90
Normal file
|
@ -0,0 +1,33 @@
|
|||
! { dg-do run }
|
||||
! PR 22607: External/module pure return-by-reference functions
|
||||
|
||||
pure function hoj()
|
||||
integer :: hoj(3)
|
||||
hoj = (/1, 2, 3/)
|
||||
end function hoj
|
||||
|
||||
module huj_mod
|
||||
contains
|
||||
pure function huj()
|
||||
integer :: huj(3)
|
||||
huj = (/1, 2, 3/)
|
||||
end function huj
|
||||
end module huj_mod
|
||||
|
||||
program pure_byref_3
|
||||
use huj_mod
|
||||
implicit none
|
||||
|
||||
interface
|
||||
pure function hoj()
|
||||
integer :: hoj(3)
|
||||
end function hoj
|
||||
end interface
|
||||
integer :: a(3)
|
||||
|
||||
a = huj()
|
||||
if (.not. all(a == (/1, 2, 3/))) call abort()
|
||||
|
||||
a = hoj()
|
||||
if (.not. all(a == (/1, 2, 3/))) call abort()
|
||||
end program pure_byref_3
|
35
gcc/testsuite/gfortran.dg/userdef_operator_1.f90
Normal file
35
gcc/testsuite/gfortran.dg/userdef_operator_1.f90
Normal file
|
@ -0,0 +1,35 @@
|
|||
! { dg-do compile }
|
||||
! Testcase from PR 25396: User defined operators returning arrays.
|
||||
module geometry
|
||||
|
||||
implicit none
|
||||
|
||||
interface operator(.cross.)
|
||||
module procedure cross
|
||||
end interface
|
||||
|
||||
contains
|
||||
|
||||
! Cross product between two 3d vectors.
|
||||
pure function cross(a, b)
|
||||
real, dimension(3), intent(in) :: a,b
|
||||
real, dimension(3) :: cross
|
||||
|
||||
cross = (/ a(2) * b(3) - a(3) * b(2), &
|
||||
a(3) * b(1) - a(1) * b(3), &
|
||||
a(1) * b(2) - a(2) * b(1) /)
|
||||
end function cross
|
||||
|
||||
end module geometry
|
||||
|
||||
program opshape
|
||||
use geometry
|
||||
|
||||
implicit none
|
||||
|
||||
real :: t(3,3), a
|
||||
|
||||
a = dot_product (t(:,1), t(:,2) .cross. t(:,3))
|
||||
|
||||
end program opshape
|
||||
|
Loading…
Add table
Reference in a new issue