Skip to content

[WIP] simulation code generation fixes

Marvin Häuser requested to merge poc_sim_fixes into master

Running DSE on "SmartCardProtocol" currently crashes all simulation binaries on AARCH64 macOS with Xcode Clang. I identified multiple culprits, such as undefined behaviour when traversing a variadic argument list, or dereferencing a NULL pointer. To further harden the code against such bugs, I propose enabling the typical "extra" warnings, as well as making most warnings fatal. This already uncovered further issues, such as uninitialized return values. Please refer for the individual commits for details.

This remains a WIP draft for three reasons:

  • There are open questions for commits marked as [WIP]:
    • 6f1d3dd6: This is supposed to be NULL in real-world runs?
    • 9f51e068: The types for these are unsigned, so the condition is always true. Is it realistic for the subtraction done at initialization to underflow and must this be detected instead? Should the code maybe use overflow-safe arithmetics?
    • f62c886c: I took best guesses here at what is intended to fall through and what might be a bug, but I have no definite answers.
  • I tested the changes only with "SmartCardProtocol", other code generation samples may emit errors.
  • Project-specific code used by end-user projects may start emitting errors as well. Maybe this should be suppressible via an environment variable or some custom Makefile with a property? I am not sure which route to take.
Edited by Marvin Häuser

Merge request reports