IP Library › Granted Patent US 12,547,525
Granted Patent B2
US 12,547,525 · App. 18/346,180 · Granted Feb 10, 2026

Validation of code translation using intermediate representation

Inventors: Rangeet Pan (White Plains, NY); Saurabh Sinha (Danbury, CT); Rahul Krishna Prasad (White Plains, NY); Julian Timothy Dolby (Bronx, NY); Venkata Nagaraju Pavuluri (New Rochelle, NY); Maja Vukovic (New York, NY)
Assignee: International Business Machines Corporation
G06F11/3608
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12,547,525
App. No.
18/346,180
Granted
Feb 10, 2026
Kind
B2
Abstract

In some implementations, a code translation validation platform may convert source code, associated with a source application, to an intermediate representation that supports a source programing language and a target programing language. The code translation validation platform may identify metamorphic relations in the intermediate representation based on program constructs and program interactions. The code translation validation platform may generate test cases based on the identified metamorphic relations. The code translation validation platform may perform symbolic execution of the intermediate representation to generated test cases. The code translation validation platform may apply the generated test cases to the source programming language and to the target programming language.

Claims (68)

1 . A computer-implemented method comprising:

converting source code, associated with a source application, to an intermediate representation that supports a source programing language and a target programing language;

identifying metamorphic relations in the intermediate representation based on program constructs and program interactions;

generating first test cases based on the identified metamorphic relations,

wherein the first test cases are converted to second test cases for the source programming language, and

wherein the first test cases are converted to third test cases for the target programming language; and

applying the second test cases to the source programming language and the third test cases to the target programming language.

2 . The computer-implemented method of claim 1 , wherein the source code is a first source code written in the source programming language,

wherein a second source code is a translation of the first source code into the target programming language, and

wherein applying the second test cases to the source programming language and the third test cases to the target programming language comprises:

applying the second test cases to the first source code and the third test cases to the second source code to validate the translation of the first source code.

3 . The computer-implemented method of claim 2 , wherein applying the second test cases to the source programming language and the third test cases to the target programming language comprises:

applying the second test cases to the first source code and the third test cases to the second source code to determine whether the second source code is syntactically and semantically equivalent to the first source code.

4 . The computer-implemented method of claim 2 , wherein applying the second test cases to the source programming language and the third test cases to the target programming language comprises:

detecting a failure resulting from applying the third test cases to the second source code; and

determining that the translation of the first source code is not valid.

5 . The computer-implemented method of claim 1 , wherein generating the first test cases comprises:

generating metamorphic test cases of metamorphic testing,

wherein the metamorphic test cases are applied to the source programming language and to the target programming language.

6 . The computer-implemented method of claim 1 , wherein identifying the metamorphic relations comprises:

identifying metamorphic relations based input and output operations associated with the source code.

7 . The computer-implemented method of claim 1 , wherein the program constructs include syntaxes of the source programming language, and

wherein the program interactions include semantics of the source programming language.

8 . A computer program product comprising:

one or more computer readable storage medium, and program instructions collectively stored on the one or more computer readable storage medium, the program instructions comprising:

program instructions to convert a first source code, of a source programing language, to an intermediate representation that supports the source programing language and a target programing language;

program instructions to perform an action using the intermediate representation;

program instructions to generate first test cases based on a result of performing the action,

wherein the first test cases are converted to second test cases for the source programming language, and

wherein the first test cases are converted to third test cases for the target programming language;

program instructions to apply the second test cases to the first source code and the third test cases to a second source code of the target programming language; and

program instructions to determine, based on applying the second test cases to the first source code and the third test cases to the second source code, whether the second source code is a valid translation of the first source code.

9 . The computer program product of claim 8 , wherein the program instructions to perform the action comprise:

program instructions to identify metamorphic relations in the intermediate representation based on program constructs of the source programing language and program interactions of the source programing language.

10 . The computer program product of claim 9 , wherein the program instructions to generate the first test cases comprise:

