After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 615998 - GOOM plugin crashes on Solaris when built with MMX code enabled
GOOM plugin crashes on Solaris when built with MMX code enabled
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
0.10.21
Other Solaris
: Normal blocker
: 0.10.22
Assigned To: Brian Cameron
GStreamer Maintainers
: 563350 622067 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2010-04-16 21:22 UTC by Brian Cameron
Modified: 2010-07-02 19:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch fixing problem (440 bytes, application/octet-stream)
2010-04-16 21:22 UTC, Brian Cameron
  Details
patch which applies against head (407 bytes, patch)
2010-04-16 21:40 UTC, Brian Cameron
committed Details | Review

Description Brian Cameron 2010-04-16 21:22:03 UTC
Created attachment 158924 [details]
patch fixing problem

The GOOM plugin crashes on Solaris when you build it with MMX mode enabled.
I filed a bug against the Sun Studio compiler about this and they informed me that
the problem is a bug in the assembly code.

Here is the comment from the engineer on the Sun Studio team who looked into this:

Actually the problem is not in our compiler. 
goom.c contains wrong code (in aten this problem is masked by differences in the registers allocation):
...
170     __asm__ __volatile__ ("#2 \n\t psrld $4, %%mm0" "#2 \n\t psrld $4, %%mm1"   /* PERTEDEC = $4 */
171         "#4 \n\t movd %%mm1,%%eax"
172         "#3 \n\t movq %%mm3,%%mm5"
173         "#4 \n\t mull %[prevX]"
174         "#4 \n\t movd %%mm0,%%esi"
175         "#3 \n\t punpcklbw %%mm5, %%mm3"
176         "#4 \n\t addl %%esi, %%eax"
177         "#3 \n\t movq %%mm3, %%mm4"
178         "#3 \n\t movq %%mm3, %%mm5"
179         "#4 \n\t movl %[expix1], %%esi"
180         "#3 \n\t punpcklbw %%mm5, %%mm3"
181         "#4 \n\t movq (%%esi,%%eax,4),%%mm0"
182         "#3 \n\t punpckhbw %%mm5, %%mm4"
183         "#4 \n\t addl %[prevX],%%eax"
184         "#4 \n\t movq (%%esi,%%eax,4),%%mm2"::[expix1] "g" (expix1)
185         ,[prevX] "g" (prevX)
186         :"eax", "esi");
...

See at line 173: instruction 'mull' change %edx so '%edx' should be mentioned in the clobber list. 

Updated goom.c is compilled/executed successfully:
[as158432@int4-sol3 tests]$ cat -n 1.c|sed -n '170,186 p'
   170	    __asm__ __volatile__ ("#2 \n\t psrld $4, %%mm0" "#2 \n\t psrld $4, %%mm1"   /* PERTEDEC = $4 */
   171	        "#4 \n\t movd %%mm1,%%eax"
   172	        "#3 \n\t movq %%mm3,%%mm5"
   173	        "#4 \n\t mull %[prevX]"
   174	        "#4 \n\t movd %%mm0,%%esi"
   175	        "#3 \n\t punpcklbw %%mm5, %%mm3"
   176	        "#4 \n\t addl %%esi, %%eax"
   177	        "#3 \n\t movq %%mm3, %%mm4"
   178	        "#3 \n\t movq %%mm3, %%mm5"
   179	        "#4 \n\t movl %[expix1], %%esi"
   180	        "#3 \n\t punpcklbw %%mm5, %%mm3"
   181	        "#4 \n\t movq (%%esi,%%eax,4),%%mm0"
   182	        "#3 \n\t punpckhbw %%mm5, %%mm4"
   183	        "#4 \n\t addl %[prevX],%%eax"
   184	        "#4 \n\t movq (%%esi,%%eax,4),%%mm2"::[expix1] "g" (expix1)
   185	        ,[prevX] "g" (prevX)
   186	        :"eax", "esi", "edx");

Sure enough, fixing the code with the attached patch fixes the problem
Comment 1 Brian Cameron 2010-04-16 21:40:06 UTC
Created attachment 158926 [details] [review]
patch which applies against head

Here is an updated patch which applies against the latest code.
Comment 2 Sebastian Dröge (slomo) 2010-04-17 08:33:21 UTC
Comment on attachment 158926 [details] [review]
patch which applies against head

Looks good and should go into next pre-release.
Comment 3 Tim-Philipp Müller 2010-04-17 09:29:01 UTC
commit f3c032e6ac1e5fd05b8c51b4258396417d6d6e56
Author: Brian Cameron <brian.cameron@oracle.com>
Date:   Sat Apr 17 10:06:41 2010 +0100

    goom: add edx to clobber list in inline assembly code
    
    mull modifies %edx, so should be mentioned in clobber list.
    Fixes crash on Solaris (#615998).
Comment 4 Tim-Philipp Müller 2010-04-29 09:16:26 UTC
*** Bug 563350 has been marked as a duplicate of this bug. ***
Comment 5 Philip Withnall 2010-06-19 12:26:15 UTC
*** Bug 622067 has been marked as a duplicate of this bug. ***