When compiling hackbench.c , I got the warning message:
---------------
$ ./testcases/kernel/sched/cfs-scheduler$ make
cc -I../../../../include -Wall    hackbench.c  -L../../../../lib -lltp
-lpthread -o hackbench
hackbench.c: In function ‘main’:
hackbench.c:350: warning: control reaches end of non-void function
--------------

That means the hackbench would return a  random number. I tested it on some
different versions of GCC and got the non-zero return value.
--------------
# gcc -v
Reading specs from /usr/lib/gcc/ppc64-redhat-linux/3.4.6/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-java-awt=gtk
--host=ppc64-redhat-linux --build=ppc64-redhat-linux
--target=ppc64-redhat-linux --with-cpu=default32
Thread model: posix
gcc version 3.4.6 20060404 (Red Hat 3.4.6-10)
# cd ltp-full-20080731.orig/testcases/kernel/sched/cfs-scheduler
# make
cc -I../../../../include -Wall    hackbench.c  -L../../../../lib -lltp
-lpthread -o hackbench
hackbench.c: In function `main':
hackbench.c:350: warning: control reaches end of non-void function
# ./hackbench
Running with 10*40 (== 400) tasks.
# echo $?
231
# ./hackbench
Running with 10*40 (== 400) tasks.
# echo $?
124
# ./hackbench
Running with 10*40 (== 400) tasks.
# echo $?
215


$ gcc -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--with-gxx-include-dir=/usr/include/c++/4.2 --program-suffix=-4.2
--enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc
--enable-mpfr --enable-targets=all --enable-checking=release
--build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.2.3 (Ubuntu 4.2.3-2ubuntu7)
$ cd testcases/kernel/sched/cfs-schedule/
$ make
cc -I../../../../include -Wall    hackbench.c  -L../../../../lib -lltp
-lpthread -o hackbench
hackbench.c: In function ‘main’:
hackbench.c:350: warning: control reaches end of non-void function
$ ./hackbench
Running with 10*40 (== 400) tasks.
$ echo $?
72
$ ./hackbench
Running with 10*40 (== 400) tasks.
$ echo $?
57
$ ./hackbench
Running with 10*40 (== 400) tasks.
$ echo $?
31
-----------------

A simple patch can avoid this problem.

Signed-off-by: Jin Bing Guo <[EMAIL PROTECTED]>
----------
--- ltp-full-20080731.orig/testcases/kernel/sched/cfs-scheduler/hackbench.c
2008-07-21 06:18:06.000000000 -0500
+++ ltp-full-20080731/testcases/kernel/sched/cfs-scheduler/hackbench.c
2008-08-13 03:40:01.000000000 -0500
@@ -347,4 +347,7 @@ int main(int argc, char *argv[])

      /* Print time... */
      timersub(&stop, &start, &diff);
+     printf("Time: %lu.%03lu\n", diff.tv_sec, diff.tv_usec/1000);
+     exit(0);
+
 }



Best regards!

Jin Bing Guo  郭晋兵

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to