public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: IainS <developer@sandoe-acoustics.co.uk>
To: Fortran List <fortran@gcc.gnu.org>, GCC Development <gcc@gcc.gnu.org>
Subject: [patch, howto, gfortan] make check fix ppc64/darwin8
Date: Tue, 17 Jun 2008 10:41:00 -0000	[thread overview]
Message-ID: <159EDE9B-231E-4848-8F8D-FB8D86883C58@sandoe-acoustics.co.uk> (raw)

I came across a "gotcha" whilst trying to test the static  
implementation of libgfortran on PPC64-apple-darwin8.
Thanks to Tobias B for pointing me at 99% of the solution.

Probably the number of affected systems is small ;) - but, FWIW,  
here's HOWTO and a fix.

-----
If you host on {powerpc, i686}-apple-darwin8 and you want to static  
link (or check libgfortran) -m64 for PPC64  then this applies to you.

There is an incompatibility [presumably in ld64] between the default  
debug symbol generation (stabs) and what's required
for linking/checking PPC64 on darwin8 ...  this incompatibility  "is  
not going to be fixed".

The specific crunch is that every -O3  torture test is compiled with -g
    =>  in gfortran this causes every -O3 torture test to fail when  
checking -m64.

----

The solution is to build the required code with -gdwarf-2,  
unfortunately the "-g" flag is hard-coded in a couple of relevant  
places:

(a) in  "fortran-torture.exp"  and in "gcc-dg.exp" (which is included  
in gfortran-dg.exp)
[ the change to gcc-dg.exp makes this non-local to gfortran ]

(b) in the top level configure (as a default C/CXX/FLAGS_FOR_TARGET).

The minimum change work-around is this:

1/ configure/make gcc with CFLAGS_FOR_TARGET = "-02 -gdwarf-2 - 
pipe" (and CXXFLAGS_FOR_TARGET the same)

2/ apply the following :

Index: gcc/testsuite/lib/gcc-dg.exp
===================================================================
--- gcc/testsuite/lib/gcc-dg.exp        (revision 136861)
+++ gcc/testsuite/lib/gcc-dg.exp        (working copy)
@@ -48,9 +48,15 @@
         { -O2 } \
         { -O3 -fomit-frame-pointer } \
         { -O3 -fomit-frame-pointer -funroll-loops } \
-       { -O3 -fomit-frame-pointer -funroll-all-loops -finline- 
functions } \
-       { -O3 -g } \
-       { -Os } ]
+       { -O3 -fomit-frame-pointer -funroll-all-loops -finline- 
functions } ]
+
+       if { [istarget "*-*-darwin8"] } {
+       lappend DG_TORTURE_OPTIONS  { -O3 -gdwarf-2 }
+       } else {
+       lappend DG_TORTURE_OPTIONS  { -O3 -g }
+       }
+
+       lappend DG_TORTURE_OPTIONS { -Os }
  }

  global GCC_UNDER_TEST
Index: gcc/testsuite/lib/fortran-torture.exp
===================================================================
--- gcc/testsuite/lib/fortran-torture.exp       (revision 136861)
+++ gcc/testsuite/lib/fortran-torture.exp       (working copy)
@@ -73,9 +73,16 @@
         { -O2 } \
         { -O2 -fomit-frame-pointer -finline-functions } \
         { -O2 -fomit-frame-pointer -finline-functions -funroll- 
loops } \
-       { -O2 -fbounds-check } \
-       { -O3 -g } \
-       { -Os }
+       { -O2 -fbounds-check }
+
+       if { [istarget "*-*-darwin8"] } {
+       lappend options  { -O3 -gdwarf-2 }
+       } else {
+       lappend options  { -O3 -g }
+       }
+
+       lappend options { -Os }
+
      if { $test_tree_vectorize } {
         lappend options $vectorizer_options
      }


*************************************
COMPARISONs of make check-host with and without the changes

This is on darwin 8.11.0

*************************************
make check-host   (default, m32)
one extra pass, no regressions
*************************************

g++
-----
	no change

gcc
-----
one extra pass from using dwarf-2
FAIL: gcc.dg/pch/save-temps-1.c  -O3 -g  assembly comparison
PASS: gcc.dg/pch/save-temps-1.c  -O3 -gdwarf-2  assembly comparison

gfortran
----------
	no change

obj-c++
----------
	no change

obj-c
------
	no change


*************************************
make check-host   (m64) RUNTESTFLAGS="--target_board=unix/-m64"
69 extra passes, no regressions
*************************************

g++
------
one extra pass from using dwarf-2
FAIL: g++.old-deja/g++.eh/badalloc1.C execution test (-g)
PASS: g++.old-deja/g++.eh/badalloc1.C execution test (-gdwarf-2)

gcc
-----
one extra pass from using dwarf-2
FAIL: gcc.dg/pch/save-temps-1.c  -O3 -g  assembly comparison
PASS: gcc.dg/pch/save-temps-1.c  -O3 -gdwarf-2  assembly comparison

gfortran (every test with -O3 -g fails )
----------
67 extra passes using -gdwarf-2

		=== gfortran Summary  (-g) ===

# of expected passes		26196
# of unexpected failures	85
# of expected failures		46
# of unsupported tests		59
/Volumes/SwapScratch/OS-source/gcc-44-build/n2n/gcc/testsuite/ 
gfortran/../../gfortran  version 4.4.0 20080612 (experimental) (GCC)

		=== gfortran Summary (-gdwarf-2)  ===

# of expected passes		26263
# of unexpected failures	18
# of expected failures		46
# of unsupported tests		59
/Volumes/SwapScratch/OS-source/gcc-44-build/n2n/gcc/testsuite/ 
gfortran/../../gfortran  version 4.4.0 20080612 (experimental) (GCC)

obj-c++
----------
	no change

obj-c
------
	no change

----
I guess, there's one residual puzzle to me;   from the doc. I'd  
understand that the -O3 optimizations are in the back end and therefore
common to all the tools.  However, this problem only really shows up  
to any significant extent with gfortran.

ttfn,
Iain

                 reply	other threads:[~2008-06-17 10:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=159EDE9B-231E-4848-8F8D-FB8D86883C58@sandoe-acoustics.co.uk \
    --to=developer@sandoe-acoustics.co.uk \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).