I've been wondering if it's possible to compile using GCC with some optimization flag to avoid have two duplicate arrays to the .rodata section? Thus, memory addresses would be the same. For example:
const char str [7] = "string";
const char str1 [7] = "string";
int printf (const char * format, ...);
int main (void) {
if (str == str1)
printf ("Equal memory addresses");
return 0;
}
So in this example above, is it possible that somehow the compiler uses the same memory addresses?