Commit c995a1c
fix: Handle multiple stores to same address for pointer-based access (#16)
Previously, findStoredValue only returned the first Store instruction
found for a given address. This caused false negatives when multiple
stores existed in different control flow paths (e.g., if/else branches).
Changes:
- Renamed findStoredValue to findAllStoredValues to return all stores
- Added traceAllStoredValues to check ALL stored values have context
(similar to Phi node semantics - all paths must have ctx)
- Updated traceUnOp and traceAlloc to use the new functions
Example that was previously missed:
e := logger.Info().Ctx(ctx)
ptr := &e
if cond {
*ptr = logger.Warn() // no ctx in this branch!
}
(*ptr).Msg("msg") // Now correctly reports missing ctx
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>1 parent cf6771a commit c995a1c
2 files changed
+66
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
373 | 373 | | |
374 | 374 | | |
375 | 375 | | |
376 | | - | |
377 | | - | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
378 | 379 | | |
379 | 380 | | |
380 | 381 | | |
381 | 382 | | |
382 | 383 | | |
383 | 384 | | |
384 | 385 | | |
385 | | - | |
386 | | - | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
387 | 389 | | |
388 | 390 | | |
389 | 391 | | |
390 | 392 | | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
391 | 406 | | |
392 | 407 | | |
393 | 408 | | |
| |||
476 | 491 | | |
477 | 492 | | |
478 | 493 | | |
479 | | - | |
480 | | - | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
481 | 505 | | |
482 | 506 | | |
483 | 507 | | |
| |||
495 | 519 | | |
496 | 520 | | |
497 | 521 | | |
| 522 | + | |
498 | 523 | | |
499 | 524 | | |
500 | 525 | | |
501 | 526 | | |
502 | 527 | | |
503 | 528 | | |
504 | 529 | | |
505 | | - | |
| 530 | + | |
506 | 531 | | |
507 | 532 | | |
508 | 533 | | |
509 | | - | |
| 534 | + | |
510 | 535 | | |
511 | 536 | | |
512 | 537 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1062 | 1062 | | |
1063 | 1063 | | |
1064 | 1064 | | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
0 commit comments