Commit c60542b
committed
pytime: add _PyTime_check_mul_overflow() macro to avoid undefined behaviour
Overflow test in test_FromSecondsObject() fails on FreeBSD 10.0 buildbot which
uses clang. clang implements more aggressive optimization which gives
different result than GCC on undefined behaviours.
Check if a multiplication will overflow, instead of checking if a
multiplicatin had overflowed, to avoid undefined behaviour.
Add also debug information if the test on overflow fails.1 parent ff0ed3e commit c60542b
2 files changed
+26
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
781 | 781 | | |
782 | 782 | | |
783 | 783 | | |
784 | | - | |
| 784 | + | |
| 785 | + | |
785 | 786 | | |
786 | 787 | | |
787 | 788 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
10 | 15 | | |
11 | 16 | | |
12 | 17 | | |
| |||
226 | 231 | | |
227 | 232 | | |
228 | 233 | | |
229 | | - | |
230 | | - | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
231 | 238 | | |
232 | 239 | | |
233 | 240 | | |
234 | 241 | | |
| 242 | + | |
235 | 243 | | |
236 | 244 | | |
237 | 245 | | |
| |||
245 | 253 | | |
246 | 254 | | |
247 | 255 | | |
248 | | - | |
249 | | - | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
250 | 260 | | |
251 | 261 | | |
252 | 262 | | |
253 | 263 | | |
| 264 | + | |
254 | 265 | | |
255 | 266 | | |
256 | 267 | | |
| |||
308 | 319 | | |
309 | 320 | | |
310 | 321 | | |
311 | | - | |
312 | | - | |
| 322 | + | |
313 | 323 | | |
314 | 324 | | |
315 | 325 | | |
| 326 | + | |
316 | 327 | | |
317 | 328 | | |
318 | 329 | | |
| |||
587 | 598 | | |
588 | 599 | | |
589 | 600 | | |
590 | | - | |
591 | 601 | | |
592 | 602 | | |
593 | 603 | | |
594 | 604 | | |
595 | | - | |
| 605 | + | |
| 606 | + | |
596 | 607 | | |
597 | 608 | | |
598 | 609 | | |
599 | | - | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
600 | 613 | | |
601 | | - | |
602 | | - | |
| 614 | + | |
603 | 615 | | |
604 | 616 | | |
605 | 617 | | |
606 | 618 | | |
607 | 619 | | |
608 | 620 | | |
609 | 621 | | |
| 622 | + | |
610 | 623 | | |
611 | 624 | | |
612 | 625 | | |
| |||
0 commit comments