This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/81172] Expected new warning option -Warray-bounds-pointer-arithmetic


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?

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]