spurious memory access error using localtime(), SunStudio 12, Solaris 10 x8
The following code:
#include <stdio.h>
#include <sys/types.h>
#include <time.h>
int
main()
{
time_t t = time(NULL);
struct tm *ptm = localtime(&t);
printf("hours = %d\n", ptm->tm_hour);
}
produces the following error:
(dbx) check -access
access checking - ON
(dbx) run
Running: testtime
(process id 8489)
Reading rtcapihook.so
Reading libdl.so.1
Reading rtcaudit.so
Reading libmapmalloc.so.1
Reading libgen.so.1
Reading libm.so.2
Reading rtcboot.so
Reading librtc.so
RTC: Enabling Error Checking...
RTC: Running program...
Reading disasm.so
Read from unallocated (rua):
Attempting to read 4 bytes at address 0xfefc0208
stopped in main at line 11 in file "testtime.c"
11printf("hours = %d\n", ptm->tm_hour);
(dbx)
I *think* my code is valid and this is a bug in the memory checking tool. I am using Solaris 10 x86 on an Ultra 20 and Sun Studio 12 FCS. A related (old) thread is:
http://forum.java.sun.com/thread.jspa?threadID=5072458
Thanks!
Jordan

