Subject: Re: quetion for gcc on hpux
Date: Wed, 23 Feb 2005 06:28:40 -0600
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".
HTH,
--Eljay
PS: I ran into the same issue on DEC Alpha Tru64 machines.