Fix #175: declare int (not i1) runtime params to match C ABI#187
Open
Emad-Mahmodi wants to merge 1 commit into
Open
Fix #175: declare int (not i1) runtime params to match C ABI#187Emad-Mahmodi wants to merge 1 commit into
Emad-Mahmodi wants to merge 1 commit into
Conversation
Several runtime functions whose C signature takes an int were declared to the compiler with a 1-bit integer (int1T) -- the same i1-vs-int mismatch as eurecom-s3#83. Affected: _sym_build_float (is_double), _sym_build_int_to_float (is_double, is_signed), _sym_build_float_to_float and _sym_build_bits_to_float (to_double). Declare these parameters as i32 and pass the flags as i32 at the call sites. The remaining i1 parameters correspond to C bool arguments, whose width already matches (clang lowers bool to i1) and where the callee observes only one bit, so they are unaffected. _sym_push_path_constraint is addressed separately in eurecom-s3#186. Behavior-preserving (identical diverging inputs on a float-heavy test).
883f6bc to
243430f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #175 (follow-up to #83).
Audited every
int1Tparameter incompiler/Runtime.cppagainst the C signatures inruntime/include/RuntimeCommon.h. The functions whose C parameter isintwere declared withi1, the same mismatch as #83 — the callee reads 32 bits while the compiler passes one, so the high bits can be dirty:_sym_build_float(int is_double)_sym_build_int_to_float(int is_double, int is_signed)_sym_build_float_to_float(int to_double)_sym_build_bits_to_float(int to_double)This declares those parameters as
i32and passes the flags asi32at the call sites.The remaining
i1parameters correspond to Cboolarguments (_sym_build_bool, the overflow helpers,_sym_read_memory/_sym_write_memory,_sym_build_insert/_sym_build_extract). Forbool, clang already lowers toi1, the width matches, and the callee observes only one bit, so these are not affected by the #83 mechanism and are left unchanged._sym_push_path_constraintis handled in #186.Verified behavior-preserving: a float-heavy program (float/double compares, int→float, float→float, bitcast) produces identical diverging inputs before and after, and instruments without verifier errors.