From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 105969 invoked by alias); 30 Jan 2018 14:03:01 -0000 Mailing-List: contact fortran-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: fortran-owner@gcc.gnu.org Received: (qmail 105911 invoked by uid 89); 30 Jan 2018 14:03:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-21.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_2,GIT_PATCH_3,TIME_LIMIT_EXCEEDED,T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.2 spammy=pedantic, 12.6, strive, minds X-Spam-User: qpsmtpd, 3 recipients X-HELO: smtp.CeBiTec.Uni-Bielefeld.DE Received: from smtp.CeBiTec.Uni-Bielefeld.DE (HELO smtp.CeBiTec.Uni-Bielefeld.DE) (129.70.160.84) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 30 Jan 2018 14:02:50 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id 070A97A7; Tue, 30 Jan 2018 15:02:33 +0100 (CET) Received: from smtp.CeBiTec.Uni-Bielefeld.DE ([127.0.0.1]) by localhost (malfoy.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 5-LixBUD0pU4; Tue, 30 Jan 2018 15:02:30 +0100 (CET) Received: from lokon.CeBiTec.Uni-Bielefeld.DE (lokon.CeBiTec.Uni-Bielefeld.DE [129.70.161.152]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPS id 6E7737A6; Tue, 30 Jan 2018 15:02:30 +0100 (CET) Received: (from ro@localhost) by lokon.CeBiTec.Uni-Bielefeld.DE (8.15.2+Sun/8.15.2/Submit) id w0UE2HDr017888; Tue, 30 Jan 2018 15:02:17 +0100 (MET) From: Rainer Orth To: Joseph Myers Cc: , , Subject: Re: Link with correct values-*.o files on Solaris (PR target/40411) References: Date: Tue, 30 Jan 2018 14:03:00 -0000 In-Reply-To: (Joseph Myers's message of "Fri, 12 Jan 2018 17:46:23 +0000") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (usg-unix-v) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-SW-Source: 2018-01/txt/msg00216.txt.bz2 --=-=-= Content-Type: text/plain Content-length: 3099 Hi Joseph, > On Fri, 12 Jan 2018, Rainer Orth wrote: > >> At the same time, I had a new look at when values-Xc.o is used by the >> Studio compilers. It selects strict ISO C mode in a couple of cases, >> and the latest Studio 12.6 cc, which is about to do away with the >> previous -Xc option which enabled that mode in favour of gcc-compatible >> -pedantic, uses the latter to control its use. So I've changed gcc to >> follow suit. > > gcc -pedantic is only ever a diagnostic option, not a semantic one; it's > incorrect to use it to change library semantics. The relevant options for > strict ISO C (and C++) modes are -ansi, -std=c*, -std=iso9899:199409 and > aliases for those options. that's what you get for changing your code at the eleventh hour ;-) Before introducing -pedantic, I had #define STARTFILE_ARCH_SPEC \ "%{ansi|std=c90|std=iso9899\\:199409:values-Xc.o%s; :values-Xa.o%s} \ (which isn't correct either since it only handled C90 and C94). I don't think you need to handle the aliases explicitly: last time I checked they never arrive in specs. Prompted by the realization that -ansi applies to both C and C++ and I only meant to affect C, I had a look at what the (then recently released) Studio 12.6 compilers do, which strive for more GCC compatibility. I've now also checked the OpenSolaris libc and libm sources for uses of _lib_version == strict_ansi (as is set in values-Xc.o). libc has none, and the uses in libm all follow this pattern (ignoring C Issue 4.2 compatibility mode handling no longer activated): if (lib_version == strict_ansi) { errno = EDOM; } else if (!matherr(&exc)) { errno = EDOM; } The default implementation of matherr (overridable by the user) just returns 0. So it seems the following snippet #define STARTFILE_ARCH_SPEC \ [...] %{std=c9*|std=iso9899\\:199409|std=c1*:values-Xc.o%s; :values-Xa.o%s} \ seems like the right thing to do, as you said. > -ansi is not defined as a .opt alias of -std=c90 (because the option it's > an alias for depends on whether C or C++ is being compiled), so I'd expect > the specs to need to handle it along with -std=c90. I'd also expect > -std=iso9899:199409 to need to be handled there, supposing handling it > like -std=c90 is correct. And what about C++ versions not based on C99 or > later? I'm of mixed minds about whether or not to include -ansi in the above list: for C it's correct, for C++ it's less clear. AFAIK there's no way to distinguish between different languages in specs (like via an -x switch always passed in). OTOH, it has always been there already. The following patch implements the above with corresponding comment adjustments. I'm open to suggestions what to do about -ansi. Rainer -- ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University 2018-01-29 Rainer Orth PR target/40411 * config/sol2.h (STARTFILE_ARCH_SPEC): Use -std=c9*, -std=iso9899:199409, -std=c1* instead of -pedantic to select values-Xc.o. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=sol2-values-Xc.patch Content-length: 1271 # HG changeset patch # Parent 85f8b72d36b77c99997c044e6383f825596017ad Fix use of Solaris values-Xc.o (PR target/40411) diff --git a/gcc/config/sol2.h b/gcc/config/sol2.h --- a/gcc/config/sol2.h +++ b/gcc/config/sol2.h @@ -180,7 +180,9 @@ along with GCC; see the file COPYING3. The values-X[ac].o objects set the variable _lib_version. The Studio C compilers use values-Xc.o with either -Xc or (since Studio 12.6) -pedantic to select strictly conformant ISO C behaviour, otherwise - values-Xa.o. + values-Xa.o. Since -pedantic is a diagnostic option only in GCC, we + need to specifiy the -std=c* options and -std=iso9899:199409. -ansi is + omitted from that list to avoid influencing C++. The values-xpg[46].o objects define either or both __xpg[46] variables, selecting XPG4 mode (__xpg4) and conforming C99/SUSv3 behavior (__xpg6). @@ -195,7 +197,7 @@ along with GCC; see the file COPYING3. #undef STARTFILE_ARCH_SPEC #define STARTFILE_ARCH_SPEC \ "%{!shared:%{!symbolic: \ - %{pedantic:values-Xc.o%s; :values-Xa.o%s} \ + %{std=c9*|std=iso9899\\:199409|std=c1*:values-Xc.o%s; :values-Xa.o%s} \ %{std=c90|std=gnu90:values-xpg4.o%s; :values-xpg6.o%s}}}" #if defined(HAVE_LD_PIE) && defined(HAVE_SOLARIS_CRTS) --=-=-=--