public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/97914] New: -fno-delete-null-pointer-checks not working properly with constexpr
@ 2020-11-19 18:12 mfarazma.ext at gmail dot com
2020-11-19 18:18 ` [Bug c++/97914] " mpolacek at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: mfarazma.ext at gmail dot com @ 2020-11-19 18:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97914
Bug ID: 97914
Summary: -fno-delete-null-pointer-checks not working properly
with constexpr
Product: gcc
Version: 7.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: mfarazma.ext at gmail dot com
Target Milestone: ---
Compiling this code:
```
constexpr int test(const int *arr) {
if(arr == 0){
//
}
return 5;
}
int main(){
static constexpr int arr[] = {1,2,3};
static constexpr int b = test(arr);
return 0;
}
```
With "g++ -fno-delete-null-pointer-check test.cc" generates this error:
error '(((const int*)(& arr)) == 0u)' is not a constant expression.
Seems like an odd behaviour as clang++ is able to compile this successfully.
I have tested it on gcc 6, 7, 9 as well has "HEAD 11.0.0".
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/97914] -fno-delete-null-pointer-checks not working properly with constexpr
2020-11-19 18:12 [Bug c++/97914] New: -fno-delete-null-pointer-checks not working properly with constexpr mfarazma.ext at gmail dot com
@ 2020-11-19 18:18 ` mpolacek at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-11-19 18:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97914
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |DUPLICATE
CC| |mpolacek at gcc dot gnu.org
--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
.
*** This bug has been marked as a duplicate of bug 97913 ***
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-11-19 18:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-19 18:12 [Bug c++/97914] New: -fno-delete-null-pointer-checks not working properly with constexpr mfarazma.ext at gmail dot com
2020-11-19 18:18 ` [Bug c++/97914] " mpolacek 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).