2026-04-11
To the Development Team
I am using your app to compile C code and I have encountered a critical bug regarding pointer arithmetic and array memory addressing.
Device: iPhone 12 Pro
iOS Version: iOS 17.2
Description: According to the C standard, if a is declared as int a[5], the expression &a + 1 should advance the pointer by the size of the entire array (i.e., sizeof(a), which is 20 bytes). However, in your compiler/interpreter environment, &a + 1 evaluates to the exact same memory address as a and &a (0 byte offset).
This causes subsequent pointer calculations to read out-of-bounds memory.
Steps to Reproduce: Please run the following standard C code in your app:
#include "stdio.h"
int main(int argc, char **argv) {
int a[5] = {1, 2, 3, 4, 5};
int *p = (int *)(&a + 1);
printf("sizeof(a) = %zu bytes\n", sizeof(a));
printf("Address a = %p\n", (void*)a);
printf("Address &a + 1 = %p\n", (void*)(&a + 1));
printf("Address p - 1 = %p\n", (void*)(p - 1));
printf("Output: %d %d\n", *(a + 1), *(p - 1));
return 0;
}
Expected Result (Standard C Compiler Behavior):
Address &a + 1 should be Address a + 20 bytes.
Output should be: 2 5
Actual Result (Bug Behavior in your app):
sizeof(a) correctly returns 20 bytes.
However, Address a and Address &a + 1 return the exact same address (e.g., 0x151bd0448).
Consequently, p - 1 steps backward before the array starts (e.g., 0x151bd0444), resulting in the output: 2 0
This seems to be a bug in how your compiler/interpreter handles the type decay or pointer math for int (*)[5].
Looking forward to a fix in the future updates. Thank you for your great work on the app!