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]

Checking of constant bounds in array access



Hi there,

this probably has been asked before; if so please excuse, I didn't search
the archives too extensively. My question is: would it be possible for the
compiler to generate a warning on the following code snippet:
----------------------------------------------------------------------
void f() {
  int a[10];
  a[1000] = 1;
  a[-100] = 1;
};
----------------------------------------------------------------------
Bounds and indices are known to the compiler, so it should be possible to
catch this kind of problem.

Regards,
  Wolfgang



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