From patchwork Thu Oct 24 20:51:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Malcolm X-Patchwork-Id: 286012 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id CA6802C00E0 for ; Fri, 25 Oct 2013 07:51:46 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id; q=dns; s=default; b=cnW3ZF2elHj9 3i5vYy+OOGUuMKx+bxIKyAwIYjivlAnzZc0X7dn3k+3K4WI5Eq72/t2tGMnmbhjB j9pqAKsC8nrQKnifBCp4+P0O5IIB3iqArq91xWBnBPgHDkdZmwOnv5M8ugUuCi3+ 3TXAGR3WJB2cXqkKMDHfTRNx2N7i02M= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id; s=default; bh=incyNfQWGEkJLIx0Y5 QEQfpJWeA=; b=rjP0NroDD3qHsiut05urPvA6WIL7Co7vXZ/gilhsYIwDzEPznj w/xt+deQ6jJLbilIx8rTkbZ130vX5S8/szKok/mKUB0p0Vud1yi6UaSfJCwoS8ll YF++Hiuwws3MNh5c0JGqQzr2Q2hpcRXJ09lm2CzKKWcKnDJ6i3BtZARcA= Received: (qmail 20810 invoked by alias); 24 Oct 2013 20:51:40 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 20792 invoked by uid 89); 24 Oct 2013 20:51:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 24 Oct 2013 20:51:39 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r9OKpbAu016896 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 24 Oct 2013 16:51:38 -0400 Received: from surprise.bos.redhat.com ([10.18.25.13]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r9OKpaW2020665; Thu, 24 Oct 2013 16:51:37 -0400 From: David Malcolm To: gcc-patches@gcc.gnu.org, jit@gcc.gnu.org Cc: David Malcolm Subject: [jit] Fix various issues relating to gcc_jit_location. Date: Thu, 24 Oct 2013 16:51:17 -0400 Message-Id: <1382647877-31116-1-git-send-email-dmalcolm@redhat.com> X-IsSubscribed: yes I've committed the following fixes to the dmalcolm/jit branch: (Found via fuzz testing) gcc/jit/ * internal-api.c (gcc::jit::function::add_eval): Handle non-NULL locations. (gcc::jit::context::handle_locations): Fix test for the various kinds of declarations, replacing use of DECL_MINIMAL_CHECK, which aborts on failure (such as if we saw a type). * libgccjit.h (GCC_JIT_BOOL_OPTION_DEBUGINFO): Fix out-of-date comment. --- gcc/jit/ChangeLog.jit | 10 ++++++++++ gcc/jit/internal-api.c | 6 ++++-- gcc/jit/libgccjit.h | 4 ++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/gcc/jit/ChangeLog.jit b/gcc/jit/ChangeLog.jit index 6308c6d..30664be 100644 --- a/gcc/jit/ChangeLog.jit +++ b/gcc/jit/ChangeLog.jit @@ -1,3 +1,13 @@ +2013-10-24 David Malcolm + + * internal-api.c (gcc::jit::function::add_eval): Handle non-NULL + locations. + (gcc::jit::context::handle_locations): Fix test for the various + kinds of declarations, replacing use of DECL_MINIMAL_CHECK, + which aborts on failure (such as if we saw a type). + * libgccjit.h (GCC_JIT_BOOL_OPTION_DEBUGINFO): Fix out-of-date + comment. + 2013-10-23 David Malcolm * internal-api.c: Update for rename of tree-flow.h to tree-cfg.h diff --git a/gcc/jit/internal-api.c b/gcc/jit/internal-api.c index 574aef0..b21aaa6 100644 --- a/gcc/jit/internal-api.c +++ b/gcc/jit/internal-api.c @@ -883,10 +883,12 @@ gcc::jit::function:: add_eval (location *loc, rvalue *rvalue) { - gcc_assert (NULL == loc); gcc_assert (rvalue); gcc_assert (m_kind != GCC_JIT_FUNCTION_IMPORTED); + if (loc) + set_tree_location (rvalue->as_tree (), loc); + tsi_link_after (&m_stmt_iter, rvalue->as_tree (), TSI_CONTINUE_LINKING); } @@ -1444,7 +1446,7 @@ handle_locations () /* This covers expressions: */ if (CAN_HAVE_LOCATION_P (t)) SET_EXPR_LOCATION (t, srcloc); - else if (DECL_MINIMAL_CHECK (t)) + else if (CODE_CONTAINS_STRUCT(TREE_CODE(t), TS_DECL_MINIMAL)) DECL_SOURCE_LOCATION (t) = srcloc; else { diff --git a/gcc/jit/libgccjit.h b/gcc/jit/libgccjit.h index f058162..0712533 100644 --- a/gcc/jit/libgccjit.h +++ b/gcc/jit/libgccjit.h @@ -144,8 +144,8 @@ enum gcc_jit_bool_option be able to inspect variables and step through your code. Note that you can't step through code unless you set up source - location information for the code, and that isn't yet supported - in the API. */ + location information for the code (by creating and passing in + gcc_jit_location instances). */ GCC_JIT_BOOL_OPTION_DEBUGINFO, /* If true, gcc_jit_context_compile will dump its initial "tree"