FULL PRODUCT VERSION : java version "1.6.0-rc" Java(TM) SE Runtime Environment (build 1.6.0-rc-b90) Java HotSpot(TM) Client VM (build 1.6.0-rc-b90, mixed mode, sharing) ADDITIONAL OS VERSION INFORMATION : Any Solaris A DESCRIPTION OF THE PROBLEM : hotspot/src/os/solaris/vm/os_solaris.cpp contains this: jlong os::javaTimeMillis() { timeval t; static const char* aNull = 0; if (gettimeofday( &t, &aNull) == -1) Two similar calls can be found in hotspot/src/os/solaris/vm/hpi_solaris.hpp. The second argument to gettimeofday() call should be NULL or a "struct timezone *". What is being passed is "&aNull", i.e. a pointer to a char*. Notice carefully: a NULL is not being passed, but rather a pointer to a variable that contains NULL. Should be aNull or more simply NULL. As "struct timezone" contains two "int"s (= 8 bytes) and a pointer to a "char*" (= 4 bytes) is passed this is working by sheer luck. I guess the compiler happens to align the stack in such a way that there is extra 4 bytes of space in just the right place. Or maybe the timeval and timezone structs end up partly overlapping. I'm amazed System.currentTimeMillis() isn't dumping core. REPRODUCIBILITY : This bug can be reproduced always.
|