[DTrace-devel] [PATCH] Fix type alignment handling for enums
Eugene Loh
eugene.loh at oracle.com
Fri Aug 20 10:55:56 PDT 2021
Sorry, I'm clueless here. What is the issue? Is there a user-visible
bug? Specifically, should this change be accompanied by a test? I
simply do not understand the issue at stake here.
On 8/20/21 2:47 AM, Kris Van Hees wrote:
> The type alignment handling code used to determine the alignment size
> for a given datatype was treating enums as if they were integers, but
> that is incorrect. It should (just like integers and pointers) have
> its alignment set to match its size, but it should avoid the explicit
> void-checking that is done for integers.
>
> Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
> ---
> libdtrace/dt_parser.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libdtrace/dt_parser.c b/libdtrace/dt_parser.c
> index e9dcff98..bac895a2 100644
> --- a/libdtrace/dt_parser.c
> +++ b/libdtrace/dt_parser.c
> @@ -1630,7 +1630,6 @@ dt_node_decl(void)
> size = ctf_type_size(dtt.dtt_ctfp, dtt.dtt_type);
>
> switch (kind) {
> - case CTF_K_ENUM:
> case CTF_K_INTEGER:
> if (ctf_type_encoding(dtt.dtt_ctfp, type,
> &cte) == 0 &&
> @@ -1639,6 +1638,7 @@ dt_node_decl(void)
> "cannot have void object: %s\n",
> dsp->ds_ident);
> /*FALLTHRU*/
> + case CTF_K_ENUM:
> case CTF_K_POINTER:
> alignment = size;
> break;
More information about the DTrace-devel
mailing list