Request for a C++ warning for undefined behaviour

Andrew Pinski pinskia@physics.uc.edu
Wed Aug 13 12:09:00 GMT 2003


On Wednesday, Aug 13, 2003, at 05:46 US/Eastern, Igor Bukanov wrote:

> It would also be nice if GCC would warn about the following code:
>
> int x = x + 1;
>
> Few years ago I spend some hours fixing that but even with GCC 3.2.2 
> "gcc -Wall" gives no warnings for that.
>
> At least in C "int x = x + 1;" is error if used outside functions but 
> in C++ the following compiles warningless in any scope:
>
> const int x = x + 1;

I almost have a patch for this but it will not get finished for another 
month since I have a big project for school.
There was some talk about this about two weeks ago also.


Thanks,
Andrew Pinski



More information about the Gcc mailing list