https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99418
--- Comment #8 from Ivan Sorokin ---
If I understand #c5 correctly the minimal reproducer should be this:
void g(int&);
void f()
{
int a[10];
int& p = a[10]; // (1)
g(a[10]); // (2)
}
Both (1) and (2) are undefined and -fsani
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99418
--- Comment #7 from Ivan Sorokin ---
(In reply to Martin Liška from comment #3)
> That said, can we close it as resolved?
I'm sorry for not being clear from the beginning. The original report was about
-fsanitize=bounds sanitizer which sometime
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99418
--- Comment #6 from Ivan Sorokin ---
(In reply to Jakub Jelinek from comment #4)
> Asan can't by design detect neither #c0 nor #c1, only ubsan can.
> The reason why ubsan has that off by one stuff is that in C/C++,
> &mas[n - 1][m] is not undefin
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99418
Martin Sebor changed:
What|Removed |Added
CC||msebor at gcc dot gnu.org
--- Comment #5
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99418
--- Comment #4 from Jakub Jelinek ---
Asan can't by design detect neither #c0 nor #c1, only ubsan can.
The reason why ubsan has that off by one stuff is that in C/C++,
&mas[n - 1][m] is not undefined behavior, only mas[n - 1][m] is.
And with clas
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99418
Martin Liška changed:
What|Removed |Added
Last reconfirmed||2021-03-08
Status|UNCONFIRMED
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99418
--- Comment #2 from Ivan Sorokin ---
It looks like this is related to ignore_off_by_one parameter of
ubsan_instrument_bounds.
As can be seen in gimple the problematic .UBSAN_BOUNDS checks against array
size plus 1.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99418
--- Comment #1 from Ivan Sorokin ---
Here is the reduced example. It doesn't SIGSEGV, but it doesn't report any
sanitizer errors either:
$ g++ -g -fsanitize=bounds 3.cpp
$ cat 3.cpp
#include
void escape(int& a)
{}
void test(size_t n, size_t m