public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/98518] New: std::array not bound checked with _GLIBCXX_ASSERTIONS
@ 2021-01-04 21:34 arnaud02 at users dot sourceforge.net
2021-01-05 13:32 ` [Bug libstdc++/98518] " redi at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: arnaud02 at users dot sourceforge.net @ 2021-01-04 21:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98518
Bug ID: 98518
Summary: std::array not bound checked with _GLIBCXX_ASSERTIONS
Product: gcc
Version: 10.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: arnaud02 at users dot sourceforge.net
Target Milestone: ---
operator[] of std::array is not bound checked when specifying
_GLIBCXX_ASSERTIONS.
Considering:
#define _GLIBCXX_ASSERTIONS 1
#include <array>
#include <cstdio>
int f(int i) {
std::array<int,2> x = {1, 4};
return x[i]; // bounds are not checked
}
int main() {
volatile int i = 2;
printf("f=%d\n", f(i));
}
the array bound violation is not detected. By constrast, replacing std::array
by std::vector results in the expected assertion violation.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug libstdc++/98518] std::array not bound checked with _GLIBCXX_ASSERTIONS
2021-01-04 21:34 [Bug libstdc++/98518] New: std::array not bound checked with _GLIBCXX_ASSERTIONS arnaud02 at users dot sourceforge.net
@ 2021-01-05 13:32 ` redi at gcc dot gnu.org
2021-01-06 10:23 ` arnaud02 at users dot sourceforge.net
2021-07-22 13:41 ` redi at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2021-01-05 13:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98518
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This has already been charged for GCC 11 and asserts now.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug libstdc++/98518] std::array not bound checked with _GLIBCXX_ASSERTIONS
2021-01-04 21:34 [Bug libstdc++/98518] New: std::array not bound checked with _GLIBCXX_ASSERTIONS arnaud02 at users dot sourceforge.net
2021-01-05 13:32 ` [Bug libstdc++/98518] " redi at gcc dot gnu.org
@ 2021-01-06 10:23 ` arnaud02 at users dot sourceforge.net
2021-07-22 13:41 ` redi at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: arnaud02 at users dot sourceforge.net @ 2021-01-06 10:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98518
--- Comment #2 from Arnaud Desitter <arnaud02 at users dot sourceforge.net> ---
It is indeed fixed. Fantastic.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug libstdc++/98518] std::array not bound checked with _GLIBCXX_ASSERTIONS
2021-01-04 21:34 [Bug libstdc++/98518] New: std::array not bound checked with _GLIBCXX_ASSERTIONS arnaud02 at users dot sourceforge.net
2021-01-05 13:32 ` [Bug libstdc++/98518] " redi at gcc dot gnu.org
2021-01-06 10:23 ` arnaud02 at users dot sourceforge.net
@ 2021-07-22 13:41 ` redi at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2021-07-22 13:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98518
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |11.0
Resolution|--- |FIXED
Status|UNCONFIRMED |RESOLVED
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed by r11-4854
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-07-22 13:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-04 21:34 [Bug libstdc++/98518] New: std::array not bound checked with _GLIBCXX_ASSERTIONS arnaud02 at users dot sourceforge.net
2021-01-05 13:32 ` [Bug libstdc++/98518] " redi at gcc dot gnu.org
2021-01-06 10:23 ` arnaud02 at users dot sourceforge.net
2021-07-22 13:41 ` 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).