[cfe-dev] ConstantArrayType's size is not always of pointer width
Sebastian Redl
sebastian.redl at getdesigned.at
Tue Dec 2 13:13:35 PST 2008
Eli Friedman wrote:
> On Tue, Dec 2, 2008 at 9:03 AM, Sebastian Redl
> <sebastian.redl at getdesigned.at> wrote:
>
>> Ah, OK. But is using the width of the constant the right thing to do?
>> Shouldn't an array size ultimately be of type size_t?
>>
>
> It'll ultimately be allocated that way, but casting doesn't really
> seem necessary; we definitely don't want to truncate the size.
>
So clients of the AST simply must not make assumptions about the width
of array size and array index expressions. That's fine with me, but I've
already fixed three 64-bit bugs in the static verifier that were caused
by this assumption, so perhaps this should be documented very clearly
somewhere.
Sebastian
More information about the cfe-dev
mailing list