program instructions to generate test cases based on the identified metamorphic relations.

11 . The computer program product of claim 8 , wherein the program instructions to perform the action comprise:

program instructions to perform symbolic execution on the intermediate representation.

12 . The computer program product of claim 11 , wherein the program instructions to generate the first test cases comprise:

program instructions to generate test cases for the intermediate representation based on performing the symbolic execution on the intermediate representation.

13 . The computer program product of claim 11 ,

wherein the program instructions further comprise:

program instructions to convert the first test cases to the second test cases for the source programming language; and

program instructions to convert the first test cases to the third test cases for the target programming language.

14 . The computer program product of claim 13 , wherein the program instructions to determine whether the second source code is a valid translation of the first source code comprise:

program instructions to compare first outputs of applying the second test cases and second outputs of applying the third test cases; and

program instructions to determine whether the second source code is a valid translation of the first source code based on comparing the first outputs and the second outputs.

15 . A system comprising:

one or more devices configured to:

convert a first source code, of a source programing language, to an intermediate representation that supports the source programing language and a target programing language;

generate first test cases based on the intermediate representation;

convert the first test cases to second test cases for the source programming language;

convert the first test cases to third test cases for the target programming language;

apply the second test cases to the first source code and the third test cases to a second source code of the target programming language; and

determine, based on applying the second test cases to the first source code and the third test cases to the second source code, whether the second source code is a valid translation of the first source code.

16 . The system of claim 15 , wherein, to generate the first test cases, the one or more devices are configured to:

generate the first test cases based on symbolic execution of the intermediate representation.

17 . The system of claim 16 , wherein, to generate the first test cases based on the symbolic execution, the one or more devices are configured to:

generate the first test cases based on constraint solvers.

18 . The system of claim 15 , wherein, to generate the first test cases, the one or more devices are configured to:

identify metamorphic relations in the intermediate representation based on program constructs of the source programing language and program interactions of the source programing language; and

generate the first test cases based on the identified metamorphic relations.

19 . The system of claim 18 , wherein, to determine whether the second source code is a valid translation of the first source code, the one or more devices are configured to:

compare first outputs of applying the second test cases and second outputs of applying the third test cases; and

determine whether the second source code is a valid translation of the first source code based on comparing the first outputs and the second outputs.

20 . The system of claim 15 , wherein, to determine whether the second source code is a valid translation of the first source code, the one or more devices are configured to:

detect a failure resulting from applying the third test cases; and

