quetion for gcc on hpux

Eljay Love-Jensen eljay@adobe.com
Thu Feb 24 02:42:00 GMT 2005

Hi Dai,

If you choose not to change the bad code that is causing a SIGBUS, I 
believe you cannot use GCC since (as far as I am aware) GCC does not 
provide a mechanism *IN THE COMPILE/LINK* to catch the SIGBUS signal and do 
the byte-by-byte manipulation to complete the action.

Such handling of a SIGBUS slows down the performance of the application 
significantly.  If the SIGBUS is happening on a data structure that is 
often used, such as in a tight loop, you can expect to see a degradation of 
performance on the order of two or three magnitudes.

You could write your own SIGBUS handler (as such, in that sense, GCC 
provide a mechanism -- i.e., the building blocks to do it yourself), so you 
wouldn't have to change the rest of your code other than in main to put in 
your SIGBUS handler, and the SIGBUS handler itself.

My recommendation is to fix the bad code, not surround the application with 
a inevitably inefficient SIGBUS handler that masks bad programming*.

* "bad" in the sense of "violates system architecture constraints".


PS:  I ran into the same issue on DEC Alpha Tru64 machines.

More information about the Gcc-help mailing list