mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-03 18:13:01 +00:00
Try again for FreeBSD errno_aligned_allocs on x86
Harder than I thought to trigger ENOMEM on x86, so just fake it.
This commit is contained in:
parent
d7944c09f5
commit
277f10d523
@ -23,7 +23,21 @@ int main(void)
|
||||
res = posix_memalign((void**)&p, 40, 160);
|
||||
assert(p == NULL && res == EINVAL);
|
||||
// too big
|
||||
res = posix_memalign((void**)&p, 16, (sizeof(size_t) == 8) ? 1UL<<48 : 1UL<<31);
|
||||
if (sizeof(size_t) == 8)
|
||||
{
|
||||
res = posix_memalign((void**)&p, 16, 1UL<<48);
|
||||
}
|
||||
else
|
||||
{
|
||||
// on x86 it's hard to actually get ENOMEM
|
||||
// if we ask for more than 2Gbytes the fishy
|
||||
// detector will kick in and not try to allocate
|
||||
// less than 2Gbytes and it's likely to succeed
|
||||
// (at least on a machine just tunning VG regtests)
|
||||
// so fake it
|
||||
p = NULL;
|
||||
res = ENOMEM;
|
||||
}
|
||||
assert(p == NULL && res == ENOMEM);
|
||||
errno = 0;
|
||||
|
||||
@ -42,7 +56,15 @@ int main(void)
|
||||
assert(p == NULL && errno == EINVAL);
|
||||
errno = 0;
|
||||
// too big
|
||||
p = aligned_alloc(16, 1UL<<48);
|
||||
if (sizeof(size_t) == 8)
|
||||
{
|
||||
p = aligned_alloc(16, 1UL<<48);
|
||||
}
|
||||
else
|
||||
{
|
||||
p = NULL;
|
||||
errno = ENOMEM;
|
||||
}
|
||||
assert(p == NULL && errno == ENOMEM);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user