HomePhabricator

[Sema][SVE] Reject arrays of sizeless types

Authored by rsandifo-arm on Feb 27 2020, 2:25 AM.

Description

[Sema][SVE] Reject arrays of sizeless types

The SVE ACLE doesn't allow arrays of sizeless types. At the moment
clang accepts the TU:

__SVInt8_t x[2];

but trying to code-generate it triggers the LLVM assertion:

llvm/lib/IR/Type.cpp:588: static llvm::ArrayType* llvm::ArrayType::get(llvm::Type*, uint64_t): Assertion `isValidElementType(ElementType) && "Invalid type for array element!"' failed.

This patch reports an appropriate error instead.

The rules are slightly more restrictive than for general incomplete types.
For example:

struct s;
typedef struct s arr[2];

is valid as far as it goes, whereas arrays of sizeless types are
invalid in all contexts. BuildArrayType therefore needs a specific
check for isSizelessType in addition to the usual handling of
incomplete types.

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

Details

Committed
rsandifo-armMar 13 2020, 12:28 PM
Differential Revision
D76082: [Sema][SVE] Reject arrays of sizeless types
Parents
rG8c5c60a493ca: [Sema][SVE] Reject by-copy capture of sizeless types
Branches
Unknown
Tags
Unknown