Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/lib/libc/time

On Thu, 25 Oct 2012, Martin Husemann wrote:
Modified Files:
        src/lib/libc/time: zic.c

Log Message:
Add a few casts to avoid (IMHO bogus) gcc warnings breaking the vax build.

-       if (dayoff < min_time / SECSPERDAY) {
+       if (dayoff < (long)(min_time / SECSPERDAY)) {

time_t and zic_t are 64 bit types, and max_time and min_time are the largest possible positive and negative 64-bit values. max_time / SECSPERDAY or min_time / SECSPERDAY will be much too large to fit in a 32-bit int, and casting to int will cause overflow.

Does adding a /*CONSTCOND*/ comment work? If so, I'd prefer that to a cast. If you do need a cast, then I think you should cast dayoff to zic_t.

--apb (Alan Barrett)

Home | Main Index | Thread Index | Old Index