propagate the 'inexact' flag on when initializing a constant

This commit is contained in:
Wolfgang Bumiller 2014-05-24 17:51:26 +02:00
parent 68c2baa7c1
commit 536138273f

View file

@ -5842,7 +5842,6 @@ skipvar:
else
{
var->hasvalue = true;
var->inexact = ((ast_value*)cexp)->inexact;
if (cval->expression.vtype == TYPE_STRING)
var->constval.vstring = parser_strdup(cval->constval.vstring);
else if (cval->expression.vtype == TYPE_FIELD)
@ -5873,6 +5872,14 @@ skipvar:
vec_free(sy.argc);
var->cvq = cvq;
}
/* a constant initialized to an inexact value should be marked inexact:
* const float x = <inexact>; should propagate the inexact flag
*/
if (var->cvq == CV_CONST && var->expression.vtype == TYPE_FLOAT) {
cval = (ast_value*)cexp;
if (ast_istype(cexp, ast_value) && cval->hasvalue && cval->cvq == CV_CONST)
var->inexact = cval->inexact;
}
}
another: