Skip to content

Fix msan false positive swl swr uninit read#2033

Draft
EngineersBox wants to merge 70 commits into
grumpycoders:mainfrom
EngineersBox:fix-msan-false-positive-swl-swr-uninit-read
Draft

Fix msan false positive swl swr uninit read#2033
EngineersBox wants to merge 70 commits into
grumpycoders:mainfrom
EngineersBox:fix-msan-false-positive-swl-swr-uninit-read

Fixed BAD_COMBINATION with shl/shr instructions not using CL register…

21957d4
Select commit
Loading
Failed to load commit list.
CodeScene Delta Analysis / CodeScene Code Health Review (main) failed Jun 30, 2026 in 1m 20s

CodeScene PR Check

Quality Gate Failed

Gates Failed
Prevent hotspot decline (2 hotspots with Large Method)
New code is healthy (1 new file with code health below 9.00)
Enforce critical code health rules (1 file with Bumpy Road Ahead)
Enforce advisory code health rules (5 files with Large Method, Code Duplication, Complex Method, Complex Conditional, Overall Code Complexity)

See analysis details in CodeScene

Reason for failure
Prevent hotspot decline Violations Code Health Impact
instructions.cc 1 rule in this hotspot 4.71 → 4.23 Suppress
instructions.cc 1 rule in this hotspot 3.59 → 3.48 Suppress
New code is healthy Violations Code Health Impact
msan.cc 4 rules 8.56 Suppress
Enforce critical code health rules Violations Code Health Impact
msan.cc 1 critical rule 8.56 Suppress
Enforce advisory code health rules Violations Code Health Impact
msan.cc 3 advisory rules 8.56 Suppress
instructions.cc 1 advisory rule 4.71 → 4.23 Suppress
psxinterpreter.cc 1 advisory rule 7.11 → 6.90 Suppress
instructions.cc 1 advisory rule 3.59 → 3.48 Suppress
gpu.cc 1 advisory rule 4.92 → 4.90 Suppress

Quality Gate Profile: Clean Code Collective
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.

Details

🚩 Declining Code Health (highest to lowest):

  • Code Duplication psxinterpreter.cc
  • Overall Code Complexity msan.cc
  • Large Method instructions.cc: DynaRecCPU::recLWL 🔥
  • Large Method instructions.cc: DynaRecCPU::recLWR 🔥
  • Large Method instructions.cc: DynaRecCPU::recSWL 🔥
  • Large Method instructions.cc: DynaRecCPU::recSWR 🔥
  • Large Method instructions.cc: DynaRecCPU::recSWL 🔥
  • Large Method instructions.cc: DynaRecCPU::recSWR 🔥
  • Complex Method gpu.cc: PCSX::GPU::chainedDMAWrite
  • Complex Method gpu.cc: PCSX::GPU::gpuDmaChainSize
  • Complex Conditional msan.cc: execInvalidTest
  • Complex Method msan.cc: execInvalidTest
  • Complex Method msan.cc: execValidTest
  • Bumpy Road Ahead msan.cc: execInvalidTest

✅ Improving Code Health:

  • Overall Code Complexity main.cc

Annotations

Check warning on line 1470 in src/core/DynaRec_aa64/instructions.cc

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (main)

❌ New issue: Large Method

DynaRecCPU::recSWL has 77 lines, threshold = 70

Large functions with many lines of code are generally harder to understand and lower the code health.
Avoid adding more lines to this function.

Check warning on line 1567 in src/core/DynaRec_aa64/instructions.cc

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (main)

❌ New issue: Large Method

DynaRecCPU::recSWR has 77 lines, threshold = 70

Large functions with many lines of code are generally harder to understand and lower the code health.
Avoid adding more lines to this function.

Check warning on line 901 in src/core/DynaRec_x64/instructions.cc

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (main)

❌ Getting worse: Large Method

DynaRecCPU::recLWL increases from 74 to 100 lines of code, threshold = 70

Large functions with many lines of code are generally harder to understand and lower the code health.
Avoid adding more lines to this function.

Check warning on line 1016 in src/core/DynaRec_x64/instructions.cc

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (main)

❌ Getting worse: Large Method

DynaRecCPU::recLWR increases from 74 to 97 lines of code, threshold = 70

Large functions with many lines of code are generally harder to understand and lower the code health.
Avoid adding more lines to this function.

Check warning on line 1301 in src/core/DynaRec_x64/instructions.cc

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (main)

❌ Getting worse: Large Method

DynaRecCPU::recSWL increases from 82 to 92 lines of code, threshold = 70

Large functions with many lines of code are generally harder to understand and lower the code health.
Avoid adding more lines to this function.

Check warning on line 1421 in src/core/DynaRec_x64/instructions.cc

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (main)

❌ Getting worse: Large Method

DynaRecCPU::recSWR increases from 82 to 92 lines of code, threshold = 70

Large functions with many lines of code are generally harder to understand and lower the code health.
Avoid adding more lines to this function.

Check warning on line 967 in src/core/psxinterpreter.cc

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (main)

❌ Getting worse: Code Duplication

introduced similar code in: InterpretedCPU::psxLWL,InterpretedCPU::psxLWR

Avoid duplicated, aka copy-pasted, code inside the module. More duplication lowers the code health.

Check warning on line 608 in src/core/gpu.cc

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (main)

❌ Getting worse: Complex Method

PCSX::GPU::chainedDMAWrite increases in cyclomatic complexity from 13 to 14, threshold = 9

This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid
adding more conditionals and code to it without refactoring.

Check warning on line 334 in src/core/gpu.cc

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (main)

❌ Getting worse: Complex Method

PCSX::GPU::gpuDmaChainSize increases in cyclomatic complexity from 12 to 13, threshold = 9

This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid
adding more conditionals and code to it without refactoring.

Check warning on line 262 in tests/pcsxrunner/msan.cc

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (main)

❌ New issue: Complex Method

execInvalidTest has a cyclomatic complexity of 15, threshold = 9

This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid
adding more conditionals and code to it without refactoring.

Check warning on line 93 in tests/pcsxrunner/msan.cc

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (main)

❌ New issue: Complex Method

execValidTest has a cyclomatic complexity of 12, threshold = 9

This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid
adding more conditionals and code to it without refactoring.

Check warning on line 222 in tests/pcsxrunner/msan.cc

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (main)

❌ New issue: Complex Conditional

execInvalidTest has 1 complex conditionals with 2 branches, threshold = 2

A complex conditional is an expression inside a branch (e.g. if, for, while) which consists of multiple,
logical operators such as AND/OR. The more logical operators in an expression, the more severe the code
smell.

Check warning on line 262 in tests/pcsxrunner/msan.cc

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (main)

❌ New issue: Bumpy Road Ahead

execInvalidTest has 2 blocks with nested conditional logic. Any nesting of 2 or deeper is considered.
Threshold is 2 blocks per function

The Bumpy Road code smell is a function that contains multiple chunks of nested conditional logic. The
deeper the nesting and the more bumps, the lower the code health.

Check warning on line 1 in tests/pcsxrunner/msan.cc

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (main)

❌ New issue: Overall Code Complexity

This module has a mean cyclomatic complexity of 4.10 across 10 functions. The mean complexity threshold
is 4

This file has many conditional statements (e.g. if, for, while) across its implementation, leading to
lower code health. Avoid adding more conditionals.

Check notice on line 1 in src/main/main.cc

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (main)

✅ Getting better: Overall Code Complexity

The mean cyclomatic complexity decreases from 7.56 to 7.10, threshold = 4

This file has many conditional statements (e.g. if, for, while) across its implementation, leading to
lower code health. Avoid adding more conditionals.