array-to-scalar-simplification
Use when code uses an array to store a single character/value that is only accessed at one index
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Use when code uses an array to store a single character/value that is only accessed at one index
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Use when printf statements output strings without trailing newlines
Use when array is accessed with direct user input as index (0-based indexing)
Use when the program accesses a precomputed table using an offset (e.g., arr[n-1]) that introduces an arithmetic operation between the symbolic input and the index
Use when loop variables iterate over character values (e.g., ASCII codes) to represent different operations or choices
Use when code uses a loop to search for an input value in an array and then uses the found index for further computation
Use when code reads a fixed number of characters into an array and only accesses individual elements
| name | array-to-scalar-simplification |
| description | Use when code uses an array to store a single character/value that is only accessed at one index |
A KLEE-coverage code transformation. Applying it rewrites C source so symbolic execution explores more of the program's behavior.
When code uses an array to store a single character/value that is only accessed at one index
Replace the array declaration and indexed access with a simple scalar variable
Arrays introduce symbolic memory indexing complexity in KLEE, while scalar variables create simpler constraints that are easier to solve and explore
Before:
#include<stdio.h>
int main()
{
char a[100];
scanf("%c",&a[0]);
printf("%c",(a[0]+1));
}
After:
#include<stdio.h>
int main()
{
char c1;
c1=getchar();
putchar(c1+1);
putchar('\n');
return 0;
}
1b05609a