https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65028

--- Comment #13 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Jan Hubicka from comment #12)
> I agree it is probably differnt issue, but lets see. It would help if you
> can look at the backtract and see if there is a problem between
> local/non-local calling conventions.  I.e. function called with parameters
> passed on stack and consuming them in registers.

X32 passes parameters in registers, just like x86-64.  I got

(gdb) disass
Dump of assembler code for function operator*(ggSpectrum const&, ggSpectrum
const&):
   0x00420780 <+0>:    movups (%esi),%xmm0
   0x00420784 <+4>:    mov    %rdi,%rax
   0x00420787 <+7>:    movups 0x10(%esi),%xmm1
=> 0x0042078c <+12>:    mulps  (%edx),%xmm0
                                ^^^^^ It isn't aligned to 32 bytes.
   0x00420790 <+16>:    mulps  0x10(%edx),%xmm1
   0x00420795 <+21>:    movups %xmm0,(%edi)
   0x00420799 <+25>:    movups %xmm1,0x10(%edi)
   0x0042079e <+30>:    retq   
End of assembler dump.
(gdb) p/x $edx
$2 = 0xffffcc48
(gdb) f 1
#1  0x004452d4 in __base_ctor  (v=..., z=..., y=..., x=..., bPrimary=..., 
    gPrimary=..., rPrimary=..., this=0xffffbf60) at ./ggPhotometer.h:53
53                      colorMatrix[0][0] = (cieX * rPrimary).area();
(gdb) p cieX
$3 = {data = {0.146008939, 0.279831082, 0.0505069345, 0.202513069, 
    0.729846954, 0.957131386, 0.414069265, 0.0614523999}}
(gdb) p rPrimary
$4 = (const struct ggSpectrum &) @0xffffcc48: {data = {0, 0, 0, 0, 
    0.0899555609, 0.550044477, 0.959999979, 1}}
(gdb) ...
   0x004452c4 <+1620>:    mov    (%esp),%rdx
   0x004452c9 <+1625>:    mov    %r15,%rsi
   0x004452cc <+1628>:    mov    %r14,%rdi
   0x004452cf <+1631>:    callq  0x420780 <operator*(ggSpectrum const&,
ggSpectrum const&)>
=> 0x004452d4 <+1636>:    mov    %r14,%rdi
...
Breakpoint 1, 0x004452cf in __base_ctor  (v=..., z=..., y=..., x=..., 
    bPrimary=..., gPrimary=..., rPrimary=..., this=0xffffbf60)
    at ./ggPhotometer.h:53
53                      colorMatrix[0][0] = (cieX * rPrimary).area();
(gdb) p/x $rdi
$6 = 0xffffbf40
(gdb) p/x $rsi
$7 = 0xffffbfa8
(gdb) p/x $rdx
$8 = 0xffffcc48
(gdb) p this
$9 = (struct ggPhotometer * const) 0xffffbf60
(gdb) p &cieX
$10 = (struct ggSpectrum *) 0xffffbfa8
(gdb) p/x &rPrimary
$11 = 0xffffcc48
(gdb) p/x $pc
$13 = 0x4452cf
(gdb) p rPrimary
$1 = (const struct ggSpectrum &) @0xffffcc48: {data = {0, 0, 0, 0, 
    0.0899555609, 0.550044477, 0.959999979, 1}}
(gdb) 

Why do we think rPrimary is 16-byte aligned when it is only 8-byte aligned?

Reply via email to