bug-gnu-utils
[Top][All Lists]
Advanced

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

bug fix for for loops with null bodies


From: Aharon Robbins
Subject: bug fix for for loops with null bodies
Date: Wed, 11 Oct 2000 22:15:01 +0200

> Date: Fri, 6 Oct 2000 09:24:03 -0600 (MDT)
> From: "Nelson H. F. Beebe" <address@hidden>
> To: address@hidden
> Cc: address@hidden
> Subject: gawk-3.0.6: fatal error: internal error
> 
> I just uncovered an error in gawk-3.0.6, installed here on
> 11-Sep-2000.
> 
> I've been able to reduce it to a simple program for you:
> 
> % cat foo.awk
> {
>     for (printer in Min_Count)
>         ;
>     print "# University of Utah Department of Mathematics"
> }
> 
> % /local/build/gawk-3.0.6/gawk -f foo.awk /dev/null
> gawk: foo.awk:4: fatal error: internal error
> Abort (core dumped)
> 
> % gdb /local/build/gawk-3.0.6/gawk
> GNU gdb 5.0
> Copyright 2000 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and you are
> welcome to change it and/or distribute copies of it under certain conditions.
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB.  Type "show warranty" for details.
> This GDB was configured as "sparc-sun-solaris2.7"...
> (gdb) run -f foo.awk /dev/null
> Starting program: /local/build/gawk-3.0.6/gawk -f foo.awk /dev/null
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x2edb0 in yyparse () at ./awk.y:401
> 401                     if ($8->type == Node_K_delete
> (gdb) where
> #0  0x2edb0 in yyparse () at ./awk.y:401
> #1  0x2a2d4 in main (argc=4, argv=0xffbee9bc) at main.c:380

This is indeed a bug. Apply the following patch.

Thanks,

Arnold
-------------------------------------------------------------------------
*** ../gawk-3.0.6/awk.y Sun Jul 16 18:29:50 2000
--- awk.y       Wed Oct 11 22:10:47 2000
***************
*** 398,404 ****
                 * Check that the body is a `delete a[i]' statement,
                 * and that both the loop var and array names match.
                 */
!               if ($8->type == Node_K_delete
                    && $8->rnode != NULL
                    && strcmp($3, $8->rnode->var_value->vname) == 0
                    && strcmp($5, $8->lnode->vname) == 0) {
--- 398,404 ----
                 * Check that the body is a `delete a[i]' statement,
                 * and that both the loop var and array names match.
                 */
!               if ($8 != NULL && $8->type == Node_K_delete
                    && $8->rnode != NULL
                    && strcmp($3, $8->rnode->var_value->vname) == 0
                    && strcmp($5, $8->lnode->vname) == 0) {
--
Aharon (Arnold) Robbins --- Pioneer Consulting Ltd.     address@hidden
P.O. Box 354            Home Phone: +972  8 979-0381    Fax: +1 603 761-6761
Nof Ayalon              Cell Phone: +972 51  297-545    (See www.efax.com)
D.N. Shimshon 99785     Laundry increases exponentially in the
ISRAEL                  number of children. -- Miriam Robbins




reply via email to

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