Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[libc++][PowerPC] align.pass.cpp test failure for 13.0.0-rc1 on PowerPC #50890

Closed
amy-kwan opened this issue Aug 19, 2021 · 6 comments
Closed
Labels
bugzilla Issues migrated from bugzilla

Comments

@amy-kwan
Copy link
Contributor

Bugzilla Link 51548
Resolution FIXED
Resolved on Oct 11, 2021 20:29
Version trunk
OS Linux
Blocks #51489
CC @ldionne,@tstellar
Fixed by commit(s) f640c31 198edf0

Extended Description

The following libc++ LIT test fails on 13.0.0-rc1 for Ubuntu on Power:

libc++ :: libcxx/atomics/atomics.align/align.pass.cpp


An assertion of the following is produced for this test:

command stderr:

t.tmp.exe: /home/conanap/llvm/community/llvm-project/libcxx/test/libcxx/atomics/atomics.align/align.pass.cpp:41: atomic_test::atomic_test() [T = LLIArr2]: Assertion `alignof(AtomicImpl) >= sizeof(AtomicImpl) && "expected natural alignment for lock-free type"' failed.

error: command failed with exit status: 250

This failure is still being investigated.

@amy-kwan
Copy link
Contributor Author

This failure was revealed through this commit:

commit 6427c53
Author: Louis Dionne [email protected]
Date: Wed Mar 24 16:45:55 2021 -0400

[libc++] Use add_lit_testsuite to register the libc++ test suite

The Runtimes build uses variables set by add_lit_testsuite to discover
tests suites to run.

Differential Revision: https://reviews.llvm.org/D97913

If I understand correctly, this commit runs the libc++ test cases on our side now, whereas they weren't being run for us on Power previously.

@amy-kwan
Copy link
Contributor Author

This failure is Linux specific for Power.

The align.pass.cpp test case tests the alignment of multiple different atomic types. If the atomic type is "lock-free", then the type must be properly aligned.

The issue is that alignof() should be >= sizeof() if the type is considered lock-free, but is not for two of the types found in the test. A reduced test case showing the two types that are not adequately aligned:


#include
#include
#include <stdio.h>

template
struct atomic_test : public std::__atomic_base {
atomic_test() {
if (this->is_lock_free()) {
using AtomicImpl = decltype(this->_a);
printf("alignof() = %lu, sizeof() = %lu\n",
alignof(AtomicImpl), sizeof(AtomicImpl));
//assert(alignof(AtomicImpl) >= sizeof(AtomicImpl) &&
// "expected natural alignment for lock-free type");
}
}
};

int main(int, char**) {

#define CHECK_ALIGNMENT(T)
do {
typedef T type;
atomic_test t;
} while (0)

CHECK_ALIGNMENT(struct LLIArr2 { long long int i[2]; });
CHECK_ALIGNMENT(struct Padding { char c; /* padding */ long long int i; });

return 0;
}


When ran, this produces:

alignof() = 8, sizeof() = 16
alignof() = 8, sizeof() = 16

As they do not match, the test would normally fail due to the assert() for expected natural alignment for lock-free type (but is commented out in the reduced test above).

@amy-kwan
Copy link
Contributor Author

For now, I have a patch that XFAILs this test case on Power: https://reviews.llvm.org/D108668

@ldionne
Copy link
Member

ldionne commented Aug 26, 2021

Shipped to main and cherry-picked to release/13.x as 198edf0.

@tstellar
Copy link
Collaborator

tstellar commented Sep 1, 2021

Merged: 198edf0

@tstellar
Copy link
Collaborator

mentioned in issue #51489

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 11, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla
Projects
None yet
Development

No branches or pull requests

3 participants