Previous: Floating-point precision, Up: Working Programs

14.4.11 Inconsistent Calling Sequences

Code containing inconsistent calling sequences in the same file is normally rejected—see GLOBALS. (Use, say, ftnchek to ensure consistency across source files. See Generating Skeletons and Prototypes with f2c.)

Mysterious errors, which may appear to be code generation problems, can appear specifically on the x86 architecture with some such inconsistencies. On x86 hardware, floating-point return values of functions are placed on the floating-point unit's register stack, not the normal stack. Thus calling a REAL or DOUBLE PRECISION FUNCTION as some other sort of procedure, or vice versa, scrambles the floating-point stack. This may break unrelated code executed later. Similarly if, say, external C routines are written incorrectly.