https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107698

--- Comment #2 from Li Shaohua <shaohua.li at inf dot ethz.ch> ---
I found a new test where gcc-O1 misses the global-buffer-overflow. Not sure if
these two have the same root cause:

% cat a.c
int a, c;
int *b = &a;
int main() {
  int d = *b;
  for (; c < 3; c++)
    b = b + (d == *b);
}
%
% gcc-tk -O1 -fsanitize=address a.c && ./a.out
%
% gcc-tk -O3 -fsanitize=address a.c && ./a.out
=================================================================
==3536571==ERROR: AddressSanitizer: global-buffer-overflow on address
0x000000404204 at pc 0x000000401130 bp 0x7ffe232ffd40 sp 0x7ffe232ffd38
...
%

Reply via email to