public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/108531] New: Imaginary types are not supported, violating ISO C Annex G
@ 2023-01-24 19:51 Keith.S.Thompson at gmail dot com
  2023-01-24 20:00 ` [Bug c/108531] " Keith.S.Thompson at gmail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Keith.S.Thompson at gmail dot com @ 2023-01-24 19:51 UTC (permalink / raw)
  To: gcc-bugs

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__.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c/108531] Imaginary types are not supported, violating ISO C Annex G
  2023-01-24 19:51 [Bug c/108531] New: Imaginary types are not supported, violating ISO C Annex G Keith.S.Thompson at gmail dot com
@ 2023-01-24 20:00 ` Keith.S.Thompson at gmail dot com
  2023-01-24 20:06 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Keith.S.Thompson at gmail dot com @ 2023-01-24 20:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Keith Thompson <Keith.S.Thompson at gmail dot com> ---
After I submitted this, I found that this is probably a duplicate of:

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

(I disagree with the resolution of that bug report.)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c/108531] Imaginary types are not supported, violating ISO C Annex G
  2023-01-24 19:51 [Bug c/108531] New: Imaginary types are not supported, violating ISO C Annex G Keith.S.Thompson at gmail dot com
  2023-01-24 20:00 ` [Bug c/108531] " Keith.S.Thompson at gmail dot com
@ 2023-01-24 20:06 ` pinskia at gcc dot gnu.org
  2023-01-24 20:59 ` Keith.S.Thompson at gmail dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-01-24 20:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
C2x changes this ... (so does TS 18661-1 ) so ....

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c/108531] Imaginary types are not supported, violating ISO C Annex G
  2023-01-24 19:51 [Bug c/108531] New: Imaginary types are not supported, violating ISO C Annex G Keith.S.Thompson at gmail dot com
  2023-01-24 20:00 ` [Bug c/108531] " Keith.S.Thompson at gmail dot com
  2023-01-24 20:06 ` pinskia at gcc dot gnu.org
@ 2023-01-24 20:59 ` Keith.S.Thompson at gmail dot com
  2023-01-25  7:16 ` sam at gentoo dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Keith.S.Thompson at gmail dot com @ 2023-01-24 20:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Keith Thompson <Keith.S.Thompson at gmail dot com> ---
In the latest C2X draft,
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3054.pdf
Annex G still requires imaginary number support for any implementation
that defines __STDC_IEC_60559_COMPLEX__ or __STDC_IEC_559_COMPLEX__.

I don't see anything relevant in TS 18661-1
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2314.pdf

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c/108531] Imaginary types are not supported, violating ISO C Annex G
  2023-01-24 19:51 [Bug c/108531] New: Imaginary types are not supported, violating ISO C Annex G Keith.S.Thompson at gmail dot com
                   ` (2 preceding siblings ...)
  2023-01-24 20:59 ` Keith.S.Thompson at gmail dot com
@ 2023-01-25  7:16 ` sam at gentoo dot org
  2023-01-25 18:16 ` Keith.S.Thompson at gmail dot com
  2023-01-26  1:12 ` joseph at codesourcery dot com
  5 siblings, 0 replies; 7+ messages in thread
From: sam at gentoo dot org @ 2023-01-25  7:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Sam James <sam at gentoo dot org> ---
LLVM side: https://github.com/llvm/llvm-project/issues/60269

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c/108531] Imaginary types are not supported, violating ISO C Annex G
  2023-01-24 19:51 [Bug c/108531] New: Imaginary types are not supported, violating ISO C Annex G Keith.S.Thompson at gmail dot com
                   ` (3 preceding siblings ...)
  2023-01-25  7:16 ` sam at gentoo dot org
@ 2023-01-25 18:16 ` Keith.S.Thompson at gmail dot com
  2023-01-26  1:12 ` joseph at codesourcery dot com
  5 siblings, 0 replies; 7+ messages in thread
From: Keith.S.Thompson at gmail dot com @ 2023-01-25 18:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Keith Thompson <Keith.S.Thompson at gmail dot com> ---
FYI, I've sent an email to the C standard editors (the addresses at
the top of the N3054 draft) suggesting that imaginary number support
should be optional even if __STDC_IEC_559_COMPLEX__ and
__STDC_IEC_60559_COMPLEX__ are defined.

It's probably too late to make such a change in C23.

(__STDC_IEC_60559_COMPLEX__ is replacing __STDC_IEC_559_COMPLEX__,
which is obsolescent.)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c/108531] Imaginary types are not supported, violating ISO C Annex G
  2023-01-24 19:51 [Bug c/108531] New: Imaginary types are not supported, violating ISO C Annex G Keith.S.Thompson at gmail dot com
                   ` (4 preceding siblings ...)
  2023-01-25 18:16 ` Keith.S.Thompson at gmail dot com
@ 2023-01-26  1:12 ` joseph at codesourcery dot com
  5 siblings, 0 replies; 7+ messages in thread
From: joseph at codesourcery dot com @ 2023-01-26  1:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
My only real addition to my previous comments in the referenced glibc bug 
report is that, given we defined _Float32 which has the same "not promoted 
at language level in variable arguments" property as _Imaginary float and 
let it have the ABI arising naturally from the back ends in the absence of 
target maintainers / ABI maintainers choosing something different, it 
would probably be reasonable to do the same thing for imaginary types; 
this case is rather different from _BitInt where there are significant ABI 
choices to be made for each architecture (and I've filed bugs on various 
ABI repositories to request that such ABIs be defined).  It would be good 
if psABI maintainers kept up more with C standard features, however.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-01-26  1:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-24 19:51 [Bug c/108531] New: Imaginary types are not supported, violating ISO C Annex G Keith.S.Thompson at gmail dot com
2023-01-24 20:00 ` [Bug c/108531] " Keith.S.Thompson at gmail dot com
2023-01-24 20:06 ` pinskia at gcc dot gnu.org
2023-01-24 20:59 ` Keith.S.Thompson at gmail dot com
2023-01-25  7:16 ` sam at gentoo dot org
2023-01-25 18:16 ` Keith.S.Thompson at gmail dot com
2023-01-26  1:12 ` joseph at codesourcery dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).