bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] pretty-print eats parentheses (3)


From: Hermann Peifer
Subject: Re: [bug-gawk] pretty-print eats parentheses (3)
Date: Thu, 22 Jun 2017 18:51:44 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

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
>> }
>>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]