Skip to content

Commit ad5757b

Browse files
committed
Fix #845: incorrect function arguments in fuser_mqubit.h
CodeQL scans flagged lines like this in file `lib/fuser_mqubit.h`: ```c++ IO::messagef(" gates are fused into %lu gates\n", stat.num_fused_gates); ``` The CodeQL warning is: > Each call to the printf function or a related function should include the type and sequence of arguments defined by the format. If the function is passed arguments of a different type or in a different sequence then the arguments are reinterpreted to fit the type and sequence expected, resulting in unpredictable behavior.
1 parent 7932f78 commit ad5757b

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

lib/fuser_mqubit.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,15 +1007,15 @@ class MultiQubitGateFuser final : public Fuser<IO, Gate> {
10071007
if (verbosity < 3) return;
10081008

10091009
if (stat.num_controlled_gates > 0) {
1010-
IO::messagef("%lu controlled gates\n", stat.num_controlled_gates);
1010+
IO::messagef("%u controlled gates\n", stat.num_controlled_gates);
10111011
}
10121012

10131013
if (stat.num_mea_gates > 0) {
1014-
IO::messagef("%lu measurement gates", stat.num_mea_gates);
1014+
IO::messagef("%u measurement gates", stat.num_mea_gates);
10151015
if (stat.num_fused_mea_gates == stat.num_mea_gates) {
10161016
IO::messagef("\n");
10171017
} else {
1018-
IO::messagef(" are fused into %lu gates\n", stat.num_fused_mea_gates);
1018+
IO::messagef(" are fused into %u gates\n", stat.num_fused_mea_gates);
10191019
}
10201020
}
10211021

@@ -1031,7 +1031,7 @@ class MultiQubitGateFuser final : public Fuser<IO, Gate> {
10311031
}
10321032
}
10331033

1034-
IO::messagef(" gates are fused into %lu gates\n", stat.num_fused_gates);
1034+
IO::messagef(" gates are fused into %u gates\n", stat.num_fused_gates);
10351035

10361036
if (verbosity < 5) return;
10371037

0 commit comments

Comments
 (0)