This is the mail archive of the
mailing list for the elfutils project.
Re: [PATCH] libdwfl: Fix wrong type to make gcc -fsanitize=undefined happy.
- From: Roland McGrath <roland at hack dot frob dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Thu, 23 Apr 2015 10:05:44 -0700
- Subject: Re: [PATCH] libdwfl: Fix wrong type to make gcc -fsanitize=undefined happy.
> Extra plus in front of 0? Why not just use sizeof(struct msgtable)?
Yeah, I guess that would be fine too.
> Something like can be done without unions:
> #define msgstr (*(char (*)[sizeof msgtable])&msgtable)
> AFACT it's well-defined C and permits to perform bound checking.
That's less clean than a union.