Skip to content

Implement struct array field analysis#90

Merged
Medowhill merged 1 commit intoYale-PROCTOR:masterfrom
presenthee:struct-array
May 5, 2026
Merged

Implement struct array field analysis#90
Medowhill merged 1 commit intoYale-PROCTOR:masterfrom
presenthee:struct-array

Conversation

@presenthee
Copy link
Copy Markdown
Contributor

Summary

  • Added struct_array_field analysis to analyze the consecutive fields which are used as an array in the source code
    • Select target structs by seeing its type
    • By using andersen analysis, find .offset accesses to target struct fields
    • Rewrite only if the pointee type of the accessed pointer and target field type are the same.
  • Perform struct_array_field rewriting before pointer rewriting

Test

Rewrite the following struct in 7 test cases

#[derive(Copy, Clone)]
#[repr(C)]
pub struct c2Simplex {
    pub a: c2sv,
    pub b: c2sv,
    pub c: c2sv,
    pub d: c2sv,
    pub div: core::ffi::c_float,
    pub count: core::ffi::c_int,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct c2Simplex {
    pub a: [c2sv; 4],
    pub div: f32,
    pub count: i32,
}

Run on test-corpus:
Summary:

  • Test Cases Discovered: 338
  • Test Cases Skipped: 2
  • Test Cases Tested: 331
  • Test Cases Failed: 37

@Medowhill Medowhill merged commit bb85e5f into Yale-PROCTOR:master May 5, 2026
1 check passed
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.

2 participants