From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28161 invoked by alias); 30 Jan 2019 09:18:15 -0000 Mailing-List: contact libc-help-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Post: List-Help: , Sender: libc-help-owner@sourceware.org Received: (qmail 28150 invoked by uid 89); 30 Jan 2019 09:18:15 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE autolearn=no version=3.3.2 spammy=accident, HTo:U*libc-help, H*RU:sk:!192.16, Hx-spam-relays-external:sk:!192.16 X-HELO: mail-wr1-f49.google.com Received: from mail-wr1-f49.google.com (HELO mail-wr1-f49.google.com) (209.85.221.49) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 30 Jan 2019 09:18:14 +0000 Received: by mail-wr1-f49.google.com with SMTP id 96so25210961wrb.2 for ; Wed, 30 Jan 2019 01:18:13 -0800 (PST) Return-Path: Received: from [192.168.188.21] (x5ce6fc75.dyn.telefonica.de. [92.230.252.117]) by smtp.gmail.com with ESMTPSA id p10sm4008850wmd.14.2019.01.30.01.18.10 for (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Wed, 30 Jan 2019 01:18:11 -0800 (PST) To: libc-help@sourceware.org From: Stephan Bergmann Subject: math_errhandling getting undef'ed for -std=gnu11? Message-ID: Date: Wed, 30 Jan 2019 09:18:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2019-01/txt/msg00058.txt.bz2 My understanding is that C11 requires to define math_errhandling (as macro or identifier with external linkage), and my assumption is that GCC's -std=gnu11 (vs. -std=c11), while it might enable language extensions, would not remove from that. However, at least with glibc-headers-2.28-26.fc29.x86_64, > $ cat test.c > #include > int main() { return math_errhandling; } fails for > $ gcc -m32 -O -std=gnu11 test.c > test.c: In function ‘main’: > test.c:2:21: error: ‘math_errhandling’ undeclared (first use in this function) > int main() { return math_errhandling; } > ^~~~~~~~~~~~~~~~ > test.c:2:21: note: each undeclared identifier is reported only once for each function it appears in while it succeeds for > $ gcc -m32 -O -std=c11 test.c What causes the difference is apparently the block > /* Disable x87 inlines when -fpmath=sse is passed and also when we're building > on x86_64. Older gcc (gcc-3.2 for example) does not define __SSE2_MATH__ > for x86_64. */ > #if !defined __SSE2_MATH__ && !defined __x86_64__ > # if ((!defined __NO_MATH_INLINES || defined __LIBC_INTERNAL_MATH_INLINES) \ > && defined __OPTIMIZE__) > > /* The inline functions do not set errno or raise necessarily the > correct exceptions. */ > # undef math_errhandling [...] in /usr/include/bits/mathinline.h. Now, my question is whether that is by design (implying that -std=gnu11 is deliberately non-conforming here) or by accident. (But seeing "Remove x86 mathinline.h" completely dropping sysdeps/x86/fpu/bits/mathinline.h from later glibc probably makes the question somewhat moot.)