What causes the output "Hello" when I enable -O for gcc ? Shouldn't it still segfault (according to this wiki) ?
% cat segv.c
#include <stdio.h>
int main()
{
char * s = "Hello";
s[0] = 'Y';
puts(s);
return 0;
}
% gcc segv.c && ./a.out
zsh: segmentation fault ./a.out
% gcc -O segv.c && ./a.out
Hello