https://bugs.kde.org/show_bug.cgi?id=272940 Summary: valgrind refuses to work with memalign() on for large align requests Product: valgrind Version: unspecified Platform: Unlisted Binaries OS/Version: Linux Status: NEW Severity: normal Priority: NOR Component: memcheck AssignedTo: jseward@acm.org ReportedBy: madcoder@debian.org edmonds@chase{0}:~/code/test$ cat memalign.c #include #define size (1 << 21) int main(void) { void *ptr; posix_memalign(&ptr, size, size); free(ptr); return 0; } edmonds@chase{0}:~/code/test$ gcc -O0 -ggdb -Wall -o memalign memalign.c edmonds@chase{0}:~/code/test$ valgrind ./memalign ==31507== Memcheck, a memory error detector. ==31507== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al. ==31507== Using LibVEX rev 1854, a library for dynamic binary translation. ==31507== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP. ==31507== Using valgrind-3.3.1-Debian, a dynamic binary instrumentation framework. ==31507== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al. ==31507== For more details, rerun with: -v ==31507== VG_(arena_memalign)(0x3879AB60, 2097152, 2097152) bad alignment valgrind: the 'impossible' happened: VG_(arena_memalign) ==31507== at 0x380194CC: report_and_quit (m_libcassert.c:140) ==31507== by 0x380195E4: panic (m_libcassert.c:210) ==31507== by 0x38019652: vgPlain_core_panic_at (m_libcassert.c:215) ==31507== by 0x38019671: vgPlain_core_panic (m_libcassert.c:220) ==31507== by 0x380228BE: vgPlain_arena_memalign (m_mallocfree.c:1392) ==31507== by 0x38002909: vgMemCheck_new_block (mc_malloc_wrappers.c:195) ==31507== by 0x38002BEA: vgMemCheck_memalign (mc_malloc_wrappers.c:259) ==31507== by 0x38033F08: vgPlain_scheduler (scheduler.c:1277) ==31507== by 0x380448D3: run_a_thread_NORETURN (syswrap-linux.c:89) sched status: running_tid=1 Thread 1: status = VgTs_Runnable ==31507== at 0x4C1FFCF: memalign (vg_replace_malloc.c:460) ==31507== by 0x4C20068: posix_memalign (vg_replace_malloc.c:569) ==31507== by 0x400536: main (memalign.c:7) Note: see also the FAQ.txt in the source distribution. It contains workarounds to several common problems. If that doesn't help, please report this bug to: www.valgrind.org In the bug report, send all the above text, the valgrind version, and what Linux distro you are using. Thanks. edmonds@chase{1}:~/code/test$ there is a check in coregrind/m_mallocfree.c:1385 which reads, // Check that the requested alignment seems reasonable; that is, is // a power of 2. if (req_alignB < VG_MIN_MALLOC_SZB || req_alignB > 1048576 || VG_(log2)( req_alignB ) == -1 /* not a power of 2 */) { VG_(printf)("VG_(arena_memalign)(%p, %lu, %lu)\nbad alignment", a, req_alignB, req_pszB ); VG_(core_panic)("VG_(arena_memalign)"); /*NOTREACHED*/ } the comment or the code is wrong, as there are certainly powers of 2 larger than 1048576. This is Debian bug #489297 (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=489297) -- Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.