public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "burnus at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/40646]  New: ICE assigning array return value from type-bound  procedure
Date: Sat, 04 Jul 2009 07:50:00 -0000	[thread overview]
Message-ID: <bug-40646-13404@http.gcc.gnu.org/bugzilla/> (raw)

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


             reply	other threads:[~2009-07-04  7:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-04  7:50 burnus at gcc dot gnu dot org [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-40646-13404@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).