public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/31692]  New: function without result clause fails to compile prperly
@ 2007-04-25  5:25 rakuen_himawari at yahoo dot co dot jp
  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
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: rakuen_himawari at yahoo dot co dot jp @ 2007-04-25  5:25 UTC (permalink / raw)
  To: gcc-bugs

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


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

end of thread, other threads:[~2007-05-14 19:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-25  5:25 [Bug fortran/31692] New: function without result clause fails to compile prperly rakuen_himawari at yahoo dot co dot jp
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

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