Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

Unportable usage of bit fields #143

Closed
@akruis

Description

@akruis

The "flags" member of Stackless tasklets and channels is a bit-field structure (PyTaskletFlagStruc and PyChannelFlagStruc). The methods tasklet_new, channel_new, tasklet_reduce, channel_reduce, tasklet_setstate and channel_setstate access the "flags" structure in an undefined (strict aliasing violation) or implementation defined way. Using bit-fields in a portable way is difficult and has been discussed widely. In short: placement of bit-field members in the storage unit is implementation defined. For details consult the language definition.

My fix will default to a slow but portable solution with the option to use the native memory layout, if we know that the compiler uses the conventional placement (first member starts at the least significant bit of the storage unit, other members follows immediately). Currently I know that x86 and amd64 are safe.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions