[Bug c/108531] New: Imaginary types are not supported, violating ISO C Annex G

Keith.S.Thompson at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Jan 24 19:51:04 GMT 2023


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108531

            Bug ID: 108531
           Summary: Imaginary types are not supported, violating ISO C
                    Annex G
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: Keith.S.Thompson at gmail dot com
  Target Milestone: ---

#include <stdio.h>
#include <complex.h>
int main(void) {
#ifdef __STDC_IEC_559_COMPLEX__
    printf("__STDC_IEC_559_COMPLEX__ is defined as %d\n",
__STDC_IEC_559_COMPLEX__);
#else
    printf("__STDC_IEC_559_COMPLEX__ is NOT defined\n");
#endif

#ifdef _Imaginary_I
    printf("Imaginary types are supported\n");
#else
    printf("Imaginary types are NOT supported\n");
#endif
}

The output of this program, when compiled with
"gcc -Wall -Wextra -std=c11 -pedantic-errors"
is:

__STDC_IEC_559_COMPLEX__ is defined as 1
Imaginary types are NOT supported

ISO C Annex G was informative in C99, but was made normative in C11. 
Imaginary types are optional in C11, but are mandatory for any
implementation that predefines __STDC_IEC_559_COMPLEX__.
(Complex types were made optional in C11, but that's not relevant here.)

To conform to C11 (and later), gcc should either implement imaginary types
as defined in Annex G or remove the definition of __STDC_IEC_559_COMPLEX__.


More information about the Gcc-bugs mailing list