[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: The output of gcc_jit_context_dump_to_file() is missing parenthesis in expressions involving casts



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
>