* [Patch, fortran] PR66257 [5/6 regression] elemental typebound calls rejected as actual argument
@ 2015-05-23 22:45 Mikael Morin
2015-05-24 13:18 ` Paul Richard Thomas
0 siblings, 1 reply; 2+ messages in thread
From: Mikael Morin @ 2015-05-23 22:45 UTC (permalink / raw)
To: gcc-patches, gfortran
[-- Attachment #1: Type: text/plain, Size: 279 bytes --]
Hello,
For PR 63727, a check was introduced, rejecting procedure pointer
components used as actual arguments:
foo(obj%proc_comp)
but it had the side effect of also rejecting
foo(obj%proc_comp(arg))
Fixed by the attached patch.
Tested on x86_64-linux. OK for 6/5 ?
Mikael
[-- Attachment #2: pr66257_v1.diff --]
[-- Type: text/x-patch, Size: 838 bytes --]
2015-05-23 Mikael Morin <mikael@gcc.gnu.org>
PR fortran/66257
* resolve.c (resolve_actual_arglist): Don't throw an error
if the argument with procedure pointer component is not a variable.
2015-05-23 Mikael Morin <mikael@gcc.gnu.org>
PR fortran/66257
* typebound_call_27.f90: New file.
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index fbf260f..a46ab60 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -1981,7 +1981,8 @@ resolve_actual_arglist (gfc_actual_arglist *arg, procedure_type ptype,
}
comp = gfc_get_proc_ptr_comp(e);
- if (comp && comp->attr.elemental)
+ if (e->expr_type == EXPR_VARIABLE
+ && comp && comp->attr.elemental)
{
gfc_error ("ELEMENTAL procedure pointer component %qs is not "
"allowed as an actual argument at %L", comp->name,
[-- Attachment #3: typebound_call_27.f90 --]
[-- Type: text/x-fortran, Size: 800 bytes --]
! { dg-do compile }
!
! PR fortran/66257
! Check that typebound function calls are accepted as actual argument.
!
MODULE test_class
IMPLICIT NONE
PRIVATE
PUBLIC:: test
INTEGER, PARAMETER :: dp = SELECTED_REAL_KIND(15)
TYPE test
PRIVATE
CONTAINS
PRIVATE
PROCEDURE, PUBLIC:: E
PROCEDURE, PUBLIC:: Om
END TYPE test
CONTAINS
ELEMENTAL FUNCTION E (self, a)
IMPLICIT NONE
CLASS(test), INTENT(IN):: self
REAL(kind=dp), INTENT(IN):: a
REAL(kind=dp):: E
E = a
END FUNCTION E
ELEMENTAL FUNCTION Om (self, z)
IMPLICIT NONE
CLASS(test), INTENT(IN):: self
REAL(kind=dp), INTENT(IN):: z
REAL(kind=dp):: Om
Om = self%E(self%E(z))
Om = log10(self%E(z))
END FUNCTION Om
END MODULE test_class
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Patch, fortran] PR66257 [5/6 regression] elemental typebound calls rejected as actual argument
2015-05-23 22:45 [Patch, fortran] PR66257 [5/6 regression] elemental typebound calls rejected as actual argument Mikael Morin
@ 2015-05-24 13:18 ` Paul Richard Thomas
0 siblings, 0 replies; 2+ messages in thread
From: Paul Richard Thomas @ 2015-05-24 13:18 UTC (permalink / raw)
To: Mikael Morin; +Cc: gcc-patches, gfortran
Hi Mikael,
Yes, that's fine for 5 and 6.
Thanks for the patch.
Paul
On 23 May 2015 at 23:35, Mikael Morin <mikael.morin@sfr.fr> wrote:
> Hello,
>
> For PR 63727, a check was introduced, rejecting procedure pointer
> components used as actual arguments:
> foo(obj%proc_comp)
> but it had the side effect of also rejecting
> foo(obj%proc_comp(arg))
>
> Fixed by the attached patch.
> Tested on x86_64-linux. OK for 6/5 ?
>
> Mikael
>
>
>
--
Outside of a dog, a book is a man's best friend. Inside of a dog it's
too dark to read.
Groucho Marx
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-05-24 11:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-23 22:45 [Patch, fortran] PR66257 [5/6 regression] elemental typebound calls rejected as actual argument Mikael Morin
2015-05-24 13:18 ` Paul Richard Thomas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).