This is an archive of the discontinued LLVM Phabricator instance.

[Sema][SVE] Don't allow fields to have sizeless type
ClosedPublic

Authored by rsandifo-arm on Mar 6 2020, 4:41 AM.

Details

Summary

The SVE ACLE doesn't allow fields to have sizeless type. At the moment
clang accepts things like:

struct s { __SVInt8_t x; } y;

but trying to code-generate it leads to LLVM asserts like:

llvm/include/llvm/Support/TypeSize.h:126: uint64_t llvm::TypeSize::getFixedSize() const: Assertion `!IsScalable && "Request for a fixed size on a scalable object"' failed.

This patch adds an associated clang diagnostic.

Diff Detail

Event Timeline

rsandifo-arm created this revision.Mar 6 2020, 4:41 AM
Herald added a project: Restricted Project. · View Herald Transcript
efriedma added inline comments.Mar 11 2020, 7:26 PM
clang/lib/Sema/SemaLambda.cpp
1633

Can BuildCaptureField actually print an error? If it can, do you have a testcase?

Add a test for the BuildCaptureField change

rsandifo-arm marked 2 inline comments as done.Mar 12 2020, 11:17 AM
rsandifo-arm added inline comments.
clang/lib/Sema/SemaLambda.cpp
1633

Thanks for the reviews!

The only test I could find that triggered this was:

auto bad_init_4 = [a(void_fn())] {}; // expected-error {{has incomplete type 'void'}}

from CXX/expr/expr.prim/expr.prim.lambda/p11-1y.cpp. This might not be the optimal way to report the problem though.

I've added a corresponding test for the sizeless case.

efriedma accepted this revision.Mar 12 2020, 12:30 PM

LGTM

clang/lib/Sema/SemaLambda.cpp
1633

Makes sense.

This revision is now accepted and ready to land.Mar 12 2020, 12:30 PM
This revision was automatically updated to reflect the committed changes.
rsandifo-arm marked an inline comment as done.