Skip to content

Fix ccall type-punning and mcall division by zero#2530

Merged
pd3 merged 1 commit intosamtools:developfrom
sirus20x6:fix/ccall-mcall-bugs
Mar 31, 2026
Merged

Fix ccall type-punning and mcall division by zero#2530
pd3 merged 1 commit intosamtools:developfrom
sirus20x6:fix/ccall-mcall-bugs

Conversation

@sirus20x6
Copy link
Copy Markdown
Contributor

Summary

  • Fix tmpi declaration from float to int32_t in ccall.c — was passed to bcf_update_info_int32 which interpreted float bit pattern as garbage integer for CLR tag
  • Add zero-denominator guard in mcall.c before dividing by sum of DP4 counts — produces mq = 0 when depth is zero, matching the pattern in test16_core

Test plan

  • Existing test suite passes (1920/1920)
  • Verify CLR INFO tag contains correct integer values after consensus calling

ccall.c: Change `tmpi` from float to int32_t so that
bcf_update_info_int32() receives actual integer bits instead of
reinterpreting float bits as an int32.

mcall.c: Guard the MQ calculation against division by zero when all
DP4 counts are zero, consistent with the existing check in
test16_core().
@sirus20x6 sirus20x6 force-pushed the fix/ccall-mcall-bugs branch from 1127269 to ae662c5 Compare March 26, 2026 00:54
@pd3 pd3 closed this Mar 31, 2026
@pd3 pd3 reopened this Mar 31, 2026
@pd3 pd3 merged commit 944cebd into samtools:develop Mar 31, 2026
0 of 7 checks passed
@pd3
Copy link
Copy Markdown
Member

pd3 commented Mar 31, 2026

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants