ggc-simple.c uses `long double'

Mark Mitchell mark@codesourcery.com
Thu Sep 30 19:57:00 GMT 1999


>>>>> "Kaveh" == Kaveh R Ghazi <ghazi@caip.rutgers.edu> writes:

    Kaveh> 	I'm having trouble compiling ggc-simple.c on SunOS4
    Kaveh> using cc because the file uses `long double':

    >> /* A generic allocation, with an external mark bit.  */
    >> 
    >> struct ggc_any { struct ggc_any *chain; unsigned int
    >> magic_mark;
    >> 
    >> /* Make sure the data is reasonably aligned.  */ union { char
    >> c; HOST_WIDE_INT i; long double d; } u; };


    Kaveh> It looks like the code only references the char element `c'
    Kaveh> and the rest is only there for alignment. 

Right.

    Kaveh> If true, can we
    Kaveh> get rid of the `long double' and use HOST_WIDEST_INT
    Kaveh> (WIDEST, not WIDE) for element `i' instead?  Would that be
    Kaveh> sufficient alignment?

Not in general.  (What's to keep those platforms that have long double
from requiring a stricter alignment for it than for really wide ints?)
But, this is fairly hacky anyway.

    Kaveh> Otherwise, perhaps we need the AC_C_LONG_DOUBLE autoconf
    Kaveh> test?

Yes, I think so.  And then the `long double' should be either `double'
or `long double' accordingly.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com



More information about the Gcc-bugs mailing list