From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11442 invoked by alias); 16 Jun 2015 18:29:53 -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 11426 invoked by uid 89); 16 Jun 2015 18:29:52 -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=-1.7 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=no version=3.3.2 X-Spam-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=no 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: <1434478939.14663.42.camel@surprise> Subject: Re: The output of gcc_jit_context_dump_to_file() is missing parenthesis in expressions involving casts From: David Malcolm To: Dibyendu Majumdar Cc: jit@gcc.gnu.org Date: Thu, 01 Jan 2015 00:00:00 -0000 In-Reply-To: <1434478556.14663.39.camel@surprise> References: <1434328937.3192.21.camel@surprise> <1434478556.14663.39.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.23 X-SW-Source: 2015-q2/txt/msg00082.txt.bz2 On Tue, 2015-06-16 at 14:15 -0400, David Malcolm wrote: > On Sun, 2015-06-14 at 20:42 -0400, David Malcolm wrote: > > On Sun, 2015-06-14 at 20:11 +0100, Dibyendu Majumdar wrote: > > > It seems that in some cases the output is not showing parenthesis > > > where it should. > > > > Yes, this is a bug. > > > > The dumping fns are somewhat hacky; they have no concept of C precedence > > order, and are probably misleading on some expressions. Sorry. > > > > I've filed it as: > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66539 > > (snip) > > This should be fixed now for gcc trunk (for GCC 6) as of r224531; > gcc_jit_get_debug_string should now add parentheses where needed, > mimicking C's precedence order. FWIW, in particular, my testcase for the debug string of a chain of derefs with a cast inside them emits this: "((struct node *)ptr->next)->next" (see gcc/testsuite/jit.dg/test-debug-strings.c). > If after updating to r224531 you still see any expressions where it gets > it wrong, please let me know. > > Dave >