[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] gawk/master doesn't print when profiling
From: |
arnold |
Subject: |
Re: [bug-gawk] gawk/master doesn't print when profiling |
Date: |
Wed, 13 Feb 2019 02:37:10 -0700 |
User-agent: |
Heirloom mailx 12.5 7/5/10 |
Hi.
Hermann Peifer <address@hidden> wrote:
> Hi again,
>
> I noticed some strange print behaviour when processing the attached
> file. It looks to me that the print failure is somehow related to the
> combination of processing CR line terminators and using "-p". See below.
> I can't reproduce the issue with Gawk 4.2.1.
This was a subtle bug! Very good catch! Keep up the good work. :-)
Here's the fix. I will get it into git later.
Thanks,
Arnold
----------------------------------------------------------
diff --git a/awkgram.y b/awkgram.y
index 720efcee..9f2b4d3c 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -1190,8 +1190,10 @@ simple_stmt
*/
regular_print:
if ($4 == NULL) { /* no redirection */
- if ($3 == NULL) { /* printf without arg */
+ if ($3 == NULL) { /* print/printf without
arg */
$1->expr_count = 0;
+ if ($1->opcode == Op_K_print)
+ $1->opcode = Op_K_print_rec;
$1->redir_type = redirect_none;
$$ = list_create($1);
} else {
@@ -1208,6 +1210,8 @@ regular_print:
bcfree(ip);
if ($3 == NULL) {
$1->expr_count = 0;
+ if ($1->opcode == Op_K_print)
+ $1->opcode = Op_K_print_rec;
$$ = list_append($4, $1);
} else {
INSTRUCTION *t = $3;