bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] gawk internal error on $i++


From: Ed Morton
Subject: Re: [bug-gawk] gawk internal error on $i++
Date: Mon, 7 Oct 2013 19:13:17 +0000 (UTC)

Sounds good, thanks!


From: "Aharon Robbins" <address@hidden>
To: address@hidden, address@hidden
Sent: Monday, October 7, 2013 2:06:24 PM
Subject: Re: gawk internal error on $i++

Hi Ed.

> Date: Mon, 07 Oct 2013 08:17:48 -0500
> From: Ed Morton <address@hidden>
> To: address@hidden
> CC: Arnold Robbins <address@hidden>
> Subject: gawk internal error on $i++
>
> On cygwin on Windows 7:
>
>     $ awk 'BEGIN{ $i++ = 3; print i }'
>     awk: cmd. line:1: fatal: internal error line 5032, file: awkgram.y
>
>     $ awk --version
>     GNU Awk 4.1.0, API: 1.0 (GNU MPFR 3.1.2, GNU MP 5.1.2)
>
>     $ bash --version
>     GNU bash, version 4.1.11(2)-release (x86_64-unknown-cygwin)

Thanks for the report.

Yes, it's a bug.  The following patch handles this specific case and
also improves the error message for "the next time".

I will push this in the next day or two.

Arnold

------------------------------------------
diff --git a/awkgram.y b/awkgram.y
index f0ff4f0..2cfffae 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -5028,8 +5028,13 @@ mk_assignment(INSTRUCTION *lhs, INSTRUCTION *rhs, INSTRUCTION *op)
         case Op_push_array:
                 tp->opcode = Op_push_lhs;
                 break;
+        case Op_field_assign:
+                yyerror(_("cannot assign a value to the result of a field post-increment _expression_"));
+                break;
         default:
-                cant_happen();
+                fatal(_("internal error: mk_assignment received `%s' opcode"),
+                                opcode2str(tp->opcode));
+                break;
         }
 
         tp->do_reference = (op->opcode != Op_assign);        /* check for uninitialized reference */


reply via email to

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