This is the mail archive of the gcc-bugs@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]

[Bug c/88352] New: x86 mingw returning struct with just double in ST0 instead of edx:eax


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

            Bug ID: 88352
           Summary: x86 mingw returning struct  with just double in ST0
                    instead of edx:eax
           Product: gcc
           Version: 7.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jay.krell at cornell dot edu
  Target Milestone: ---

typedef struct { double d; } Struct;
typedef union { double d; } Union;

Struct f1 ()
{ 
const Struct res = {3.0};
return res;
}

Union f2 ()
{
const Union res = {3.0};
return res;
}

Result "should" be in edx:eax to match Visual C++ but first is in ST0.

Shown here with an older version but also seen in 7.3.

$ cat 1.c
typedef struct { double d; } Struct;
typedef union { double d; } Union;

Struct f1 ()
{ 
const Struct res = {3.0};
return res;
}

Union f2 ()
{
const Union res = {3.0};
return res;
}

$ /usr/local/bin/i686-w64-mingw32-gcc -c -S -v 1.c -O2
Using built-in specs.
COLLECT_GCC=/usr/local/bin/i686-w64-mingw32-gcc
Target: i686-w64-mingw32
Configured with: ../configure --target=i686-w64-mingw32
--prefix=/usr/local/Cellar/mingw-w64/5.0.4_1/toolchain-i686
--with-bugurl=https://github.com/Homebrew/homebrew-core/issues
--enable-languages=c,c++,fortran
--with-ld=/usr/local/Cellar/mingw-w64/5.0.4_1/toolchain-i686/bin/i686-w64-mingw32-ld
--with-as=/usr/local/Cellar/mingw-w64/5.0.4_1/toolchain-i686/bin/i686-w64-mingw32-as
--with-gmp=/usr/local/opt/gmp --with-mpfr=/usr/local/opt/mpfr
--with-mpc=/usr/local/opt/libmpc --with-isl=/usr/local/opt/isl
--disable-multilib --enable-threads=posix
Thread model: posix
gcc version 8.2.0 (GCC) 
COLLECT_GCC_OPTIONS='-c' '-S' '-v' '-O2' '-mtune=generic' '-march=pentiumpro'

/usr/local/Cellar/mingw-w64/5.0.4_1/toolchain-i686/libexec/gcc/i686-w64-mingw32/8.2.0/cc1
-quiet -v -D_REENTRANT 1.c -quiet -dumpbase 1.c -mtune=generic
-march=pentiumpro -auxbase 1 -O2 -version -o 1.s
GNU C17 (GCC) version 8.2.0 (i686-w64-mingw32)
        compiled by GNU C version 4.2.1 Compatible Apple LLVM 9.1.0
(clang-902.0.39.2), GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0,
isl version isl-0.20-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory
"/usr/local/Cellar/mingw-w64/5.0.4_1/toolchain-i686/lib/gcc/i686-w64-mingw32/8.2.0/../../../../i686-w64-mingw32/sys-include"
#include "..." search starts here:
#include <...> search starts here:

/usr/local/Cellar/mingw-w64/5.0.4_1/toolchain-i686/lib/gcc/i686-w64-mingw32/8.2.0/include

/usr/local/Cellar/mingw-w64/5.0.4_1/toolchain-i686/lib/gcc/i686-w64-mingw32/8.2.0/include-fixed

/usr/local/Cellar/mingw-w64/5.0.4_1/toolchain-i686/lib/gcc/i686-w64-mingw32/8.2.0/../../../../i686-w64-mingw32/include
End of search list.
GNU C17 (GCC) version 8.2.0 (i686-w64-mingw32)
        compiled by GNU C version 4.2.1 Compatible Apple LLVM 9.1.0
(clang-902.0.39.2), GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0,
isl version isl-0.20-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 3686321321bbed62b5f333879ede45a4
COMPILER_PATH=/usr/local/Cellar/mingw-w64/5.0.4_1/toolchain-i686/libexec/gcc/i686-w64-mingw32/8.2.0/:/usr/local/Cellar/mingw-w64/5.0.4_1/toolchain-i686/libexec/gcc/i686-w64-mingw32/8.2.0/:/usr/local/Cellar/mingw-w64/5.0.4_1/toolchain-i686/libexec/gcc/i686-w64-mingw32/:/usr/local/Cellar/mingw-w64/5.0.4_1/toolchain-i686/lib/gcc/i686-w64-mingw32/8.2.0/:/usr/local/Cellar/mingw-w64/5.0.4_1/toolchain-i686/lib/gcc/i686-w64-mingw32/:/usr/local/Cellar/mingw-w64/5.0.4_1/toolchain-i686/lib/gcc/i686-w64-mingw32/8.2.0/../../../../i686-w64-mingw32/bin/
LIBRARY_PATH=/usr/local/Cellar/mingw-w64/5.0.4_1/toolchain-i686/lib/gcc/i686-w64-mingw32/8.2.0/:/usr/local/Cellar/mingw-w64/5.0.4_1/toolchain-i686/lib/gcc/i686-w64-mingw32/8.2.0/../../../../i686-w64-mingw32/lib/../lib/:/usr/local/Cellar/mingw-w64/5.0.4_1/toolchain-i686/lib/gcc/i686-w64-mingw32/8.2.0/../../../../i686-w64-mingw32/lib/
COLLECT_GCC_OPTIONS='-c' '-S' '-v' '-O2' '-mtune=generic' '-march=pentiumpro'
HB30-VM-Eklavya:mono4 jay$ cat 1.s
        .file   "1.c"
        .text
        .p2align 4,,15
        .globl  _f1
        .def    _f1;    .scl    2;      .type   32;     .endef
_f1:
        flds    LC0
        ret
        .p2align 4,,15
        .globl  _f2
        .def    _f2;    .scl    2;      .type   32;     .endef
_f2:
        xorl    %eax, %eax
        movl    $1074266112, %edx
        ret
        .section .rdata,"dr"
        .align 4
LC0:
        .long   1077936128
        .ident  "GCC: (GNU) 8.2.0"

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