Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22022

How to make GCC or Clang compile all the code, even unreachable?

$
0
0

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.


Viewing all articles
Browse latest Browse all 22022

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>