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

--- Comment #5 from Xi Ruoyao <ryxi at stu dot xidian.edu.cn> ---
(In reply to Martin Sebor from comment #4)

> Clang diagnoses the the cases where the offset or index is a constant
> expression (and under the expected option) but it doesn't diagnose others
> where the offset/index value is not a constant expression but can be
> determined to be out of bounds by VRP, for instance.  GCC can do better, but
> it may not be able to distinguish between the two kinds of warnings outside
> the front end.

I'm aware that GCC C/C++ FE convert a[x] to *(a+x) very early.  But now it's
very strange - why GCC -Warray-bounds doesn't warn for pointer arithmetics?

Reply via email to