Variability-Aware Detection and Repair of Compilation Errors Using Foundation Models in Configurable Systems
Rohit Gheyi, Lucas Albuquerque, Márcio Ribeiro, Eduardo Almeida, Danyllo Albuquerque, Mirko Perkusich
TL;DR
This work investigates whether foundation models can detect and repair variability-induced compilation errors in configurable C systems. By constructing a 5,000-instance synthetic dataset and evaluating open-weight GPT-OSS-20B and Gemini 3 Pro against TypeChef, the study shows that foundation models achieve high precision and substantial repair success, often outperforming traditional variability-aware tools in detection. Real-world evaluation via Git commits and mutation testing further demonstrates practical utility, despite limitations in context size and output stability for some models. The findings advocate a complementary workflow that leverages foundation models for explanations and fixes alongside traditional analyses, highlighting promising directions for AI-assisted variability-aware development while acknowledging current scalability and reliability constraints.
Abstract
Modern software systems often rely on conditional compilation to support optional features and multiple deployment scenarios. In configurable systems, compilation errors may arise only under specific combinations of features, remaining hidden during development and testing. Such variability-induced errors are difficult to detect in practice, as traditional compilers analyze only a single configuration at a time, while existing variability-aware tools typically require complex setup and incur high analysis costs. In this article, we present an empirical study on the use of foundation models to detect and fix compilation errors caused by feature variability in configurable C systems. We evaluate GPT-OSS-20B and GEMINI 3 PRO, and compare them with TYPECHEF, a state-of-the-art variability-aware parser. Our evaluation considers two complementary settings: 5,000 small configurable systems designed to systematically exercise variability-induced compilation behavior, comprising both systems with and without compilation errors, and 14 real-world GitHub commits, as well as an additional set of mutation testing scenarios (42). Our results show that foundation models can effectively identify variability-induced compilation errors. On small configurable systems, GPT-OSS-20B achieved a precision of 0.97, recall of 0.90, and accuracy of 0.94, substantially increasing detection coverage compared to TYPECHEF, and exhibiting performance comparable to GEMINI 3. For compilation error repair, GPT-OSS-20B produced compilable fixes in over 70% of the cases. In the analysis of real commits, CHATGPT-5.2 detected all injected faults except for two cases and identified a potential real compilation bug in a Linux commit with more than 1,000 modified lines. Our findings indicate that current state-of-the-art foundation models provide a practical and low-effort complement to traditional variability-aware analyses.
