From b85449adb9120b984916eb9bc0a88a466ec0744e Mon Sep 17 00:00:00 2001 From: Hans-Peter Nilsson Date: Thu, 8 Jan 2015 21:57:49 +0000 Subject: [PATCH] re PR testsuite/62250 (FAIL: gfortran.dg/coarray/alloc_comp_1.f90 -fcoarray=lib -O2 -lcaf_single) PR testsuite/62250 * lib/target-supports.exp (check_effective_target_libatomic_available): New. * gfortran.dg/coarray/caf.exp: Only add -latomic for targets that match effective-target libatomic_available. * gfortran.dg/coarray_lib_comm_1.f90: Similar. From-SVN: r219364 --- gcc/testsuite/ChangeLog | 9 +++++++++ gcc/testsuite/gfortran.dg/coarray/caf.exp | 10 ++++++++-- gcc/testsuite/lib/target-supports.exp | 7 +++++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6e19a07f85b..d7d9ac8c7f6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2015-01-08 Hans-Peter Nilsson + + PR testsuite/62250 + * lib/target-supports.exp (check_effective_target_libatomic_available): + New. + * gfortran.dg/coarray/caf.exp: Only add -latomic for + targets that match effective-target libatomic_available. + * gfortran.dg/coarray_lib_comm_1.f90: Similar. + 2015-01-08 David Malcolm * jit.dg/test-error-block-in-wrong-function.c (verify_code): diff --git a/gcc/testsuite/gfortran.dg/coarray/caf.exp b/gcc/testsuite/gfortran.dg/coarray/caf.exp index 1ee247731b3..47529d3b960 100644 --- a/gcc/testsuite/gfortran.dg/coarray/caf.exp +++ b/gcc/testsuite/gfortran.dg/coarray/caf.exp @@ -58,6 +58,12 @@ proc dg-compile-aux-modules { args } { # cleanup-modules isn't intentionally invoked here. } +# Add -latomic only where supported. Assume built-in support elsewhere. +set maybe_atomic_lib "" +if [check_effective_target_libatomic_available] { + set maybe_atomic_lib "-latomic" +} + # Main loop. foreach test [lsort [glob -nocomplain $srcdir/$subdir/*.\[fF\]{,90,95,03,08} ]] { # If we're only testing specific files and this isn't one of them, skip it. @@ -81,14 +87,14 @@ foreach test [lsort [glob -nocomplain $srcdir/$subdir/*.\[fF\]{,90,95,03,08} ]] foreach flags $option_list { verbose "Testing $nshort (single), $flags" 1 set gfortran_aux_module_flags "-fcoarray=single $flags" - dg-test $test "-fcoarray=single $flags -latomic" "" + dg-test $test "-fcoarray=single $flags $maybe_atomic_lib" "" cleanup-modules "" } foreach flags $option_list { verbose "Testing $nshort (libcaf_single), $flags" 1 set gfortran_aux_module_flags "-fcoarray=lib $flags -lcaf_single" - dg-test $test "-fcoarray=lib $flags -lcaf_single -latomic" "" + dg-test $test "-fcoarray=lib $flags -lcaf_single $maybe_atomic_lib" "" cleanup-modules "" } } diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 119d2c578d4..f5c6db851fc 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -1128,6 +1128,13 @@ proc check_libcilkrts_available { } { } "-fcilkplus -lcilkrts" ] } +# Return true if the atomic library is supported on the target. +proc check_effective_target_libatomic_available { } { + return [check_no_compiler_messages libatomic_available executable { + int main (void) { return 0; } + } "-latomic"] +} + # Return 1 if an ASCII locale is supported on this host, 0 otherwise. proc check_ascii_locale_available { } { -- 2.30.2