click-reduce tool #26

Open
opened 2025-10-23 16:03:40 +02:00 by alexander.nutz · 0 comments

a tool that minimizes C code as much as possible, to still trigger a condition, like a optimizer failure for example.

example:
you have a 200 thousand lines of code C project, and some compiler segfaults for some reason.
Now you are not the compiler dev, but still want the bug to be fixed; what should you do?? You can't give the compiler devs all your company's code, and compiler devs can't easily reproduce this....

the solution: automatically reduce the input code and check that it still triggers the same compile failure.

this is a very common thing in compilers, so there are many existing tools for doing that, like:

  • mlir-reduce
  • llvm-reduce
  • spirv-reduce
  • ....

but we want a tool that operates on C code directly

existing alternatives for C:

  • creduce: depends on a specific older llvm version, which is ehhr

how this will work:

  • there will be many ways for how to reduce a program, for example:
    • remove whole statements
    • replace variables usages with 0
    • replace expressions with 0
    • remove a switch case#
  • then there will be an algorithm which applies some of these and runs a user provided program and checks if the conditions are still met, if yes, continue reducing, if no, go back to previous program
a tool that minimizes C code as much as possible, to still trigger a condition, like a optimizer failure for example. example: you have a 200 thousand lines of code C project, and some compiler segfaults for some reason. Now you are not the compiler dev, but still want the bug to be fixed; what should you do?? You can't give the compiler devs all your company's code, and compiler devs can't easily reproduce this.... the solution: automatically reduce the input code and check that it still triggers the same compile failure. this is a very common thing in compilers, so there are many existing tools for doing that, like: - mlir-reduce - llvm-reduce - spirv-reduce - .... but we want a tool that operates on C code directly existing alternatives for C: - `creduce`: depends on a specific older llvm version, which is ehhr how this will work: - there will be many ways for how to reduce a program, for example: - remove whole statements - replace variables usages with 0 - replace expressions with 0 - remove a switch case# - then there will be an algorithm which applies some of these and runs a user provided program and checks if the conditions are still met, if yes, continue reducing, if no, go back to previous program
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
click-project/click#26
No description provided.