tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Make __CTASSERT1 true static assert



On Thu, Sep 19, 2019 at 03:42:35PM +0200, Kamil Rytarowski wrote:
> Our _CTASSERT is broken as it is not constant-time expression. We define
> VLA which size can be in runtime -1 and trigger UB. Worse than UB is
> that it does not validate whether the expression is valid.

Well, it is not broken for all supported use cases and there is no
runtime. So I still must be missing something here.

> >> #include <sys/cdefs.h>
> >> int main(int argc, char **argv) { __CTASSERT(argc < 0); return 0; }
> > 
> > I think this is an abuse of __CTASSERT and should not be supported.
> > 
> 
> My patch proposal fixes this.

I meant we should just fix the abuses and be done.

Martin


Home | Main Index | Thread Index | Old Index