Skip to main content
QUICK REVIEW

[Paper Review] Reverse Engineering Code Dependencies: Converting Integer-Based Variability to Propositional Logic

Adam Krafczyk, Sascha El-Sharkawy|arXiv (Cornell University)|Oct 12, 2021
Advanced Software Engineering MethodologiesComputer Science14 references3 citations
TL;DR

This paper presents a method to convert integer-based variability conditions in C-preprocessor code into equivalent propositional logic formulas, enabling existing SAT-based analysis tools to operate on software product lines that use integer-valued configuration variables. By modeling integer variables through Boolean variables per allowed value and constructing propositional formulas for arithmetic and comparison expressions, the approach preserves satisfiability for restricted integer variables and retains useful variability information even for unrestricted ones, as validated in an industrial case study.

ABSTRACT

A number of SAT-based analysis concepts and tools for software product lines exist, that extract code dependencies in propositional logic from the source code assets of the product line. On these extracted conditions, SAT-solvers are used to reason about the variability. However, in practice, a lot of software product lines use integer-based variability. The variability variables hold integer values, and integer operators are used in the conditions. Most existing analysis tools can not handle this kind of variability; they expect pure Boolean conditions. This paper introduces an approach to convert integer-based variability conditions to propositional logic. Running this approach as a preparation on an integer-based product line allows the existing SAT-based analyses to work without any modifications. The pure Boolean formulas, that our approach builds as a replacement for the integer-based conditions, are mostly equivalent to the original conditions with respect to satisfiability. Our approach was motivated by and implemented in the context of a real-world industrial case-study, where such a preparation was necessary to analyze the variability. Our contribution is an approach to convert conditions, that use integer variables, into propositional formulas, to enable easy usage of SAT-solvers on the result. It works well on restricted variables (i.e. variables with a small range of allowed values); unrestricted integer variables are handled less exact, but still retain useful variability information.

Motivation & Objective

  • Many software product lines use integer-based variability (e.g., configuration values with small ranges), but existing SAT-based analysis tools require purely Boolean conditions.
  • Existing tools like Undertaker, TypeChef, and feature-effect analyzers cannot process integer arithmetic or comparisons in #if conditions.
  • The research aims to bridge this gap by enabling SAT-based analyses on integer-based product lines without modifying the tools.
  • The goal is to preserve satisfiability and variability information during the transformation from integer expressions to propositional logic.
  • The approach must handle both restricted (small value ranges) and unrestricted (large or unbounded) integer variables effectively.

Proposed method

  • For each integer variable with a bounded range of allowed values, Boolean variables are introduced to represent whether the variable holds each specific value in its range.
  • The method performs a bottom-up traversal of the abstract syntax tree (AST) to evaluate integer sub-expressions, tracking all valid value combinations.
  • For each comparison or arithmetic operation, a propositional formula is constructed that captures all value combinations satisfying the condition.
  • When both operands are bounded variables, all pairwise value combinations are considered, leading to quadratic growth in combinations.
  • For unrestricted or large-range integer variables, a single Boolean flag is used to indicate whether the variable is defined or not, preserving partial variability information.
  • The transformation is implemented as an open-source plugin for the KernelHaven framework, replacing #if conditions in source files with equivalent propositional logic.

Experimental results

Research questions

  • RQ1Can integer-based variability conditions in C-preprocessor code be accurately converted into propositional logic for SAT-based analysis?
  • RQ2How can bounded integer variables with small value ranges be modeled in propositional logic while preserving satisfiability?
  • RQ3What is an effective strategy for handling unrestricted or high-range integer variables in the absence of full value enumeration?
  • RQ4To what extent does the transformation preserve the original variability semantics, especially in corner cases?
  • RQ5Can the transformed code be used effectively with existing SAT-based analysis tools without modifications?

Key findings

  • The transformation approach scales linearly with the size of the product line, with negligible performance overhead compared to subsequent analysis steps.
  • For bounded integer variables, the propositional formulas are mostly equisatisfiable with the original integer conditions, preserving correctness for analysis.
  • The method retains useful variability information even for unrestricted integer variables by using a single Boolean flag to indicate definedness.
  • In a real-world industrial case study on the Bosch PS-EC product line, the approach successfully enabled existing SAT-based tools to produce meaningful analysis results.
  • The implementation as a KernelHaven plugin demonstrated practical feasibility and reusability in industrial settings.
  • Limiting value combinations in high-complexity cases reduces performance impact, though at the cost of reduced precision, which is mitigated by a fallback strategy.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.