[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-gawk] pretty-print eats parentheses (3)
From: |
Hermann Peifer |
Subject: |
[bug-gawk] pretty-print eats parentheses (3) |
Date: |
Tue, 20 Jun 2017 19:36:51 +0200 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 |
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
}
- [bug-gawk] pretty-print eats parentheses (3),
Hermann Peifer <=