[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] pretty-print eats parentheses (3)
From: |
arnold |
Subject: |
Re: [bug-gawk] pretty-print eats parentheses (3) |
Date: |
Thu, 22 Jun 2017 12:58:54 -0600 |
User-agent: |
Heirloom mailx 12.4 7/29/08 |
Thanks. I'll look at that, although I think I have a fundamental fix
about ready to push.
Arnold
Hermann Peifer <address@hidden> wrote:
> On 20.06.17 19:56, address@hidden wrote:
> > Well, that's an interesting one. I'll look into it.
> >
> > Thanks,
> >
> > Arnold
>
> I noted that the sample code works fine in gawk-4.0, so I started git
> bisect which tells me:
>
> 0737d543cbf09f9142cc67db052d6d40f178560b is the first bad commit
> commit 0737d543cbf09f9142cc67db052d6d40f178560b
> Author: Arnold D. Robbins <address@hidden>
> Date: Thu May 30 21:05:38 2013 +0300
>
> More fixes in profiler.
>
> >
> > Hermann Peifer <address@hidden> wrote:
> >
> >> Hi,
> >>
> >> I just noted a case where original and pretty-printed
> >> code have different calculation results, see the sample
> >> code below. I remember having reported similar issues earlier,
> >> e.g. http://lists.gnu.org/archive/html/bug-gawk/2014-11/msg00006.html. I
> >> guess it is tricky to get these parentheses exactly right.
> >>
> >> Hermann
> >>
> >> # Sample code: so far, so good
> >> $ gawk 'BEGIN{ print 10 - (1 + 3 * 3) }'
> >> 0
> >>
> >> # Pretty-printed code gets to a different result
> >> $ gawk -o 'BEGIN{ print 10 - (1 + 3 * 3) }' && gawk -f awkprof.out
> >> 18
> >>
> >> $ cat awkprof.out
> >> BEGIN {
> >> print 10 - 1 + 3 * 3
> >> }
> >>