From 0bbab5376cb88564b33a6bbdeaf3187f802c24c8 Mon Sep 17 00:00:00 2001 From: Antoni Boucher Date: Sat, 16 Apr 2022 22:25:41 -0400 Subject: [PATCH] Fix usage of aligned type in struct constructor --- gcc/jit/libgccjit.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gcc/jit/libgccjit.cc b/gcc/jit/libgccjit.cc index ce54cc82a7a..a417e40d728 100644 --- a/gcc/jit/libgccjit.cc +++ b/gcc/jit/libgccjit.cc @@ -1414,16 +1414,16 @@ gcc_jit_context_new_struct_constructor (gcc_jit_context *ctxt, JIT_LOG_FUNC (ctxt->get_logger ()); RETURN_NULL_IF_FAIL (type, ctxt, loc, "NULL type"); - RETURN_NULL_IF_FAIL_PRINTF1 (type->is_struct (), + struct_* struct_type = type->is_struct (); + RETURN_NULL_IF_FAIL_PRINTF1 (struct_type, ctxt, loc, "constructor type is not a struct: %s", type->get_debug_string ()); - compound_type *ct = reinterpret_cast(type); - gcc::jit::recording::fields *fields_struct = ct->get_fields (); + gcc::jit::recording::fields *fields_struct = struct_type->get_fields (); size_t n_fields = fields_struct->length (); - RETURN_NULL_IF_FAIL_PRINTF1 (ct->has_known_size (), + RETURN_NULL_IF_FAIL_PRINTF1 (struct_type->has_known_size (), ctxt, loc, "struct can't be opaque: %s", type->get_debug_string ()); @@ -1472,7 +1472,7 @@ gcc_jit_context_new_struct_constructor (gcc_jit_context *ctxt, RETURN_NULL_IF_FAIL_PRINTF3 ( f->get_container () == - static_cast(type), + static_cast(struct_type), ctxt, loc, "field object at index %zu (%s), was not used when creating " "the %s", -- 2.26.2.7.g19db9cfb68.dirty