Getting a SIGIOT when running executable

I’m trying to port some code to QNX (6.2.1 nc). It compiles fine with gcc 2.95.3, it’s fairly source-portable, but when I run the validation suite I get a SIGIOT. This is particularly confusing given that the QNX docs I have found say that SIGIOT is never delivered on x86! This happens whether I use -O2, -O -g, or just -g; nothing helps (I had initially assumed it was a compiler bug). In addition, when gdb is used on the binary, nothing happens; it simply returns with another (gdb) prompt, though if you then try to exit, it warns you that the process is still running (but it never gets anywhere).

I am totally baffled by this, help would be most appreciated. Oh, before I forget, this is all C++ code.

Is it possible you application generate that signal from within?

Possible, yes (happening, no).

Turns out (after 3 or 4 hours of debugging) to be that GCC needed to have -fexceptions passed to it explicitly; for some reason the QNX port of GCC has exceptions turned off by default (!). So whenever one got thrown, bad things happened (which, aparently, including SIGIOT on QNX).

A little extra info to this
the reason gdb is just sitting there is that you need to give it a 'c’ontinue command after 'r’unning the processes.
also, if you are developing on qnx, you ‘should’ use either qcc or QCC.
QCC is for c++ code.

This is because you are using the free version. I don’t have a commercial version either but I heard that exception is on by default there, with Dinkum C++ libs.