Commit 8a385c8
committed
[vt, sdf, usd] fix array-bounds warnings on GCC 13
Five false-positive warning sites caused by GCC 13 losing bound
information during aggressive inlining.
pxr/base/vt/streamOut.cpp
Change dimension == shape.GetRank() - 1 to dimension + 1 >= shape.GetRank()
in _StreamArrayRecursive. GCC can see GetRank() returns at most 4 and
proves dimension <= 2 < NumOtherDims in the else branch.
pxr/usd/sdf/schema.cpp
Add static_cast<size_t>(level) < std::size(valueTupleDimensions.d)
to the else-if in _AddValuesToValueContext. GCC cannot bound the plain
size_t size member but can see std::size(d) == 2.
pxr/usd/usd/clip.cpp
Introduce bracketingTimesEnd as begin + std::min(numTimes, size())
in GetBracketingTimeSamplesForPath. Restores the upper bound lost after
std::distance, preventing std::sort's _S_threshold==16 path from
appearing reachable on the 5-element array.
pxr/usd/sdf/predicateLibrary.h
Replace std::vector<bool> with std::vector<uint8_t> for boundArgs.
The vector<bool> bit-packing specialisation triggers -Warray-bounds and
-Wstringop-overflow when its word-level memmove is inlined into
_TryBindArgs; uint8_t uses the standard path GCC analyses correctly.1 parent 15a2bff commit 8a385c8
4 files changed
Lines changed: 15 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
| 80 | + | |
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
459 | 459 | | |
460 | 460 | | |
461 | 461 | | |
462 | | - | |
| 462 | + | |
463 | 463 | | |
464 | 464 | | |
465 | 465 | | |
| |||
496 | 496 | | |
497 | 497 | | |
498 | 498 | | |
499 | | - | |
| 499 | + | |
500 | 500 | | |
501 | 501 | | |
502 | 502 | | |
| |||
550 | 550 | | |
551 | 551 | | |
552 | 552 | | |
553 | | - | |
| 553 | + | |
554 | 554 | | |
555 | 555 | | |
556 | 556 | | |
557 | 557 | | |
558 | | - | |
| 558 | + | |
559 | 559 | | |
560 | 560 | | |
561 | 561 | | |
| |||
572 | 572 | | |
573 | 573 | | |
574 | 574 | | |
575 | | - | |
| 575 | + | |
576 | 576 | | |
577 | 577 | | |
578 | 578 | | |
| |||
591 | 591 | | |
592 | 592 | | |
593 | 593 | | |
594 | | - | |
| 594 | + | |
595 | 595 | | |
596 | 596 | | |
597 | 597 | | |
| |||
657 | 657 | | |
658 | 658 | | |
659 | 659 | | |
660 | | - | |
| 660 | + | |
661 | 661 | | |
662 | 662 | | |
663 | 663 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| |||
1538 | 1539 | | |
1539 | 1540 | | |
1540 | 1541 | | |
1541 | | - | |
| 1542 | + | |
| 1543 | + | |
1542 | 1544 | | |
1543 | 1545 | | |
1544 | 1546 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
430 | 430 | | |
431 | 431 | | |
432 | 432 | | |
433 | | - | |
434 | | - | |
435 | | - | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
436 | 437 | | |
437 | 438 | | |
438 | 439 | | |
| |||
0 commit comments