boostorg / boostorg/type_traits

alignment_of_test is invalid (especially for IA32)

Open
#96 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
66
Forks
87
PR merge metrics
No merged PRs in 30d

Description

This test determines that the __alignof() operator returns the same value as an actual compiler alignment. However the __alignof (type) is suppose to return the minimal required alignment for the type, not the actual alignment the compiler uses. So on IA32 where an alignment of 1 works, and the ABI specifies a minimum of 4; __alignof(type) returns 4, which is correct. However in almost all cases the compiler will align at 8, for performance reasons and the test fails. On all other configs we tested the actual, and minimal alignment for clang 6.0 are the same.
Leading to misinformed comment here https://github.com/boostorg/type_traits/include/boost/type_traits/intrinsics.hpp#L289
and a fall-back of not using actual __alignof() operator for most of Boost's supported platforms.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.