This is the mail archive of the
mailing list for the elfutils project.
Re: [PATCH] Do without union of variable length arrays.
- From: Alexander Cherepanov <ch3root at openwall dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Fri, 02 Oct 2015 00:10:47 +0300
- Subject: Re: [PATCH] Do without union of variable length arrays.
On 2015-09-16 18:25, Mark Wielaard wrote:
> On Fri, 2015-09-11 at 12:22 -0700, Roland McGrath wrote:
>> It looks fine to me from a quick skim, but Mark should review and test it too.
> I am not super enthusiastic about this change, it seems to just take
> away type/size information that the compiler/bounds checking tools can
I'm not sure I fully understand the problem. As I understand it unions
of VLAs are not Ok while VLAs are Ok and even desirable due to bounds
Why not just use VLAs of unions? Cold memory?
Given that the current approach (before the patch) already required to
write superfluous "->" perhaps an approach requiring a superfluous "*"
will fit? Like this:
void *data = malloc (...);
T32 (*a32)[n] = data;
T64 (*a64)[n] = data;
Then the use looks like "(*a32)[i].member". Clang seems to be happy and
its UBSAN works fine.