public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/108617] New: nullptr comparision in constexpr not constexpr when using -fsanitize=returns-nonnull-attribute
@ 2023-01-31 18:03 andre.schackier at gmail dot com
2023-01-31 18:05 ` [Bug c++/108617] " pinskia at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: andre.schackier at gmail dot com @ 2023-01-31 18:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108617
Bug ID: 108617
Summary: nullptr comparision in constexpr not constexpr when
using -fsanitize=returns-nonnull-attribute
Product: gcc
Version: 12.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: andre.schackier at gmail dot com
Target Milestone: ---
Given the following source code
test.cpp:
constexpr bool test(const char* str) { return str == nullptr; }
int main() {
static constexpr const char str[] = "";
constexpr bool a = test(str);
(void)a;
}
and compiling it with '-std=c++11 -fsanitize=returns-nonnull-attribute' gives
the following error:
error: '(((const char*)(& str)) == 0)' is not a constant expression
1 | constexpr bool test(const char* str) { return str == nullptr; }
while compiling with only '-std=c++11' works fine.
Experimenting with compiler explorer it seems that every gcc version starting
with gcc-5.1 to the current trunk is affected by this.
https://godbolt.org/z/GEz6GYqo8
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/108617] nullptr comparision in constexpr not constexpr when using -fsanitize=returns-nonnull-attribute
2023-01-31 18:03 [Bug c++/108617] New: nullptr comparision in constexpr not constexpr when using -fsanitize=returns-nonnull-attribute andre.schackier at gmail dot com
@ 2023-01-31 18:05 ` pinskia at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-01-31 18:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108617
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Depends on| |104426
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I suspect in the end this is most likely a dup of bug 104426 .
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104426
[Bug 104426] -fsanitize=undefined causes constexpr failures
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-01-31 18:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-31 18:03 [Bug c++/108617] New: nullptr comparision in constexpr not constexpr when using -fsanitize=returns-nonnull-attribute andre.schackier at gmail dot com
2023-01-31 18:05 ` [Bug c++/108617] " pinskia 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).