Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Jul 2013 09:09:22 +0100 (BST)
From:      Anton Shterenlikht <mexas@bris.ac.uk>
To:        mexas@bristol.ac.uk, sgk@troutmask.apl.washington.edu
Cc:        fortran@freebsd.org
Subject:   Re: gfortran46: Error: Type of argument 'z' in call to 'dimag' at (1) should be COMPLEX(16), not COMPLEX(8)
Message-ID:  <201307110809.r6B89Mwm022261@mech-cluster241.men.bris.ac.uk>
In-Reply-To: <20130710232741.GA61961@troutmask.apl.washington.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
	From sgk@troutmask.apl.washington.edu Thu Jul 11 02:17:08 2013

	On Thu, Jul 11, 2013 at 12:15:28AM +0100, Anton Shterenlikht wrote:
	> These errors are from french/aster on amd64.
	> I think I need to rebuld lang/gcc after the
	> recent updates to binutils, but anyway,
	> which command line options to gfortran46
	> would lead to this error?
	> 
	> These routines are GNU extensions specifically for complex(8),
	> e.g.: http://gcc.gnu.org/onlinedocs/gcc-4.6.4/gfortran/AIMAG.html#AIMAG
	> 
	> Messages de compilation
	> =======================
	> /usr/ports/french/aster/work/aster-full-src-10.8.0/instdir/STA10.8/bibfor/algeline/dcargu.f:34.18:
	> 
	>         IF (DIMAG(C).GT.0.D0) THEN                                      
	>                   1
	> Error: Type of argument 'z' in call to 'dimag' at (1) should
	> be COMPLEX(16), not COMPLEX(8)

	Need to see the declaration for C.  My guess is that it is declared
	as 'complex c' or 'complex*8 c'.  In either case, this is the single
	precision complex type.  The program is using the specific intrinsic
	function dimag, which expects a double precision complex argument. 

	The correct fixes are to properly declare the variables via Fortran's
	kind type parameter and to use generic intrinsic functions.

$ cat dcargu.f
      FUNCTION DCARGU(C)
      IMPLICIT REAL*8 (A-H,O-Z)
C-----------------------------------------------------------------------
C            CONFIGURATION MANAGEMENT OF EDF VERSION
C MODIF ALGELINE  DATE 14/11/2006   AUTEUR LEBOUVIER F.LEBOUVIER 
C ======================================================================
C COPYRIGHT (C) 1991 - 2001  EDF R&D                  WWW.CODE-ASTER.ORG
C THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
C IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY
C THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR   
C (AT YOUR OPTION) ANY LATER VERSION.                                 
C
C THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT 
C WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF          
C MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU    
C GENERAL PUBLIC LICENSE FOR MORE DETAILS.                            
C
C YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE   
C ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER,       
C    1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE.      
C ======================================================================
C-----------------------------------------------------------------------
C CALCUL DE L'ARGUMENT D'UN NOMBRE COMPLEXE
C PAR CONVENTION ON AFFECTE 0.D0 SI C = (0.D0,0.D0)
C-----------------------------------------------------------------------
C  IN : C : NOMBRE COMPLEXE DONT ON VEUT CALCULER L'ARGUMENT
C-----------------------------------------------------------------------
      REAL*8     DCARGU
      COMPLEX*16 C
C-----------------------------------------------------------------------
      PI  = R8PI()
C
      IF (DBLE(C).EQ.0.D0) THEN
        IF (DIMAG(C).GT.0.D0) THEN
          DCARGU = PI/2.D0
        ELSE IF (DIMAG(C).LT.0.D0) THEN
          DCARGU = -PI/2.D0
        ELSE
          DCARGU = 0.D0
        ENDIF
      ELSE IF (DBLE(C).GT.0.D0) THEN
        DCARGU = DBLE(ATAN2(DIMAG(C),DBLE(C)))
      ELSE IF (DBLE(C).LT.0.D0) THEN
        DCARGU = DBLE(ATAN2(DIMAG(C),DBLE(C))) + PI
      ENDIF
      IF (DCARGU.LT.0.D0) DCARGU = DCARGU + 2.D0*PI
C
      END
$
$ gfortran46 -Wall -c dcargu.f
$

So my guess is that in the port build, some other
compiler options are used that cause the failure.
I need to check this.

And I've rebuilt binutils, lang/gcc, math/metis-edf
(with the proposed patch).

Also, french/aster builds fine on ia64 -current.

Anton




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201307110809.r6B89Mwm022261>