ASE 2024
Sun 27 October - Fri 1 November 2024 Sacramento, California, United States
Tue 29 Oct 2024 15:30 - 15:45 at Compagno - Program and Code translation Chair(s): Haiyan Zhao

Automatic C-to-Rust translation is a promising way to enhance the reliability of legacy system software. However, C2Rust, an industrially developed translator, generates Rust code with unsafe features, undermining the translation’s objective. While researchers have proposed techniques to remove unsafe features in C2Rust-generated code, these efforts have targeted only a limited subset of unsafe features. One important unsafe feature remaining unaddressed is a \emph{union}, a type consisting of multiple fields sharing the same memory storage. Programmers often place a union with a \emph{tag} in a struct to record the last-written field, but they can still access wrong fields. In contrast, Rust’s \emph{tagged unions} combine tags and unions at the language level, ensuring correct value access. In this work, we propose techniques to replace unions with tagged unions during C-to-Rust translation. We develop a static analysis that facilitates such replacement by identifying tag fields and the corresponding tag values. The analysis involves a must-points-to analysis computing struct field values and a heuristic interpreting these results. To enhance scalability, we adopt intraprocedural function-wise analysis, allowing selective analysis of functions. Our evaluation on 35 real-world C programs shows that the proposed approach is (1) precise, identifying 74 tag fields with no false positives and only five false negatives, (2) mostly correct, with 17 out of 23 programs passing tests post-transformation, and (3) scalable, capable of analyzing and transforming 192k LOC in 4,910 seconds.

Tue 29 Oct

Displayed time zone: Pacific Time (US & Canada) change

15:30 - 16:30
Program and Code translationResearch Papers / Tool Demonstrations at Compagno
Chair(s): Haiyan Zhao Peking University
15:30
15m
Talk
To Tag, or Not to Tag: Translating C’s Unions to Rust’s Tagged Unions
Research Papers
DOI
15:45
15m
Talk
Semi-Supervised Code Translation Overcoming the Scarcity of Parallel Code Data
Research Papers
Ming Zhu Virginia Tech, Mohimenul Karim Virginia Tech, Ismini Lourentzou Virginia Tech, Daphne Yao Virginia Tech
16:00
15m
Talk
A Joint Learning Model with Variational Interaction for Multilingual Program Translation
Research Papers
Yali Du Nanjing University, Hui Sun Nanjing University, National Key Laboratory for Novel Software Technology, China; Nanjing University, School of Artificial Intelligence, China, Ming Li Nanjing University
16:15
10m
Talk
Automated Validation of COBOL to Java Transformation
Tool Demonstrations
Atul Kumar IBM Research India, Diptikalyan Saha IBM Research India, Toshiaki Yasue IBM Research - Tokyo, Kohichi Ono IBM Research - Tokyo, Saravanan Krishnan IBM India Research Lab, Sandeep Hans IBM India Research Lab, Fumiko Satoh IBM Research - Tokyo, Gerald Mitchell IBM Software, Sachin Kumar IBM Software