The GNU Modula-2 front end to GCC

Exception implementation

This section describes how exceptions are implemented in GNU Modula-2 and how command line switches affect their behaviour. The option -fsoft-check-all enables all software checking of nil dereferences, division by zero etc. Additional code is produced to check these conditions and exception handlers are invoked if the conditions prevail.

Without -fsoft-check-all these exceptions will be caught by hardware (assuming the hardware support) and a signal handler is invoked. The signal handler will in turn THROW an exception which will be caught by the appropriate Modula-2 handler. However the action of throwing an exception from within a signal handler is implementation defined (according to the C++ documentation). For example on the x86_64 architecture this works whereas on the i686 architecture it does not. Therefore to ensure portability it is recommended to use -fsoft-check-all.