[Python-Dev] mingw32 and gc-header weirdness
Roumen Petrov
bugtrack at roumenpetrov.info
Thu Jul 23 03:46:32 CEST 2009
Christian Tismer wrote:
> On 7/22/09 4:56 PM, Roumen Petrov wrote:
>> Martin v. Löwis wrote:
>> [SNIP]
>>> No. tim_one changed it to be long double in r25454 to support some
>>> system that Dave Abrahams uses, so it needs to stay that way :-)
>>>
>>> However, we can certainly acknowledge that this is a bug in MingW,
>>> and special case it. Either introduce a symbolic type gchead_align_t
>>> which gets defined to just double on MingW, or put the #ifdef right
>>> into the structure.
>>
>> No this is not GCC bug. GCC support "hardware extended precision" as
>> implement long double and mingw w32api implement long double functions.
>> According to http://msdn.microsoft.com/en-us/library/9cx8xs15.aspx it is
>> MSVC limitation.
>>
>>
>>> It might also be useful to assert that sizeof(gchead_align_t) is
>>> 8 or 16, and reject 12 as a value. The point is that we need the
>>> maximum alignment, and that certainly shouldn't be 12.
>>
>> So look like python bug.
>
> The assumption is that the union with long double gives alignment
> to the largest possible integral type with a power of 2 size,
> which is then wrong, because of the unexpected size.
As is posted for GCC on linux(32-bit) size of structure is 12 =
sizeof(struct in union) = sizeof(pointer)+sizeof(pointer)+sizeof(ssize_t).
And sizeof(ssize_t) <= sizeof(long) <= sizeof(pointer) .
> What do you propose for doing proper alignment, then?
May be "void* dummy[4]" is better for force alignment ?
What about alignment on platforms with pointers > 32 bit ?
> I fear this needs to become yet another special case in pyconfig.h
>
> cheers - chris
>
Regards,
Roumen
More information about the Python-Dev
mailing list