gcc -O2 warns on master:
src/htsselftest.c:1559:12: warning: 'result' may be used uninitialized [-Wmaybe-uninitialized]
In the coucal bench loop, int result is assigned inside an if/else if chain over the six bench[].type values and then read by if (!result). Every enumerator is covered and the table only holds those six, so the read is unreachable today, but nothing in the code says so and gcc cannot prove it: adding a seventh enumerator would silently read a garbage stack slot and either pass a failed check or abort a good run.
int result = 0; at the declaration fixes it, and fails closed — an unhandled type reports failure rather than whatever was on the stack.
Confirmed pre-existing by compiling master's htsselftest.c against master's headers; the line dates to #427. Noticed while building #718, which shifts it to line 1563 but does not touch that function.
gcc -O2warns on master:In the coucal bench loop,
int resultis assigned inside anif/else ifchain over the sixbench[].typevalues and then read byif (!result). Every enumerator is covered and the table only holds those six, so the read is unreachable today, but nothing in the code says so and gcc cannot prove it: adding a seventh enumerator would silently read a garbage stack slot and either pass a failed check or abort a good run.int result = 0;at the declaration fixes it, and fails closed — an unhandled type reports failure rather than whatever was on the stack.Confirmed pre-existing by compiling master's
htsselftest.cagainst master's headers; the line dates to #427. Noticed while building #718, which shifts it to line 1563 but does not touch that function.