public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/40427] New: [F03] Procedure Pointer Components with OPTIONAL arguments
@ 2009-06-12 13:14 janus at gcc dot gnu dot org
2009-06-13 11:33 ` [Bug fortran/40427] " janus at gcc dot gnu dot org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-06-12 13:14 UTC (permalink / raw)
To: gcc-bugs
The following was reported by John McFarland:
PROGRAM prog
ABSTRACT INTERFACE
SUBROUTINE sub_template(i,j,o)
INTEGER, INTENT(in) :: i
INTEGER, INTENT(in), OPTIONAL :: j, o
END SUBROUTINE sub_template
END INTERFACE
TYPE container
PROCEDURE(sub_template), POINTER, NOPASS :: s
END TYPE container
PROCEDURE(sub_template), POINTER :: s
TYPE (container) :: c
c%s => sub
s => sub
CALL callf(s)
CALL callfc(c)
CONTAINS
SUBROUTINE callfc(c)
TYPE (container) :: c
PRINT*, 'Calling with ppc'
CALL c%s(1,o=3)
END SUBROUTINE callfc
SUBROUTINE callf(f)
PROCEDURE(sub_template), OPTIONAL, POINTER :: f
PRINT*, 'Calling pp argument'
CALL f(1,o=5)
END SUBROUTINE callf
SUBROUTINE sub(i,arg2,arg3)
INTEGER, INTENT(in) :: i
INTEGER, INTENT(in), OPTIONAL :: arg2, arg3
PRINT*, 'i:', i
PRINT*, 'Present:', PRESENT(arg2), PRESENT(arg3)
IF (PRESENT(arg2)) PRINT*, 'arg2:', arg2
IF (PRESENT(arg3)) PRINT*, 'arg3:', arg3
END SUBROUTINE sub
END PROGRAM prog
This program compiles fine, but produces the output:
Calling pp argument
i: 1
Present: F T
arg3: 5
Calling with ppc
i: 1
Present: T T
arg2: 3
arg3: -443987883
This means that there is a problem with calling PPCs with optional arguments.
--
Summary: [F03] Procedure Pointer Components with OPTIONAL
arguments
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: janus at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40427
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/40427] [F03] Procedure Pointer Components with OPTIONAL arguments
2009-06-12 13:14 [Bug fortran/40427] New: [F03] Procedure Pointer Components with OPTIONAL arguments janus at gcc dot gnu dot org
@ 2009-06-13 11:33 ` janus at gcc dot gnu dot org
2009-06-19 7:32 ` burnus at gcc dot gnu dot org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-06-13 11:33 UTC (permalink / raw)
To: gcc-bugs
--
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-06-13 11:33:42
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40427
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/40427] [F03] Procedure Pointer Components with OPTIONAL arguments
2009-06-12 13:14 [Bug fortran/40427] New: [F03] Procedure Pointer Components with OPTIONAL arguments janus at gcc dot gnu dot org
2009-06-13 11:33 ` [Bug fortran/40427] " janus at gcc dot gnu dot org
@ 2009-06-19 7:32 ` burnus at gcc dot gnu dot org
2009-06-24 11:00 ` janus at gcc dot gnu dot org
2009-06-24 11:03 ` janus at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-06-19 7:32 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from burnus at gcc dot gnu dot org 2009-06-19 07:32 -------
Patch by Janus: http://gcc.gnu.org/ml/fortran/2009-06/msg00177.html
(I try to get it reviewed soon.)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40427
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/40427] [F03] Procedure Pointer Components with OPTIONAL arguments
2009-06-12 13:14 [Bug fortran/40427] New: [F03] Procedure Pointer Components with OPTIONAL arguments janus at gcc dot gnu dot org
2009-06-13 11:33 ` [Bug fortran/40427] " janus at gcc dot gnu dot org
2009-06-19 7:32 ` burnus at gcc dot gnu dot org
@ 2009-06-24 11:00 ` janus at gcc dot gnu dot org
2009-06-24 11:03 ` janus at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-06-24 11:00 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from janus at gcc dot gnu dot org 2009-06-24 11:00 -------
Subject: Bug 40427
Author: janus
Date: Wed Jun 24 10:59:56 2009
New Revision: 148906
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=148906
Log:
2009-06-24 Janus Weil <janus@gcc.gnu.org>
PR fortran/40427
* gfortran.h (gfc_component): New member 'formal_ns'.
(gfc_copy_formal_args_ppc,void gfc_ppc_use): New.
* interface.c (gfc_ppc_use): New function, analogous to
gfc_procedure_use, but for procedure pointer components.
* module.c (MOD_VERSION): Bump module version.
(mio_component): Treat formal arguments.
(mio_formal_arglist): Changed argument from gfc_symbol to
gfc_formal_arglist.
(mio_symbol): Changed argument of mio_formal_arglist.
* resolve.c (resolve_ppc_call,resolve_expr_ppc): Call gfc_ppc_use,
to check actual arguments and treat formal args correctly.
(resolve_fl_derived): Copy formal args of procedure pointer components
from their interface.
* symbol.c (gfc_copy_formal_args_ppc): New function, analogous to
gfc_copy_formal_args, but for procedure pointer components.
2009-06-24 Janus Weil <janus@gcc.gnu.org>
PR fortran/40427
* gfortran.dg/proc_ptr_comp_11.f90: New.
Added:
trunk/gcc/testsuite/gfortran.dg/proc_ptr_comp_11.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/gfortran.h
trunk/gcc/fortran/interface.c
trunk/gcc/fortran/module.c
trunk/gcc/fortran/resolve.c
trunk/gcc/fortran/symbol.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40427
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/40427] [F03] Procedure Pointer Components with OPTIONAL arguments
2009-06-12 13:14 [Bug fortran/40427] New: [F03] Procedure Pointer Components with OPTIONAL arguments janus at gcc dot gnu dot org
` (2 preceding siblings ...)
2009-06-24 11:00 ` janus at gcc dot gnu dot org
@ 2009-06-24 11:03 ` janus at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-06-24 11:03 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from janus at gcc dot gnu dot org 2009-06-24 11:02 -------
Fixed with r148906. Closing.
--
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=40427
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-06-24 11:03 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-12 13:14 [Bug fortran/40427] New: [F03] Procedure Pointer Components with OPTIONAL arguments janus at gcc dot gnu dot org
2009-06-13 11:33 ` [Bug fortran/40427] " janus at gcc dot gnu dot org
2009-06-19 7:32 ` burnus at gcc dot gnu dot org
2009-06-24 11:00 ` janus at gcc dot gnu dot org
2009-06-24 11:03 ` janus 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).