[Gc] Win64 GCC supprt

Andrew Haley aph at redhat.com
Fri Jun 19 02:51:46 PDT 2009


NightStrike wrote:
> On Thu, Jun 18, 2009 at 4:52 PM, NightStrike<nightstrike at gmail.com> wrote:
>> On Thu, Jun 18, 2009 at 4:14 PM, Andrew Haley<aph at redhat.com> wrote:
>>>
>>>> Second, compiling yields this failure:
>>>>
>>>> ../mallocx.c:32:1: error: initializer element is not constant
>>>> ../mallocx.c:33:1: error: initializer element is not constant
>>>> ../mallocx.c:34:1: error: initializer element is not constant
>>>> ../mallocx.c:36:5: error: initializer element is not constant
>>>>
>>>>
>>>> It appears that certain things are being initialized by variables, and
>>>> this is not AFAIK supported.
>>> Can you expand that with gcc -E ?  Then we'll see what's wrong with the
>>> initializer.

>>>
>> Adding -E to the commandline didn't work, so I added -save-temps.  For
>> some reason, -E made gcc return immediately with no output.
>>
>> I am attaching mallocx.i

Well, I don't think we wanted all of it.

The problem is here.

void ** const GC_objfreelist_ptr = GC_arrays._objfreelist;
void ** const GC_aobjfreelist_ptr = GC_arrays._aobjfreelist;
void ** const GC_uobjfreelist_ptr = GC_arrays._uobjfreelist;

    void ** const GC_auobjfreelist_ptr = GC_arrays._auobjfreelist;

Now, this is very strange.  The initialization works correctly
and as far as I can see it is legal:

struct _GC_arrays {
 ...
     void *_objfreelist[((size_t)((((1 << 12)/2))>>4))+1];
...
};

void *GC_arrays._objfreelist[] should decay to a void**, and it
is a legitimate address constant by my reading of Section 6.6,
Constant Expressions.

I wonder if the real problem may be this:

__attribute__((dllimport)) struct _GC_arrays GC_arrays;

Maybe the address if a dllimport isn't an address constant.  If so,
you'll have to initialize GC_objfreelist_ptr in an initializer
routine.

Andrew.


More information about the Gc mailing list