fixfortran ruins linux __huge_val from math.h

Derek L. Bruening iye@cag.lcs.mit.edu
Tue, 7 Dec 1999 15:39:55 -0500 (EST)


Since sf2c.h includes math.h, the __huge_val union defined in math.h is
treated as a common block by the mark_common_blocks routine in the
fixfortran pass.  On Linux (RedHat 6.0) __huge_val is of type:

union { unsigned char __c[8]; double __d; }

After being converted to a group by fixfortran and back to a struct by
s2c, __huge_val has type:

struct 11 { char __init0;
            char __init1;
            char __init2;
            char __init3;
            char __init4;
            char __init5;
            char __init6;
            char __init7; };

This causes "s2c:Error: constant too large for type" because the
initializer for __huge_val contains two values that are too big for a
signed char (but not for an unsigned char, the proper type).

Linux is the only platform on which I have had a problem with this.
Other platforms have different __huge_val types that happen to work
after being "fixed".

- Derek Bruening