Your message dated Wed, 11 Sep 2019 06:04:11 +0000
with message-id <[email protected]>
and subject line Bug#939559: fixed in gcc-mingw-w64 21.5
has caused the Debian Bug report #939559,
regarding x86_64-w64-mingw32-g++-win32: program compiled with -march=native 
crashes on same CPU
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
939559: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=939559
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: g++-mingw-w64-x86-64
Version: 8.3.0-19+21.4
Severity: normal
File: /usr/bin/x86_64-w64-mingw32-g++-win32

Dear Maintainer,

I wrote this C++ source code and saved it in `bug.cpp`:

    #include <cstdint>
    #include <cstdio>
    #include <cstdlib>

    typedef int64_t int2  __attribute__ ((vector_size (16)));
    typedef int64_t int4  __attribute__ ((vector_size (32)));
    typedef int64_t int8  __attribute__ ((vector_size (64)));
    typedef int64_t int16 __attribute__ ((vector_size (128)));

    __attribute__ ((noinline))
    bool any(const int64_t &i) {
      return i;
    }

    __attribute__ ((noinline))
    bool any(const int2 &i) {
      return (((i[0] || i[1])));
    }

    __attribute__ ((noinline))
    bool any(const int4 &i) {
      return (((i[0] || i[1]) || (i[2] || i[3])));
    }

    __attribute__ ((noinline))
    bool any(const int8 &i) {
      return (((i[0] || i[1]) || (i[2] || i[3])) ||
             ((i[4] || i[5]) || (i[6] || i[7])));
    }

    __attribute__ ((noinline))
    bool any(const int16 &i) {
      return (((i[0] || i[1]) || (i[2] || i[3])) ||
             ((i[4] || i[5]) || (i[6] || i[7]))) ||
             (((i[8] || i[9]) || (i[10] || i[11])) ||
             ((i[12] || i[13]) || (i[14] || i[15])));
    }

    typedef double double2  __attribute__ ((vector_size (16)));
    typedef double double4  __attribute__ ((vector_size (32)));
    typedef double double8  __attribute__ ((vector_size (64)));
    typedef double double16 __attribute__ ((vector_size (128)));

    template <typename R, typename T>
    __attribute__ ((noinline))
    R broadcast(T x) { return R(x); }

    template <>
    __attribute__ ((noinline))
    double2  broadcast<double2 ,double>(double x) { double2 r = { x, x }; return r; }
    template <>
    __attribute__ ((noinline))
    double4  broadcast<double4 ,double>(double x) { double4 r = { x, x, x, x }; return r; }
    template <>
    __attribute__ ((noinline))
    double8  broadcast<double8 ,double>(double x) { double8 r = { x, x, x, x, x, x, x, x }; return r; }
    template <>
    __attribute__ ((noinline))
    double16 broadcast<double16,double>(double x) { double16 r = { x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x }; return r; }

    int main(int argc, char **argv)
    {
      if (argc > 1)
      {
        int N = atoi(argv[1]);
        switch (N)
        {
          case 1:  { double   x = broadcast<double ,double>(1.0); return any(x != 1.0); }           case 2:  { double2  x = broadcast<double2 ,double>(1.0); return any(x != 1.0); }           case 4:  { double4  x = broadcast<double4 ,double>(1.0); return any(x != 1.0); }           case 8:  { double8  x = broadcast<double8 ,double>(1.0); return any(x != 1.0); }           case 16: { double16 x = broadcast<double16,double>(1.0); return any(x != 1.0); }
        }
      }
      return 1;
    }

I compiled it like this:

    $ x86_64-w64-mingw32-g++ bug.cpp -march=native -O3
    bug.cpp: In function ‘R broadcast(T) [with R = __vector(8) double; T = double]’:     bug.cpp:56:45: warning: AVX512F vector return without AVX512F enabled changes the ABI [-Wpsabi]      double8  broadcast<double8 ,double>(double x) { double8  r = { x, x, x, x, x, x, x, x }; return r; }
                                                 ^

