Skip to content

Commit a9d513c

Browse files
[sdf] fix array-bounds warning on GCC 13 for 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 analyzes correctly.
1 parent 15a2bff commit a9d513c

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

pxr/usd/sdf/predicateLibrary.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ class SdfPredicateLibrary
459459
ParamType &param,
460460
bool &boundAllParams,
461461
std::vector<SdfPredicateExpression::FnArg> const &args,
462-
std::vector<bool> &boundArgs,
462+
std::vector<uint8_t> &boundArgs,
463463
NamesAndDefaults const &namesAndDefaults) {
464464

465465
// Bind the index-th 'param' from 'args' &
@@ -550,7 +550,7 @@ class SdfPredicateLibrary
550550
std::vector<SdfPredicateExpression::FnArg> const &args,
551551
NamesAndDefaults const &namesAndDefaults,
552552
std::index_sequence<I...>,
553-
std::vector<bool> &boundArgs) {
553+
std::vector<uint8_t> &boundArgs) {
554554

555555
// A fold expression would let us just do &&, but that's '17, so we just
556556
// do all of them and set a bool.
@@ -572,7 +572,7 @@ class SdfPredicateLibrary
572572
static void
573573
_FillArbitraryArgs(std::true_type,
574574
std::vector<SdfPredicateExpression::FnArg> const &args,
575-
std::vector<bool> const &boundArgs,
575+
std::vector<uint8_t> const &boundArgs,
576576
Tuple &typedArgs) {
577577
std::vector<SdfPredicateExpression::FnArg> &rest =
578578
std::get<std::tuple_size<Tuple>::value-1>(typedArgs);
@@ -591,7 +591,7 @@ class SdfPredicateLibrary
591591
static void
592592
_FillArbitraryArgs(std::false_type,
593593
std::vector<SdfPredicateExpression::FnArg> const &,
594-
std::vector<bool> const &,
594+
std::vector<uint8_t> const &,
595595
T const &) {
596596
// Do nothing.
597597
}
@@ -657,7 +657,7 @@ class SdfPredicateLibrary
657657
}
658658

659659
ParamsTuple typedArgs;
660-
std::vector<bool> boundArgs;
660+
std::vector<uint8_t> boundArgs;
661661
if (_TryBindArgs(typedArgs, args, namesAndDefaults,
662662
std::make_index_sequence<NumBindableArgs> {},
663663
boundArgs)) {

0 commit comments

Comments
 (0)