Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1318877 - Per C11 and C++11, <stdint.h> should not look at __STDC_LIMIT_MACROS or __STDC_CONSTANT_MACROS
Per C11 and C++11, <stdint.h> should not look at __STDC_LIMIT_MACROS or __STD...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: glibc (Show other bugs)
7.4
All Linux
unspecified Severity low
: rc
: 7.4
Assigned To: Martin Sebor
Sergey Kolosov
: Patch
Depends On:
Blocks: 1298243 1390370 1318878
  Show dependency treegraph
 
Reported: 2016-03-17 23:01 EDT by Frank Hirtz
Modified: 2017-08-01 14:06 EDT (History)
12 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: Definitions of certain macros in <stdint.h> were guarded by __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS, requiring the latter macros to be defined by a program in order for the former to be usable, contrary to the C11 and C++11 standards requirements. Consequence: The guarded macros were not usable unless the latter were defined. Fix: The guarding macros have been removed, and the macros previously guarded by them have been defined unconditionally. Result: More programs that strictly conform to the relevant standards are accommodated.
Story Points: ---
Clone Of:
: 1318878 (view as bug list)
Environment:
Last Closed: 2017-08-01 14:06:55 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Sourceware 15366 None None None 2016-03-17 23:01 EDT
Red Hat Product Errata RHSA-2017:1916 normal SHIPPED_LIVE Moderate: glibc security, bug fix, and enhancement update 2017-08-01 14:05:43 EDT

  None (edit)
Description Frank Hirtz 2016-03-17 23:01:00 EDT
Description of problem:

A client requested that we backport the following header fix:

<snip>
glibc's <stdint.h> follows C99, which says that in C++, certain macros should only be defined if __STDC_LIMIT_MACROS or __STDC_CONSTANT_MACROS is defined. However, the C++ committee decided that they didn't want this behavior, and explicitly overruled this in the C++11 standard (the first to provide <stdint.h>). Consequently C11 removed these rules. glibc has not been updated to follow the C11 rules, and still checks for those macros being defined in C++ mode.

C++ implementations are currently working around this by wrapping glibc's <stdint.h> with one which defines these macros first. These workarounds should not be necessary; glibc should simply not be checking for these macros. Fix would be to remove these lines from sysdeps/generic/stdint.h:

/* The ISO C99 standard specifies that in C++ implementations these
   macros should only be defined if explicitly requested.  */
#if !defined __cplusplus || defined __STDC_LIMIT_MACROS

... plus the corresponding #endif and the corresponding lines for __STDC_CONSTANT_MACROS.
</snip>

Reference:
https://sourceware.org/bugzilla/show_bug.cgi?id=15366

Version-Release number of selected component (if applicable):
glibc-headers-2.12-1.166.el6_7.7.x86_64
Comment 1 Carlos O'Donell 2016-03-20 10:38:26 EDT
The support for C11 and C++11 is only experimental in the RHEL 7 system compiler and runtimes, and there is no support for it in the RHEL 6 runtimes as far as I know.

Developer Toolset provides C11 and C++11 support in RHEL 7 and RHEL6, I'll switch the componet there and ask them for their opinion on how to fix this.

It might be that we conclude the changes are low enough risk in RHEL6 that we might change the core runtime headers, but my feeling is that this may be unacceptable as RHEL6 is now in Production Phase 2. The fix will therefore have to be contained entirely in Developer Toolset.
Comment 4 Carlos O'Donell 2016-03-29 12:33:35 EDT
The changes are unacceptable from a risk perspective for RHEL6 Production Phase 2.

The changes are acceptable for glibc in RHEL7, so we'll look at these for rhel-7.4. This would enable the use of DTS for compiling C11, but not the system compiler.
Comment 5 Jakub Jelinek 2016-03-29 12:57:26 EDT
I meant rather than say removing the
-/* The ISO C99 standard specifies that in C++ implementations these
-   macros should only be defined if explicitly requested.  */
-#if !defined __cplusplus || defined __STDC_LIMIT_MACROS
-
stuff change it to:
/* The ISO C99 standard specifies that in C++ implementations these
   macros should only be defined if explicitly requested.  */
#if !defined __cplusplus || defined __STDC_LIMIT_MACROS || __GNUC_PREREQ (5, 0)
or something similar.  That should not be that risky even for older RHELs.
Comment 6 Carlos O'Donell 2016-03-29 13:13:12 EDT
(In reply to Jakub Jelinek from comment #5)
> I meant rather than say removing the
> -/* The ISO C99 standard specifies that in C++ implementations these
> -   macros should only be defined if explicitly requested.  */
> -#if !defined __cplusplus || defined __STDC_LIMIT_MACROS
> -
> stuff change it to:
> /* The ISO C99 standard specifies that in C++ implementations these
>    macros should only be defined if explicitly requested.  */
> #if !defined __cplusplus || defined __STDC_LIMIT_MACROS || __GNUC_PREREQ (5,
> 0)
> or something similar.  That should not be that risky even for older RHELs.

That might be workable for older RHEL. Again my worry is that there are people already using gcc 5.x on RHEL6, perhaps their own compiler, and changing glibc would change the behaviour that they are seeing from the core runtimes. In a production phase 2 release like RHEL 6.9 we don't want to change anything that anyone might already be expecting to behave a certain way. While in RHEL 7.3 and 7.4 we have much more tolerance to this kind of change.
Comment 7 Florian Weimer 2016-11-24 13:18:18 EST
Upstream:

commit 1ef74943ce2f114c78b215af57c2ccc72ccdb0b7
Author: Paul Pluzhnikov <ppluzhnikov@google.com>
Date:   Thu Apr 25 11:08:31 2013 -0700

    Get rid of __STDC_FORMAT_MACROS, __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS
Comment 14 errata-xmlrpc 2017-08-01 14:06:55 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2017:1916

Note You need to log in before you can comment on or make changes to this bug.