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

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).