I ran it on the same host like this, and it crashed:

    $ ./a.exe 4
    wine: Unhandled page fault on read access to 0xffffffffffffffff at address 0x4016a8 (thread 002a), starting debugger...
    002c:fixme:dbghelp:elf_search_auxv can't find symbol in module
    002c:fixme:dbghelp:elf_search_auxv can't find symbol in module
    002c:fixme:dbghelp:elf_search_auxv can't find symbol in module
    002c:fixme:dbghelp:elf_search_auxv can't find symbol in module
    002c:fixme:dbghelp:elf_search_auxv can't find symbol in module
    Unhandled exception: page fault on read access to 0xffffffffffffffff in 64-bit code (0x00000000004016a8).
    002c:fixme:dbghelp:elf_search_auxv can't find symbol in module
    002c:fixme:dbghelp:interpret_function_table_entry PUSH_MACHFRAME 6
    Register dump:
     rip:00000000004016a8 rsp:000000000032f928 rbp:00000000004619e0 eflags:00010203 (  R- --  I   - - -C)      rax:000000000032fa10 rbx:000000000032fa80 rcx:000000000032fa10 rdx:0000000000405000      rsi:0000000000000002 rdi:00000000004619e0 r8:00000000ffffffd0  r9:0000000000000000 r10:0000000000000002      r11:0000000000461a68 r12:0000000000000018 r13:0000000000000010 r14:0000000000000000 r15:0000000000000000
    Stack dump:
    0x000000000032f928:  00000000004031e8 0000000000000000
    0x000000000032f938:  0000000000000000 0000000000000000
    0x000000000032f948:  0000000000000000 0000000000202020
    0x000000000032f958:  0000000020000000 0000000000ffffff
    0x000000000032f968:  ffffffff00ffffff 0000000000202020
    0x000000000032f978:  0000000000000000 0000000000000000
    0x000000000032f988:  0000000000000000 0000000000000000
    0x000000000032f998:  0000000000000000 0000000000000000
    0x000000000032f9a8:  0000000000000000 0000000000000000
    0x000000000032f9b8:  0000000000000000 0000000000000000
    0x000000000032f9c8:  0000000000000000 0000000000000000
    0x000000000032f9d8:  0000000000000000 0000000000000000
    Backtrace:
    =>0 0x00000000004016a8 in a (+0x16a8) (0x00000000004619e0)
      1 0x00000000004031e8 in a (+0x31e7) (0x00000000004619e0)
    0x00000000004016a8: ldsl    %ebp,%edi
    Modules:
    Module    Address                    Debug info    Name (20 modules)
    PE              400000-          458000    Dwarf           a
    ELF            7b400000-        7b831000    Deferred kernel32<elf>
      \-PE            7b420000-        7b831000    \ kernel32
    ELF            7bc00000-        7bd2c000    Deferred ntdll<elf>
      \-PE            7bc20000-        7bd2c000    \ ntdll
    ELF            7c000000-        7c005000    Deferred <wine-loader>
    ELF        7f8e5120b000-    7f8e51239000    Deferred libtinfo.so.6
    ELF        7f8e51239000-    7f8e51262000    Deferred libncurses.so.6
    ELF        7f8e51362000-    7f8e51445000    Deferred msvcrt<elf>
      \-PE        7f8e51380000-    7f8e51445000    \ msvcrt
    ELF        7f8e51445000-    7f8e5145a000    Deferred libnss_files.so.2
    ELF        7f8e5145a000-    7f8e51473000    Deferred libnsl.so.1
    ELF        7f8e51473000-    7f8e51480000    Deferred libnss_nis.so.2
    ELF        7f8e51480000-    7f8e5148b000    Deferred libnss_compat.so.2
    ELF        7f8e51970000-    7f8e5198a000    Deferred libgcc_s.so.1
    ELF        7f8e5198a000-    7f8e51b0d000    Deferred libm.so.6
    ELF        7f8e51b0f000-    7f8e51b14000    Deferred libdl.so.2
    ELF        7f8e51b14000-    7f8e51cd5000    Deferred libc.so.6
    ELF        7f8e51cd5000-    7f8e51cf6000    Deferred libpthread.so.0
    ELF        7f8e51edf000-    7f8e51f09000    Deferred ld-linux-x86-64.so.2
    Threads:
    process  tid      prio (all id:s are in hex)
    0000000e services.exe
      00000020    0
      0000001b    0
      00000015    0
      00000014    0
      00000013    0
      00000010    0
      0000000f    0
    00000011 winedevice.exe
      00000018    0
      00000017    0
      00000016    0
      00000012    0
    00000019 plugplay.exe
      0000001d    0
      0000001c    0
      0000001a    0
    0000001e winedevice.exe
      00000025    0
      00000022    0
      00000021    0
      0000001f    0
    00000023 explorer.exe
      00000028    0
      00000027    0
      00000026    0
      00000024    0
    00000029 (D) Z:\home\claude\a.exe
      0000002a    0 <==
    System information:
        Wine build: wine-4.0 (Debian 4.0-2)
        Platform: x86_64
        Version: Windows 7
        Host system: Linux
        Host version: 4.19.0-5-amd64

