Keeping unreachable code

Casper Hornstrup chorns@users.sourceforge.net
Sun Feb 3 16:55:00 GMT 2002


On Monday 04 February 2002 00:18, you wrote:
> <<It can if it thinks it is 'dead' code and it does since no jumps targets
> the code. The address of the exception handler is kept in a table so the
> runtime library can find it.
>
>
> It cannot throw away a fucntion that could potentially be called from
> some other file, that's obvious, and that's what you disagreed with.
>
> <<It is not a whole C function it throws away...it is part of the code I
> have modified it to emit for __try/__except blocks.
>
>
> Then it is not a function, and has nothing to do with what I said. Of
> course it will throw away code of the kind you describe. In fact I think
> you are persuing a lost cause here. Optimization will kill you in general
> (we have found that in the move from GCC 2.8.1 to GCC 3 for GNAT, it was
> impossible to keep the old GNAT zero cost exception mechanism working,
> because of optimziations -- not only throwing away code, but more
> importantly, moving code around in ways that are inconsistent with the
> model -- I bet you will run into the same problem.
>
> Why are you doing this at all?

I am doing this because I'm developing a open source Windows NT clone (see 
www.reactos.com) using GCC/MinGW. MS Visual C++ compiler supports Structured 
Exception Handling (SEH), which is exception handling at the OS and compiler 
level, but GCC does not.
SEH can be used to make robust drivers and is required for some 
types of Windows NT drivers. MinGW will benefit from SEH support in GCC too 
since Windows applications can use it too.

SEH:
http://msdn.microsoft.com/library/en-us/vccore98/html/_core_exception_handling_topics_.28.seh.29.asp?frame=true



More information about the Gcc mailing list