public inbox for jit@gcc.gnu.org
 help / color / mirror / Atom feed
From: Alex Coplan <Alex.Coplan@arm.com>
To: "jit@gcc.gnu.org" <jit@gcc.gnu.org>
Cc: David Malcolm <dmalcolm@redhat.com>, nd <nd@arm.com>
Subject: libgccjit: Clarifying the permitted type conversions
Date: Thu, 9 Jul 2020 14:15:14 +0000	[thread overview]
Message-ID: <VI1PR08MB402951506212A2CFD8641B04EA640@VI1PR08MB4029.eurprd08.prod.outlook.com> (raw)

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

             reply	other threads:[~2020-07-09 14:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-09 14:15 Alex Coplan [this message]
2020-07-21  8:27 ` Alex Coplan
2020-07-22  8:45 ` [PATCH] libgccjit: Improve doc and comments regarding type casts (Was: Clarifying the permitted type conversions) Andrea Corallo
2020-08-06  7:40   ` [PATCH] libgccjit: Improve doc and comments regarding type casts Andrea Corallo
2020-09-09  7:56     ` Andrea Corallo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=VI1PR08MB402951506212A2CFD8641B04EA640@VI1PR08MB4029.eurprd08.prod.outlook.com \
    --to=alex.coplan@arm.com \
    --cc=dmalcolm@redhat.com \
    --cc=jit@gcc.gnu.org \
    --cc=nd@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).