Running it with other arguments does not crash.

I expect a program compiled with -march=native to work on the machine
on which it was compiled.

This seems to be a mingw issue (or possibly a wine issue, also occurs with
wine-development), as compiling with regular x86-64 g++ does not exhibit
the problem.

    $ g++ --version
    g++ (Debian 8.3.0-6) 8.3.0
    Copyright (C) 2018 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions. There is NO     warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    $ apt-cache policy g++
    g++:
      Installed: 4:8.3.0-1
      Candidate: 4:8.3.0-1
      Version table:
         4:9.2.1-3 500
            500 http://ftp.uk.debian.org/debian unstable/main amd64 Packages
     *** 4:8.3.0-1 990
            990 http://ftp.uk.debian.org/debian buster/main amd64 Packages
            100 /var/lib/dpkg/status
    $ apt-cache policy wine
    wine:
      Installed: 4.0-2
      Candidate: 4.0-2
      Version table:
         4.0.2-1 500
            500 http://ftp.uk.debian.org/debian unstable/main amd64 Packages
            500 http://ftp.uk.debian.org/debian unstable/main i386 Packages
     *** 4.0-2 990
            990 http://ftp.uk.debian.org/debian buster/main amd64 Packages
            990 http://ftp.uk.debian.org/debian buster/main i386 Packages
            100 /var/lib/dpkg/status
    $ apt-cache policy wine-development
    wine-development:
      Installed: 4.7-1
      Candidate: 4.7-1
      Version table:
     *** 4.7-1 500
            500 http://ftp.uk.debian.org/debian unstable/main amd64 Packages
            500 http://ftp.uk.debian.org/debian unstable/main i386 Packages
            100 /var/lib/dpkg/status
         4.2-4 990
            990 http://ftp.uk.debian.org/debian buster/main amd64 Packages
            990 http://ftp.uk.debian.org/debian buster/main i386 Packages

Here's my CPU:

    $ cat /proc/cpuinfo
    processor    : 0
    vendor_id    : AuthenticAMD
    cpu family    : 23
    model        : 8
    model name    : AMD Ryzen 7 2700X Eight-Core Processor
    stepping    : 2
    microcode    : 0x800820b
    cpu MHz        : 1985.533
    cache size    : 512 KB
    physical id    : 0
    siblings    : 16
    core id        : 0
    cpu cores    : 8
    apicid        : 0
    initial apicid    : 0
    fpu        : yes
    fpu_exception    : yes
    cpuid level    : 13
    wp        : yes
    flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb hw_pstate sme ssbd sev ibpb vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt sha_ni xsaveopt xsavec xgetbv1 xsaves clzero irperf xsaveerptr arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif overflow_recov succor smca     bugs        : sysret_ss_attrs null_seg spectre_v1 spectre_v2 spec_store_bypass
    bogomips    : 7399.05
    TLB size    : 2560 4K pages
    clflush size    : 64
    cache_alignment    : 64
    address sizes    : 43 bits physical, 48 bits virtual
    power management: ts ttp tm hwpstate cpb eff_freq_ro [13] [14]
    [snip 15 more instances]

Thanks,


Claude


