From: Clifford Wolf Date: Sat, 6 Aug 2016 11:16:23 +0000 (+0200) Subject: Fixed bug in parsing real constants X-Git-Tag: yosys-0.7~154 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7f755dec75824e27dd79173a76d5819bf7fdbd27;p=yosys.git Fixed bug in parsing real constants --- diff --git a/frontends/verilog/verilog_parser.y b/frontends/verilog/verilog_parser.y index c2327011f..7b025db23 100644 --- a/frontends/verilog/verilog_parser.y +++ b/frontends/verilog/verilog_parser.y @@ -1378,10 +1378,10 @@ basic_expr: } | TOK_REALVAL { $$ = new AstNode(AST_REALVALUE); - char *p = strdup($1->c_str()), *q; - for (int i = 0, j = 0; !p[j]; j++) - if (p[j] != '_') - p[i++] = p[j], p[i] = 0; + char *p = (char*)malloc(GetSize(*$1) + 1), *q; + for (int i = 0, j = 0; j < GetSize(*$1); j++) + if ((*$1)[j] != '_') + p[i++] = (*$1)[j], p[i] = 0; $$->realvalue = strtod(p, &q); log_assert(*q == 0); delete $1;