OSR Dev Blog

Inlining into SEH Filters Can Result in Invalid Code on AMD64
(By: Hector J. Rodriquez | Published: 02-Jun-04| Modified: 07-Jun-04)

It started out as a typical day for me at the office.  I came in, I got my double dose of French Roast coffee and settled down for a long day of, well...doing whatever is I get paid to do here.   Along the way I came across some documentation on Structured Exception Handling and found this interesting tidbit of information: Under the title "AMD64 Compiler Limitations" in the Windows Server 2003 DDK states the following:

"Inlining into SEH filters can result in invalid code if you use the GetExceptionCode or GetExceptionInfo fuctions."

The accompanying example illustrates the code that can cause problems: 

//Avoid using GetExceptionInfo() for this structure
__inline void funca(DWORD); 
__try { 
... 
} except(funca(GetExceptionCode())) 
{ 
... 
} 
//Instead use the compiler switch /Ob0 to disable inlining or use: 
__declspec(noinline) 
// On a class member function if there is a problem 

I doubt many people would ever do this, but it is an interesting tidbit to keep in mind. 

Oh well, time for another French Roast double!

This article was printed from OSR Online http://www.osronline.com

Copyright 2017 OSR Open Systems Resources, Inc.