public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/40646]  New: ICE assigning array return value from type-bound  procedure
@ 2009-07-04  7:50 burnus at gcc dot gnu dot org
  2009-07-04 12:22 ` [Bug fortran/40646] " pault at gcc dot gnu dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-07-04  7:50 UTC (permalink / raw)
  To: gcc-bugs

Reported by Charlie Sharpsteen at
  http://gcc.gnu.org/ml/fortran/2009-07/msg00010.html

The program runs with NAG f95 5.1 and prints twice:
   1.0000000000000000   1.0000000000000000   1.0000000000000000   
   1.0000000000000000

With gfortran:
  aaa.f90: In function 'bugtest':
  aaa.f90:30:0: internal compiler error: Segmentation fault

valgrind shows:
==17749== Invalid read of size 1
==17749==    at 0x56D412: gfc_return_by_reference (trans-types.c:2089)
==17749==    by 0x550D88: gfc_trans_assignment (trans-expr.c:4412)

which is:
  2087  gfc_return_by_reference (gfc_symbol * sym)
  2088  {
  2089    if (!sym->attr.function)
  2090      return 0;


! Testcase by Charlie Sharpsteen
module bugTestMod
implicit none
  type:: boundTest
  contains
    procedure, nopass:: test => returnMat
  end type boundTest
contains
  function returnMat( a, b ) result( mat )
    integer:: a, b
    double precision, dimension(a,b):: mat 
    mat = 1d0
  end function returnMat
end module bugTestMod

program bugTest
  use bugTestMod
  implicit none
  double precision, dimension(2,2):: testCatch
  type( boundTest ):: testObj
  write(*,*)testObj%test(2,2)  ! <<<< OK (at run time)
  testCatch = testObj%test(2,2)! <<<< ICE
  write(*,*)testCatch
end program bugTest


-- 
           Summary: ICE assigning array return value from type-bound
                    procedure
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40646


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2009-07-13 16:58 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-04  7:50 [Bug fortran/40646] New: ICE assigning array return value from type-bound procedure burnus at gcc dot gnu dot org
2009-07-04 12:22 ` [Bug fortran/40646] " pault at gcc dot gnu dot org
2009-07-04 12:38 ` janus at gcc dot gnu dot org
2009-07-04 12:45 ` burnus at gcc dot gnu dot org
2009-07-04 14:11 ` janus at gcc dot gnu dot org
2009-07-05 19:14 ` pault at gcc dot gnu dot org
2009-07-06  7:37 ` [Bug fortran/40646] [F03] array-valued procedure pointer components janus at gcc dot gnu dot org
2009-07-09 14:07 ` janus at gcc dot gnu dot org
2009-07-10 12:25 ` janus at gcc dot gnu dot org
2009-07-13 13:42 ` janus at gcc dot gnu dot org
2009-07-13 13:45 ` janus at gcc dot gnu dot org
2009-07-13 16:58 ` dominiq at lps dot ens dot fr

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