From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 81388 invoked by alias); 26 Jun 2015 19:35:35 -0000 Mailing-List: contact jit-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Subscribe: Sender: jit-owner@gcc.gnu.org Received: (qmail 81376 invoked by uid 89); 26 Jun 2015 19:35:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.98.7 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 X-Spam-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: X-HELO: mx1.redhat.com Message-ID: <1435346872.13727.126.camel@surprise> Subject: Re: Compilation error involving comparison and logical operator From: David Malcolm To: Dibyendu Majumdar Cc: jit@gcc.gnu.org Date: Thu, 01 Jan 2015 00:00:00 -0000 In-Reply-To: References: <1435276622.13727.58.camel@surprise> <1435311769.13727.90.camel@surprise> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-SW-Source: 2015-q2/txt/msg00120.txt.bz2 On Fri, 2015-06-26 at 20:24 +0100, Dibyendu Majumdar wrote: > On 26 June 2015 at 10:42, David Malcolm wrote: > > Note that unlike C, libgccjit has no implicit type-coercion: anywhere > > you want to treat int as bool or vice versa, or convert between float > > and int, you need to do it explicitly via a cast > > (gcc_jit_context_new_cast). > > > > Couple of questions: > > 1. What is the type of a binary logical operator By "a binary logical operator" presumably you mean the result of gcc_jit_context_new_comparison. This has type GCC_JIT_TYPE_BOOL. > and what effect does > the result type in gcc_jit_context_new_binary_op() have? This defines the type of the resulting rvalue. I believe you can use this as another way of doing a cast. > 2. What is the type of unary logical operator It depends on the result_type passed in to gcc_jit_context_new_unary_op. > and what is the effect > of result type in gcc_jit_context_new_unary_op()? This defines the type of the resulting rvalue. As above you can use this as another way of doing a cast. > The comparison operator does not take a result type so presumably it > is always boolean? Correct.