determine that the second source code is not a valid translation of the first source code.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jun 30, 2023
From: PAN, RANGEET; SINHA, SAURABH; KRISHNA PRASAD, RAHUL; DOLBY, JULIAN TIMOTHY; PAVULURI, VENKATA NAGARAJU; VUKOVIC, MAJA
To: INTERNATIONAL BUSINESS MACHINES CORPORATION
Reel/Frame 064134/0763 →
Continuity (1)
Related Publication 20250004909A1 · Jan 2, 2025
References Cited (51)
US 6425118B1 · Molloy · 2002 [cited by applicant]
US 8230402B2 · Chen · 2012 [cited by applicant]
US 8533691B2 · Ben-Artzi · 2013 [cited by examiner]
US 8843908B2 · Hawblitzel · 2014 [cited by examiner]
US 9229696B2 · Box · 2016 [cited by examiner]
US 9542559B2 · Brumley · 2017 [cited by examiner]
US 9665350B1 · Kalmar · 2017 [cited by examiner]
US 9804946B2 · Conlon · 2017 [cited by applicant]
US 9858057B2 · Venkatasubramanian · 2018 [cited by applicant]
US 10102107B2 · Darbha · 2018 [cited by applicant]
US 10127143B2 · Hamilton · 2018 [cited by examiner]
US 10459829B2 · Sarangapani · 2019 [cited by examiner]
US 11042631B2 · Ghosh · 2021 [cited by examiner]
US 11288173B1 · Wang · 2022 [cited by examiner]
US 11449410B2 · Hong · 2022 [cited by applicant]
US 11816450B2 · Katakam · 2023 [cited by examiner]
US 20030182653A1 · Desoli · 2003 [cited by applicant]
US 20150007148A1 · Bartley · 2015 [cited by examiner]
US 20160117239A1 · Hamilton · 2016 [cited by examiner]
US 20170132119A1 · Xu · 2017 [cited by examiner]
US 20180357145A1 · Sarangapani · 2018 [cited by examiner]
US 20190102281A1 · DeMarco · 2019 [cited by examiner]
US 20200097389A1 · Smith · 2020 [cited by examiner]
US 20210318951A1 · Gombosh · 2021 [cited by applicant]
US 20220091967A1 · Wang · 2022 [cited by examiner]
US 20220261337A1 · Arbel · 2022 [cited by applicant]
US 20220374344A1 · Brown · 2022 [cited by examiner]
US 20230168985A1 · Jardini · 2023 [cited by examiner]
US 20230297491A1 · Sariel · 2023 [cited by examiner]
US 20230393964A1 · Li · 2023 [cited by examiner]
US 20250004909A1 · Pan · 2025 [cited by examiner]
CN 109634869A · 2019 [cited by examiner]
CN 112286784A · 2021 [cited by examiner]
CN 113377644A · 2021 [cited by applicant]
CN 112445492B · 2024 [cited by examiner]
EP 2919132A1 · 2015 [cited by examiner]
WO WO2024178567A1 · 2024 [cited by examiner]
CN-112286784-A—English translation. [cited by examiner]
CN-109634869-A—English Translation. [cited by examiner]
WO-2024178567-A1—English Tranlation. [cited by examiner]
Chen, Tsong Y., Shing C. Cheung, and Shiu Ming Yiu. “Metamorphic testing: a new approach for generating next test cases.” arXiv preprint arXiv:2002.12543 (2020). [cited by examiner]
Parthasarathy, Gaurav, et al. “Towards trustworthy automated program verifiers: Formally validating translations into an intermediate verification language.” Proceedings of the ACM on Programming Languages 8.PLDI (2024)… [cited by examiner]
Cadar et al., “Klee: Unassisted and Automatic Generation of High-Coverage Tests for Complex Systems Programs.” In OSDI, vol. 8, pp. 209-224. 2008. [cited by applicant]
Chen et al., “Codet: Code Generation with Generated Tests.” arXiv preprint arXiv:2207.10397, Nov. 2022, pp. 1-19. [cited by applicant]
Dolby et al., “Finding Bugs Efficiently with a SAT Solver.” In Proceedings of the the 6th joint meeting of the European software engineering conference and the CM SIGSOFT symposium on The foundations of software enginee… [cited by applicant]
Kapus et al., “Automatic Testing of Symbolic Execution Engines via Program Generation and Differential Testing,” ASE 2017, 32nd IEEE/ACM International Conference on Automated Software Engineering (ASE), pp. 590-600. IEE… [cited by applicant]
Kulal et al., “Spoc: Search-based Pseudocode to Code.” Advances in Neural Information Processing Systems 32, arXiv:1906.04908v1, 11 pages. 2019. [cited by applicant]
Le et al., “Compiler Validation via Equivalence Modulo Inputs.” In Proceedings of the 35th Acm Sigplan Conference on Programming Language Design and Implementation, pp. 216-226, 2014. [cited by applicant]
Lidbury et al., “Many-Core Compiler Fuzzing.” In Proceedings of the 36th ACM SIGPLAN Conference on Programming Language Design and Implementation, 12 pages, 2015. [cited by applicant]
Roziere et al., “Leveraging Automated Unit Tests for Unsupervised Code Translation,” Conference Paper, International Conference on Learning Representations, 20 pages, 2022. [cited by applicant]
Torlak et al., “MemSAT: Checking Axiomatic Specifications of Memory Models.” ACM SIGPLAN Notices 45, No. 6, Jun. 2010, pp. 341-350. [cited by applicant]