public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/114181] New: issubnormal is a macro
@ 2024-03-01 0:27 g.peterhoff@t-online.de
2024-03-01 0:32 ` [Bug c/114181] " pinskia at gcc dot gnu.org
` (14 more replies)
0 siblings, 15 replies; 16+ messages in thread
From: g.peterhoff@t-online.de @ 2024-03-01 0:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114181
Bug ID: 114181
Summary: issubnormal is a macro
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: g.peterhoff@t-online.de
Target Milestone: ---
issubnormal is a macro and therefore not a (builtin)function.
This is incorrect, as no further issubnormal functions can be implemented, e.g.
for C++
namespace std
{
bool issubnormal(...);
}
thx
Gero
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c/114181] issubnormal is a macro
2024-03-01 0:27 [Bug c/114181] New: issubnormal is a macro g.peterhoff@t-online.de
@ 2024-03-01 0:32 ` pinskia at gcc dot gnu.org
2024-03-01 0:35 ` pinskia at gcc dot gnu.org
` (13 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-01 0:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114181
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Last reconfirmed| |2024-03-01
Status|UNCONFIRMED |WAITING
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Gcc does not provide math.h. nor defines the macro issubnormal.
In libstdc++, there are #undef for some macros to get around libc that define
some functions as macros.
If you are implementing something similar then you should be able to do that
too.
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c/114181] issubnormal is a macro
2024-03-01 0:27 [Bug c/114181] New: issubnormal is a macro g.peterhoff@t-online.de
2024-03-01 0:32 ` [Bug c/114181] " pinskia at gcc dot gnu.org
@ 2024-03-01 0:35 ` pinskia at gcc dot gnu.org
2024-03-01 0:41 ` g.peterhoff@t-online.de
` (12 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-01 0:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114181
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Also please provide a full testcase to show what you are doing because this
code snippet is not even valid c++.
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c/114181] issubnormal is a macro
2024-03-01 0:27 [Bug c/114181] New: issubnormal is a macro g.peterhoff@t-online.de
2024-03-01 0:32 ` [Bug c/114181] " pinskia at gcc dot gnu.org
2024-03-01 0:35 ` pinskia at gcc dot gnu.org
@ 2024-03-01 0:41 ` g.peterhoff@t-online.de
2024-03-01 0:51 ` pinskia at gcc dot gnu.org
` (11 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: g.peterhoff@t-online.de @ 2024-03-01 0:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114181
--- Comment #3 from g.peterhoff@t-online.de ---
Of course issubnormal is defined in math.h (in my case line 1088, gcc 13.2).
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c/114181] issubnormal is a macro
2024-03-01 0:27 [Bug c/114181] New: issubnormal is a macro g.peterhoff@t-online.de
` (2 preceding siblings ...)
2024-03-01 0:41 ` g.peterhoff@t-online.de
@ 2024-03-01 0:51 ` pinskia at gcc dot gnu.org
2024-03-01 1:04 ` g.peterhoff@t-online.de
` (10 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-01 0:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114181
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |MOVED
Status|WAITING |RESOLVED
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to g.peterhoff from comment #3)
> Of course issubnormal is defined in math.h (in my case line 1088, gcc 13.2).
libstdc++'s cmath does:
```
#define _GLIBCXX_INCLUDE_NEXT_C_HEADERS
#include_next <math.h>
#undef _GLIBCXX_INCLUDE_NEXT_C_HEADERS
...
#undef fpclassify
#undef isfinite
#undef isinf
#undef isnan
#undef isnormal
#undef signbit
#undef isgreater
#undef isgreaterequal
#undef isless
#undef islessequal
#undef islessgreater
#undef isunordered
```
And then libstdc++'s math.h does:
```
#if !defined __cplusplus || defined _GLIBCXX_INCLUDE_NEXT_C_HEADERS
# include_next <math.h>
#else
#ifndef _GLIBCXX_MATH_H
#define _GLIBCXX_MATH_H 1
# include <cmath>
```
If you are implementing a cmath for a C++ implementation, you need to a similar
thing and `#undef` it.
The math.h that defines issubnormal comes from glibc.
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c/114181] issubnormal is a macro
2024-03-01 0:27 [Bug c/114181] New: issubnormal is a macro g.peterhoff@t-online.de
` (3 preceding siblings ...)
2024-03-01 0:51 ` pinskia at gcc dot gnu.org
@ 2024-03-01 1:04 ` g.peterhoff@t-online.de
2024-03-01 1:07 ` pinskia at gcc dot gnu.org
` (9 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: g.peterhoff@t-online.de @ 2024-03-01 1:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114181
g.peterhoff@t-online.de changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|MOVED |FIXED
--- Comment #5 from g.peterhoff@t-online.de ---
> If you are implementing a cmath for a C++ implementation, you need to a similar thing and `#undef` it.
> The math.h that defines issubnormal comes from glibc.
That's what I mean. See also e.g.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77925
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77926
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c/114181] issubnormal is a macro
2024-03-01 0:27 [Bug c/114181] New: issubnormal is a macro g.peterhoff@t-online.de
` (4 preceding siblings ...)
2024-03-01 1:04 ` g.peterhoff@t-online.de
@ 2024-03-01 1:07 ` pinskia at gcc dot gnu.org
2024-03-01 1:08 ` pinskia at gcc dot gnu.org
` (8 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-01 1:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114181
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|FIXED |INVALID
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
.
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c/114181] issubnormal is a macro
2024-03-01 0:27 [Bug c/114181] New: issubnormal is a macro g.peterhoff@t-online.de
` (5 preceding siblings ...)
2024-03-01 1:07 ` pinskia at gcc dot gnu.org
@ 2024-03-01 1:08 ` pinskia at gcc dot gnu.org
2024-03-01 1:14 ` g.peterhoff@t-online.de
` (7 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-01 1:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114181
--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
C++ standard does not define a std::issubnormal yet.
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c/114181] issubnormal is a macro
2024-03-01 0:27 [Bug c/114181] New: issubnormal is a macro g.peterhoff@t-online.de
` (6 preceding siblings ...)
2024-03-01 1:08 ` pinskia at gcc dot gnu.org
@ 2024-03-01 1:14 ` g.peterhoff@t-online.de
2024-03-01 1:17 ` pinskia at gcc dot gnu.org
` (6 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: g.peterhoff@t-online.de @ 2024-03-01 1:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114181
g.peterhoff@t-online.de changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|INVALID |FIXED
--- Comment #8 from g.peterhoff@t-online.de ---
Of course, std::issubnormal is not yet available at the moment. To be able to
implement this at all, issubnormal from math.h must not be a macro!
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c/114181] issubnormal is a macro
2024-03-01 0:27 [Bug c/114181] New: issubnormal is a macro g.peterhoff@t-online.de
` (7 preceding siblings ...)
2024-03-01 1:14 ` g.peterhoff@t-online.de
@ 2024-03-01 1:17 ` pinskia at gcc dot gnu.org
2024-03-01 2:20 ` g.peterhoff@t-online.de
` (5 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-01 1:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114181
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|FIXED |INVALID
--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
To implement it in libstdc++, you implement it the same way isnormal, etc. Is
done.
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c/114181] issubnormal is a macro
2024-03-01 0:27 [Bug c/114181] New: issubnormal is a macro g.peterhoff@t-online.de
` (8 preceding siblings ...)
2024-03-01 1:17 ` pinskia at gcc dot gnu.org
@ 2024-03-01 2:20 ` g.peterhoff@t-online.de
2024-03-01 2:38 ` pinskia at gcc dot gnu.org
` (4 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: g.peterhoff@t-online.de @ 2024-03-01 2:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114181
g.peterhoff@t-online.de changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|INVALID |FIXED
--- Comment #10 from g.peterhoff@t-online.de ---
Exactly that does not work, because issubnormal is a simple macro.
Only if before the implementation
#undef issubnormal
is made before implementation: https://godbolt.org/z/z3PG3hYev
That is incorrect.
* I have no idea what happens if math.h is already included somewhere and I
subsequently undefine issubnormal.
* It is not my job to program around any (compiler-specific) problems. The
compiler has to do it right or it doesn't support it at all.
Therefore issubnormal must be provided as a "real" function or via builtin.
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c/114181] issubnormal is a macro
2024-03-01 0:27 [Bug c/114181] New: issubnormal is a macro g.peterhoff@t-online.de
` (9 preceding siblings ...)
2024-03-01 2:20 ` g.peterhoff@t-online.de
@ 2024-03-01 2:38 ` pinskia at gcc dot gnu.org
2024-03-01 3:08 ` g.peterhoff@t-online.de
` (3 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-01 2:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114181
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|FIXED |INVALID
--- Comment #11 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
In this case gcc has nothing to do with this. Since defining issubnormal inside
std is undefined behavior there is nothing to be done.
Also you don't need a builtin since fpclassify is there already.
When issubnormal is added to the c++ standard, libstdc++'s will add it too.
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c/114181] issubnormal is a macro
2024-03-01 0:27 [Bug c/114181] New: issubnormal is a macro g.peterhoff@t-online.de
` (10 preceding siblings ...)
2024-03-01 2:38 ` pinskia at gcc dot gnu.org
@ 2024-03-01 3:08 ` g.peterhoff@t-online.de
2024-03-01 3:19 ` pinskia at gcc dot gnu.org
` (2 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: g.peterhoff@t-online.de @ 2024-03-01 3:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114181
g.peterhoff@t-online.de changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|INVALID |FIXED
--- Comment #12 from g.peterhoff@t-online.de ---
If this comes into the C++ standard I would have to rewrite it anyway. Why not
now that I have reported this error?
Are there already plans how to deal with the
https://en.cppreference.com/w/c/experimental/fpext1
https://en.cppreference.com/w/c/experimental/fpext4
regarding C++?
thx
Gero
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c/114181] issubnormal is a macro
2024-03-01 0:27 [Bug c/114181] New: issubnormal is a macro g.peterhoff@t-online.de
` (11 preceding siblings ...)
2024-03-01 3:08 ` g.peterhoff@t-online.de
@ 2024-03-01 3:19 ` pinskia at gcc dot gnu.org
2024-03-01 11:05 ` redi at gcc dot gnu.org
2024-03-01 11:19 ` jakub at gcc dot gnu.org
14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-01 3:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114181
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|FIXED |INVALID
--- Comment #13 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to g.peterhoff from comment #12)
> Are there already plans how to deal with the
> https://en.cppreference.com/w/c/experimental/fpext1
> https://en.cppreference.com/w/c/experimental/fpext4
> regarding C++?
Well dfp is supported, or kinda of supported already for GCC, see PR 51364
also.
as far as fpext4 is concern, I suspect it might be better to take it up with
the C++ standards committee ...
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c/114181] issubnormal is a macro
2024-03-01 0:27 [Bug c/114181] New: issubnormal is a macro g.peterhoff@t-online.de
` (12 preceding siblings ...)
2024-03-01 3:19 ` pinskia at gcc dot gnu.org
@ 2024-03-01 11:05 ` redi at gcc dot gnu.org
2024-03-01 11:19 ` jakub at gcc dot gnu.org
14 siblings, 0 replies; 16+ messages in thread
From: redi at gcc dot gnu.org @ 2024-03-01 11:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114181
--- Comment #14 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Libc headers define lots of macros, we don't #undef them in C++ headers unless
they use the name of a function defined by the C++ library (because C++ says
its library functions must be real functions and must not be hidden by macros).
If you want to provide an implementation of issubnormal (e.g. as
boost::issubnormal) then you need to do:
#include <math.h>
#undef issubnormal
I don't think it's a libstdc++ bug that we don't #undef non-standard macros.
It's certainly not a GCC component=c bug that Glibc defines a macro in its
<math.h>.
So there's no GCC bug here.
Like Andrew said, iff we need to define std::issubnormal then we'll #undef it,
but we're not going to do that until we need to.
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c/114181] issubnormal is a macro
2024-03-01 0:27 [Bug c/114181] New: issubnormal is a macro g.peterhoff@t-online.de
` (13 preceding siblings ...)
2024-03-01 11:05 ` redi at gcc dot gnu.org
@ 2024-03-01 11:19 ` jakub at gcc dot gnu.org
14 siblings, 0 replies; 16+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-03-01 11:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114181
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #15 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
You could as well use namespace std { bool (issubnormal) (...); } if you don't
want macro expansion for it.
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2024-03-01 11:19 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-01 0:27 [Bug c/114181] New: issubnormal is a macro g.peterhoff@t-online.de
2024-03-01 0:32 ` [Bug c/114181] " pinskia at gcc dot gnu.org
2024-03-01 0:35 ` pinskia at gcc dot gnu.org
2024-03-01 0:41 ` g.peterhoff@t-online.de
2024-03-01 0:51 ` pinskia at gcc dot gnu.org
2024-03-01 1:04 ` g.peterhoff@t-online.de
2024-03-01 1:07 ` pinskia at gcc dot gnu.org
2024-03-01 1:08 ` pinskia at gcc dot gnu.org
2024-03-01 1:14 ` g.peterhoff@t-online.de
2024-03-01 1:17 ` pinskia at gcc dot gnu.org
2024-03-01 2:20 ` g.peterhoff@t-online.de
2024-03-01 2:38 ` pinskia at gcc dot gnu.org
2024-03-01 3:08 ` g.peterhoff@t-online.de
2024-03-01 3:19 ` pinskia at gcc dot gnu.org
2024-03-01 11:05 ` redi at gcc dot gnu.org
2024-03-01 11:19 ` jakub at gcc dot gnu.org
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).