[gambit-list] Need different compiler behavior to debug arithmetic

Bradley Lucier lucier at math.purdue.edu
Mon Oct 24 19:49:26 EDT 2005


Marc:

Here's something to think about for later.

I know of no way, at the Scheme level, to debug incorrect  
declarations of fixnum or flonum.  If you run an application  
interpreted, it just works, which is OK. If you run something  
compiled in safe mode, then it works whether the declarations are  
correct or not.  And when you run it in unsafe mode then it generally  
fails with a segmentation fault.  The only way I know to debug this  
type of fault is to compile Gambit and the application itself with - 
g, run the application inside gdb, then determine (a) what operation  
is failing and (b) the location of that operation in the scheme code  
by diagnosing the C output of gsc.  Not fun, even for me ;-).

I'l like to suggest the following compilation model for compiling  
numerics in safe mode:

Declaration: generic, mostly-*

Result: Generates code to determine the types of arguments and do the  
correct thing, including calling the generic operations if necessary.

Declaration: fixnum, flonum

Result: check the types of arguments, and generate an exception of  
the arguments do not match the correct types.

I don't think there needs to be any change in unsafe mode.

This way I could debug mistaken declarations without going through gdb.

Brad



More information about the Gambit-list mailing list