Re: memset() bug for 32-bit code with sun4v ?
- From: Dave <foo@xxxxxxx>
- Date: Sat, 18 Jul 2009 16:50:57 +0100
Marc wrote:
On Jul 17, 2:30 am, Dave <f...@xxxxxxx> wrote:Without access to the Solaris 10 source code, it's impossible to know
precisely how the library function memset() is coded.
Actually it should be. You could try something like:
dbx ./someprogramusingmemset
dis -a memset
here it should print the implementation
(I don't currently have access to a solaris to check if the syntax is
exactly this one)
Someone looking at the OpenSolaris code
http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/lib...
believes the memset() function in OpenSolaris for sun4v is ok, but it
unknown to us whether the code in Solaris 10 is the same or not.
The sun4v implementation in opensolaris has /sun4v/ in its path. The
URL above is for the implementation that I think is strange.
I'd be interested if any others could compile this bit of code (check2.c below), which is a modification of a program that Marc wrote and published on the gcc bug database, after this was openened initially as a bug against gcc 4.4.0.
It dumps core on the Sun T5240, but runs fine on my Blade 2000. Sun's compiler will not compile it though.
kirkby@t2:[~] $ gcc -m32 check2.c
kirkby@t2:[~] $ ldd a.out
libc.so.1 => /lib/libc.so.1
libm.so.2 => /lib/libm.so.2
/platform/SUNW,T5240/lib/libc_psr.so.1
kirkby@t2:[~] $ ./a.out
n=0
n=1
Abort (core dumped)
kirkby@t2:[~] $ cat check2.c
#include <stdio.h>
typedef __SIZE_TYPE__ size_t;
extern void *memset (void *, const void *, size_t);
extern void abort (void);
volatile size_t i = 0x80000000U, j = 0x80000000U;
char buf[16];
int main (void)
{
int n;
for (n=0 ; n <=10;++n) {
printf("n=%d\n",n);
if (sizeof (size_t) != 4)
return 0;
buf[n] = 6;
memset (buf+n, 0, i + j);
if (buf[n] != 6)
abort ();
}
return 0;
}
--
I respectfully request that this message is not archived by companies as
unscrupulous as 'Experts Exchange' . In case you are unaware,
'Experts Exchange' take questions posted on the web and try to find
idiots stupid enough to pay for the answers, which were posted freely
by others. They are leeches.
.
- Follow-Ups:
- Re: memset() bug for 32-bit code with sun4v ?
- From: Chris Ridd
- Re: memset() bug for 32-bit code with sun4v ?
- References:
- memset() bug for 32-bit code with sun4v ?
- From: Dave
- Re: memset() bug for 32-bit code with sun4v ?
- From: Marc
- memset() bug for 32-bit code with sun4v ?
- Prev by Date: Re: So where IS it?
- Next by Date: Re: memset() bug for 32-bit code with sun4v ?
- Previous by thread: Re: memset() bug for 32-bit code with sun4v ?
- Next by thread: Re: memset() bug for 32-bit code with sun4v ?
- Index(es):
Relevant Pages
|