[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: strtonum(<num>) (rather than "<num>") causes internal error
From: |
Aharon Robbins |
Subject: |
Re: strtonum(<num>) (rather than "<num>") causes internal error |
Date: |
Thu, 5 Jun 2003 12:04:10 +0300 |
> To: address@hidden
> Subject: strtonum(<num>) (rather than "<num>") causes internal error
> From: James Troup <address@hidden>
> Date: Wed, 04 Jun 2003 17:45:22 +0100
>
> Hi Aharon,
>
> This bug report comes from the Debian bug tracking system. You can
> view the full log at:
>
> http://bugs.debian.org/159279
>
> | $ gawk 'BEGIN {print strtonum("13")};'
> | 13
> | $ gawk 'BEGIN {print strtonum(13)};'
> | gawk: cmd. line:1: fatal error: internal error
> | zsh: abort ./gawk 'BEGIN {print strtonum(13)};'
>
> This is a regression; 3.1.0 prints '13' for both versions of
> strtonum. 3.1.1 and up to 3.1.2d abort as above.
> --
> James
Thanks. I dunno how this broke. Here's a patch.
Arnold
-------------------- cut here ----------------------
Thu Jun 5 12:01:41 2003 Arnold D. Robbins <address@hidden>
* builtin.c (do_strtonum): Make `strtonum(13)' work.
--- ../gawk-3.1.2/builtin.c 2003-02-28 11:04:08.000000000 +0200
+++ builtin.c 2003-06-05 12:00:51.000000000 +0300
@@ -2572,7 +2607,9 @@
tmp = tree_eval(tree->lnode);
- if (isnondecimal(tmp->stptr))
+ if ((tmp->flags & (NUMBER|NUMCUR)) != 0)
+ d = (double) force_number(tmp);
+ else if (isnondecimal(tmp->stptr))
d = nondec2awknum(tmp->stptr, tmp->stlen);
else
d = (double) force_number(tmp);