public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/41733] Proc-pointer conformance checks: Elemental-proc-ptr => non-elemental-proc
[not found] <bug-41733-4@http.gcc.gnu.org/bugzilla/>
@ 2011-09-15 19:47 ` janus at gcc dot gnu.org
2011-09-15 20:16 ` janus at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: janus at gcc dot gnu.org @ 2011-09-15 19:47 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41733
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2011-09-15
AssignedTo|unassigned at gcc dot |janus at gcc dot gnu.org
|gnu.org |
Ever Confirmed|0 |1
--- Comment #3 from janus at gcc dot gnu.org 2011-09-15 19:32:59 UTC ---
(In reply to comment #2)
> C728 (R742) The proc-target shall not be a nonintrinsic elemental procedure.
Here is a simple patch for this constraint:
Index: gcc/fortran/expr.c
===================================================================
--- gcc/fortran/expr.c (revision 178888)
+++ gcc/fortran/expr.c (working copy)
@@ -3448,6 +3448,14 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_ex
rvalue->symtree->name, &rvalue->where) == FAILURE)
return FAILURE;
}
+ /* Check for F08:C730. */
+ if (attr.elemental && !attr.intrinsic)
+ {
+ gfc_error ("Nonintrinsic elemental procedure '%s' is invalid "
+ "in procedure pointer assigment at %L",
+ rvalue->symtree->name, &rvalue->where);
+ return FAILURE;
+ }
/* Ensure that the calling convention is the same. As other attributes
such as DLLEXPORT may differ, one explicitly only tests for the
and a minimal test case:
implicit none
procedure(my_dcos), pointer :: f
f => my_dcos
contains
real elemental function my_dcos(x)
real, intent(in) :: x
my_dcos = cos(x)
end function
end
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/41733] Proc-pointer conformance checks: Elemental-proc-ptr => non-elemental-proc
[not found] <bug-41733-4@http.gcc.gnu.org/bugzilla/>
2011-09-15 19:47 ` [Bug fortran/41733] Proc-pointer conformance checks: Elemental-proc-ptr => non-elemental-proc janus at gcc dot gnu.org
@ 2011-09-15 20:16 ` janus at gcc dot gnu.org
2011-09-22 9:37 ` janus at gcc dot gnu.org
2011-09-22 9:52 ` janus at gcc dot gnu.org
3 siblings, 0 replies; 6+ messages in thread
From: janus at gcc dot gnu.org @ 2011-09-15 20:16 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41733
--- Comment #4 from janus at gcc dot gnu.org 2011-09-15 19:47:21 UTC ---
Also we need to check for the following F08 constraints:
"12.5.2.9 Actual arguments associated with dummy procedure entities
If the interface of a dummy procedure is explicit, its characteristics as a
procedure (12.3.1) shall be the same as those of its effective argument, except
that a pure effective argument may be associated with a dummy argument that is
not pure and an elemental intrinsic actual procedure may be associated with a
dummy procedure (which cannot be elemental)."
and
"7.2.2.4 Procedure pointer assignment
3 If the pointer object has an explicit interface, its characteristics shall be
the same as the pointer target except that the pointer target may be pure even
if the pointer object is not pure and the pointer target may be an elemental
intrinsic procedure even if the pointer object is not elemental."
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/41733] Proc-pointer conformance checks: Elemental-proc-ptr => non-elemental-proc
[not found] <bug-41733-4@http.gcc.gnu.org/bugzilla/>
2011-09-15 19:47 ` [Bug fortran/41733] Proc-pointer conformance checks: Elemental-proc-ptr => non-elemental-proc janus at gcc dot gnu.org
2011-09-15 20:16 ` janus at gcc dot gnu.org
@ 2011-09-22 9:37 ` janus at gcc dot gnu.org
2011-09-22 9:52 ` janus at gcc dot gnu.org
3 siblings, 0 replies; 6+ messages in thread
From: janus at gcc dot gnu.org @ 2011-09-22 9:37 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41733
--- Comment #5 from janus at gcc dot gnu.org 2011-09-22 09:32:14 UTC ---
Author: janus
Date: Thu Sep 22 09:32:11 2011
New Revision: 179080
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=179080
Log:
2011-09-22 Janus Weil <janus@gcc.gnu.org>
PR fortran/41733
* expr.c (gfc_check_pointer_assign): Check for nonintrinsic elemental
procedures.
* interface.c (gfc_compare_interfaces): Rename 'intent_flag'. Check
for PURE and ELEMENTAL attributes.
(compare_actual_formal): Remove pureness check here.
2011-09-22 Janus Weil <janus@gcc.gnu.org>
PR fortran/41733
* gfortran.dg/impure_actual_1.f90: Modified error message.
* gfortran.dg/proc_ptr_32.f90: New.
* gfortran.dg/proc_ptr_33.f90: New.
Added:
trunk/gcc/testsuite/gfortran.dg/proc_ptr_32.f90
trunk/gcc/testsuite/gfortran.dg/proc_ptr_33.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/expr.c
trunk/gcc/fortran/interface.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gfortran.dg/impure_actual_1.f90
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/41733] Proc-pointer conformance checks: Elemental-proc-ptr => non-elemental-proc
[not found] <bug-41733-4@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2011-09-22 9:37 ` janus at gcc dot gnu.org
@ 2011-09-22 9:52 ` janus at gcc dot gnu.org
3 siblings, 0 replies; 6+ messages in thread
From: janus at gcc dot gnu.org @ 2011-09-22 9:52 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41733
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
--- Comment #6 from janus at gcc dot gnu.org 2011-09-22 09:40:07 UTC ---
r179080 should fix all issues in the c.l.f. thread. Closing as fixed.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/41733] Proc-pointer conformance checks: Elemental-proc-ptr => non-elemental-proc
2009-10-16 19:49 [Bug fortran/41733] New: Proc-pointer conformance checks burnus at gcc dot gnu dot org
2009-10-16 20:35 ` [Bug fortran/41733] Proc-pointer conformance checks: Elemental-proc-ptr => non-elemental-proc burnus at gcc dot gnu dot org
@ 2009-10-17 19:07 ` burnus at gcc dot gnu dot org
1 sibling, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-10-17 19:07 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from burnus at gcc dot gnu dot org 2009-10-17 19:07 -------
There is the following additional restriction, which I could not find (Thanks
James!):
C728 (R742) The proc-target shall not be a nonintrinsic elemental procedure.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41733
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/41733] Proc-pointer conformance checks: Elemental-proc-ptr => non-elemental-proc
2009-10-16 19:49 [Bug fortran/41733] New: Proc-pointer conformance checks burnus at gcc dot gnu dot org
@ 2009-10-16 20:35 ` burnus at gcc dot gnu dot org
2009-10-17 19:07 ` burnus at gcc dot gnu dot org
1 sibling, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-10-16 20:35 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from burnus at gcc dot gnu dot org 2009-10-16 20:35 -------
The first example,
procedure(fun), pointer :: f
f => my_dcos
write(*,*) f(x)
looks fine to me. "fun" is elemental - and my_dcos is also elemental.
The second example is wrong: "fun" is elemental, but "my_dcos" is not thus
f => my_dcos
is invalid per F2003, 7.4.2.2 Procedure pointer assignment:
"If proc-pointer-object has an explicit interface, its characteristics shall
be
the same as proc-target except that proc-target may be pure even if
proc-pointer-object is not pure and proc-target may be an elemental intrinsic
procedure even if proc-pointer-object is not elemental."
The third example looks OK again - actually, it is the same as the first,
except that one uses an intrinsic elemental procedure (dcos).
Test case for the second example:
module funcs
implicit none
integer, parameter :: dp = kind(1.0d0)
abstract interface
elemental function fun(x)
import
implicit none
real(dp), intent(in) :: x
real(dp) fun
end function fun
end interface
contains
function my_dcos(x)
integer, parameter :: dp = kind(1.0d0)
real(dp), intent(in) :: x
real(dp) :: my_dcos
my_dcos = cos(x)
end function
end module funcs
program start
use funcs
implicit none
procedure(fun), pointer :: f
real(dp) x(3)
x = [1,2,3]
f => my_dcos
write(*,*) f(x)
end program start
--
burnus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|Proc-pointer conformance |Proc-pointer conformance
|checks |checks: Elemental-proc-ptr
| |=> non-elemental-proc
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41733
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-09-22 9:40 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-41733-4@http.gcc.gnu.org/bugzilla/>
2011-09-15 19:47 ` [Bug fortran/41733] Proc-pointer conformance checks: Elemental-proc-ptr => non-elemental-proc janus at gcc dot gnu.org
2011-09-15 20:16 ` janus at gcc dot gnu.org
2011-09-22 9:37 ` janus at gcc dot gnu.org
2011-09-22 9:52 ` janus at gcc dot gnu.org
2009-10-16 19:49 [Bug fortran/41733] New: Proc-pointer conformance checks burnus at gcc dot gnu dot org
2009-10-16 20:35 ` [Bug fortran/41733] Proc-pointer conformance checks: Elemental-proc-ptr => non-elemental-proc burnus at gcc dot gnu dot org
2009-10-17 19:07 ` burnus at gcc dot gnu dot org
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).