Bug 194058 - x11-toolkits/qt4-gui: bus error in qt_memfill32_sse2() on 9.3-STABLE i386 triggered by multimedia/vlc
Summary: x11-toolkits/qt4-gui: bus error in qt_memfill32_sse2() on 9.3-STABLE i386 tri...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: i386 Any
: --- Affects Only Me
Assignee: freebsd-kde (group)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-01 07:08 UTC by Arrigo Marchiori
Modified: 2016-01-17 15:20 UTC (History)
3 users (show)

See Also:


Attachments
make.conf (283 bytes, text/plain)
2014-10-01 10:06 UTC, Arrigo Marchiori
no flags Details
Remove pseudo-assembly (609 bytes, patch)
2014-10-07 19:33 UTC, Alonso Schaich
no flags Details | Diff
Build log after disabling all platform-specific optimization (29.05 KB, application/gzip)
2014-10-08 07:38 UTC, Arrigo Marchiori
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Arrigo Marchiori 2014-10-01 07:08:05 UTC
Bus error in x11-toolkits/qt4-gui triggered by
multimedia/vlc. The function that triggers the bus error is
qt_memfill32_sse2() in file painting/qdrawhelper_sse2.cpp:261.

This happens on:
FreeBSD myhost 9.3-STABLE FreeBSD 9.3-STABLE #88 r272279M: Mon Sep 29 09:10:30 CEST 2014     root@myhost:/usr/obj/usr/src/sys/GENERIC  i386
Ports tree at revision 369691
CPU is an AMD Phenom 9550.

I reported this problem on the kde@ mailing list on September 3rd but I received no answer. Since that day, I updated ports and world every week, but the problem is still there.

The following description is from September 3rd, therefore it relates to the qt and vlc ports from that day.

I was trying to start VLC today and it just printed out
"Bus error". I recompiled debug-enabled Qt libraries (core and gui)
and ran VLC through gdb:

Program received signal SIGBUS, Bus error.
[Switching to Thread 2880ac00 (LWP 101319/vlc)]
qt_memfill32_sse2 (dest=0x28999800, value=0, count=784)
    at painting/qdrawhelper_sse2.cpp:261
261         const __m128i value128 = _mm_set_epi32(value, value, value, value);
Current language:  auto; currently c++
(gdb) bt
#0  qt_memfill32_sse2 (dest=0x28999800, value=0, count=784)
    at painting/qdrawhelper_sse2.cpp:261
#1  0x29e46dd0 in qt_memfill<unsigned int> (dest=0x28999800, color=0, 
    count=784) at qdrawhelper_p.h:1846
#2  0x29f988e6 in qt_rectfill<unsigned int> (dest=0x28999800, value=0, x=0, 
    y=0, width=28, height=28, stride=112) at qdrawhelper_p.h:1887
#3  0x29f90d1b in QImage::fill (this=0x2cfd952c, pixel=0)
    at image/qimage.cpp:2009
#4  0x29fce0db in QRasterPixmapData::fill (this=0x2cfd9500, color=@0xbf97be90)
    at image/qpixmap_raster.cpp:266
#5  0x29fb7e86 in QPixmap::fill (this=0xbf97be44, color=@0xbf97be90)
    at image/qpixmap.cpp:1036
#6  0x2e7fb54a in Oxygen::ShadowCache::pixmap () from /usr/local/lib/liboxygenstyle.so.4
[snip]
(gdb) frame 0
#0  qt_memfill32_sse2 (dest=0x28999800, value=0, count=784)
    at painting/qdrawhelper_sse2.cpp:261
261         const __m128i value128 = _mm_set_epi32(value, value,
value, value);
(gdb) list
256         case 12: *dest++ = value; --count;
257         }
258
259         int count128 = count / 4;
260         __m128i *dst128 = reinterpret_cast<__m128i*>(dest);
261         const __m128i value128 = _mm_set_epi32(value, value,
value, value);
262
263         int n = (count128 + 3) / 4;
264         switch (count128 & 0x3) {
265         case 0: do { _mm_stream_si128(dst128++, value128);

dmesg recognizes my CPU as follows: [as of October 1st]

Copyright (c) 1992-2014 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 9.3-STABLE #88 r272279M: Mon Sep 29 09:10:30 CEST 2014
    root@myhost:/usr/obj/usr/src/sys/GENERIC i386
gcc version 4.2.1 20070831 patched [FreeBSD]
CPU: AMD Phenom(tm) 9550 Quad-Core Processor (2200.26-MHz 686-class CPU)
  Origin = "AuthenticAMD"  Id = 0x100f23  Family = 0x10  Model = 0x2  Stepping = 3
  Features=0x178bfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,MMX,FXSR,SSE,SSE2,HTT>
  Features2=0x802009<SSE3,MON,CX16,POPCNT>
  AMD Features=0xee500800<SYSCALL,NX,MMX+,FFXSR,Page1GB,RDTSCP,LM,3DNow!+,3DNow!>
  AMD Features2=0x7ff<LAHF,CMP,SVM,ExtAPIC,CR8,ABM,SSE4A,MAS,Prefetch,OSVW,IBS>
  TSC: P-state invariant
real memory  = 4294967296 (4096 MB)
avail memory = 3137052672 (2991 MB)
Comment 1 Bugzilla Automation freebsd_committer freebsd_triage 2014-10-01 07:08:05 UTC
Maintainers CC'd
Comment 2 Arrigo Marchiori 2014-10-01 10:06:05 UTC
Created attachment 147880 [details]
make.conf

make.conf from my system.
Comment 3 Alonso Schaich freebsd_committer freebsd_triage 2014-10-07 19:33:24 UTC
Created attachment 148078 [details]
Remove pseudo-assembly
Comment 4 Alonso Schaich freebsd_committer freebsd_triage 2014-10-07 19:35:42 UTC
Hi,

can you rebuild your QT4 ports without handwritten platformspecific code and retry?

The attachment to the previous comment is a patch on Mk/bsd.qt.mk of the ports collection that __should__ disable it.
Comment 5 Raphael Kubo da Costa freebsd_committer freebsd_triage 2014-10-07 19:46:02 UTC
This probably fixes it, but disables all the optimizations everywhere. It would be good to know why the autodetection isn't working (I'm assuming some feature that doesn't exist is being used nevertheless).
Comment 6 Arrigo Marchiori 2014-10-08 07:32:28 UTC
Hello,

thank you for your replies!

Alonso, I applied your patch and rebuilt x11-toolkits/qt4-gui.
vlc seems to work flawlessly. I am attaching the build log.

Raphael, I googled "qt_memfill32_sse2()" and found an old bug from 2010 (QTBUG-14272) that blamed gcc for a similar problem.
Do you think I could try using a different compiler other than the default? I am using gcc but I don't know whether the port is using the one in base or from a port.
Do you think this would be a good path to follow? In case, how do I override the compiler for the port?
Comment 7 Arrigo Marchiori 2014-10-08 07:38:16 UTC
Created attachment 148089 [details]
Build log after disabling all platform-specific optimization
Comment 8 Martin Wilke freebsd_committer freebsd_triage 2016-01-17 15:20:52 UTC
problem was solved in 2014.