Version: 3.6.0-r11050 (using KDE 4.4.0) Compiler: gcc-4.4.3 OS: Linux Installed from: Gentoo Packages On my AMD Phenom X4 9600 and Phenom II X4 945, if Qt 4.5 or 4.6 (didn't try with Qt-4.4) is build with glib support, I can't valgrind any kde4 app. If Qt is build without glib support everything works fine. vex amd64->IR: unhandled instruction bytes: 0xF3 0x48 0xF 0xBD 0xFF 0xB0 Process terminating with default action of signal 4 (SIGILL) Illegal opcode at address 0xD513BCA at 0xD513BCA: T.128 (gutils.h:358) by 0xD513C84: slab_allocator_alloc_chunk (gslice.c:1005) by 0xD514D22: g_slice_alloc (gslice.c:661) by 0xD4D189C: g_array_sized_new (garray.c:87) by 0xD520228: g_static_private_set (gthread.c:451) by 0xD4DF46A: g_get_filename_charsets (gconvert.c:1199) by 0xD4DF4ED: _g_convert_thread_init (gconvert.c:1304) by 0xD520499: g_thread_init_glib (gthread.c:165) by 0x887787E: QEventDispatcherGlibPrivate::QEventDispatcherGlibPrivate(_GMainContext*) (qeventdispatcher_glib.cpp:297) by 0x9281F8E: QGuiEventDispatcherGlibPrivate::QGuiEventDispatcherGlibPrivate() (qguieventdispatcher_glib.cpp:171) by 0x928207E: QGuiEventDispatcherGlib::QGuiEventDispatcherGlib(QObject*) (qguieventdispatcher_glib.cpp:186) by 0x92484D2: QApplicationPrivate::createEventDispatcher() (qapplication_x11.cpp:596) CFLAGS="-march=amdfam10 -O2 -pipe -fomit-frame-pointer -g" CHOST="x86_64-pc-linux-gnu" valgrind-svn-r11050
gutils.h:358 is ((GLIB_SIZEOF_LONG * 8 - 1) ^ __builtin_clzl(number)) + 1 : 1; guess it is a problem with __builtin_clzl(number)) and how gcc/AMD handles it?
I build a small standalone testcase inline int number(unsigned long a) { return true ? ((8 * 8 - 1) ^ __builtin_clzl(a)) + 1 : 1; } but valgrind works fine there, so I guess it is not __builtin_clzl
There's no need for lots of complicated diagnostics - the error message is sufficient to tell us what needs to be done. The instruction here (after prefixed are removed) is 0x0F 0xBD which decodes as: BSR Gv, Ev We do have support for that instruction, but we reject it if it has an F3 prefix like this one does. As far as I can see in the instruction set manual it is indeed invalid to have a repeat prefix like F3 on this instruction.
Sorry but I don't see why F3 prefix is invalid in this case maybe I interpreted it wrong but according too http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/24594.pdf page 183 (LZCNT Count Leading Zeros) Everything seems to be fine
I was using too old a copy of the manual, which means that must be a fairly new instruction. The description also clearly says: "Software MUST check the CPUID bit once per program or library initialization before using the LZCNT instruction, or inconsistent behavior may result. Which your program presumably isn't don't as valgrind will not be asserting that bit in the CPUID flags. The reason that it's not safe to use without checking the CPU is that on old processors the F3 prefix was probably ignored, so the instruction would execute as BSR rather than faulting if run on an old processor.
*** This bug has been marked as a duplicate of bug 212335 ***