libgccjit: Clarifying the permitted type conversions

Alex Coplan Alex.Coplan@arm.com
Thu Jul 9 14:15:14 GMT 2020


Hello,

I have some questions about the type conversions allowed by the
libgccjit interface.

Firstly, I believe it is the case that the intent is that all implicit
conversions are forbidden. Is this correct?

Secondly, I wanted to clarify the situation with respect to explicit
casts; that is, those conversions allowed by gcc_jit_context_new_cast().
The docs [0] say:

Currently only a limited set of conversions are possible:
 - int <-> float
 - int <-> bool
 - P* <-> Q*, for pointer types P and Q

However, empirically (at least on aarch64), libgccjit appears to allow
me to compile casts between any pair of types in the following set
without any complaint:

{
  SIGNED_CHAR,
  UNSIGNED_CHAR,
  SHORT,
  UNSIGNED_SHORT,
  INT,
  UNSIGNED_INT,
  LONG,
  UNSIGNED_LONG,
  LONG_LONG,
  UNSIGNED_LONG_LONG
}

Is this intended behaviour? If so, does the documentation need to be
updated here? If not, perhaps there are some checks missing in the
libgccjit interface?

Many thanks,
Alex

[0] : https://gcc.gnu.org/onlinedocs/jit/topics/expressions.html


More information about the Jit mailing list