fix C code according to pgoodman comments, annotate multi-byte reads
This commit is contained in:
@@ -32,6 +32,8 @@ def main():
|
||||
print "is provided, defaults to last test defined."
|
||||
sys.exit(0)
|
||||
|
||||
parser = argparse.ArgumentParser(description="Intelligently reduce test case")
|
||||
|
||||
args = sys.argv
|
||||
|
||||
try:
|
||||
|
||||
@@ -328,14 +328,14 @@ inline static void ForAll(Closure func) {
|
||||
template <typename... FuncTys>
|
||||
inline static void OneOf(FuncTys&&... funcs) {
|
||||
if (FLAGS_verbose_reads) {
|
||||
printf("DeepState: STARTING OneOf CALL\n");
|
||||
printf("STARTING OneOf CALL\n");
|
||||
}
|
||||
std::function<void(void)> func_arr[sizeof...(FuncTys)] = {funcs...};
|
||||
unsigned index = DeepState_UIntInRange(
|
||||
0U, static_cast<unsigned>(sizeof...(funcs))-1);
|
||||
func_arr[Pump(index, sizeof...(funcs))]();
|
||||
if (FLAGS_verbose_reads) {
|
||||
printf("DeepState: FINISHED OneOf CALL\n");
|
||||
printf("FINISHED OneOf CALL\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+11
-5
@@ -142,7 +142,7 @@ void DeepState_SymbolizeData(void *begin, void *end) {
|
||||
DeepState_Abandon("Read too many symbols");
|
||||
}
|
||||
if (FLAGS_verbose_reads) {
|
||||
printf ("Reading byte at %u\n", DeepState_InputIndex);
|
||||
printf("Reading byte at %u\n", DeepState_InputIndex);
|
||||
}
|
||||
bytes[i] = DeepState_Input[DeepState_InputIndex++];
|
||||
}
|
||||
@@ -221,7 +221,7 @@ int DeepState_Bool(void) {
|
||||
DeepState_Abandon("Read too many symbols");
|
||||
}
|
||||
if (FLAGS_verbose_reads) {
|
||||
printf ("Reading byte as boolean at %u\n", DeepState_InputIndex);
|
||||
printf("Reading byte as boolean at %u\n", DeepState_InputIndex);
|
||||
}
|
||||
return DeepState_Input[DeepState_InputIndex++] & 1;
|
||||
}
|
||||
@@ -232,13 +232,19 @@ int DeepState_Bool(void) {
|
||||
DeepState_Abandon("Read too many symbols"); \
|
||||
} \
|
||||
type val = 0; \
|
||||
if (FLAGS_verbose_reads) { \
|
||||
printf("STARTING MULTI-BYTE READ\n"); \
|
||||
} \
|
||||
_Pragma("unroll") \
|
||||
for (size_t i = 0; i < sizeof(type); ++i) { \
|
||||
if (FLAGS_verbose_reads) { \
|
||||
printf ("Reading byte at %u\n", DeepState_InputIndex); \
|
||||
} \
|
||||
if (FLAGS_verbose_reads) { \
|
||||
printf("Reading byte at %u\n", DeepState_InputIndex); \
|
||||
} \
|
||||
val = (val << 8) | ((type) DeepState_Input[DeepState_InputIndex++]); \
|
||||
} \
|
||||
if (FLAGS_verbose_reads) { \
|
||||
printf("FINISHED MULTI-BYTE READ\n"); \
|
||||
} \
|
||||
return val; \
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user