If I compile the following code:
void f() {int* ptr = 0;try { *ptr = 9;} catch (...) { printf("caught");}
Gcc doesn`t compile code that it considers unreachable, so the resulting assembly does not contain the catch block. How do I make GCC compile everything?
I need this because I am researching the possibility of passing C++ exceptions from the kernel to user programs, so if the code above is executed, the kernel will throw an exception after *ptr=9 that should be caught in the catch block.