Repository: bitcoin/bitcoin (language: cpp)

Issue:
Cross-compiled `bitcoind -signet` silently fails on Windows
The issue was [discovered](https://github.com/bitcoin/bitcoin/issues/24501#issuecomment-1079738588) during 23.0rc2 testing.

MSVC build works flawlessly.

`bitcoind -testnet` also works flawlessly.


Discussion / hints:
22.0 also works fine?
I (assume) I've reproduced this, running the rc2 binaries under wine. Took a number of start / restarts:
```bash
wine bitcoin-23.0rc2/bin/bitcoind.exe -signet -debug
...
2022-03-31T18:57:44Z UpdateTip: new best=000000dfd1fdd9d0220de57bceadfdd23693706212e7a498c13adc121e622f2d height=18741 version=0x20000000 log2_work=37.707765 tx=19169 date='2021-01-01T22:47:33Z' progress=0.011334 cache=0.0MiB(213txo)
2022-03-31T18:57:44Z   - Connect postprocess: 31.87ms [3.63s (17.34ms/blk)]
2022-03-31T18:57:44Z - Connect block: 57.01ms [10.20s (48.82ms/blk)]
2022-03-31T18:57:44Z Enqueuing BlockConnected: block hash=000000dfd1fdd9d0220de57bceadfdd23693706212e7a498c13adc121e622f2d block height=18741
2022-03-31T18:57:44Z Enqueuing UpdatedBlockTip: new block hash=000000dfd1fdd9d0220de57bceadfdd23693706212e7a498c13adc121e622f2d fork block hash=0000005337a12c725465d0fca9bcaaba37bd9ba56b38d6f86ea90148cc89f8fd (in IBD=true)
2022-03-31T18:57:44Z BlockConnected: block hash=000000dfd1fdd9d0220de57bceadfdd23693706212e7a498c13adc121e622f2d block height=18741
2022-03-31T18:57:44Z Enter: lock contention cs_main, net_processing.cpp:1552 started
2022-03-31T18:57:44Z   - Load block from disk: 2.25ms [0.13s]
2022-03-31T18:57:44Z     - Sanity checks: 0.24ms [0.05s (0.22ms/blk)]
2022-03-31T18:57:44Z     - Fork checks: 11.90ms [0.79s (3.77ms/blk)]
2022-03-31T18:57:44Z       - Connect 1 transactions: 1.79ms (1.793ms/tx, 0.000ms/txin) [0.59s (2.83ms/blk)]
2022-03-31T18:57:44Z     - Verify 0 txins: 4.56ms (0.000ms/txin) [1.35s (6.41ms/blk)]
2022-03-31T18:57:44Z     - Index writing: 3.14ms [0.71s (3.40ms/blk)]
2022-03-31T18:57:44Z BlockChecked: block hash=0000014ccc0ceec3f77c3afd3186431f42615d5f8b34f21ebffee7193ce54552 state=Valid
2022-03-31T18:57:44Z   - Connect total: 41.42ms [5.58s (26.56ms/blk)]
2022-03-31T18:57:44Z   - Flush: 1.80ms [0.52s (2.47ms/blk)]
2022-03-31T18:57:44Z   - Writing chainstate: 1.56ms [0.40s (1.90ms/blk)]
2022-03-31T18:57:44Z Blockpolicy estimates updated by 0 of 0 block txs, since last block 0 of 0 tracked, mempool map size 0, max target 0 from current
2022-03-31T18:57:44Z UpdateTip: new best=0000014ccc0ceec3f77c3afd3186431f42615d5f8b34f21ebffee7193ce54552 height=18742 version=0x20000000 log2_work=37.707844 tx=19170 date='2021-01-01T22:48:50Z' progress=0.011335 cache=0.0MiB(214txo)
2022-03-31T18:57:45Z   - Connect postprocess: 20.96ms [3.65s (17.36ms/blk)]
2022-03-31T18:57:45Z - Connect block: 67.99ms [10.27s (48.91ms/blk)]
2022-03-31T18:57:45Z Enqueuing BlockConnected: block hash=0000014ccc0ceec3f77c3afd3186431f42615d5f8b34f21ebffee7193ce54552 block height=18742
2022-03-31T18:57:45Z Enqueuing UpdatedBlockTip: new block hash=0000014ccc0ceec3f77c3afd3186431f42615d5f8b34f21ebffee7193ce54552 fork block hash=000000dfd1fdd9d0220de57bceadfdd23693706212e7a498c13adc121e622f2d (in IBD=true)
2022-03-31T18:57:45Z Enter: lock contention cs_main, net_processing.cpp:1552 completed (88688��s)
2022-03-31T18:57:45Z Enter: lock contention cs_main, validation.cpp:2271 started
2022-03-31T18:57:45Z Enter: lock contention cs_main, validation.cpp:2271 completed (6��s)
2022-03-31T18:57:45Z UpdatedBlockTip: new block hash=000000dfd1fdd9d0220de57bceadfdd23693706212e7a498c13adc121e622f2d fork block hash=0000005337a12c725465d0fca9bcaaba37bd9ba56b38d6f86ea90148cc89f8fd (in IBD=true)
2022-03-31T18:57:45Z Requesting block 000000c2759e1e3b5be09b1a542a99b8bb0c9b00a0669d1d6d4daceb2a84d3ad (18838) peer=5
2022-03-31T18:57:45Z sending getdata (37 bytes) peer=5
2022-03-31T18:57:45Z BlockConnected: block hash=0000014ccc0ceec3f77c3afd3186431f42615d5f8b34f21ebffee7193ce54552 block height=18742
2022-03-31T18:57:45Z received: block (330 bytes) peer=0
2022-03-31T18:57:45Z received block 0000004180b9e1119e080d555e7186b592d0a9b0ec15f952ca46013f363624d2 peer=0
2022-03-31T18:57:45Z UpdatedBlockTip: new block hash=0000014ccc0ceec3f77c3afd3186431f42615d5f8b34f21ebffee7193ce54552 fork block hash=000000dfd1fdd9d0220de57bceadfdd23693706212e7a498c13adc121e622f2d (in IBD=true)
2022-03-31T18:57:45Z   - Load block from disk: 0.00ms [0.13s]
2022-03-31T18:57:45Z     - Sanity checks: 0.02ms [0.05s (0.22ms/blk)]
2022-03-31T18:57:45Z     - Fork checks: 2.43ms [0.79s (3.76ms/blk)]
2022-03-31T18:57:45Z       - Connect 1 transactions: 2.31ms (2.308ms/tx, 0.000ms/txin) [0.60s (2.83ms/blk)]
2022-03-31T18:57:45Z     - Verify 0 txins: 5.94ms (0.000ms/txin) [1.35s (6.41ms/blk)]
2022-03-31T18:57:45Z     - Index writing: 9.59ms [0.72s (3.43ms/blk)]
2022-03-31T18:57:45Z BlockChecked: block hash=0000004180b9e1119e080d555e7186b592d0a9b0ec15f952ca46013f363624d2 state=Valid
2022-03-31T18:57:45Z   - Connect total: 41.20ms [5.62s (26.63ms/blk)]
2022-03-31T18:57:45Z   - Flush: 2.45ms [0.52s (2.47ms/blk)]
2022-03-31T18:57:45Z   - Writing chainstate: 2.06ms [0.40s (1.90ms/blk)]
2022-03-31T18:57:45Z Blockpolicy estimates updated by 0 of 0 block txs, since last block 0 of 0 tracked, mempool map size 0, max target 0 from current
2022-03-31T18:57:45Z UpdateTip: new best=0000004180b9e1119e080d555e7186b592d0a9b0ec15f952ca46013f363624d2 height=18743 version=0x20000000 log2_work=37.707923 tx=19171 date='2021-01-01T22:51:35Z' progress=0.011335 cache=0.0MiB(215txo)
2022-03-31T18:57:45Z   - Connect postprocess: 31.64ms [3.68s (17.43ms/blk)]
2022-03-31T18:57:45Z - Connect block: 77.34ms [10.35s (49.04ms/blk)]
2022-03-31T18:57:45Z Enqueuing BlockConnected: block hash=0000004180b9e1119e080d555e7186b592d0a9b0ec15f952ca46013f363624d2 block height=18743
2022-03-31T18:57:45Z Enqueuing UpdatedBlockTip: new block hash=0000004180b9e1119e080d555e7186b592d0a9b0ec15f952ca46013f363624d2 fork block hash=0000014ccc0ceec3f77c3afd3186431f42615d5f8b34f21ebffee7193ce54552 (in IBD=true)
2022-03-31T18:57:45Z BlockConnected: block hash=0000004180b9e1119e080d555e7186b592d0a9b0ec15f952ca46013f363624d2 block height=18743
2022-03-31T18:57:45Z Enter: lock contention cs_main, net_processing.cpp:1552 started
2022-03-31T18:57:45Z Requesting block 00000136e73a552fb46e6ccfc3b0cc21d85b085bf5ff3dc8d27e1f508da82a24 (18839) peer=0
2022-03-31T18:57:45Z sending getdata (37 bytes) peer=0
2022-03-31T18:57:45Z Enter: lock contention cs_main, net_processing.cpp:1552 completed (4561��s)
2022-03-31T18:57:45Z Enter: lock contention cs_main, net_processing.cpp:4146 started
2022-03-31T18:57:45Z Enter: lock contention cs_main, net_processing.cpp:4146 completed (5��s)
2022-03-31T18:57:45Z UpdatedBlockTip: new block hash=0000004180b9e1119e080d555e7186b592d0a9b0ec15f952ca46013f363624d2 fork block hash=0000014ccc0ceec3f77c3afd3186431f42615d5f8b34f21ebffee7193ce54552 (in IBD=true)
2022-03-31T18:57:45Z received: block (330 bytes) peer=1
2022-03-31T18:57:45Z received block 000000dcb2899d72fe9d136110db820857573c6e50e83e61d1438fd48ce62a38 peer=1
2022-03-31T18:57:45Z   - Load block from disk: 0.00ms [0.13s]
2022-03-31T18:57:45Z     - Sanity checks: 0.02ms [0.05s (0.22ms/blk)]
2022-03-31T18:57:45Z     - Fork checks: 1.91ms [0.80s (3.75ms/blk)]
2022-03-31T18:57:45Z       - Connect 1 transactions: 1.72ms (1.720ms/tx, 0.000ms/txin) [0.60s (2.82ms/blk)]
2022-03-31T18:57:45Z     - Verify 0 txins: 4.54ms (0.000ms/txin) [1.36s (6.40ms/blk)]
2022-03-31T18:57:45Z     - Index writing: 7.50ms [0.73s (3.45ms/blk)]
2022-03-31T18:57:45Z BlockChecked: block hash=000000dcb2899d72fe9d136110db820857573c6e50e83e61d1438fd48ce62a38 state=Valid
2022-03-31T18:57:45Z   - Connect total: 32.45ms [5.65s (26.66ms/blk)]
2022-03-31T18:57:45Z   - Flush: 2.09ms [0.52s (2.47ms/blk)]
2022-03-31T18:57:45Z   - Writing chainstate: 1.80ms [0.40s (1.90ms/blk)]
2022-03-31T18:57:45Z Blockpolicy estimates updated by 0 of 0 block txs, since last block 0 of 0 tracked, mempool map size 0, max target 0 from current
2022-03-31T18:57:45Z UpdateTip: new best=000000dcb2899d72fe9d136110db820857573c6e50e83e61d1438fd48ce62a38 height=18744 version=0x20000000 log2_work=37.708002 tx=19172 date='2021-01-01T22:54:00Z' progress=0.011336 cache=0.0MiB(216txo)
2022-03-31T18:57:45Z   - Connect postprocess: 22.06ms [3.70s (17.45ms/blk)]
2022-03-31T18:57:45Z - Connect block: 58.40ms [10.41s (49.09ms/blk)]
2022-03-31T18:57:45Z Enqueuing BlockConnected: block hash=000000dcb2899d72fe9d136110db820857573c6e50e83e61d1438fd48ce62a38 block height=18744
2022-03-31T18:57:45Z Enqueuing UpdatedBlockTip: new block hash=000000dcb2899d72fe9d136110db820857573c6e50e83e61d1438fd48ce62a38 fork block hash=0000004180b9e1119e080d555e7186b592d0a9b0ec15f952ca46013f363624d2 (in IBD=true)
2022-03-31T18:57:45Z BlockConnected: block hash=000000dcb2899d72fe9d136110db820857573c6e50e83e61d1438fd48ce62a38 block height=18744
2022-03-31T18:57:45Z connection attempt to 20.113.142.187:38333 timed out
2022-03-31T18:57:45Z Requesting block 000000cd1f041974340db972366349a975bebec63d969de54d25877d5901deb5 (18840) peer=1
2022-03-31T18:57:45Z Enter: lock contention cs_main, net_processing.cpp:1552 started
2022-03-31T18:57:45Z sending getdata (37 bytes) peer=1
2022-03-31T18:57:45Z Enter: lock contention cs_main, net_processing.cpp:1552 completed (1823��s)
2022-03-31T18:57:45Z Enter: lock contention cs_main, net_processing.cpp:4146 started
2022-03-31T18:57:45Z Enter: lock contention cs_main, net_processing.cpp:4146 completed (5��s)
2022-03-31T18:57:45Z UpdatedBlockTip: new block hash=000000dcb2899d72fe9d136110db820857573c6e50e83e61d1438fd48ce62a38 fork block hash=0000004180b9e1119e080d555e7186b592d0a9b0ec15f952ca46013f363624d2 (in IBD=true)
2022-03-31T18:57:45Z received: block (330 bytes) peer=0
2022-03-31T18:57:45Z received block 0000012137659b2527e27eeda65610992c969a2720d6f7c8321d4a1210d074dc peer=0
2022-03-31T18:57:45Z Requesting block 00000104a82396337c9edd6499fdd0cd6481623acf2b244041e4567546ce954d (18841) peer=0
2022-03-31T18:57:45Z sending getdata (37 bytes) peer=0
2022-03-31T18:57:45Z received: addrv2 (4546 bytes) peer=2
2022-03-31T18:57:45Z Received addr: 189 addresses (189 processed, 0 rate-limited) from peer=2
2022-03-31T18:57:45Z Added 34.250.85.241:39388 mapped to AS0 to new[144][2]
2022-03-31T18:57:45Z Added [2604:3d08:5b7f:c309:8f7:4240:460d:f2b0]:38333 mapped to AS0 to new[95][35]
2022-03-31T18:57:45Z Added [2804:14d:4ca6:1664:25b5:4fa4:5f17:4d24]:38333 mapped to AS0 to new[592][37]
2022-03-31T18:57:45Z Added 50.5.199.87:38333 mapped to AS0 to new[95][5]
2022-03-31T18:57:45Z Added 185.53.41.252:38333 mapped to AS0 to new[801][1]
2022-03-31T18:57:45Z Added 89.187.171.245:38333 mapped to AS0 to new[592][63]
2022-03-31T18:57:45Z Added [2a02:8109:b540:1b8c:c93:51e6:c063:4cc3]:38333 mapped to AS0 to new[363][41]
2022-03-31T18:57:45Z Added 92.8.102.167:38333 mapped to AS0 to new[251][58]
2022-03-31T18:57:45Z Added 106.212.74.118:38333 mapped to AS0 to new[144][38]
2022-03-31T18:57:45Z Added 20.113.142.187:38333 mapped to AS0 to new[19][35]
2022-03-31T18:57:45Z Added 95.91.242.127:38333 mapped to AS0 to new[134][24]
2022-03-31T18:57:45Z Added [2804:14d:4ca6:1664:5098:5af6:fb04:c7c4]:38333 mapped to AS0 to new[592][15]
2022-03-31T18:57:45Z Added 37.60.4.83:38333 mapped to AS0 to new[286][30]
2022-03-31T18:57:45Z Added 45.87.214.100:38333 mapped to AS0 to new[557][10]
2022-03-31T18:57:45Z Added 94.177.8.118:38333 mapped to AS0 to new[251][6]
2022-03-31T18:57:45Z Added 157.97.122.32:18333 mapped to AS0 to new[254][2]
2022-03-31T18:57:45Z Added 188.214.12.86:38333 mapped to AS0 to new[999][31]
2022-03-31T18:57:45Z Added [2601:2c6:4c00:c620:34ad:7254:9ecb:117d]:38333 mapped to AS0 to new[144][29]
2022-03-31T18:57:45Z Added 18 addresses (of 155) from 153.126.143.201: 11 tried, 216 new
2022-03-31T18:57:45Z received: block (330 bytes) peer=4
2022-03-31T18:57:45Z received block 0000010f79c4a8deff3c33372afdeedb4ebbef72e1937638d27911ec0c7964fb peer=4
2022-03-31T18:57:45Z Requesting block 00000006c00b88e00cbc382c6294dd52da01abf8e47478a9ef905bb6397ee496 (18842) peer=4
2022-03-31T18:57:45Z sending getdata (37 bytes) peer=4
2022-03-31T18:57:45Z received: block (330 bytes) peer=1
2022-03-31T18:57:45Z received block 000000e1b8cc94a924726d796424cd92385c88d2f00298907c6457769f3b3a29 peer=1
2022-03-31T18:57:45Z   - Load block from disk: 0.40ms [0.13s]
2022-03-31T18:57:45Z     - Sanity checks: 0.23ms [0.05s (0.22ms/blk)]
2022-03-31T18:57:45Z     - Fork checks: 2.20ms [0.80s (3.74ms/blk)]
2022-03-31T18:57:45Z       - Connect 1 transactions: 2.03ms (2.030ms/tx, 0.000ms/txin) [0.60s (2.82ms/blk)]
2022-03-31T18:57:45Z     - Verify 0 txins: 5.26ms (0.000ms/txin) [1.36s (6.39ms/blk)]
2022-03-31T18:57:45Z     - Index writing: 4.96ms [0.74s (3.46ms/blk)]
2022-03-31T18:57:45Z BlockChecked: block hash=000000e1b8cc94a924726d796424cd92385c88d2f00298907c6457769f3b3a29 state=Valid
2022-03-31T18:57:45Z   - Connect total: 43.12ms [5.69s (26.74ms/blk)]
2022-03-31T18:57:45Z   - Flush: 2.10ms [0.53s (2.47ms/blk)]
2022-03-31T18:57:45Z   - Writing chainstate: 1.77ms [0.41s (1.90ms/blk)]
2022-03-31T18:57:45Z Blockpolicy estimates updated by 0 of 0 block txs, since last block 0 of 0 tracked, mempool map size 0, max target 0 from current
2022-03-31T18:57:45Z UpdateTip: new best=000000e1b8cc94a924726d796424cd92385c88d2f00298907c6457769f3b3a29 height=18745 version=0x20000000 log2_work=37.708081 tx=19173 date='2021-01-01T23:02:08Z' progress=0.011337 cache=0.0MiB(217txo)
2022-03-31T18:57:45Z   - Connect postprocess: 23.65ms [3.72s (17.48ms/blk)]
2022-03-31T18:57:45Z - Connect block: 71.04ms [10.48s (49.19ms/blk)]
2022-03-31T18:57:45Z Enqueuing BlockConnected: block hash=000000e1b8cc94a924726d796424cd92385c88d2f00298907c6457769f3b3a29 block height=18745
2022-03-31T18:57:45Z Enqueuing UpdatedBlockTip: new block hash=000000e1b8cc94a924726d796424cd92385c88d2f00298907c6457769f3b3a29 fork block hash=000000dcb2899d72fe9d136110db820857573c6e50e83e61d1438fd48ce62a38 (in IBD=true)
2022-03-31T18:57:45Z BlockConnected: block hash=000000e1b8cc94a924726d796424cd92385c88d2f00298907c6457769f3b3a29 block height=18745
2022-03-31T18:57:45Z Enter: lock contention cs_main, net_processing.cpp:1552 started
2022-03-31T18:57:45Z   - Load block from disk: 0.54ms [0.13s]
2022-03-31T18:57:45Z     - Sanity checks: 0.24ms [0.05s (0.22ms/blk)]
2022-03-31T18:57:45Z     - Fork checks: 2.78ms [0.80s (3.74ms/blk)]
2022-03-31T18:57:45Z       - Connect 1 transactions: 2.89ms (2.894ms/tx, 0.000ms/txin) [0.60s (2.82ms/blk)]
2022-03-31T18:57:45Z     - Verify 0 txins: 7.61ms (0.000ms/txin) [1.37s (6.40ms/blk)]
2022-03-31T18:57:45Z     - Index writing: 3.77ms [0.74s (3.46ms/blk)]
2022-03-31T18:57:45Z BlockChecked: block hash=0000010f79c4a8deff3c33372afdeedb4ebbef72e1937638d27911ec0c7964fb state=Valid
2022-03-31T18:57:45Z   - Connect total: 29.45ms [5.72s (26.75ms/blk)]
2022-03-31T18:57:45Z   - Flush: 2.23ms [0.53s (2.47ms/blk)]
2022-03-31T18:57:45Z   - Writing chainstate: 1.88ms [0.41s (1.90ms/blk)]
2022-03-31T18:57:45Z Blockpolicy estimates updated by 0 of 0 block txs, since last block 0 of 0 tracked, mempool map size 0, max target 0 from current
2022-03-31T18:57:45Z UpdateTip: new best=0000010f79c4a8deff3c33372afdeedb4ebbef72e1937638d27911ec0c7964fb height=18746 version=0x20000000 log2_work=37.708160 tx=19174 date='2021-01-01T23:12:02Z' progress=0.011337 cache=0.0MiB(218txo)
2022-03-31T18:57:45Z   - Connect postprocess: 25.80ms [3.75s (17.52ms/blk)]
2022-03-31T18:57:45Z - Connect block: 59.90ms [10.54s (49.24ms/blk)]
2022-03-31T18:57:45Z Enqueuing BlockConnected: block hash=0000010f79c4a8deff3c33372afdeedb4ebbef72e1937638d27911ec0c7964fb block height=18746
2022-03-31T18:57:45Z Enqueuing UpdatedBlockTip: new block hash=0000010f79c4a8deff3c33372afdeedb4ebbef72e1937638d27911ec0c7964fb fork block hash=000000e1b8cc94a924726d796424cd92385c88d2f00298907c6457769f3b3a29 (in IBD=true)
2022-03-31T18:57:45Z Enter: lock contention cs_main, net_processing.cpp:1552 completed (87166��s)
2022-03-31T18:57:45Z Enter: lock contention cs_main, validation.cpp:2271 started
2022-03-31T18:57:45Z Enter: lock contention cs_main, validation.cpp:2271 completed (6��s)
2022-03-31T18:57:45Z UpdatedBlockTip: new block hash=000000e1b8cc94a924726d796424cd92385c88d2f00298907c6457769f3b3a29 fork block hash=000000dcb2899d72fe9d136110db820857573c6e50e83e61d1438fd48ce62a38 (in IBD=true)
2022-03-31T18:57:45Z Requesting block 000001310037f2b979ab282da3bcdcc833815047824241afcb8e429e49c4ebc5 (18843) peer=1
2022-03-31T18:57:45Z sending getdata (37 bytes) peer=1
2022-03-31T18:57:45Z BlockConnected: block hash=0000010f79c4a8deff3c33372afdeedb4ebbef72e1937638d27911ec0c7964fb block height=18746
2022-03-31T18:57:45Z received: block (330 bytes) peer=3
2022-03-31T18:57:45Z received block 0000000fcc5ff4e240f0bd02cb464ccad8e26732f14b4be80ccac053efc4b80f peer=3
2022-03-31T18:57:45Z UpdatedBlockTip: new block hash=0000010f79c4a8deff3c33372afdeedb4ebbef72e1937638d27911ec0c7964fb fork block hash=000000e1b8cc94a924726d796424cd92385c88d2f00298907c6457769f3b3a29 (in IBD=true)
2022-03-31T18:57:45Z   - Load block from disk: 0.00ms [0.13s]
2022-03-31T18:57:45Z     - Sanity checks: 0.02ms [0.05s (0.22ms/blk)]
2022-03-31T18:57:45Z     - Fork checks: 2.09ms [0.80s (3.73ms/blk)]
2022-03-31T18:57:45Z       - Connect 1 transactions: 2.00ms (1.999ms/tx, 0.000ms/txin) [0.60s (2.81ms/blk)]
2022-03-31T18:57:45Z     - Verify 0 txins: 5.28ms (0.000ms/txin) [1.37s (6.40ms/blk)]
2022-03-31T18:57:45Z Selected 106.212.74.118:38333 from new
2022-03-31T18:57:45Z trying connection 106.212.74.118:38333 lastseen=80.8hrs
2022-03-31T18:57:45Z     - Index writing: 13.20ms [0.75s (3.50ms/blk)]
2022-03-31T18:57:45Z BlockChecked: block hash=0000000fcc5ff4e240f0bd02cb464ccad8e26732f14b4be80ccac053efc4b80f state=Valid
2022-03-31T18:57:45Z   - Connect total: 33.15ms [5.76s (26.78ms/blk)]
2022-03-31T18:57:45Z   - Flush: 1.79ms [0.53s (2.47ms/blk)]
2022-03-31T18:57:45Z   - Writing chainstate: 1.72ms [0.41s (1.90ms/blk)]
2022-03-31T18:57:45Z Blockpolicy estimates updated by 0 of 0 block txs, since last block 0 of 0 tracked, mempool map size 0, max target 0 from current
2022-03-31T18:57:45Z UpdateTip: new best=0000000fcc5ff4e240f0bd02cb464ccad8e26732f14b4be80ccac053efc4b80f height=18747 version=0x20000000 log2_work=37.708239 tx=19175 date='2021-01-01T23:12:32Z' progress=0.011338 cache=0.0MiB(219txo)
2022-03-31T18:57:45Z   - Connect postprocess: 22.37ms [3.77s (17.54ms/blk)]
2022-03-31T18:57:45Z - Connect block: 59.02ms [10.60s (49.29ms/blk)]
2022-03-31T18:57:45Z Enqueuing BlockConnected: block hash=0000000fcc5ff4e240f0bd02cb464ccad8e26732f14b4be80ccac053efc4b80f block height=18747
2022-03-31T18:57:45Z Enqueuing UpdatedBlockTip: new block hash=0000000fcc5ff4e240f0bd02cb464ccad8e26732f14b4be80ccac053efc4b80f fork block hash=0000010f79c4a8deff3c33372afdeedb4ebbef72e1937638d27911ec0c7964fb (in IBD=true)
2022-03-31T18:57:45Z BlockConnected: block hash=0000000fcc5ff4e240f0bd02cb464ccad8e26732f14b4be80ccac053efc4b80f block height=18747
2022-03-31T18:57:45Z Enter: lock contention cs_main, net_processing.cpp:1552 started
2022-03-31T18:57:45Z Requesting block 0000013014165982649898ffdb6a341fd22d41018bf486a52888bf5e63038545 (18844) peer=3
2022-03-31T18:57:45Z sending getdata (37 bytes) peer=3
2022-03-31T18:57:45Z Enter: lock contention cs_main, net_processing.cpp:1552 completed (5241��s)
2022-03-31T18:57:45Z Enter: lock contention cs_main, net_processing.cpp:4146 started
2022-03-31T18:57:45Z Enter: lock contention cs_main, net_processing.cpp:4146 completed (5��s)
2022-03-31T18:57:45Z UpdatedBlockTip: new block hash=0000000fcc5ff4e240f0bd02cb464ccad8e26732f14b4be80ccac053efc4b80f fork block hash=0000010f79c4a8deff3c33372afdeedb4ebbef72e1937638d27911ec0c7964fb (in IBD=true)
2022-03-31T18:57:45Z received: block (4335 bytes) peer=5
2022-03-31T18:57:45Z received block 000000024e8c0f55523217a1e5c2aad5b5e6c4bae04418f05e28f4f0c4c84a9e peer=5
wine: Unhandled page fault on read access to FFFFFFFFFFFFFFFF at address 000000014051CC65 (thread 003f), starting debugger...
0041:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded.
0041:err:winediag:nodrv_CreateWindow Make sure that your X server is running and that $DISPLAY is set correctly.
Unhandled exception: page fault on read access to 0xffffffffffffffff in 64-bit code (0x000000014051cc65).
Register dump:
 rip:000000014051cc65 rsp:0000000008b69250 rbp:0000000005cd0450 eflags:00010246 (  R- --  I  Z- -P- )
 rax:0000000140d02c20 rbx:0000000008b694b0 rcx:0000000005cd0450 rdx:0000000000000000
 rsi:0000000005cd0450 rdi:0000000005cd0450  r8:0000000008b694b0  r9:0000000005cd0450 r10:0000000000000001
 r11:0000000005cd0440 r12:0000000005cd0450 r13:0000000000000002 r14:0000000140d02c20 r15:0000000005cd0120
Stack dump:
0x0000000008b69250:  0000000008b69360 0000000008b69270
0x0000000008b69260:  000000007bc51d54 00000000003300b0
0x0000000008b69270:  50ab0435d4426eeb ec633e074c7edc22
0x0000000008b69280:  7699651a40daa117 f21719708222529c
0x0000000008b69290:  53c0229a0b04bdf9 b949177eeeb93851
0x0000000008b692a0:  00c622bef3cda40c f6020c14f32b35af
0x0000000008b692b0:  d6125fd367a1f042 e77f13be0b0bc4a6
0x0000000008b692c0:  dc132ced89c18998 6342f429c8644abf
0x0000000008b692d0:  6607c4b1a48c95ce d47402f6b72a6f03
0x0000000008b692e0:  a2373b940d40a06a 90fc7cbaa75028df
0x0000000008b692f0:  93b26bec418f70b9 47bd2098014abf21
0x0000000008b69300:  2ea82f94ce3e6dce a74df7d65c95936e
Backtrace:
=>0 0x000000014051cc65 EntryPoint+0x10051b785() in bitcoind (0x0000000005cd0450)
0x000000014051cc65 EntryPoint+0x10051b785 in bitcoind: ldsl	%ebp,%edi
Modules:
Module	Address					Debug info	Name (79 modules)
ELF	        7b000000-        7b0e2000	Deferred        kernelbase<elf>
  \-PE	        7b010000-        7b0e2000	\               kernelbase
ELF	        7b400000-        7b68b000	Deferred        kernel32<elf>
  \-PE	        7b420000-        7b68b000	\               kernel32
ELF	        7bc00000-        7befb000	Deferred        ntdll<elf>
  \-PE	        7bc20000-        7befb000	\               ntdll
ELF	        7c000000-        7c005000	Deferred        <wine-loader>
PE	       140000000-       140d14000	Export          bitcoind
ELF	    7f48114a7000-    7f48114ca000	Deferred        libgpg-error.so.0
ELF	    7f48114ca000-    7f48115e8000	Deferred        libgcrypt.so.20
ELF	    7f48115e8000-    7f4811609000	Deferred        liblz4.so.1
ELF	    7f4811609000-    7f4811613000	Deferred        librt.so.1
ELF	    7f4811613000-    7f481161f000	Deferred        libffi.so.7
ELF	    7f481161f000-    7f48116ce000	Deferred        libsystemd.so.0
ELF	    7f48116ce000-    7f48116d5000	Deferred        libkeyutils.so.1
ELF	    7f48116d5000-    7f4811759000	Deferred        libgmp.so.10
ELF	    7f4811759000-    7f4811790000	Deferred        libhogweed.so.5
ELF	    7f4811790000-    7f48117ca000	Deferred        libnettle.so.7
ELF	    7f48117ca000-    7f48117e0000	Deferred        libtasn1.so.6
ELF	    7f48117e0000-    7f4811962000	Deferred        libunistring.so.2
ELF	    7f4811962000-    7f4811983000	Deferred        libidn2.so.0
ELF	    7f4811983000-    7f4811ab9000	Deferred        libp11-kit.so.0
ELF	    7f4811ab9000-    7f4811b0a000	Deferred        libdbus-1.so.3
ELF	    7f4811b0a000-    7f4811b19000	Deferred        libkrb5support.so.0
ELF	    7f4811b19000-    7f4811b20000	Deferred        libcom_err.so.2
ELF	    7f4811b20000-    7f4811b51000	Deferred        libk5crypto.so.3
ELF	    7f4811b51000-    7f4811c2e000	Deferred        libkrb5.so.3
ELF	    7f4811c2e000-    7f4811e04000	Deferred        libgnutls.so.30
ELF	    7f4811e04000-    7f4811e17000	Deferred        libavahi-client.so.3
ELF	    7f4811e17000-    7f4811e25000	Deferred        libavahi-common.so.3
ELF	    7f4811e25000-    7f4811e72000	Deferred        libgssapi_krb5.so.2
ELF	    7f4811e72000-    7f4811f0d000	Deferred        libcups.so.2
ELF	    7f4811f8e000-    7f4811fb4000	Deferred        imm32<elf>
  \-PE	    7f4811fa0000-    7f4811fb4000	\               imm32
ELF	    7f4811fdb000-    7f4811fe4000	Deferred        libuuid.so.1
ELF	    7f4811fe4000-    7f4812012000	Deferred        libexpat.so.1
ELF	    7f4812012000-    7f4812059000	Deferred        libfontconfig.so.1
ELF	    7f4812059000-    7f4812075000	Deferred        libz.so.1
ELF	    7f4812075000-    7f48120ad000	Deferred        libpng16.so.16
ELF	    7f48120ad000-    7f481216c000	Deferred        libfreetype.so.6
ELF	    7f481216c000-    7f481219c000	Deferred        libtinfo.so.6
ELF	    7f481219c000-    7f48121c5000	Deferred        libncurses.so.6
ELF	    7f48121c5000-    7f48121cd000	Deferred        libnss_dns.so.2
ELF	    7f48121cd000-    7f48121e9000	Deferred        libresolv.so.2
ELF	    7f48121e9000-    7f48121ef000	Deferred        libnss_mdns4_minimal.so.2
ELF	    7f481220e000-    7f4812253000	Deferred        ws2_32<elf>
  \-PE	    7f4812220000-    7f4812253000	\               ws2_32
ELF	    7f4812253000-    7f48122ea000	Deferred        rpcrt4<elf>
  \-PE	    7f4812260000-    7f48122ea000	\               rpcrt4
ELF	    7f48122ea000-    7f481245e000	Deferred        ole32<elf>
  \-PE	    7f4812310000-    7f481245e000	\               ole32
ELF	    7f481245e000-    7f4812484000	Deferred        shcore<elf>
  \-PE	    7f4812470000-    7f4812484000	\               shcore
ELF	    7f4812484000-    7f481249c000	Deferred        version<elf>
  \-PE	    7f4812490000-    7f481249c000	\               version
ELF	    7f481249c000-    7f4812654000	Deferred        gdi32<elf>
  \-PE	    7f48124b0000-    7f4812654000	\               gdi32
ELF	    7f4812654000-    7f48128ef000	Deferred        user32<elf>
  \-PE	    7f4812680000-    7f48128ef000	\               user32
ELF	    7f48128ef000-    7f4812957000	Deferred        shlwapi<elf>
  \-PE	    7f4812900000-    7f4812957000	\               shlwapi
ELF	    7f4812957000-    7f48133b1000	Deferred        shell32<elf>
  \-PE	    7f4812970000-    7f48133b1000	\               shell32
ELF	    7f48133b1000-    7f48134a8000	Deferred        msvcrt<elf>
  \-PE	    7f48133d0000-    7f48134a8000	\               msvcrt
ELF	    7f48134a8000-    7f48134dc000	Deferred        iphlpapi<elf>
  \-PE	    7f48134b0000-    7f48134dc000	\               iphlpapi
ELF	    7f48135dc000-    7f4813679000	Deferred        advapi32<elf>
  \-PE	    7f48135f0000-    7f4813679000	\               advapi32
ELF	    7f4813e09000-    7f4813e32000	Deferred        liblzma.so.5
ELF	    7f4813e32000-    7f4813e4d000	Deferred        libgcc_s.so.1
ELF	    7f4813e4d000-    7f4813f9c000	Deferred        libm.so.6
ELF	    7f4813f9c000-    7f4813fb9000	Deferred        libunwind.so.8
ELF	    7f4813fbb000-    7f4813fc1000	Deferred        libdl.so.2
ELF	    7f4813fc1000-    7f48141b3000	Deferred        libc.so.6
ELF	    7f48141b3000-    7f48141d6000	Deferred        libpthread.so.0
ELF	    7f48141da000-    7f48141ee000	Deferred        libnss_files.so.2
ELF	    7f48141f5000-    7f4814398000	Dwarf           libwine.so.1
ELF	    7f481439a000-    7f48143ca000	Deferred        ld-linux-x86-64.so.2
Threads:
process  tid      prio (all id:s are in hex)
0000000e services.exe
	00000028    0
	00000025    0
	0000001c    0
	00000013    0
	00000010    0
	0000000f    0
00000011 plugplay.exe
	00000017    0
	00000016    0
	00000012    0
00000018 explorer.exe
	00000021    0
	00000020    0
	00000019    0
0000001a winedevice.exe
	00000022    0
	0000001f    0
	0000001e    0
	0000001d    0
	0000001b    0
00000023 winedevice.exe
	00000029    0
	00000027    0
	00000026    0
	00000024    0
0000002a (D) Z:\home\ubuntu\signet\bitcoin-23.0rc2\bin\bitcoind.exe
	0000003f    0 <==
	0000003e    0
	0000003d    0
	0000003b    0
	0000003a    0
	00000038    0
	00000037    0
	00000036    0
	00000035    0
	00000034    0
	00000033    0
	00000032    0
	00000031    0
	00000030    0
	0000002f    0
	0000002e    0
	0000002d    0
	0000002c    0
	0000002b    0
System information:
    Wine build: wine-5.0 (Ubuntu 5.0-3ubuntu1)
    Platform: x86_64
    Version: Windows 7
    Host system: Linux
    Host version: 5.13.0-1019-aws
```
> 22.0 also works fine?

Yes. Just tested.
I think I got the same issue  (but for `bitcoin-qt.exe` on Windows 10 Home / Version 20H2 on VMWare).

It was installed using [bitcoin-23.0rc2-win64-setup.exe](https://bitcoincore.org/bin/bitcoin-core-23.0/test.rc2/bitcoin-23.0rc2-win64-setup.exe)

The application abruptly quits and no messages are logged in `debug.log`. The last lines are about `UpdateTip: new best=00000000...`.
Initially I thought it was a problem related to the virtualization resources, but then I noticed that the same doesn't happen for version 22.



FWIW, we've managed to trace at least @fanquake's crash to the avx2 implementation of sha256sum:
```
$ addr2line -e bin/bitcoin.exe.dbg -aipfC 0x14051cc65
0x000000014051cc65: sha256d64_avx2::Transform_8way(unsigned char*, unsigned char const*) at /distsrc-base/distsrc-23.0rc2-x86_64-w64-mingw32/src/crypto/sha256_avx2.cpp:316
```
This probably explains why I couldn't reproduce it in wine. The computer I was using doesn't have either instruction set.

According to @sipa you might need a AVX2 capable CPU which doesn't support SHA-NI to get this code path.

It could be a compiler bug around AVX2 intrinsics or something.
It's probably: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54412

The stack is 16 byte aligned according to the ABI, but gcc assumes 32 byte alignment during register spilling (doesn't re-align the stack pointer), resulting in ~50% chance of a crash.

Looks like we'll have to disable AVX2 (anything that uses 256 bit types) on mingw builds. Probably least impact to disable it in during detection in `configure.ac`.

Fix patch:
diff --git a/contrib/guix/manifest.scm b/contrib/guix/manifest.scm
index 3f110ab99546f..fcec592c2c2a6 100644
--- a/contrib/guix/manifest.scm
+++ b/contrib/guix/manifest.scm
@@ -162,13 +162,17 @@ desirable for building Bitcoin Core release binaries."
 (define (make-gcc-with-pthreads gcc)
   (package-with-extra-configure-variable gcc "--enable-threads" "posix"))
 
+(define (make-mingw-w64-cross-gcc-vmov-alignment cross-gcc)
+  (package-with-extra-patches cross-gcc
+    (search-our-patches "vmov-alignment.patch")))
+
 (define (make-mingw-pthreads-cross-toolchain target)
   "Create a cross-compilation toolchain package for TARGET"
   (let* ((xbinutils (cross-binutils target))
          (pthreads-xlibc mingw-w64-x86_64-winpthreads)
          (pthreads-xgcc (make-gcc-with-pthreads
                          (cross-gcc target
-                                    #:xgcc (make-ssp-fixed-gcc base-gcc)
+                                    #:xgcc (make-ssp-fixed-gcc (make-mingw-w64-cross-gcc-vmov-alignment base-gcc))
                                     #:xbinutils xbinutils
                                     #:libc pthreads-xlibc))))
     ;; Define a meta-package that propagates the resulting XBINUTILS, XLIBC, and
diff --git a/contrib/guix/patches/vmov-alignment.patch b/contrib/guix/patches/vmov-alignment.patch
new file mode 100644
index 0000000000000..072f76eafd38f
--- /dev/null
+++ b/contrib/guix/patches/vmov-alignment.patch
@@ -0,0 +1,267 @@
+Description: Use unaligned VMOV instructions
+Author: Stephen Kitt <skitt@debian.org>
+Bug-Debian: https://bugs.debian.org/939559
+
+Based on a patch originally by Claude Heiland-Allen <claude@mathr.co.uk>
+
+--- a/gcc/config/i386/sse.md
++++ b/gcc/config/i386/sse.md
+@@ -1058,17 +1058,11 @@
+ {
+   if (FLOAT_MODE_P (GET_MODE_INNER (<MODE>mode)))
+     {
+-      if (misaligned_operand (operands[1], <MODE>mode))
+-	return "vmovu<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}";
+-      else
+-	return "vmova<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}";
++      return "vmovu<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}";
+     }
+   else
+     {
+-      if (misaligned_operand (operands[1], <MODE>mode))
+-	return "vmovdqu<ssescalarsize>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}";
+-      else
+-	return "vmovdqa<ssescalarsize>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}";
++      return "vmovdqu<ssescalarsize>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}";
+     }
+ }
+   [(set_attr "type" "ssemov")
+@@ -1184,17 +1178,11 @@
+ {
+   if (FLOAT_MODE_P (GET_MODE_INNER (<MODE>mode)))
+     {
+-      if (misaligned_operand (operands[0], <MODE>mode))
+-	return "vmovu<ssemodesuffix>\t{%1, %0%{%2%}|%0%{%2%}, %1}";
+-      else
+-	return "vmova<ssemodesuffix>\t{%1, %0%{%2%}|%0%{%2%}, %1}";
++      return "vmovu<ssemodesuffix>\t{%1, %0%{%2%}|%0%{%2%}, %1}";
+     }
+   else
+     {
+-      if (misaligned_operand (operands[0], <MODE>mode))
+-	return "vmovdqu<ssescalarsize>\t{%1, %0%{%2%}|%0%{%2%}, %1}";
+-      else
+-	return "vmovdqa<ssescalarsize>\t{%1, %0%{%2%}|%0%{%2%}, %1}";
++      return "vmovdqu<ssescalarsize>\t{%1, %0%{%2%}|%0%{%2%}, %1}";
+     }
+ }
+   [(set_attr "type" "ssemov")
+@@ -7806,7 +7794,7 @@
+   "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
+   "@
+    %vmovlps\t{%1, %0|%q0, %1}
+-   %vmovaps\t{%1, %0|%0, %1}
++   %vmovups\t{%1, %0|%0, %1}
+    %vmovlps\t{%1, %d0|%d0, %q1}"
+   [(set_attr "type" "ssemov")
+    (set_attr "prefix" "maybe_vex")
+@@ -13997,29 +13985,15 @@
+   switch (<MODE>mode)
+     {
+     case E_V8DFmode:
+-      if (misaligned_operand (operands[2], <ssequartermode>mode))
+-	return "vmovupd\t{%2, %x0|%x0, %2}";
+-      else
+-	return "vmovapd\t{%2, %x0|%x0, %2}";
++      return "vmovupd\t{%2, %x0|%x0, %2}";
+     case E_V16SFmode:
+-      if (misaligned_operand (operands[2], <ssequartermode>mode))
+-	return "vmovups\t{%2, %x0|%x0, %2}";
+-      else
+-	return "vmovaps\t{%2, %x0|%x0, %2}";
++      return "vmovups\t{%2, %x0|%x0, %2}";
+     case E_V8DImode:
+-      if (misaligned_operand (operands[2], <ssequartermode>mode))
+-	return which_alternative == 2 ? "vmovdqu64\t{%2, %x0|%x0, %2}"
++      return which_alternative == 2 ? "vmovdqu64\t{%2, %x0|%x0, %2}"
+ 				      : "vmovdqu\t{%2, %x0|%x0, %2}";
+-      else
+-	return which_alternative == 2 ? "vmovdqa64\t{%2, %x0|%x0, %2}"
+-				      : "vmovdqa\t{%2, %x0|%x0, %2}";
+     case E_V16SImode:
+-      if (misaligned_operand (operands[2], <ssequartermode>mode))
+-	return which_alternative == 2 ? "vmovdqu32\t{%2, %x0|%x0, %2}"
++      return which_alternative == 2 ? "vmovdqu32\t{%2, %x0|%x0, %2}"
+ 				      : "vmovdqu\t{%2, %x0|%x0, %2}";
+-      else
+-	return which_alternative == 2 ? "vmovdqa32\t{%2, %x0|%x0, %2}"
+-				      : "vmovdqa\t{%2, %x0|%x0, %2}";
+     default:
+       gcc_unreachable ();
+     }
+@@ -21225,63 +21199,27 @@
+       switch (get_attr_mode (insn))
+ 	{
+ 	case MODE_V16SF:
+-	  if (misaligned_operand (operands[1], <ssehalfvecmode>mode))
+-	    return "vmovups\t{%1, %t0|%t0, %1}";
+-	  else
+-	    return "vmovaps\t{%1, %t0|%t0, %1}";
++	  return "vmovups\t{%1, %t0|%t0, %1}";
+ 	case MODE_V8DF:
+-	  if (misaligned_operand (operands[1], <ssehalfvecmode>mode))
+-	    return "vmovupd\t{%1, %t0|%t0, %1}";
+-	  else
+-	    return "vmovapd\t{%1, %t0|%t0, %1}";
++	  return "vmovupd\t{%1, %t0|%t0, %1}";
+ 	case MODE_V8SF:
+-	  if (misaligned_operand (operands[1], <ssehalfvecmode>mode))
+-	    return "vmovups\t{%1, %x0|%x0, %1}";
+-	  else
+-	    return "vmovaps\t{%1, %x0|%x0, %1}";
++	  return "vmovups\t{%1, %x0|%x0, %1}";
+ 	case MODE_V4DF:
+-	  if (misaligned_operand (operands[1], <ssehalfvecmode>mode))
+-	    return "vmovupd\t{%1, %x0|%x0, %1}";
+-	  else
+-	    return "vmovapd\t{%1, %x0|%x0, %1}";
++	  return "vmovupd\t{%1, %x0|%x0, %1}";
+ 	case MODE_XI:
+-	  if (misaligned_operand (operands[1], <ssehalfvecmode>mode))
+-	    {
+-	      if (which_alternative == 2)
+-		return "vmovdqu\t{%1, %t0|%t0, %1}";
+-	      else if (GET_MODE_SIZE (<ssescalarmode>mode) == 8)
+-		return "vmovdqu64\t{%1, %t0|%t0, %1}";
+-	      else
+-		return "vmovdqu32\t{%1, %t0|%t0, %1}";
+-	    }
++	  if (which_alternative == 2)
++	    return "vmovdqu\t{%1, %t0|%t0, %1}";
++	  else if (GET_MODE_SIZE (<ssescalarmode>mode) == 8)
++	    return "vmovdqu64\t{%1, %t0|%t0, %1}";
+ 	  else
+-	    {
+-	      if (which_alternative == 2)
+-		return "vmovdqa\t{%1, %t0|%t0, %1}";
+-	      else if (GET_MODE_SIZE (<ssescalarmode>mode) == 8)
+-		return "vmovdqa64\t{%1, %t0|%t0, %1}";
+-	      else
+-		return "vmovdqa32\t{%1, %t0|%t0, %1}";
+-	    }
++	    return "vmovdqu32\t{%1, %t0|%t0, %1}";
+ 	case MODE_OI:
+-	  if (misaligned_operand (operands[1], <ssehalfvecmode>mode))
+-	    {
+-	      if (which_alternative == 2)
+-		return "vmovdqu\t{%1, %x0|%x0, %1}";
+-	      else if (GET_MODE_SIZE (<ssescalarmode>mode) == 8)
+-		return "vmovdqu64\t{%1, %x0|%x0, %1}";
+-	      else
+-		return "vmovdqu32\t{%1, %x0|%x0, %1}";
+-	    }
++	  if (which_alternative == 2)
++	    return "vmovdqu\t{%1, %x0|%x0, %1}";
++	  else if (GET_MODE_SIZE (<ssescalarmode>mode) == 8)
++	    return "vmovdqu64\t{%1, %x0|%x0, %1}";
+ 	  else
+-	    {
+-	      if (which_alternative == 2)
+-		return "vmovdqa\t{%1, %x0|%x0, %1}";
+-	      else if (GET_MODE_SIZE (<ssescalarmode>mode) == 8)
+-		return "vmovdqa64\t{%1, %x0|%x0, %1}";
+-	      else
+-		return "vmovdqa32\t{%1, %x0|%x0, %1}";
+-	    }
++	    return "vmovdqu32\t{%1, %x0|%x0, %1}";
+ 	default:
+ 	  gcc_unreachable ();
+ 	}
+--- a/gcc/config/i386/i386.c
++++ b/gcc/config/i386/i386.c
+@@ -4981,13 +4981,13 @@
+       switch (type)
+ 	{
+ 	case opcode_int:
+-	  opcode = misaligned_p ? "vmovdqu32" : "vmovdqa32";
++	  opcode = "vmovdqu32";
+ 	  break;
+ 	case opcode_float:
+-	  opcode = misaligned_p ? "vmovups" : "vmovaps";
++	  opcode = "vmovups";
+ 	  break;
+ 	case opcode_double:
+-	  opcode = misaligned_p ? "vmovupd" : "vmovapd";
++	  opcode = "vmovupd";
+ 	  break;
+ 	}
+     }
+@@ -4996,16 +4996,16 @@
+       switch (scalar_mode)
+ 	{
+ 	case E_SFmode:
+-	  opcode = misaligned_p ? "%vmovups" : "%vmovaps";
++	  opcode = "%vmovups";
+ 	  break;
+ 	case E_DFmode:
+-	  opcode = misaligned_p ? "%vmovupd" : "%vmovapd";
++	  opcode = "%vmovupd";
+ 	  break;
+ 	case E_TFmode:
+ 	  if (evex_reg_p)
+-	    opcode = misaligned_p ? "vmovdqu64" : "vmovdqa64";
++	    opcode = "vmovdqu64";
+ 	  else
+-	    opcode = misaligned_p ? "%vmovdqu" : "%vmovdqa";
++	    opcode = "%vmovdqu";
+ 	  break;
+ 	default:
+ 	  gcc_unreachable ();
+@@ -5017,48 +5017,32 @@
+ 	{
+ 	case E_QImode:
+ 	  if (evex_reg_p)
+-	    opcode = (misaligned_p
+-		      ? (TARGET_AVX512BW
+-			 ? "vmovdqu8"
+-			 : "vmovdqu64")
+-		      : "vmovdqa64");
++	    opcode = TARGET_AVX512BW ? "vmovdqu8" : "vmovdqu64";
+ 	  else
+-	    opcode = (misaligned_p
+-		      ? (TARGET_AVX512BW
+-			 ? "vmovdqu8"
+-			 : "%vmovdqu")
+-		      : "%vmovdqa");
++	    opcode = TARGET_AVX512BW ? "vmovdqu8" : "%vmovdqu";
+ 	  break;
+ 	case E_HImode:
+ 	  if (evex_reg_p)
+-	    opcode = (misaligned_p
+-		      ? (TARGET_AVX512BW
+-			 ? "vmovdqu16"
+-			 : "vmovdqu64")
+-		      : "vmovdqa64");
++	    opcode = TARGET_AVX512BW ? "vmovdqu16" : "vmovdqu64";
+ 	  else
+-	    opcode = (misaligned_p
+-		      ? (TARGET_AVX512BW
+-			 ? "vmovdqu16"
+-			 : "%vmovdqu")
+-		      : "%vmovdqa");
++	    opcode = TARGET_AVX512BW ? "vmovdqu16" : "%vmovdqu";
+ 	  break;
+ 	case E_SImode:
+ 	  if (evex_reg_p)
+-	    opcode = misaligned_p ? "vmovdqu32" : "vmovdqa32";
++	    opcode = "vmovdqu32";
+ 	  else
+-	    opcode = misaligned_p ? "%vmovdqu" : "%vmovdqa";
++	    opcode = "%vmovdqu";
+ 	  break;
+ 	case E_DImode:
+ 	case E_TImode:
+ 	case E_OImode:
+ 	  if (evex_reg_p)
+-	    opcode = misaligned_p ? "vmovdqu64" : "vmovdqa64";
++	    opcode = "vmovdqu64";
+ 	  else
+-	    opcode = misaligned_p ? "%vmovdqu" : "%vmovdqa";
++	    opcode = "%vmovdqu";
+ 	  break;
+ 	case E_XImode:
+-	  opcode = misaligned_p ? "vmovdqu64" : "vmovdqa64";
++	  opcode = "vmovdqu64";
+ 	  break;
+ 	default:
+ 	  gcc_unreachable ();


Test patch: