Skip to content

Commit

Permalink
Merge branch 'release/2.0.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
guidotack committed Aug 1, 2015
2 parents d040210 + 6b65a46 commit 26cbf9d
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 11 deletions.
14 changes: 14 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@
# MiniZinc Changelog #
======================

Version 2.0.6
=============

Changes:
- Add parser support for hexadecimal floating point constants.

Bug fixes:
- Fix bounds computation for some calls (abs, int_times).
- Fix flattening of some array declarations (when right hand side is
an identifier).
- Add four missing GC locks (could lead to incorrect garbage collection).
- Compact output model only after optimisation phase (could lead to
incorrect items being removed from output model).

Version 2.0.5
=============

Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ project (libminizinc CXX)
# The version number.
set (libminizinc_VERSION_MAJOR 2)
set (libminizinc_VERSION_MINOR 0)
set (libminizinc_VERSION_PATCH 5)
set (libminizinc_VERSION_PATCH 6)

if (ADDITIONAL_DATE_STRING)
set (libminizinc_VERSION_PATCH "${libminizinc_VERSION_PATCH}.${ADDITIONAL_DATE_STRING}")
Expand Down
5 changes: 0 additions & 5 deletions lib/eval_par.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1684,9 +1684,6 @@ namespace MiniZinc {
_bounds.push_back(Bounds(0,0));
}
} else if (c.id() == "int_times") {
BottomUpIterator<ComputeIntBounds> cbi(*this);
cbi.run(c.args()[0]);
cbi.run(c.args()[1]);
Bounds b1 = _bounds.back(); _bounds.pop_back();
Bounds b0 = _bounds.back(); _bounds.pop_back();
if (!b1.first.isFinite() || !b1.second.isFinite() || !b0.first.isFinite() || !b0.second.isFinite()) {
Expand All @@ -1704,8 +1701,6 @@ namespace MiniZinc {
} else if (c.id() == constants().ids.bool2int) {
_bounds.push_back(Bounds(0,1));
} else if (c.id() == "abs") {
BottomUpIterator<ComputeIntBounds> cbi(*this);
cbi.run(c.args()[0]);
Bounds b0 = _bounds.back();
if (b0.first < 0) {
_bounds.pop_back();
Expand Down
20 changes: 16 additions & 4 deletions lib/flatten.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,13 @@ namespace MiniZinc {

/// Check if \a e is NULL or true
bool istrue(EnvI& env, Expression* e) {
GCLock lock;
return e==NULL || (e->type().ispar() && e->type().isbool()
&& eval_bool(env,e));
}
/// Check if \a e is non-NULL and false
bool isfalse(EnvI& env, Expression* e) {
GCLock lock;
return e!=NULL && e->type().ispar() && e->type().isbool()
&& !eval_bool(env,e);
}
Expand Down Expand Up @@ -2477,7 +2479,7 @@ namespace MiniZinc {
if (vd==NULL) {
vd = flat_exp(env,Ctx(),id->decl(),NULL,constants().var_true).r()->cast<Id>()->decl();
id->decl()->flat(vd);
ArrayLit* al = vd->e()->cast<ArrayLit>();
ArrayLit* al = follow_id(vd->id())->cast<ArrayLit>();
if (al->v().size()==0) {
if (r==NULL)
ret.r = al;
Expand Down Expand Up @@ -3483,7 +3485,12 @@ namespace MiniZinc {
case BOT_IMPL:
{
if (ctx.b==C_ROOT && r==constants().var_true && boe0->type().ispar()) {
if (eval_bool(env,boe0)) {
bool b;
{
GCLock lock;
b = eval_bool(env,boe0);
}
if (b) {
Ctx nctx = ctx;
nctx.neg = negArgs;
nctx.b = negArgs ? C_NEG : C_ROOT;
Expand All @@ -3497,7 +3504,12 @@ namespace MiniZinc {
break;
}
if (ctx.b==C_ROOT && r==constants().var_true && boe1->type().ispar()) {
if (eval_bool(env,boe1)) {
bool b;
{
GCLock lock;
b = eval_bool(env,boe1);
}
if (b) {
Ctx nctx = ctx;
nctx.neg = negArgs;
nctx.b = negArgs ? C_NEG : C_ROOT;
Expand Down Expand Up @@ -5233,7 +5245,6 @@ namespace MiniZinc {
}
}
}
e.output->compact();

for (IdMap<VarOccurrences::Items>::iterator it = e.output_vo._m.begin();
it != e.output_vo._m.end(); ++it) {
Expand Down Expand Up @@ -6153,6 +6164,7 @@ namespace MiniZinc {
}

m->compact();
e.envi().output->compact();

for (IdMap<VarOccurrences::Items>::iterator it = env.vo._m.begin();
it != env.vo._m.end(); ++it) {
Expand Down
10 changes: 9 additions & 1 deletion lib/lexer.lxx
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,15 @@ char* bufferData(void* parm) {
else
return MZN_INVALID_INTEGER_LITERAL;
}
0x[0-9A-Fa-f]+ { beginToken(yyget_extra(yyscanner), yylloc, yytext);

0[xX]([0-9a-fA-F]*\.[0-9a-fA-F]+|[0-9a-fA-F]+\.)([pP][+-]?[0-9]+)|(0[xX][0-9a-fA-F]+[pP][+-]?[0-9]+) { beginToken(yyget_extra(yyscanner), yylloc, yytext);
if (strtofloatval(yytext, yylval->dValue))
return MZN_FLOAT_LITERAL;
else
return MZN_INVALID_FLOAT_LITERAL;
}

0[xX][0-9A-Fa-f]+ { beginToken(yyget_extra(yyscanner), yylloc, yytext);
if (strtointval(yytext, yylval->iValue))
return MZN_INTEGER_LITERAL;
else
Expand Down
1 change: 1 addition & 0 deletions mzn2fzn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ int main(int argc, char** argv) {
std::cerr << " done (" << stoptime(lasttime) << ")" << std::endl;
} else {
env.flat()->compact();
env.output()->compact();
}

if (flag_statistics) {
Expand Down

0 comments on commit 26cbf9d

Please sign in to comment.