public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/20178] New: COMPLEX function returns incompatible with g77
@ 2005-02-23 23:29 gcc-bugzilla at gcc dot gnu dot org
  2005-02-23 23:32 ` [Bug fortran/20178] " pinskia at gcc dot gnu dot org
                   ` (28 more replies)
  0 siblings, 29 replies; 31+ messages in thread
From: gcc-bugzilla at gcc dot gnu dot org @ 2005-02-23 23:29 UTC (permalink / raw)
  To: gcc-bugs



A function returning a COMPLEX value cannot be compiled in g77 and
called from gfortran (or vice versa) - doing so results in a segfault
or incorrect results.  (See test case below.)

This is a problem, since for the near future g77 and gfortran are
likely to coexist on many systems, and incompatible calling
conventions for F77 code means that libraries like the BLAS will have
to be provided in two flavors (g77 and gfortran) on the same system, a
major headache for users (not to mention distributors).

Note that COMPLEX argument passing seems to be okay (the below test
case works fine if it is switched from a function into a subroutine).

Environment:
System: Linux fftw.org 2.6.3-1-686-smp #2 SMP Tue Feb 24 20:29:08 EST 2004 i686 GNU/Linux
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../configure --prefix=/home/stevenj/gcc4 --enable-languages=c,f95

How-To-Repeat:
Create two files, arg1.f and arg1tst.f, consisting of:

arg1.f:
      complex function arg1(x, y)
      complex x, y
      arg1 = x + y
      return
      end

arg1tst.f:
      program arg1tst
      complex x,y,z, arg1
      x = cmplx(1.,2.)
      y = cmplx(3.,4.)
      z = arg1(x,y)
      write(*,*) z
      end

Compile arg1.f with g77 (I'm using version 3.3.5):

	g77 -c arg1.f

Compile arg1tst.f with gfortran, and link with arg1.o from above:

	gfortran arg1tst.f arg1.o -o arg1tst

Run ./arg1tst, and the result on my system is:

	Segmentation fault

Expected output is: (  4.000000    ,  6.000000    )

-- 
           Summary: COMPLEX function returns incompatible with g77
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: stevenj at fftw dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


^ permalink raw reply	[flat|nested] 31+ messages in thread
[parent not found: <bug-20178-9955@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2006-01-31 18:01 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-23 23:29 [Bug fortran/20178] New: COMPLEX function returns incompatible with g77 gcc-bugzilla at gcc dot gnu dot org
2005-02-23 23:32 ` [Bug fortran/20178] " pinskia at gcc dot gnu dot org
2005-02-24  2:42 ` tobi at gcc dot gnu dot org
2005-02-24  2:43 ` tobi at gcc dot gnu dot org
2005-02-24  4:39 ` pinskia at gcc dot gnu dot org
2005-02-24  7:31 ` tobi at gcc dot gnu dot org
2005-02-24  9:27 ` stevenj at fftw dot org
2005-02-24  9:27 ` pinskia at gcc dot gnu dot org
2005-02-24  9:27 ` pinskia at gcc dot gnu dot org
2005-02-24 10:30 ` tobi at gcc dot gnu dot org
2005-02-24 10:35 ` stevenj at fftw dot org
2005-02-24 10:58 ` stevenj at fftw dot org
2005-02-28  2:50 ` tobi at gcc dot gnu dot org
2005-03-03 20:51 ` tobi at gcc dot gnu dot org
2005-03-03 21:36 ` tobi at gcc dot gnu dot org
2005-03-03 21:49 ` stevenj at fftw dot org
2005-03-03 22:06 ` tobi at gcc dot gnu dot org
2005-03-04  4:44 ` stevenj at fftw dot org
2005-03-04  4:46 ` stevenj at fftw dot org
2005-03-04 11:27 ` tobi at gcc dot gnu dot org
2005-03-04 11:40 ` tobi at gcc dot gnu dot org
2005-03-05 15:33 ` tobi at gcc dot gnu dot org
2005-05-10 22:07 ` cvs-commit at gcc dot gnu dot org
2005-05-10 22:23 ` tobi at gcc dot gnu dot org
     [not found] ` <19490500.1116054120820.JavaMail.root@dtm1eusosrv72.dtm.ops.eu.uu.net>
2005-05-15 11:32   ` Toon Moene
2005-05-15 11:34 ` toon at moene dot indiv dot nluug dot nl
2005-05-18 11:23 ` Tobias dot Schlueter at physik dot uni-muenchen dot de
2005-05-22 18:10 ` Tobias dot Schlueter at physik dot uni-muenchen dot de
2005-07-20 23:13 ` pinskia at gcc dot gnu dot org
2005-07-22 13:42 ` tobi at gcc dot gnu dot org
     [not found] <bug-20178-9955@http.gcc.gnu.org/bugzilla/>
2006-01-31 18:01 ` pinskia 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).