-- System Information:
Debian Release: 10.0
  APT prefers stable
  APT policy: (990, 'stable'), (500, 'stable-debug'), (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.19.0-5-amd64 (SMP w/16 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE=en_GB:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages g++-mingw-w64-x86-64 depends on:
ii  gcc-mingw-w64-base    8.3.0-19+21.4
ii  gcc-mingw-w64-x86-64  8.3.0-19+21.4
ii  libc6                 2.28-10
ii  libgcc1               1:8.3.0-6
ii  libgmp10              2:6.1.2+dfsg-4
ii  libisl19              0.20-2
ii  libmpc3               1.1.0-1
ii  libmpfr6              4.0.2-1
ii  libstdc++6            8.3.0-6
ii  zlib1g                1:1.2.11.dfsg-1

g++-mingw-w64-x86-64 recommends no packages.

Versions of packages g++-mingw-w64-x86-64 suggests:
pn  gcc-8-locales  <none>

-- no debconf information

--- End Message ---
--- Begin Message ---
Source: gcc-mingw-w64
Source-Version: 21.5

We believe that the bug you reported is fixed in the latest version of
gcc-mingw-w64, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Stephen Kitt <[email protected]> (supplier of updated gcc-mingw-w64 package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Wed, 11 Sep 2019 07:39:39 +0200
Source: gcc-mingw-w64
Architecture: source
Version: 21.5
Distribution: unstable
Urgency: medium
Maintainer: Stephen Kitt <[email protected]>
Changed-By: Stephen Kitt <[email protected]>
Closes: 939559
Changes:
 gcc-mingw-w64 (21.5) unstable; urgency=medium
 .
   * Use unaligned VMOV instructions to avoid crashes caused by mis-aligned
     values; thanks to Claude Heiland-Allen for the patch! Closes: #939559.
   * Standards-Version 4.4.0, no change required.
Checksums-Sha1:
 9d98c20e3973d3177278fc7f6f5be18d170ed748 3440 gcc-mingw-w64_21.5.dsc
 a9071040b094e316c0dd0abbdefd118adaa3e5b8 58240 gcc-mingw-w64_21.5.tar.xz
 24ca6f38bc7b90ad0e99c795e5b90dd2b8bda1b8 7263 
gcc-mingw-w64_21.5_source.buildinfo
Checksums-Sha256:
 e9c7aa5b03dc43a6786f10a1db7ef5c6756547579a66ba572ff830d161f6e59c 3440 
gcc-mingw-w64_21.5.dsc
 626d95c51d35a2e3ec57d7c2ec8779ce160850311826018551817e960e14db28 58240 
gcc-mingw-w64_21.5.tar.xz
 e50e76d372d3c6c9a8316ef10502ff0feb22b6a6ee87ea8fdc9860095afc43da 7263 
gcc-mingw-w64_21.5_source.buildinfo
Files:
 00035b8766dc01a1912dd50e6fb63fe6 3440 devel optional gcc-mingw-w64_21.5.dsc
 0c097bec648c2d01ea0332d77cd72cf8 58240 devel optional gcc-mingw-w64_21.5.tar.xz
 6ae9cb27831ed6c1ed7a5725b0a8fd83 7263 devel optional 
gcc-mingw-w64_21.5_source.buildinfo

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEnPVX/hPLkMoq7x0ggNMC9Yhtg5wFAl14iLUACgkQgNMC9Yht
g5zdQQ/9EuQMAH9dRYaSdznvnRJj6SBuKtHPa/y9uPhwQwjUAsC7x9yGzaKDGmCB
TmxYUZ2kkBwJ13Pnd0BTnsmP1d0JVTwVfGQjlPwdE2O90sYJdxqOx/AFIOOnE669
rXKDI/2pzkDII6AXelqq07DYI1SCjXbhKayqtadIK5j/CvaO/zuO8q0b70uuJ4dW
CvOqpU0qMhXi6OCOp0s4Eou+WvqF3tyUl2Ggjm+ymVNKR8CLeuRKfhUZO/amfnUQ
yHLk12cFNMdXl6pM/mYnCI9hBFFrEa5xQv4krurwCtZVJ6GK/oLa7oOVC4QvbJHg
uBmcW0X2G2sqgM7g5m59pq0tdbh9uw+Yj2f5Jo/TAOuoJwdagex0Nie3Uuc/5MlR
aA7/dqyTFjAamHhWfWdkVvAgw8qSvvjHOlRdZ9fNBOBoLyFJeTb+CESbR1REpUwi
srj5tBT89C7CIwOouNI79gyiE57AU0RzRWp6U668ju6tM38RhG6TqxydSuaGk7sx
Zw2otwsDZ8TjxJbubaWMMh2PwsZrTtik9R7RNjpHqA3Iem1s1E5yuP+eC3yV+nPD
Z1AQWPvcWDdO6I2nDglA7qDQoayfhXr8oGxxEaS1inrjdzt2uxfNh5VBrSiVOe9E
tLV6cQ4nwxQLpuOOAOr6e+1/aWr6bzcKMMBNCRwZYQRjtTphyqM=
=fAls
-----END PGP SIGNATURE-----

--- End Message ---

Reply via email to