This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch] Bug 88521 - gcc 9.0 from r266355 miscompile x265 for mingw-w64 target


W dniu 20.12.2018 o 09:12, Lokesh Janghel pisze:
> Hi Mateuszb,
> 
> I tested with your proposition patch and it is working right.
> I also added the patch with test case.
> Please let me know your thoughts/suggestions.
> 
> 
> Thanks
> Lokesh
 
Patch looks good to me, thanks!

On 64-bit target we should be OK.

We could take a look on 32-bit target.
I've attached patch that do the same for 32- and 64-bit targets.
Sample result:
$ cat t.cpp
float fun1(void)
{
    return 4.14f;
}

typedef struct {float x;} Float;

Float fun2(void)
{
    Float v;
    v.x = 4.14f;
    return v;
}

double fun3(void)
{
    return 3.13;
}

typedef struct {double x;} Double;

Double fun4(void)
{
    Double v;
    v.x = 3.13;
    return v;
}
Mateusz@Mateusz-i7 /c/temp
$ g++ -c -Wall -O2 -o t.o t.cpp

Mateusz@Mateusz-i7 /c/temp
$ objdump -dr t.o

t.o:     file format pe-x86-64


Disassembly of section .text:

0000000000000000 <_Z4fun1v>:
   0:   f3 0f 10 05 00 00 00    movss  0x0(%rip),%xmm0        # 8 <_Z4fun1v+0x8>
   7:   00
                        4: R_X86_64_PC32        .rdata
   8:   c3                      retq
   9:   0f 1f 80 00 00 00 00    nopl   0x0(%rax)

0000000000000010 <_Z4fun2v>:
  10:   8b 05 00 00 00 00       mov    0x0(%rip),%eax        # 16 <_Z4fun2v+0x6>
                        12: R_X86_64_PC32       .rdata
  16:   c3                      retq
  17:   66 0f 1f 84 00 00 00    nopw   0x0(%rax,%rax,1)
  1e:   00 00

0000000000000020 <_Z4fun3v>:
  20:   f2 0f 10 05 08 00 00    movsd  0x8(%rip),%xmm0        # 30 <_Z4fun4v>
  27:   00
                        24: R_X86_64_PC32       .rdata
  28:   c3                      retq
  29:   0f 1f 80 00 00 00 00    nopl   0x0(%rax)

0000000000000030 <_Z4fun4v>:
  30:   48 8b 05 08 00 00 00    mov    0x8(%rip),%rax        # 3f <_Z4fun4v+0xf>
                        33: R_X86_64_PC32       .rdata
  37:   c3                      retq
  38:   90                      nop
  39:   90                      nop
  3a:   90                      nop
  3b:   90                      nop
  3c:   90                      nop
  3d:   90                      nop
  3e:   90                      nop
  3f:   90                      nop

Mateusz@Mateusz-i7 /c/temp
$ m32- 900

Mateusz@Mateusz-i7 /c/temp
$ g++ -c -Wall -O2 -o t32.o t.cpp

Mateusz@Mateusz-i7 /c/temp
$ objdump -dr t32.o

t32.o:     file format pe-i386


Disassembly of section .text:

00000000 <__Z4fun1v>:
   0:   d9 05 00 00 00 00       flds   0x0
                        2: dir32        .rdata
   6:   c3                      ret
   7:   8d b4 26 00 00 00 00    lea    0x0(%esi,%eiz,1),%esi
   e:   66 90                   xchg   %ax,%ax

00000010 <__Z4fun2v>:
  10:   a1 00 00 00 00          mov    0x0,%eax
                        11: dir32       .rdata
  15:   c3                      ret
  16:   8d b4 26 00 00 00 00    lea    0x0(%esi,%eiz,1),%esi
  1d:   8d 76 00                lea    0x0(%esi),%esi

00000020 <__Z4fun3v>:
  20:   dd 05 08 00 00 00       fldl   0x8
                        22: dir32       .rdata
  26:   c3                      ret
  27:   8d b4 26 00 00 00 00    lea    0x0(%esi,%eiz,1),%esi
  2e:   66 90                   xchg   %ax,%ax

00000030 <__Z4fun4v>:
  30:   b8 0a d7 a3 70          mov    $0x70a3d70a,%eax
  35:   ba 3d 0a 09 40          mov    $0x40090a3d,%edx
  3a:   c3                      ret
  3b:   90                      nop
  3c:   90                      nop
  3d:   90                      nop
  3e:   90                      nop
  3f:   90                      nop

Attachment: gcc-9-32.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]