Bug 1986441
| Summary: | stdio.h undefines __USE_XOPEN_EXTENDED, no definition for FPE_INTDIV | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 8 | Reporter: | Wade Hampton <wadehamptoniv> |
| Component: | glibc | Assignee: | glibc team <glibc-bugzilla> |
| Status: | CLOSED NOTABUG | QA Contact: | qe-baseos-tools-bugs |
| Severity: | low | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 8.3 | CC: | ahajkova, ashankar, codonell, dj, fweimer, jakub, mnewsome, ohudlick, pfrankli, sipoyare |
| Target Milestone: | beta | Keywords: | Bugfix |
| Target Release: | --- | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | No Doc Update | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2021-08-06 19:03:11 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
stdio.h is provided by glibc-headers, not gcc. (In reply to Wade Hampton from comment #0) > The following program fails to build. However, if I move the define for > __USE_XOPEN_EXTENDED to just before the include for signal.h, it builds fine. You may not define or use double-underscore macros as they are part of the implementation. > The manual page indicates the _POSIX* include is required for sigaction > and siginfo_t. This is called a "feature test macro" which allows your code to use specific features. See `man 7 feature_test_macros` for more information. The _POSIX_C_SOURCE controls which POSIX standard is provided by the headers. In order to use siginfo_t you must have POSIX support equal to or newer than IEEE Std 1003.1b-1993 (>= 199309L). In order to use FPE_* constants you must *generally* have POSIX support equal to or newer than IEEE 1003.1-2008 (>= 200809L), but there are other standards that also defined these constants. > #define _POSIX_C_SOURCE 199309L /* for siginfo_t per man page */ > #define __USE_XOPEN_EXTENDED /* for FPE_* defines */ > #include <stdio.h> > #include <signal.h> > > void main() { > /* this fails to build: */ > if (x == FPE_INTDEV) > printf("test\n"); > return(0); > } A simple function would look like this: #include <stdio.h> #include <signal.h> void foo(int x) { if (x == FPE_INTDIV) printf("test\n"); } gcc -D_GNU_SOURCE -c test.c This works because _GNU_SOURCE provides POSIX IEEE 1003.1-2008 (>= 200809L) values e.g. sigaction with siginfo_t and definitions for FPE_INTDIV. Alternatively: gcc -D_POSIX_C_SOURCE=200809L -c test.c I hope this helps! |
Description of problem: I am evaluating trapping SIGFPE for an application. My test program uses sigaction and reads si_code and compares it with FPE_INTDIV. Program works fine with CentOS 7 and below, but does not build on CentOS 8 as it fails to find FPE_INTDIV. Version-Release number of selected component (if applicable): gcc: 8.3.1.5.1 glibc-headers: 2.28.127 How reproducible: Each time Steps to Reproduce: 1. Create test program 2. Try to compile 3. Actual results: FPE_INTDEV is undefined Expected results: it compiles and works Additional info: The following program fails to build. However, if I move the define for __USE_XOPEN_EXTENDED to just before the include for signal.h, it builds fine. The manual page indicates the _POSIX* include is required for sigaction and siginfo_t. #define _POSIX_C_SOURCE 199309L /* for siginfo_t per man page */ #define __USE_XOPEN_EXTENDED /* for FPE_* defines */ #include <stdio.h> #include <signal.h> void main() { /* this fails to build: */ if (x == FPE_INTDEV) printf("test\n"); return(0); }