Open
Description
This issue was copied from checkedc/checkedc-clang#1138
We have the following code in test/CheckedC/inferred-bounds/bounds-context.c
:
void f(char p nt_checked[0] : count(len), unsigned len) {}
The compiler currently allows this because p
has a declared bounds of count(len)
. But this declaration conflicts with the empty size declaration which is illegal.
Also if we remove the declared bounds then the compiler asserts.
void f(char p nt_checked[0]) {}
clang: /usr/magrang/master/src/clang/lib/Sema/BoundsUtils.cpp:57:
static clang::BoundsExpr* clang::BoundsUtil::CreateBoundsForArrayType(clang::Sema&, clang::QualType, bool):
Assertion `size.uge(1) && "must have at least one element"' failed.