public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/51082] New: Proc-pointer: Wrong result for a pointer to a proc-pointer component
@ 2011-11-10 15:07 burnus at gcc dot gnu.org
2011-11-10 20:05 ` [Bug fortran/51082] [F03] " janus at gcc dot gnu.org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-11-10 15:07 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51082
Bug #: 51082
Summary: Proc-pointer: Wrong result for a pointer to a
proc-pointer component
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: burnus@gcc.gnu.org
CC: xarthisius.kk@gmail.com
The following program reported at #gfortran shall print twice "1.0" but with
gfortran, it just prints:
1.00000000
At line 23 of file pp.f90 (unit = 6, file = 'stdout')
Internal Error: bad real kind
If one looks at the dump, one sees:
p_list.process = ala1;
p = &p_list;
with the call being:
D.1841 = p_list.process (&C.1840);
_gfortran_transfer_real_write (&dt_parm.0, &D.1841, 4);
D.1844 = p->process (&C.1843);
_gfortran_transfer_real_write (&dt_parm.1, D.1844, 4);
Notice in particular that for the second case, one has "D.1844" instead of
"&D.1844".
program ala
implicit none
type process_list
procedure(process_interface), pointer, nopass :: process
type(process_list), pointer :: next => null()
end type process_list
abstract interface
real function process_interface(x)
real, intent(in) :: x
end function process_interface
end interface
type(process_list), target :: p_list
type(process_list), pointer :: p
p_list%process => ala1
p => p_list
write(*,*) p_list%process(1.0)
write(*,*) p%process(1.0) !!!! fails with gfortran
contains
real function ala1(x)
implicit none
real, intent(in) :: x
ala1 = x
end function ala1
end program ala
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/51082] [F03] Wrong result for a pointer to a proc-pointer component
2011-11-10 15:07 [Bug fortran/51082] New: Proc-pointer: Wrong result for a pointer to a proc-pointer component burnus at gcc dot gnu.org
@ 2011-11-10 20:05 ` janus at gcc dot gnu.org
2011-11-10 20:29 ` janus at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: janus at gcc dot gnu.org @ 2011-11-10 20:05 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51082
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2011-11-10
CC| |janus at gcc dot gnu.org
Summary|Proc-pointer: Wrong result |[F03] Wrong result for a
|for a pointer to a |pointer to a proc-pointer
|proc-pointer component |component
Ever Confirmed|0 |1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/51082] [F03] Wrong result for a pointer to a proc-pointer component
2011-11-10 15:07 [Bug fortran/51082] New: Proc-pointer: Wrong result for a pointer to a proc-pointer component burnus at gcc dot gnu.org
2011-11-10 20:05 ` [Bug fortran/51082] [F03] " janus at gcc dot gnu.org
@ 2011-11-10 20:29 ` janus at gcc dot gnu.org
2011-11-10 21:18 ` janus at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: janus at gcc dot gnu.org @ 2011-11-10 20:29 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51082
--- Comment #1 from janus at gcc dot gnu.org 2011-11-10 20:04:55 UTC ---
Note: The following variant works.
program ala
implicit none
type process_list
procedure(ala1), pointer, nopass :: process
end type
type(process_list), target :: p_list
type(process_list), pointer :: p
real :: r
p_list%process => ala1
p => p_list
r = p%process(1.0)
write(*,*) r
contains
real function ala1(x)
real, intent(in) :: x
ala1 = x
end function ala1
end program ala
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/51082] [F03] Wrong result for a pointer to a proc-pointer component
2011-11-10 15:07 [Bug fortran/51082] New: Proc-pointer: Wrong result for a pointer to a proc-pointer component burnus at gcc dot gnu.org
2011-11-10 20:05 ` [Bug fortran/51082] [F03] " janus at gcc dot gnu.org
2011-11-10 20:29 ` janus at gcc dot gnu.org
@ 2011-11-10 21:18 ` janus at gcc dot gnu.org
2012-04-13 14:23 ` janus at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: janus at gcc dot gnu.org @ 2011-11-10 21:18 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51082
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
AssignedTo|unassigned at gcc dot |janus at gcc dot gnu.org
|gnu.org |
--- Comment #2 from janus at gcc dot gnu.org 2011-11-10 21:02:34 UTC ---
Fix:
Index: gcc/fortran/trans-expr.c
===================================================================
--- gcc/fortran/trans-expr.c (revision 181240)
+++ gcc/fortran/trans-expr.c (working copy)
@@ -5019,7 +5019,7 @@ gfc_conv_expr_reference (gfc_se * se, gfc_expr * e
&& ((expr->value.function.esym
&& expr->value.function.esym->result->attr.pointer
&& !expr->value.function.esym->result->attr.dimension)
- || (!expr->value.function.esym
+ || (!expr->value.function.esym && !expr->ref
&& expr->symtree->n.sym->attr.pointer
&& !expr->symtree->n.sym->attr.dimension)))
{
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/51082] [F03] Wrong result for a pointer to a proc-pointer component
2011-11-10 15:07 [Bug fortran/51082] New: Proc-pointer: Wrong result for a pointer to a proc-pointer component burnus at gcc dot gnu.org
` (2 preceding siblings ...)
2011-11-10 21:18 ` janus at gcc dot gnu.org
@ 2012-04-13 14:23 ` janus at gcc dot gnu.org
2012-04-15 11:48 ` janus at gcc dot gnu.org
2012-04-15 11:54 ` janus at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: janus at gcc dot gnu.org @ 2012-04-13 14:23 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51082
--- Comment #3 from janus at gcc dot gnu.org 2012-04-13 14:23:25 UTC ---
Note: The patch in comment #2 regtests cleanly.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/51082] [F03] Wrong result for a pointer to a proc-pointer component
2011-11-10 15:07 [Bug fortran/51082] New: Proc-pointer: Wrong result for a pointer to a proc-pointer component burnus at gcc dot gnu.org
` (3 preceding siblings ...)
2012-04-13 14:23 ` janus at gcc dot gnu.org
@ 2012-04-15 11:48 ` janus at gcc dot gnu.org
2012-04-15 11:54 ` janus at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: janus at gcc dot gnu.org @ 2012-04-15 11:48 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51082
--- Comment #4 from janus at gcc dot gnu.org 2012-04-15 11:47:55 UTC ---
Author: janus
Date: Sun Apr 15 11:47:49 2012
New Revision: 186465
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=186465
Log:
2012-04-15 Janus Weil <janus@gcc.gnu.org>
PR fortran/51082
* trans-expr.c (gfc_conv_expr_reference): Check if the expression is a
simple function call (or a more involved PPC reference).
2012-04-15 Janus Weil <janus@gcc.gnu.org>
PR fortran/51082
* gfortran.dg/proc_ptr_comp_34.f90: New test case.
Added:
trunk/gcc/testsuite/gfortran.dg/proc_ptr_comp_34.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/trans-expr.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/51082] [F03] Wrong result for a pointer to a proc-pointer component
2011-11-10 15:07 [Bug fortran/51082] New: Proc-pointer: Wrong result for a pointer to a proc-pointer component burnus at gcc dot gnu.org
` (4 preceding siblings ...)
2012-04-15 11:48 ` janus at gcc dot gnu.org
@ 2012-04-15 11:54 ` janus at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: janus at gcc dot gnu.org @ 2012-04-15 11:54 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51082
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
--- Comment #5 from janus at gcc dot gnu.org 2012-04-15 11:52:41 UTC ---
Fixed with r186465. Closing.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-04-15 11:54 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-10 15:07 [Bug fortran/51082] New: Proc-pointer: Wrong result for a pointer to a proc-pointer component burnus at gcc dot gnu.org
2011-11-10 20:05 ` [Bug fortran/51082] [F03] " janus at gcc dot gnu.org
2011-11-10 20:29 ` janus at gcc dot gnu.org
2011-11-10 21:18 ` janus at gcc dot gnu.org
2012-04-13 14:23 ` janus at gcc dot gnu.org
2012-04-15 11:48 ` janus at gcc dot gnu.org
2012-04-15 11:54 ` janus at gcc dot gnu.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).