"Falk Hueffner" <falk.hueffner@xxxxxxxxxxxxxxxxxxxxxxxx> writes: > > "John S. Yates, Jr." <jyates@xxxxxxxxxxx> writes: > > > > If your explanation is correct, that is that a call to an > > exception-raising, noreturn function is viewed as changing > > control flow, then what is gcc's stance on using > > instructions that raise exceptions within asm() blocks? > > Is it possible that you're confusing C++ exception and > hardware traps? Those two concepts are in no way related with > g++. Some C++ compilers catch hardware traps and make C++ > exceptions of them, but g++ doesn't. Therefore, you cannot > throw C++ exceptions from asm at all. The fact that g++ does not on its own turn arithmetic traps into C++ exceptions does not preclude a user from doing so. This is exactly what we do in the system on which I work: We implement multi-terabyte databases including billions of rows on massively parallel hardware by converting SQL queries into C++, compiling the result and broadcasting the generate binary to all nodes. Given arbitrary content in a database and arbitrary aggregation within a query one has to expect exceptional cases. When these arise it is not appropriate to crash the system or to simply kill a process. We have to abort the query, roll back transactions, etc. The only sane way of doing this is to turn all hardware traps into an exceptions. > "Falk Hueffner" <falk.hueffner@xxxxxxxxxxxxxxxxxxxxxxxx> writes: > > It's an expected limitation. asm's are not supposed to > change the control flow. The manual could probably more > explicit about this... I find this assertion hard to believe. The gcc manual shows an explicit example of using an asm() to make a call. If your assertion is truly gcc's reasoned design intent then it implies that any author of an asm() containing a call is responsible for ensuring that the transitive closure of all code reachable from that call is and remains free of exception possibilities for all time. Surely such drastic consequences from a design choice would have merited a cautionary comment of some sort... I therefore put it to you that this is not simply a deficiency in gcc documentation but rather a legitimate bug. True, a fix might require additional syntax... But as things stand asm() is a festering gotcha. > "Falk Hueffner" <falk.hueffner@xxxxxxxxxxxxxxxxxxxxxxxx> writes: > > Maybe you could try to generate the required .eh_frames > manually, I think the Linux kernel does this somewhere. I am desperate and willing to try anything. Searching the web based-on your suggestion I found the following article: http://www.tldp.org/LDP/khg/HyperNews/get/devices/exceptions.html I believe I could indeed do something similar if I knew enough about the contents of .eh_frames. So far though I have had no luck looking for documentation. Any suggestions? /john -- John S. Yates, Jr. 508 665-6897 (voice) Netezza Inc 508 665-6811 (fax) 200 Crossing Blvd. Framingham, MA 01701