public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c++/82877] negative array index accepted in a pointer difference expression in constexpr context [not found] <bug-82877-4@http.gcc.gnu.org/bugzilla/> @ 2021-01-29 17:43 ` ppalka at gcc dot gnu.org 2021-09-12 19:01 ` johelegp at gmail dot com 2022-09-26 9:29 ` redi at gcc dot gnu.org 2 siblings, 0 replies; 3+ messages in thread From: ppalka at gcc dot gnu.org @ 2021-01-29 17:43 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82877 Patrick Palka <ppalka at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ppalka at gcc dot gnu.org --- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> --- Looks we correctly reject the testcase starting with GCC 9.1 (r9-6136): <source>:9:21: in 'constexpr' expansion of 'f()' <source>:9:22: error: array subscript value '-1' is outside the bounds of array type 'int [1]' 9 | constexpr int i = f (); | ^ Starting with GCC 10.1, the diagnostic also points to the correct line: source>:9:21: in 'constexpr' expansion of 'f()' <source>:6:27: error: array subscript value '-1' is outside the bounds of array type 'int [1]' 6 | return &s.a[0] - &s.a[-1]; // undefined, should be rejected | ~~~~~~^ ^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/82877] negative array index accepted in a pointer difference expression in constexpr context [not found] <bug-82877-4@http.gcc.gnu.org/bugzilla/> 2021-01-29 17:43 ` [Bug c++/82877] negative array index accepted in a pointer difference expression in constexpr context ppalka at gcc dot gnu.org @ 2021-09-12 19:01 ` johelegp at gmail dot com 2022-09-26 9:29 ` redi at gcc dot gnu.org 2 siblings, 0 replies; 3+ messages in thread From: johelegp at gmail dot com @ 2021-09-12 19:01 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82877 Johel Ernesto Guerrero Peña <johelegp at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |johelegp at gmail dot com --- Comment #4 from Johel Ernesto Guerrero Peña <johelegp at gmail dot com> --- Up to GCC 10. Not since GCC 11. Another example: https://godbolt.org/z/GW3rrejjq. ```C++ constexpr void f(int i) { (&i)[-1]; } int main() { []() consteval { f(0); }(); } ``` Bug 89149 may be a duplicate of this. ^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/82877] negative array index accepted in a pointer difference expression in constexpr context [not found] <bug-82877-4@http.gcc.gnu.org/bugzilla/> 2021-01-29 17:43 ` [Bug c++/82877] negative array index accepted in a pointer difference expression in constexpr context ppalka at gcc dot gnu.org 2021-09-12 19:01 ` johelegp at gmail dot com @ 2022-09-26 9:29 ` redi at gcc dot gnu.org 2 siblings, 0 replies; 3+ messages in thread From: redi at gcc dot gnu.org @ 2022-09-26 9:29 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82877 Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jlame646 at gmail dot com --- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> --- *** Bug 107039 has been marked as a duplicate of this bug. *** ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-09-26 9:29 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <bug-82877-4@http.gcc.gnu.org/bugzilla/> 2021-01-29 17:43 ` [Bug c++/82877] negative array index accepted in a pointer difference expression in constexpr context ppalka at gcc dot gnu.org 2021-09-12 19:01 ` johelegp at gmail dot com 2022-09-26 9:29 ` redi 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).