diff mbox

[RFA:] fix breakage with "Update testsuite to run with slim LTO"

Message ID yddk47yeeww.fsf@manam.CeBiTec.Uni-Bielefeld.DE
State New
Headers show

Commit Message

Rainer Orth Oct. 21, 2011, 11:56 a.m. UTC
Iain Sandoe <developer@sandoe-acoustics.co.uk> writes:

> It looks like the gnat testsuite is also broken - but HP's fix doesn't
> recover that.
> .. will try and take a look - but short on time today,

I think I see what's going on: in gnat.log, I find

Running /vol/gcc/src/hg/trunk/local/gcc/testsuite/gnat.dg/dg.exp ...
ERROR: tcl error sourcing library file /vol/gcc/src/hg/trunk/local/gcc/testsuite/lib/gcc-dg.exp.
can't read "GCC_UNDER_TEST": no such variable
can't read "GCC_UNDER_TEST": no such variable
    while executing
"lappend options "compiler=$GCC_UNDER_TEST""
    (procedure "gcc_target_compile" line 37)
    invoked from within
"gcc_target_compile $source $dest $type $options"
    invoked from within
"if [ string match "*.c" $source ] then {
	return [gcc_target_compile $source $dest $type $options]
    }"
    (procedure "gnat_target_compile" line 12)
    invoked from within
"${tool}_target_compile $src $output $compile_type "$options""
    (procedure "check_compile" line 39)
    invoked from within
"check_compile linker_plugin executable {
     int main() { return 0; }
  } {-flto -fuse-linker-plugin}"
    ("eval" body line 1)
    invoked from within
"eval check_compile $args"
    (procedure "check_no_compiler_messages_nocache" line 2)
    invoked from within
"check_no_compiler_messages_nocache linker_plugin executable {
     int main() { return 0; }
  } "-flto -fuse-linker-plugin""
    (procedure "check_linker_plugin_available" line 2)
    invoked from within
"check_linker_plugin_available"
    invoked from within
