This is the mail archive of the gcc@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] |
int j; for (j = 1; 0 < j; j *= 2) if (! bigtime_test (j)) return 1;
Here it is obvious to a programmer that the comparison is intended to do overflow checking, even though the test controls the loop.
Another question for the GCC experts: would it fix the bug if we replaced "j *= 2" with "j <<= 1" in this sample code?
int i, j; for (i = 0, j = 1; i < 31; i++) j <<= 1;
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |