public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rakuen_himawari at yahoo dot co dot jp" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/31692]  New: function without result clause fails to compile prperly
Date: Wed, 25 Apr 2007 05:25:00 -0000	[thread overview]
Message-ID: <bug-31692-13327@http.gcc.gnu.org/bugzilla/> (raw)

The following code causes segfault on execution. 
(This code works with PGI, Intel, and Hitachi Fortrans)

    module one
    contains
        function foo1(n)
        integer :: n
        integer :: foo1(n)

        call bar1(n, foo1)
        return
        end function

        subroutine bar1(n, array)
          integer :: n
          integer :: array(*)
          integer :: i
          do i = 1, n
             array(i) = i
          enddo
        end subroutine
    end module

    program main
      use one
      integer :: n
      n = 3
      write(*,*) foo1(n)
    end program

If the defnition of function foo1 is modeified as following, The problem
disappear.

        function foo1(n) result(res)
        integer :: n
        integer :: res(n)

        call bar1(n, res)
        return
        end function


-- 
           Summary: function without result clause fails to compile prperly
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rakuen_himawari at yahoo dot co dot jp
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


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


             reply	other threads:[~2007-04-25  5:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-25  5:25 rakuen_himawari at yahoo dot co dot jp [this message]
2007-04-25  6:38 ` [Bug fortran/31692] Wrong code when passing function name as result to procedures burnus at gcc dot gnu dot org
2007-04-27 22:52 ` burnus at gcc dot gnu dot org
2007-05-04  6:29 ` pault at gcc dot gnu dot org
2007-05-05  0:06 ` patchapp at dberlin dot org
2007-05-08 12:45 ` pault at gcc dot gnu dot org
2007-05-08 12:49 ` pault at gcc dot gnu dot org
2007-05-14 19:08 ` burnus at gcc dot gnu dot org

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-31692-13327@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).