* [Bug fortran/42072] [F03] wrong-code with C_F_PROCPOINTER
2009-11-16 22:48 [Bug fortran/42072] New: [F03] wrong-code with C_F_PROCPOINTER janus at gcc dot gnu dot org
@ 2009-11-16 22:51 ` janus at gcc dot gnu dot org
2009-11-16 22:56 ` janus at gcc dot gnu dot org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-11-16 22:51 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from janus at gcc dot gnu dot org 2009-11-16 22:51 -------
Side-note on C_F_PROCPOINTER: The manual claims that ...
"Due to the currently lacking support of procedure pointers in GNU Fortran this
function is not fully operable."
... which is a dirty lie.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42072
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/42072] [F03] wrong-code with C_F_PROCPOINTER
2009-11-16 22:48 [Bug fortran/42072] New: [F03] wrong-code with C_F_PROCPOINTER janus at gcc dot gnu dot org
2009-11-16 22:51 ` [Bug fortran/42072] " janus at gcc dot gnu dot org
@ 2009-11-16 22:56 ` janus at gcc dot gnu dot org
2009-11-16 23:00 ` pinskia at gcc dot gnu dot org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-11-16 22:56 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from janus at gcc dot gnu dot org 2009-11-16 22:55 -------
Proposed fix:
Index: gcc/fortran/trans-expr.c
===================================================================
--- gcc/fortran/trans-expr.c (revision 154189)
+++ gcc/fortran/trans-expr.c (working copy)
@@ -2645,6 +2645,12 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol *
tmp = gfc_get_ppc_type (arg->next->expr->ref->u.c.component);
else
tmp = TREE_TYPE (arg->next->expr->symtree->n.sym->backend_decl);
+
+ if (arg->next->expr->symtree->n.sym->attr.proc_pointer
+ && arg->next->expr->symtree->n.sym->attr.dummy)
+ fptrse.expr = build_fold_indirect_ref_loc (input_location,
+ fptrse.expr);
+
se->expr = fold_build2 (MODIFY_EXPR, tmp, fptrse.expr,
fold_convert (tmp, cptrse.expr));
--
janus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |janus at gcc dot gnu dot org
|dot org |
Status|UNCONFIRMED |ASSIGNED
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2009-11-16 22:55:50
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42072
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/42072] [F03] wrong-code with C_F_PROCPOINTER
2009-11-16 22:48 [Bug fortran/42072] New: [F03] wrong-code with C_F_PROCPOINTER janus at gcc dot gnu dot org
2009-11-16 22:51 ` [Bug fortran/42072] " janus at gcc dot gnu dot org
2009-11-16 22:56 ` janus at gcc dot gnu dot org
@ 2009-11-16 23:00 ` pinskia at gcc dot gnu dot org
2009-11-16 23:00 ` pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-11-16 23:00 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from pinskia at gcc dot gnu dot org 2009-11-16 23:00 -------
Wrong buttons :).
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |janus at gcc dot gnu dot org
|dot org |
Status|NEW |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42072
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/42072] [F03] wrong-code with C_F_PROCPOINTER
2009-11-16 22:48 [Bug fortran/42072] New: [F03] wrong-code with C_F_PROCPOINTER janus at gcc dot gnu dot org
` (2 preceding siblings ...)
2009-11-16 23:00 ` pinskia at gcc dot gnu dot org
@ 2009-11-16 23:00 ` pinskia at gcc dot gnu dot org
2009-11-17 12:00 ` janus at gcc dot gnu dot org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-11-16 23:00 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pinskia at gcc dot gnu dot org 2009-11-16 22:59 -------
call setpointer(ptype)
is being converted into:
setpointer.1481 ();
So inside MAIN__ we have:
static void setpointer (integer(kind=4) (*<T3af>) (integer(kind=4)));
setpointer (&ptype);
That is wrong, unless I am missing a reference type somewhere.
Plus inside setpointer I think:
p = (integer(kind=4) (*<T3af>) (integer(kind=4)) *) funpointer;
is incorrect, it should be:
*p = funpointer;
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |NEW
Last reconfirmed|2009-11-16 22:55:50 |2009-11-16 22:59:51
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42072
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/42072] [F03] wrong-code with C_F_PROCPOINTER
2009-11-16 22:48 [Bug fortran/42072] New: [F03] wrong-code with C_F_PROCPOINTER janus at gcc dot gnu dot org
` (3 preceding siblings ...)
2009-11-16 23:00 ` pinskia at gcc dot gnu dot org
@ 2009-11-17 12:00 ` janus at gcc dot gnu dot org
2009-11-18 13:25 ` janus at gcc dot gnu dot org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-11-17 12:00 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from janus at gcc dot gnu dot org 2009-11-17 12:00 -------
(In reply to comment #3)
> So inside MAIN__ we have:
> static void setpointer (integer(kind=4) (*<T3af>) (integer(kind=4)));
> setpointer (&ptype);
>
> That is wrong, unless I am missing a reference type somewhere.
Yes, indeed the 'static' line is wrong. However, it does not seem to have any
consequences.
> Plus inside setpointer I think:
> p = (integer(kind=4) (*<T3af>) (integer(kind=4)) *) funpointer;
>
> is incorrect, it should be:
> *p = funpointer;
Right, this is corrected by my patch in comment #2. With that patch, the dump
shows:
setpointer (integer(kind=4) (*<T3d4>) (integer(kind=4)) * p)
{
*p = (integer(kind=4) (*<T3d4>) (integer(kind=4))) funpointer;
}
MAIN__ ()
{
extern void (*<T62>) (void) funpointer;
integer(kind=4) (*<T3d4>) (integer(kind=4)) ptype;
integer(kind=4) (*<T3d4>) (integer(kind=4)) ptype2;
static void setpointer (integer(kind=4) (*<T3d4>) (integer(kind=4)));
Here the 'setpointer' routine is ok, but again the static declaration is wrong.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42072
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/42072] [F03] wrong-code with C_F_PROCPOINTER
2009-11-16 22:48 [Bug fortran/42072] New: [F03] wrong-code with C_F_PROCPOINTER janus at gcc dot gnu dot org
` (4 preceding siblings ...)
2009-11-17 12:00 ` janus at gcc dot gnu dot org
@ 2009-11-18 13:25 ` janus at gcc dot gnu dot org
2009-11-20 15:51 ` janus at gcc dot gnu dot org
2009-11-20 16:08 ` janus at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-11-18 13:25 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from janus at gcc dot gnu dot org 2009-11-18 13:25 -------
Subject: Bug 42072
Author: janus
Date: Wed Nov 18 13:24:54 2009
New Revision: 154292
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=154292
Log:
2009-11-18 Janus Weil <janus@gcc.gnu.org>
PR fortran/42072
* trans-expr.c (gfc_conv_procedure_call): Handle procedure pointer
dummies which are passed to C_F_PROCPOINTER.
2009-11-18 Janus Weil <janus@gcc.gnu.org>
PR fortran/42072
* gfortran.dg/proc_ptr_8.f90: Extended.
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/trans-expr.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gfortran.dg/proc_ptr_8.f90
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42072
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/42072] [F03] wrong-code with C_F_PROCPOINTER
2009-11-16 22:48 [Bug fortran/42072] New: [F03] wrong-code with C_F_PROCPOINTER janus at gcc dot gnu dot org
` (5 preceding siblings ...)
2009-11-18 13:25 ` janus at gcc dot gnu dot org
@ 2009-11-20 15:51 ` janus at gcc dot gnu dot org
2009-11-20 16:08 ` janus at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-11-20 15:51 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from janus at gcc dot gnu dot org 2009-11-20 15:51 -------
The runtime problem and the obsolete comment in the manual are fixed now. So
the only issue left is the wrong static declaration reported in comment #3.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42072
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/42072] [F03] wrong-code with C_F_PROCPOINTER
2009-11-16 22:48 [Bug fortran/42072] New: [F03] wrong-code with C_F_PROCPOINTER janus at gcc dot gnu dot org
` (6 preceding siblings ...)
2009-11-20 15:51 ` janus at gcc dot gnu dot org
@ 2009-11-20 16:08 ` janus at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-11-20 16:08 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from janus at gcc dot gnu dot org 2009-11-20 16:08 -------
(In reply to comment #7)
> So the only issue left is the wrong static declaration reported in comment #3.
This is now PR 42122. Closing this one.
--
janus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42072
^ permalink raw reply [flat|nested] 9+ messages in thread