Type Inference for C

Author:

Melo Leandro T. C.1,Ribeiro Rodrigo G.2,Guimarães Breno C. F.1,Pereira Fernando Magno Quintão1

Affiliation:

1. UFMG, Brazil

2. UFOP, Brazil

Abstract

Type inference is a feature that is common to a variety of programming languages. While, in the past, it has been prominently present in functional ones (e.g., ML and Haskell), today, many object-oriented/multi-paradigm languages such as C# and C++ offer, to a certain extent, such a feature. Nevertheless, type inference still is an unexplored subject in the realm of C. In particular, it remains open whether it is possible to devise a technique that encompasses the idiosyncrasies of this language. The first difficulty encountered when tackling this problem is that parsing C requires, not only syntactic, but also semantic information. Yet, greater challenges emerge due to C’s intricate type system. In this work, we present a unification-based framework that lets us infer the missing struct, union, enum, and typedef declarations in a program. As an application of our technique, we investigate the reconstruction of partial programs. Incomplete source code naturally appears in software development: during design and while evolving, testing, and analyzing programs; therefore, understanding it is a valuable asset. With a reconstructed well-typed program, one can: (i) enable static analysis tools in scenarios where components are absent; (ii) improve precision of “zero setup” static analysis tools; (iii) apply stub generators, symbolic executors, and testing tools on code snippets; and (iv) provide engineers with an assortment of compilable benchmarks for performance and correctness validation. We evaluate our technique on code from a variety of C libraries, including GNU’s Coreutils and on snippets from popular projects such as CPython, FreeBSD, and Git.

Funder

CNPq, CAPES, and FAPEMIG

Publisher

Association for Computing Machinery (ACM)

Subject

Software

Reference102 articles.

1. ANSI-Standard. 1989. ANSI X3.159-1989—The C Programming Language. American National Standards Institute (ANSI) Washington D.C. USA. ANSI-Standard. 1989. ANSI X3.159-1989—The C Programming Language. American National Standards Institute (ANSI) Washington D.C. USA.

2. COBAYN

3. Liveness-Driven Random Program Generation

4. Overhauling SC atomics in C11 and OpenCL

Cited by 5 articles. 订阅此论文施引文献 订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献

1. FQN Inference in Partial Code by Prompt-tuned Language Model of Code;ACM Transactions on Software Engineering and Methodology;2023-12-21

2. Program representations for predictive compilation: State of affairs in the early 20’s;Journal of Computer Languages;2022-12

3. Prompt-tuned Code Language Model as a Neural Knowledge Base for Type Inference in Statically-Typed Partial Code;Proceedings of the 37th IEEE/ACM International Conference on Automated Software Engineering;2022-10-10

4. BenchPress;Proceedings of the International Conference on Parallel Architectures and Compilation Techniques;2022-10-08

5. Type Inference for C;ACM Transactions on Programming Languages and Systems;2020-12

同舟云学术

1.学者识别学者识别

2.学术分析学术分析

3.人才评估人才评估

"同舟云学术"是以全球学者为主线,采集、加工和组织学术论文而形成的新型学术文献查询和分析系统,可以对全球学者进行文献检索和人才价值评估。用户可以通过关注某些学科领域的顶尖人物而持续追踪该领域的学科进展和研究前沿。经过近期的数据扩容,当前同舟云学术共收录了国内外主流学术期刊6万余种,收集的期刊论文及会议论文总量共计约1.5亿篇,并以每天添加12000余篇中外论文的速度递增。我们也可以为用户提供个性化、定制化的学者数据。欢迎来电咨询!咨询电话:010-8811{复制后删除}0370

www.globalauthorid.com

TOP

Copyright © 2019-2024 北京同舟云网络信息技术有限公司
京公网安备11010802033243号  京ICP备18003416号-3