On Thu, 2023-12-21 at 08:33 -0500, Antoni Boucher wrote: > Hi. > This patch allows comparing aligned integer types as equal. > There's a TODO in the code about whether we should check that the > alignment is equal. > What are your thoughts on this?
I think we should check for equal alignment. [...snip...] > diff --git a/gcc/testsuite/jit.dg/test-types.c > b/gcc/testsuite/jit.dg/test-types.c > index a01944e35fa..c2f4d2bcb3d 100644 > --- a/gcc/testsuite/jit.dg/test-types.c > +++ b/gcc/testsuite/jit.dg/test-types.c > @@ -485,11 +485,15 @@ verify_code (gcc_jit_context *ctxt, gcc_jit_result > *result) > > CHECK_VALUE (z.m_FILE_ptr, stderr); > > + gcc_jit_type *long_type = gcc_jit_context_get_type (ctxt, > GCC_JIT_TYPE_LONG); > + gcc_jit_type *int64_type = gcc_jit_context_get_type (ctxt, > GCC_JIT_TYPE_INT64_T); > if (sizeof(long) == 8) > - CHECK (gcc_jit_compatible_types ( > - gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_LONG), > - gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_INT64_T))); > + CHECK (gcc_jit_compatible_types (long_type, int64_type)); > > CHECK_VALUE (gcc_jit_type_get_size (gcc_jit_context_get_type (ctxt, > GCC_JIT_TYPE_FLOAT)), sizeof (float)); > CHECK_VALUE (gcc_jit_type_get_size (gcc_jit_context_get_type (ctxt, > GCC_JIT_TYPE_DOUBLE)), sizeof (double)); > + > + gcc_jit_type *aligned_long = gcc_jit_type_get_aligned (long_type, 4); > + gcc_jit_type *aligned_int64 = gcc_jit_type_get_aligned (int64_type, 4); > + CHECK (gcc_jit_compatible_types (aligned_long, aligned_int64)); This CHECK should be guarded on sizeof(long) == 8 like the check above. Dave