"if [check_effective_target_lto] {
    # When having plugin test both slim and fat LTO and plugin/nonplugin
    # path.
    if [check_linker_plugin_ava..."
    (file "/vol/gcc/src/hg/trunk/local/gcc/testsuite/lib/gcc-dg.exp" line 71)
    invoked from within
"source /vol/gcc/src/hg/trunk/local/gcc/testsuite/lib/gcc-dg.exp"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 source /vol/gcc/src/hg/trunk/local/gcc/testsuite/lib/gcc-dg.exp"

If running the gnat.dg testsuite, lib/gcc-dg.exp is now calling
check_linker_plugin_available early, which ultimately calls
${tool}_target_compile.  For all languages but Ada,
${tool}_target_compile can compile .c files just fine, but
gnat_target_compile (which uses gnatmake) cannot, so it falls back to
directly calling gcc_target_compile in that case.  gcc_target_compile
relies on GCC_UNDER_TEST being set, which in this case hasn't yet
happened, thus the error.

My solution (a hack, actually) is to move the initialization of
GCC_UNDER_TEST in gcc-dg.exp before the calls to
check_linker_plugin_available.  x86_64-unknown-linux-gnu testing in
progress, will commit once that's finished.

Btw., the ChangeLog entry for Jan's patch was riddled with typos and
wrong pathnames.  I've corrected that with a separate checkin.

	Rainer


2011-10-21  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* lib/gcc-dg.exp (GCC_UNDER_TEST): Set before calling
	check_linker_plugin_available.

Comments

Jan Hubicka Oct. 21, 2011, 3:44 p.m. UTC | #1
> If running the gnat.dg testsuite, lib/gcc-dg.exp is now calling
> check_linker_plugin_available early, which ultimately calls
> ${tool}_target_compile.  For all languages but Ada,
> ${tool}_target_compile can compile .c files just fine, but
> gnat_target_compile (which uses gnatmake) cannot, so it falls back to
> directly calling gcc_target_compile in that case.  gcc_target_compile
> relies on GCC_UNDER_TEST being set, which in this case hasn't yet
> happened, thus the error.
> 
> My solution (a hack, actually) is to move the initialization of
> GCC_UNDER_TEST in gcc-dg.exp before the calls to
> check_linker_plugin_available.  x86_64-unknown-linux-gnu testing in
> progress, will commit once that's finished.

Oops, I was under impression that GNAT testsuite is not really using dejagnu
lib so I did not expected a change here.
Thanks for fixing that!

I also noticed that tests scanning output of late optimization passes are
now getting UNRESOLVED state with slim LTO.  We don't really lose coverage
here because we test fat LTO with the other compilation, but probably easiest
is to enfore fat LTO all the time.

Does the following seem resonable?

Honza

	* gcc.dg/torture/pta-ptrarith-1.c: Force fat LTO.
	* gcc.dg/torture/pta-ptrarith-2.c: Likewise.
	* gcc.dg/torture/pr23821.c: Likewise.
	* gcc.dg/torture/pta-ptrarith-3.c: Likewise.
	* gcc.dg/torture/pr45704.c: Likewise.
	* gcc.dg/torture/pr50472.c: Likewise.
	* gcc.dg/torture/ipa-pta-1.c: Likewise.
	* gcc.dg/torture/pta-callused-1.c: Likewise.
	* gcc.dg/torture/pr39074-2.c: Likewise.
	* gcc.dg/torture/pr39074.c: Likewise.
	* gcc.dg/torture/pr42898-2.c: Likewise.
	* gcc.dg/torture/pr42898.c: Likewise.
	* gcc.dg/torture/pta-escape-1.c: Likewise.
	* gcc.dg/torture/ssa-pta-fn-1.c: Likewise.
Index: gcc.dg/torture/pta-ptrarith-1.c
===================================================================
*** gcc.dg/torture/pta-ptrarith-1.c	(revision 180289)
--- gcc.dg/torture/pta-ptrarith-1.c	(working copy)
***************
*** 1,5 ****
  /* { dg-do run } */
! /* { dg-options "-fdump-tree-alias" } */
  /* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
  
  struct Foo {
--- 1,5 ----
  /* { dg-do run } */
! /* { dg-options "-fdump-tree-alias -ffat-lto-objects" } */
  /* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
  
  struct Foo {
Index: gcc.dg/torture/pta-ptrarith-2.c
===================================================================
*** gcc.dg/torture/pta-ptrarith-2.c	(revision 180289)
--- gcc.dg/torture/pta-ptrarith-2.c	(working copy)
***************
*** 1,5 ****
  /* { dg-do run } */
! /* { dg-options "-fdump-tree-alias" } */
  /* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
  
  struct Foo {
--- 1,5 ----
  /* { dg-do run } */
! /* { dg-options "-fdump-tree-alias -ffat-lto-objects" } */
  /* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
  
  struct Foo {
Index: gcc.dg/torture/pr23821.c
===================================================================
*** gcc.dg/torture/pr23821.c	(revision 180289)
--- gcc.dg/torture/pr23821.c	(working copy)
***************
*** 3,9 ****
  /* At -O1 DOM threads a jump in a non-optimal way which leads to
     the bogus propagation.  */
  /* { dg-skip-if "" { *-*-* } { "-O1" } { "" } } */
! /* { dg-options "-fdump-tree-ivcanon-details" } */
  
  int a[199];
  
--- 3,9 ----
  /* At -O1 DOM threads a jump in a non-optimal way which leads to
     the bogus propagation.  */
  /* { dg-skip-if "" { *-*-* } { "-O1" } { "" } } */
! /* { dg-options "-fdump-tree-ivcanon-details -ffat-lto-objects" } */
  
  int a[199];
  
Index: gcc.dg/torture/pta-ptrarith-3.c
===================================================================
*** gcc.dg/torture/pta-ptrarith-3.c	(revision 180289)
--- gcc.dg/torture/pta-ptrarith-3.c	(working copy)
***************
*** 1,5 ****
  /* { dg-do run } */
! /* { dg-options "-fdump-tree-alias" } */
  /* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
  
  extern void abort (void);
--- 1,5 ----
  /* { dg-do run } */
! /* { dg-options "-fdump-tree-alias -ffat-lto-objects" } */
  /* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
  
  extern void abort (void);
Index: gcc.dg/torture/pr45704.c
===================================================================
*** gcc.dg/torture/pr45704.c	(revision 180289)
--- gcc.dg/torture/pr45704.c	(working copy)
***************
*** 1,5 ****
  /* { dg-do compile } */
! /* { dg-options "-fdump-tree-optimized" } */
  
  struct st {
      int ptr;
--- 1,5 ----
  /* { dg-do compile } */
! /* { dg-options "-fdump-tree-optimized -ffat-lto-objects" } */
  
  struct st {
      int ptr;
Index: gcc.dg/torture/pr50472.c
===================================================================
*** gcc.dg/torture/pr50472.c	(revision 180289)
--- gcc.dg/torture/pr50472.c	(working copy)
***************
*** 1,5 ****
  /* { dg-do compile } */
! /* { dg-options "-fdump-tree-optimized" } */
  
  static const unsigned int foo = 1;
  unsigned int test( void )
--- 1,5 ----
  /* { dg-do compile } */
! /* { dg-options "-fdump-tree-optimized -ffat-lto-objects" } */
  
  static const unsigned int foo = 1;
  unsigned int test( void )
Index: gcc.dg/torture/ipa-pta-1.c
===================================================================
*** gcc.dg/torture/ipa-pta-1.c	(revision 180289)
--- gcc.dg/torture/ipa-pta-1.c	(working copy)
***************
*** 1,5 ****
  /* { dg-do compile { target { nonpic } } } */
! /* { dg-options "-fipa-pta -fdump-ipa-pta" } */
  /* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
  
  struct X { char x; char y; };
--- 1,5 ----
  /* { dg-do compile { target { nonpic } } } */
! /* { dg-options "-fipa-pta -fdump-ipa-pta -ffat-lto-objects" } */
  /* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
  
  struct X { char x; char y; };
Index: gcc.dg/torture/pta-callused-1.c
===================================================================
*** gcc.dg/torture/pta-callused-1.c	(revision 180289)
--- gcc.dg/torture/pta-callused-1.c	(working copy)
***************
*** 1,5 ****
  /* { dg-do run } */
! /* { dg-options "-fdump-tree-alias" } */
  /* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
  
  volatile int i;
--- 1,5 ----
  /* { dg-do run } */
! /* { dg-options "-fdump-tree-alias -ffat-lto-objects" } */
  /* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
  
  volatile int i;
Index: gcc.dg/torture/pr39074-2.c
===================================================================
*** gcc.dg/torture/pr39074-2.c	(revision 180289)
--- gcc.dg/torture/pr39074-2.c	(working copy)
***************
*** 1,6 ****
  /* { dg-do run } */
  /* { dg-require-effective-target stdint_types } */
! /* { dg-options "-fdump-tree-alias" } */
  /* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
  
  #include <stdint.h>
--- 1,6 ----
  /* { dg-do run } */
  /* { dg-require-effective-target stdint_types } */
! /* { dg-options "-fdump-tree-alias -ffat-lto-objects" } */
  /* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
  
  #include <stdint.h>
Index: gcc.dg/torture/pr39074.c
===================================================================
*** gcc.dg/torture/pr39074.c	(revision 180289)
--- gcc.dg/torture/pr39074.c	(working copy)
***************
*** 1,5 ****
  /* { dg-do run } */
! /* { dg-options "-fdump-tree-alias" } */
  /* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
  
  typedef __PTRDIFF_TYPE__ intptr_t;
--- 1,5 ----
  /* { dg-do run } */
! /* { dg-options "-fdump-tree-alias -ffat-lto-objects" } */
  /* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
  
  typedef __PTRDIFF_TYPE__ intptr_t;
Index: gcc.dg/torture/pr42898-2.c
===================================================================
*** gcc.dg/torture/pr42898-2.c	(revision 180289)
--- gcc.dg/torture/pr42898-2.c	(working copy)
***************
*** 1,5 ****
  /* { dg-do compile } */
! /* { dg-options "-fdump-tree-optimized" } */
  
  struct hardware {
    int parm1:8;
--- 1,5 ----
  /* { dg-do compile } */
! /* { dg-options "-fdump-tree-optimized -ffat-lto-objects" } */
  
  struct hardware {
    int parm1:8;
Index: gcc.dg/torture/pr42898.c
===================================================================
*** gcc.dg/torture/pr42898.c	(revision 180289)
--- gcc.dg/torture/pr42898.c	(working copy)
***************
*** 1,5 ****
  /* { dg-do compile } */
! /* { dg-options "-fdump-tree-optimized" } */
  
  struct hardware {
    int parm1:8;
--- 1,5 ----
  /* { dg-do compile } */
! /* { dg-options "-fdump-tree-optimized -ffat-lto-objects" } */
  
  struct hardware {
    int parm1:8;
Index: gcc.dg/torture/pta-escape-1.c
===================================================================
*** gcc.dg/torture/pta-escape-1.c	(revision 180289)
--- gcc.dg/torture/pta-escape-1.c	(working copy)
***************
*** 1,5 ****
  /* { dg-do run } */
! /* { dg-options "-fdump-tree-alias" } */
  /* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
  
  int *p;
--- 1,5 ----
  /* { dg-do run } */
! /* { dg-options "-fdump-tree-alias -ffat-lto-objects" } */
  /* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
  
  int *p;
Index: gcc.dg/torture/ssa-pta-fn-1.c
===================================================================
*** gcc.dg/torture/ssa-pta-fn-1.c	(revision 180289)
--- gcc.dg/torture/ssa-pta-fn-1.c	(working copy)
***************
*** 1,5 ****
  /* { dg-do run } */
! /* { dg-options "-fdump-tree-alias" } */
  /* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
  
  extern void abort (void);
--- 1,5 ----
  /* { dg-do run } */
! /* { dg-options "-fdump-tree-alias -ffat-lto-objects" } */
  /* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
  
  extern void abort (void);
Jan Hubicka Oct. 21, 2011, 6:34 p.m. UTC | #2
> 
> Meh...  Please no, this was the kind of scatter-patches my patch
> aimed to avoid... for example, easy to miss some tests.
> 
> Instead, on top of my patch, just copy the
> scan-assembler_required_options proc to a
> scan-tree-dump_required_options.  ...no wait, should forcing
> fat-lto be done for all tree-dumps?  If only for a subset of

Yep, problem is that early tree passes and analysis part of IPA pases is  run
with fat-lto, while late and RTL passes and execution pass of IPA are not. 

I guess we could make ipa-dump/rtl-dump/tree-dump scanning to disable fat lto
and introduce variants intended to scan late tree dumps and ipa execution dumps...
Not sure if it would make more sense than just doing it explicitely in tests.
> tree-dumps augment the *_required_options proc API to take
> arguments that let you check for that.
Well, listing all late tree passes is quite long and changing with time...

Honza
> 
> brgds, H-P
Richard Biener Oct. 24, 2011, 10:35 a.m. UTC | #3
On Fri, Oct 21, 2011 at 1:56 PM, Rainer Orth
<ro@cebitec.uni-bielefeld.de> wrote:
> Iain Sandoe <developer@sandoe-acoustics.co.uk> writes:
>
>> It looks like the gnat testsuite is also broken - but HP's fix doesn't
>> recover that.
>> .. will try and take a look - but short on time today,
>
> I think I see what's going on: in gnat.log, I find
>
> Running /vol/gcc/src/hg/trunk/local/gcc/testsuite/gnat.dg/dg.exp ...
> ERROR: tcl error sourcing library file /vol/gcc/src/hg/trunk/local/gcc/testsuite/lib/gcc-dg.exp.
> can't read "GCC_UNDER_TEST": no such variable
> can't read "GCC_UNDER_TEST": no such variable
>    while executing
> "lappend options "compiler=$GCC_UNDER_TEST""
>    (procedure "gcc_target_compile" line 37)
>    invoked from within
> "gcc_target_compile $source $dest $type $options"
>    invoked from within
> "if [ string match "*.c" $source ] then {
>        return [gcc_target_compile $source $dest $type $options]
>    }"
>    (procedure "gnat_target_compile" line 12)
>    invoked from within
> "${tool}_target_compile $src $output $compile_type "$options""
>    (procedure "check_compile" line 39)
>    invoked from within
> "check_compile linker_plugin executable {
>     int main() { return 0; }
>  } {-flto -fuse-linker-plugin}"
>    ("eval" body line 1)
>    invoked from within
> "eval check_compile $args"
>    (procedure "check_no_compiler_messages_nocache" line 2)
>    invoked from within
> "check_no_compiler_messages_nocache linker_plugin executable {
>     int main() { return 0; }
>  } "-flto -fuse-linker-plugin""
>    (procedure "check_linker_plugin_available" line 2)
>    invoked from within
> "check_linker_plugin_available"
>    invoked from within
> "if [check_effective_target_lto] {
>    # When having plugin test both slim and fat LTO and plugin/nonplugin
>    # path.
>    if [check_linker_plugin_ava..."
>    (file "/vol/gcc/src/hg/trunk/local/gcc/testsuite/lib/gcc-dg.exp" line 71)
>    invoked from within
> "source /vol/gcc/src/hg/trunk/local/gcc/testsuite/lib/gcc-dg.exp"
>    ("uplevel" body line 1)
>    invoked from within
> "uplevel #0 source /vol/gcc/src/hg/trunk/local/gcc/testsuite/lib/gcc-dg.exp"
>
> If running the gnat.dg testsuite, lib/gcc-dg.exp is now calling
> check_linker_plugin_available early, which ultimately calls
> ${tool}_target_compile.  For all languages but Ada,
> ${tool}_target_compile can compile .c files just fine, but
> gnat_target_compile (which uses gnatmake) cannot, so it falls back to
> directly calling gcc_target_compile in that case.  gcc_target_compile
> relies on GCC_UNDER_TEST being set, which in this case hasn't yet
> happened, thus the error.
>
> My solution (a hack, actually) is to move the initialization of
> GCC_UNDER_TEST in gcc-dg.exp before the calls to
> check_linker_plugin_available.  x86_64-unknown-linux-gnu testing in
> progress, will commit once that's finished.
>
> Btw., the ChangeLog entry for Jan's patch was riddled with typos and
> wrong pathnames.  I've corrected that with a separate checkin.

Still doesn't work for me:

rguenther@murzim:/abuild/rguenther/trunk-g/gcc> make check-gfortran
RUNTESTFLAGS="dg.exp=logical_dot_product.f90"
...
Running /space/rguenther/src/svn/trunk/gcc/testsuite/gfortran.dg/dg.exp ...
ERROR: (DejaGnu) proc "gcc_target_compile linker_plugin14146.o
linker_plugin14146 executable { additional_flags=-flto
additional_flags=-flto-partition=none additional_flags=-save-temps }"
does not exist.
The error code is NONE
The info on the error is:
close: spawn id exp6 not open
    while executing
"close -i exp6"
    invoked from within
"catch "close -i $spawn_id""

This is highly annoying for me ... (reverting Rainers patch doesn't help).

Richard.
diff mbox

Patch

# HG changeset patch
# Parent 9c45ed5cb653fa8053d3c7a9d6502a85b0ffbafc
Fix gnat.dg testing with linker plugin check

diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp
--- a/gcc/testsuite/lib/gcc-dg.exp
+++ b/gcc/testsuite/lib/gcc-dg.exp
@@ -41,6 +41,11 @@  if { [ishost "*-*-cygwin*"] } {
   setenv LANG C.ASCII
 }
 
+global GCC_UNDER_TEST
+if ![info exists GCC_UNDER_TEST] {
+    set GCC_UNDER_TEST "[find_gcc]"
+}
+
 if [info exists TORTURE_OPTIONS] {
     set DG_TORTURE_OPTIONS $TORTURE_OPTIONS
 } else {
@@ -84,12 +89,6 @@  if [check_effective_target_lto] {
     }
 }
 
-
-global GCC_UNDER_TEST
-if ![info exists GCC_UNDER_TEST] {
-    set GCC_UNDER_TEST "[find_gcc]"
-}
-
 global orig_environment_saved
 
 # This file may be sourced, so don't override environment settings