From patchwork Thu Jan 8 02:32:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans-Peter Nilsson X-Patchwork-Id: 426474 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id B20BB1400D5 for ; Thu, 8 Jan 2015 13:32:40 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :message-id:from:to:cc:subject:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=X2oSmIvEV6QbT0od KS5LgAl8Hzm6Agm7vrbv5PWVocDZOFuViSq2uYywgmf7PhgGgPMEQYSUkUi/vCXQ i5lavAaa2EsjsXznbGw3CerA0oVm5zoFoQ8dToAtlVadNBFALCj988qi77NEYFFy CDofHzPmNwlfIFJJBnZqIdJe7U0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :message-id:from:to:cc:subject:mime-version:content-type :content-transfer-encoding; s=default; bh=qu+wBFU3DzzRXUcCjMIjwL t5q1E=; b=ICYbCU8KiMBoVNzY7c9S6bX6OHEGoCQ1FD6ZrKiY1/JiQPQQqKhp3X fFlFoqMhE9El7f982DFO/szxdkPwDyJva1d5+b15Q4qo5n38E5uRauHqDFXyP8br XTFXJ041InhNsJgWbdpaxU1t1jcZyZ2FhC9DjPCnHSk4Nt6jWq+V8= Received: (qmail 16749 invoked by alias); 8 Jan 2015 02:32:29 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 16726 invoked by uid 89); 8 Jan 2015 02:32:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, BAYES_00, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: bes.se.axis.com Received: from bes.se.axis.com (HELO bes.se.axis.com) (195.60.68.10) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 08 Jan 2015 02:32:20 +0000 Received: from localhost (localhost [127.0.0.1]) by bes.se.axis.com (Postfix) with ESMTP id 6714A2E0F3; Thu, 8 Jan 2015 03:32:17 +0100 (CET) Received: from bes.se.axis.com ([IPv6:::ffff:127.0.0.1]) by localhost (bes.se.axis.com [::ffff:127.0.0.1]) (amavisd-new, port 10024) with LMTP id hy1mk9TKSBr3; Thu, 8 Jan 2015 03:32:16 +0100 (CET) Received: from boulder.se.axis.com (boulder.se.axis.com [10.0.2.104]) by bes.se.axis.com (Postfix) with ESMTP id BDB252E0F2; Thu, 8 Jan 2015 03:32:16 +0100 (CET) Received: from boulder.se.axis.com (localhost [127.0.0.1]) by postfix.imss71 (Postfix) with ESMTP id 89CBBF31; Thu, 8 Jan 2015 03:32:16 +0100 (CET) Received: from thoth.se.axis.com (thoth.se.axis.com [10.0.2.173]) by boulder.se.axis.com (Postfix) with ESMTP id 7D919EE5; Thu, 8 Jan 2015 03:32:16 +0100 (CET) Received: from ignucius.se.axis.com (ignucius.se.axis.com [10.88.21.50]) by thoth.se.axis.com (Postfix) with ESMTP id 7A96634357; Thu, 8 Jan 2015 03:32:16 +0100 (CET) Received: from ignucius.se.axis.com (localhost [127.0.0.1]) by ignucius.se.axis.com (8.12.8p1/8.12.8/Debian-2woody1) with ESMTP id t082WGBc030683; Thu, 8 Jan 2015 03:32:16 +0100 Received: (from hp@localhost) by ignucius.se.axis.com (8.12.8p1/8.12.8/Debian-2woody1) id t082WFaY030679; Thu, 8 Jan 2015 03:32:15 +0100 Date: Thu, 8 Jan 2015 03:32:15 +0100 Message-Id: <201501080232.t082WFaY030679@ignucius.se.axis.com> From: Hans-Peter Nilsson To: gcc-patches@gcc.gnu.org, fortran@gcc.gnu.org CC: dave.anglin@bell.net Subject: [RFA:] Fix test-suite regressions from PR62250 due to -latomic always added MIME-Version: 1.0 PR62250 (r219171) was about some fortran tests that used atomic operations but failing on systems where -latomic is required. The fix was to always add -latomic. That caused test-suite regressions for targets that don't have libatomic, but where the required operations are built-in (no separate PR entered, the fix below seemed simple enough). Here's a fix to that issue, adding a target matcher usable for individual tests (gfortran.dg/coarray_lib_comm_1.f90) as well as the grouped tests in gfortran.dg/coarray/caf.exp. If you consider using this elsewhere (other languages), there's a prerequisite that paths have been added to default linker options to find libatomic; already covered by r219171. I considered tweaking that path-adding to instead make use of lib/atomic-dg.exp, but stopped when noticing that atomic_init would be required to be called in lib/gfortran.exp and would always add -latomic and would split up the path-tweaking, doing differently than the existing tweaking in lib/gfortran.exp. Other issues likely. (If there's instead a preference to strongly depend on libatomic for fortran and forcing targets to port it, there's some required top-level dependency configury changes and/or needing to add -latomic to the defaults when linking with "gfortran" and also I don't want that, seeing this as the simpler, better fix. Of course, that also means that the user has to know to manually add -latomic for *some* fortran codes for *some* systems.) Tested to fix the issues for cris-elf (no libatomic, operations built-in), not having any effect on native x86_64-unknown-linux-gnu (has libatomic but operations also built-in) and David says test is in progress for hppa*-*-hpux* (the cause for PR62250; has libatomic, not all required built-in operations). Ok to commit? (PR marking just to make this show up in the log trail of that PR as a follow-up to the fix.) gcc/testsuite: 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. brgds, H-P Index: lib/target-supports.exp =================================================================== --- lib/target-supports.exp (revision 219277) +++ lib/target-supports.exp (working copy) @@ -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 { } { Index: gfortran.dg/coarray/caf.exp =================================================================== --- gfortran.dg/coarray/caf.exp (revision 219277) +++ gfortran.dg/coarray/caf.exp (working copy) @@ -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 $s 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 "" } } Index: gfortran.dg/coarray_lib_comm_1.f90 =================================================================== --- gfortran.dg/coarray_lib_comm_1.f90 (revision 219277) +++ gfortran.dg/coarray_lib_comm_1.f90 (working copy) @@ -1,5 +1,6 @@ ! { dg-do run } -! { dg-options "-fdump-tree-original -fcoarray=lib -lcaf_single -latomic" } +! { dg-options "-fdump-tree-original -fcoarray=lib -lcaf_single -latomic" { target libatomic_available } } +! { dg-options "-fdump-tree-original -fcoarray=lib -lcaf_single" { target { ! libatomic_available } } } ! ! Some dependency-analysis check for coarray communication !