Skip to content

fix(DuplicateGlobals): skip unnamed globals and guard against the type mismatch.#23

Open
osmandagli wants to merge 17 commits into
HEAPLab:dev-reddifrom
osmandagli:dev-reddi
Open

fix(DuplicateGlobals): skip unnamed globals and guard against the type mismatch.#23
osmandagli wants to merge 17 commits into
HEAPLab:dev-reddifrom
osmandagli:dev-reddi

Conversation

@osmandagli
Copy link
Copy Markdown

PR Title

Fix the duplicated global variable names and type mismatch.

PR Description

The original loop in the DuplicateGlobals.cpp file does not control the variable names, and this causes all the unnamed (compiler-generated) variables (e.g., '@3 = internal global i64 0', '@4 = internal global i8 0') to become '@_dup'. This causes a type mismatch error, since the second variable will try to initialize, but the variable type is different than the first one.

Solution

  1. Check the variable names at the start of the loop.
if (GV->getName().empty()) {
    continue;
}
  1. Check the variable type before initializing
if (Initializer->getType() == GVCopy->getValueType()) {
    GVCopy->setInitializer(Initializer);
}

Summary

Added the necessary checks for all the empty named variables and type mismatches to prevent type mismatch errors.

EmilioCorigliano and others added 17 commits April 19, 2026 21:41
Some other features shall be implemented and fixes done for these tests to pass
- Now the entrypoint of the program (usually the "main" function) is duplicated in-place when using EDDI, so that the program directly enters the Sphere of Replication
- Avoided the search for debug locations when debug is not enabled
… different consistency check

- Now in EDDI we can generate an ErrBB block for each consistency check which, after the call to "DataCorruption_Handler()", jumps to the normal continuation basic block
- CFCSS has been fixed to support multiple ErrBB
Added basic case and more checks to avoid null dereferences
Now indirect function calls are hardened by calling the duplicate version of the function, passing both the original and the duplicate operands. Also, a consistency check on the pointer of the function to be called is added too (in addition to the classic consistency checks of the operands).
@EmilioCorigliano EmilioCorigliano force-pushed the dev-reddi branch 2 times, most recently from 8532b5a to a1987cb Compare April 28, 2026 10:22
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.

1 participant