Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Jul 2013 09:52:39 -0700
From:      Steve Kargl <sgk@troutmask.apl.washington.edu>
To:        mexas@bristol.ac.uk
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:  <20130712165239.GA74169@troutmask.apl.washington.edu>
In-Reply-To: <201307121118.r6CBIhiE098987@mech-cluster241.men.bris.ac.uk>
References:  <20130712051417.GA71107@troutmask.apl.washington.edu> <201307121118.r6CBIhiE098987@mech-cluster241.men.bris.ac.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Jul 12, 2013 at 12:18:43PM +0100, Anton Shterenlikht wrote:
> >From sgk@troutmask.apl.washington.edu Fri Jul 12 07:25:06 2013
> 
> >I suspect that the code_aster developers have no
> >idea how dangerous these options are, or understand
> >their limitations.  If the code_aster developers
> >do not want to do a proper port of the Fortran code
> >from single precision to double precision, then they
> >probably should use -freal-4-real-8, which is likely
> >closers to what they want.
> 
> Ok, I'll see if the port builds with -freal-4-real-8.
> However this option is only supported starting from 4.7:
> 
> $ gfortran46 -freal-4-real-8 z.f90
> f951: error: unrecognized command line option '-freal-4-real-8'
> $ gfortran47 -freal-4-real-8 z.f90
> $ 
> 
> which brings me to the topic I struggled for some time -
> using non-default GCC ports compiler. Simply changing
> 
> $ grep GCC_DEFAULT_VERSION= /usr/ports/Mk/bsd.gcc.mk
> GCC_DEFAULT_VERSION=    4.6
> $ 
> 
> to e.g. 4.7 seems to work for some ports but not for others.

I would need to see the specific errors/issues.  4.7 of course
fixes numerous bugs in 4.6, adds features, and may tighten up
conformance checking.

> It is not clear how many ports, and which, have to
> be rebuilt with such a change. For example, if I want
> to build code_aster with 4.7, do I need to rebuild
> all or some ports on which it depends also with 4.7?

IIRC, the ABI for the runtime library has not changed from
4.6 to 4.7.  So, code compiled with 4.6 should be able to
link with the 4.7 compiler.  I don't remember if/what may
have changed with module internals.

Here's a slightly better example code for testing the
options.  Note, there are still some quirks one needs
to understand about these options and Fortran's EQUIVALENCE,
COMMON, and use of kind type parameter suffixes (ie., 1.e0_8).

  integer, parameter :: sp = kind(1.e0), dp = kind(1.d0)

  complex z        ! Standard conforming default kind.
  complex(sp) zsp  ! Standard conforming default kind.
  complex(dp) zdp  ! Standard conforming double precision.
  complex*8 a8     ! Non-standard old school declaration
  complex*16 a16   ! Non-standard old school declaration

  print '(5(I0,1X))', kind(z), kind(zsp), kind(zdp), kind(a8), kind(a16)

  end

This is on amd64.

% gfc4x -o a a.f90 && ./a
4 4 8 4 8
% gfc4x -o a a.f90 -fdefault-real-8 && ./a
8 8 16 4 8
% gfc4x -o a a.f90 -freal-4-real-8 && ./a
8 8 8 8 8


-- 
Steve



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