<html>
    <head>
      <base href="https://bugzilla.libav.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - misaligned stack on i386-netbsd"
   href="https://bugzilla.libav.org/show_bug.cgi?id=1119">1119</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>misaligned stack on i386-netbsd
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Libav
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>git HEAD
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>BSD
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>minor
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>---
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>general
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>bugzilla@libav.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>michael.kostylev@gmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=710" name="attach_710" title="proposed patch">attachment 710</a> <a href="attachment.cgi?id=710&action=edit" title="proposed patch">[details]</a></span>
proposed patch

Something similar to 847190ebd99ffd57dc89bd568a33bf2d5c424129
could be done for NetBSD too, but even the gcc builds suffer from misaligned
stack there. A dump from 2016-10:

% gdb --args /home/mik/src/fate/32/tests/checkasm/checkasm
...
Program received signal SIGSEGV, Segmentation fault.
ff_h264_idct8_add_10_sse2 () at
/home/mik/src/fate/src/libavcodec/x86/h264_idct_10bit.asm:546
546     IDCT8_ADD
(gdb) bt
#0  ff_h264_idct8_add_10_sse2 () at
/home/mik/src/fate/src/libavcodec/x86/h264_idct_10bit.asm:546
#1  0x00000008 in ?? ()
#2  0xfbd16040 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
(gdb) disas $pc-32,$pc+32
Dump of assembler code from 0x818e56a to 0x818e5aa:
   0x0818e56a <ff_h264_idct8_add_10_sse2+346>:  punpckhdq %xmm7,%xmm1
   0x0818e56e <ff_h264_idct8_add_10_sse2+350>:  movdqa %xmm0,%xmm7
   0x0818e572 <ff_h264_idct8_add_10_sse2+354>:  punpcklqdq %xmm3,%xmm0
   0x0818e576 <ff_h264_idct8_add_10_sse2+358>:  punpckhqdq %xmm3,%xmm7
   0x0818e57a <ff_h264_idct8_add_10_sse2+362>:  movdqa %xmm5,%xmm3
   0x0818e57e <ff_h264_idct8_add_10_sse2+366>:  punpcklqdq %xmm1,%xmm5
   0x0818e582 <ff_h264_idct8_add_10_sse2+370>:  punpckhqdq %xmm1,%xmm3
   0x0818e586 <ff_h264_idct8_add_10_sse2+374>:  movdqa (%ecx),%xmm1
=> 0x0818e58a <ff_h264_idct8_add_10_sse2+378>:  movdqa %xmm0,(%esp)
   0x0818e58f <ff_h264_idct8_add_10_sse2+383>:  movdqa %xmm7,0x20(%esp)
   0x0818e595 <ff_h264_idct8_add_10_sse2+389>:  movdqa %xmm5,0x40(%esp)
   0x0818e59b <ff_h264_idct8_add_10_sse2+395>:  movdqa %xmm3,0x60(%esp)
   0x0818e5a1 <ff_h264_idct8_add_10_sse2+401>:  movdqa %xmm6,%xmm3
   0x0818e5a5 <ff_h264_idct8_add_10_sse2+405>:  punpckldq %xmm2,%xmm6
   0x0818e5a9 <ff_h264_idct8_add_10_sse2+409>:  punpckhdq %xmm2,%xmm3
End of assembler dump.
(gdb) info registers
eax            0xffffd700       -10496
ecx            0xffffd9a0       -9824
edx            0x10     16
ebx            0x6549315c       1699295580
esp            0xffffd2ec       0xffffd2ec
ebp            0x33627ba7       0x33627ba7
esi            0xe02f3e23       -533774813
edi            0xb78d0d1d       -1215492835
eip            0x818e58a        0x818e58a <ff_h264_idct8_add_10_sse2+378>
eflags         0x10286  [ PF SF IF RF ]
cs             0x37     55
ss             0x4f     79
ds             0x4f     79
es             0x4f     79
fs             0x4f     79
gs             0x8b     139

The attached patch, for example, makes the x86_32-netbsd-gcc config
green and drastically reduces error count in x86_32-netbsd-clang:

gmake: *** [fate-filter-drawbox] Error 1
gmake: *** [fate-lavr-mix-q15-7-1] Error 1
gmake: *** [fate-lavr-resample-s32p-2626-8000] Error 1
gmake: *** [fate-lavr-resample-s32p-2626-44100] Error 1
gmake: *** [fate-lavr-resample-s32p-2626-48000] Error 1
gmake: *** [fate-lavr-resample-s32p-2626-96000] Error 1
gmake: *** [fate-lavr-resample-s32p-8000-2626] Error 1
gmake: *** [fate-lavr-resample-s32p-44100-2626] Error 1
gmake: *** [fate-lavr-resample-s32p-44100-8000] Error 1
gmake: *** [fate-lavr-resample-s32p-48000-2626] Error 1
gmake: *** [fate-lavr-resample-s32p-96000-2626] Error 1
gmake: *** [fate-lavr-resample-s32p-96000-8000] Error 1</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are watching all bug changes.</li>
      </ul>
    </body>
</html>