Skip to content

basic_string: construction from null is not valid crash with -O2 and --input-from-stdin #1007

@compumike

Description

@compumike

I'm experiencing a crash that happens on -O2 or higher when used with a model file on the command line plus --input-from-stdin for a data file.

./minizinc -O2 --input-from-stdin aust_with_data.mzn <aust_with_data.dzn ; echo $?
basic_string: construction from null is not valid
1

./minizinc -O2 --input-from-stdin aust_with_data.mzn aust_with_data.dzn </dev/null ; echo $?
wa=3     nt=2    sa=1
q=3      nsw=2   v=3
t=1
----------
0

./minizinc -O2 aust_with_data.mzn aust_with_data.dzn ; echo $?
wa=3     nt=2    sa=1
q=3      nsw=2   v=3
t=1
----------
0

Workaround

My workaround is to write my data to a temporary .dzn file, rather than using --input-with-stdin.

MiniZinc version

Same crash happens when using MiniZincIDE-2.9.5-x86_64.AppImage MiniZincIDE-build2394518486-x86_64.AppImage. Linux. ./minizinc is symlinked to the AppImage, which is chmod a+x executable.

Test files

aust_with_data.mzn:

% Colouring Australia using nc colours
int: nc;

var 1..nc: wa;   var 1..nc: nt;  var 1..nc: sa;   var 1..nc: q;
var 1..nc: nsw;  var 1..nc: v;   var 1..nc: t;

constraint wa != nt;
constraint wa != sa;
constraint nt != sa;
constraint nt != q;
constraint sa != q;
constraint sa != nsw;
constraint sa != v;
constraint q != nsw;
constraint nsw != v;
solve satisfy;

output ["wa=\(wa)\t nt=\(nt)\t sa=\(sa)\n",
        "q=\(q)\t nsw=\(nsw)\t v=\(v)\n",
         "t=", show(t),  "\n"];

aust_with_data.dzn:

nc = 3;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions