mirror of
https://github.com/kdlucas/byte-unixbench.git
synced 2026-08-04 03:03:29 +08:00
Fix printf format mismatch for unsigned long variables
Use %lu instead of %ld for unsigned long iteration counters in report() functions. Using %ld for unsigned long is undefined behavior per the C standard. Affected files: arith.c, dhry_1.c, hanoi.c, pipe.c, syscall.c
This commit is contained in:
@@ -40,7 +40,7 @@ volatile unsigned long iter;
|
||||
/* this function is called when the alarm expires */
|
||||
void report()
|
||||
{
|
||||
fprintf(stderr,"COUNT|%ld|1|lps\n", iter);
|
||||
fprintf(stderr,"COUNT|%lu|1|lps\n", iter);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ volatile unsigned long Run_Index;
|
||||
|
||||
void report()
|
||||
{
|
||||
fprintf(stderr,"COUNT|%ld|1|lps\n", Run_Index);
|
||||
fprintf(stderr,"COUNT|%lu|1|lps\n", Run_Index);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ long cnt;
|
||||
|
||||
void report()
|
||||
{
|
||||
fprintf(stderr,"COUNT|%ld|1|lps\n", iter);
|
||||
fprintf(stderr,"COUNT|%lu|1|lps\n", iter);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ unsigned long iter;
|
||||
|
||||
void report()
|
||||
{
|
||||
fprintf(stderr,"COUNT|%ld|1|lps\n", iter);
|
||||
fprintf(stderr,"COUNT|%lu|1|lps\n", iter);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ unsigned long iter;
|
||||
|
||||
void report()
|
||||
{
|
||||
fprintf(stderr,"COUNT|%ld|1|lps\n", iter);
|
||||
fprintf(stderr,"COUNT|%lu|1|lps\n", iter);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user