From owner-freebsd-toolchain@freebsd.org  Mon Aug 15 00:20:35 2016
Return-Path: <owner-freebsd-toolchain@freebsd.org>
Delivered-To: freebsd-toolchain@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id D5A20BBA489;
 Mon, 15 Aug 2016 00:20:35 +0000 (UTC)
 (envelope-from sgk@troutmask.apl.washington.edu)
Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu
 [128.95.76.21])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client CN "troutmask", Issuer "troutmask" (not verified))
 by mx1.freebsd.org (Postfix) with ESMTPS id A39F51148;
 Mon, 15 Aug 2016 00:20:35 +0000 (UTC)
 (envelope-from sgk@troutmask.apl.washington.edu)
Received: from troutmask.apl.washington.edu (localhost [127.0.0.1])
 by troutmask.apl.washington.edu (8.15.2/8.15.2) with ESMTPS id u7F0KWLR010918
 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO);
 Sun, 14 Aug 2016 17:20:32 -0700 (PDT)
 (envelope-from sgk@troutmask.apl.washington.edu)
Received: (from sgk@localhost)
 by troutmask.apl.washington.edu (8.15.2/8.15.2/Submit) id u7F0KWji010917;
 Sun, 14 Aug 2016 17:20:32 -0700 (PDT) (envelope-from sgk)
Date: Sun, 14 Aug 2016 17:20:32 -0700
From: Steve Kargl <sgk@troutmask.apl.washington.edu>
To: Diane Bruce <db@db.net>
Cc: freebsd-ports@freebsd.org, freebsd-toolchain@freebsd.org
Subject: Re: Problems with out libgcc_s.so in base
Message-ID: <20160815002032.GA10882@troutmask.apl.washington.edu>
References: <20160814230351.GA10587@troutmask.apl.washington.edu>
 <20160814233430.GA35872@night.db.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20160814233430.GA35872@night.db.net>
User-Agent: Mutt/1.6.1 (2016-04-27)
X-BeenThere: freebsd-toolchain@freebsd.org
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: Maintenance of FreeBSD's integrated toolchain
 <freebsd-toolchain.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/freebsd-toolchain>, 
 <mailto:freebsd-toolchain-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-toolchain/>
List-Post: <mailto:freebsd-toolchain@freebsd.org>
List-Help: <mailto:freebsd-toolchain-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain>, 
 <mailto:freebsd-toolchain-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 15 Aug 2016 00:20:35 -0000

On Sun, Aug 14, 2016 at 07:34:30PM -0400, Diane Bruce wrote:
> On Sun, Aug 14, 2016 at 04:03:51PM -0700, Steve Kargl wrote:
> > 
> > FreeBSD-ports could avoid libquadmath issues by building gcc
> > without it.  See --without-libquadmath or --without-quadmath (I
> > don't remember the config option because it would be questionable
> > to neuter one of gfortran's strength).
> 
> Correct. This blog entry I read some months ago outlines this
> exact problem we are having and suggests the identical solution.
> 
> http://glennklockwood.blogspot.ca/2014/02/linux-perf-libquadmath-and-gfortrans.html
> 
> quadmath does have an impact on performance.
> 

I read that blog a long time ago.  It is quite humorous, because
the author does not understand the storage requirements of Fortran.
If one uses only the -fdefault-real-8 option to promote REAL to
DOUBLE PRECISION, then storage requirements mandate that DP 
should be promoted to QP (if available).  That's why there is
the -fdefault-double-8.  In additions, these options were never
meant to be used in a situation where performance matters.  These
options are a crutch for lazy programmers, who don't want to properly
port code to a wider precision.   

As the person who actually implemented these options in gfortran
for backwards compatibility with g77, I can assure that very few
people know what these options do.  The problem lies in Fortran's
COMMON and EQUIVALENCE statements, where storage alignment can be
messed up by the -fdefault-* options.  Other than properly porting
code to a wider type, people should use the -freal-* (eg, -freal-4-real-8).  

I submitted a patch to fortran@gcc to deprecate the -fdefault-*
option in January.  The deprecation who have occurred over 2
major releases.  But, too many people objected under POLA. 

> > Freebsd-ports could also use a wrapper:
> > % cat ~/bin/gfc7
> > #! /bin/sh
> 
> Yes. I have also suggested we use a wrapper to the ports guys.
> 

There always the option to link apps that need libgfortran 
with the -static option.

-- 
Steve