Skip to content

Conversation

@sipa
Copy link
Member

@sipa sipa commented May 8, 2019

This adds a test for GCC bug 90348 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90348), using a test case extracted from our own sha256d64 test in crypto_tests.cpp, which was failing on some platforms.

This is based on top of #15983 to make sure the bug doesn't trigger (it does in some Travis configurations without it).

@sipa sipa force-pushed the 201905_gccbug90348 branch from 154574c to 8c21e54 Compare May 8, 2019 20:45
@maflcko
Copy link
Member

maflcko commented May 8, 2019

Looks like this only fails for the no-wallet build and win64 (not sure what that wine32 warning means):

Running tests: compilerbug_tests from test/compilerbug_tests.cpp
it looks like wine32 is missing, you should install it.
multiarch needs to be enabled first.  as root, please
execute "dpkg --add-architecture i386 && apt-get update &&
apt-get install wine32"
Running 1 test case...
Test cases order is shuffled using seed: 1529978656
Entering test module "Bitcoin Core Test Suite"
test/compilerbug_tests.cpp(8): Entering test suite "compilerbug_tests"
test/compilerbug_tests.cpp(30): Entering test case "gccbug_90348"
test/compilerbug_tests.cpp(38): error: in "compilerbug_tests/gccbug_90348": check check_zero(in, i) has failed
test/compilerbug_tests.cpp(38): error: in "compilerbug_tests/gccbug_90348": check check_zero(in, i) has failed
test/compilerbug_tests.cpp(38): error: in "compilerbug_tests/gccbug_90348": check check_zero(in, i) has failed
test/compilerbug_tests.cpp(38): error: in "compilerbug_tests/gccbug_90348": check check_zero(in, i) has failed
test/compilerbug_tests.cpp(30): Leaving test case "gccbug_90348"; testing time: 53ms
test/compilerbug_tests.cpp(8): Leaving test suite "compilerbug_tests"; testing time: 53ms
Leaving test module "Bitcoin Core Test Suite"; testing time: 53ms

@sipa
Copy link
Member Author

sipa commented May 8, 2019

I guess that's expected; sanitizers break the bug (I think they automatically enable stack-reuse=none).

@maflcko
Copy link
Member

maflcko commented May 9, 2019

What about win32, linux32, bionic qt5 and the trusty build without sanitizers?

The trusty one could have a gcc that is old enough to not have this bug, but the others should fail, hmm

https://travis-ci.org/bitcoin/bitcoin/builds/529978656

@DrahtBot
Copy link
Contributor

DrahtBot commented May 15, 2019

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

No conflicts as of last run.

@maflcko maflcko added this to the 0.18.1 milestone May 16, 2019
@laanwj
Copy link
Member

laanwj commented May 20, 2019

Needs update after #15983 which adds -fstack-reuse=none unconditionally for gcc.

@maflcko
Copy link
Member

maflcko commented May 24, 2019

@sipa 👀 ^

@fanquake
Copy link
Member

utACK 9d269e1 (needs rebase)

I did some investigating using Compiler Explorer and the c test case from the GCC bug report to better understand what's happening here.

Using the flags produced by ./configure (master) on a Debian box (GCC 8.3.0):

-fstack-reuse=none -Wstack-protector -fstack-protector-all  -Wall -Wextra -Wformat -Wvla -Wredundant-decls  -Wno-unused-parameter -Wno-implicit-fallthrough   -g -O2

I setup a test to compare the assembly produced with and without -fstack-reuse=none.

You can see my setup on Compiler Explorer here. The difference produced with and without -fstack-reuse on line 83:

<   lea rdi, [rsp+3]
---
>   lea rdi, [rsp+4]

As mentioned in the original bug report, the issue is seen on GCC 7, 8 and 9.

@maflcko maflcko force-pushed the 201905_gccbug90348 branch from 9d269e1 to 58e291c Compare June 2, 2019 08:21
@maflcko
Copy link
Member

maflcko commented Jun 2, 2019

There hasn't been any activity in the last two weeks, so I went ahead to rebase and force push to the branch in your repo. Hope you don't mind.

@maflcko
Copy link
Member

maflcko commented Jun 2, 2019

Unless there are objections, this will be merged tomorrow.

pull bot pushed a commit to uniibu/bitcoin that referenced this pull request Jun 5, 2019
58e291c Add test for GCC bug 90348 (Pieter Wuille)

Pull request description:

  This adds a test for GCC bug 90348 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90348), using a test case extracted from our own `sha256d64` test in crypto_tests.cpp, which was failing on some platforms.

  This is based on top of bitcoin#15983 to make sure the bug doesn't trigger (it does in some Travis configurations without it).

ACKs for commit 58e291:

Tree-SHA512: 4dc9084e92dd143a53930e42bb68e33d922a2a2b891406b259d3a0bed4511dcc49e7447a7a8e4eb793a26e3eacb188ca293b71e0e061f9b3230f8e7fcfd29525
@laanwj laanwj merged commit 58e291c into bitcoin:master Jun 5, 2019
@fanquake
Copy link
Member

fanquake commented Jun 7, 2019

Included for backport in #16035.

fanquake pushed a commit to fanquake/bitcoin that referenced this pull request Jun 7, 2019
maflcko pushed a commit to maflcko/bitcoin-core that referenced this pull request Jun 7, 2019
laanwj added a commit that referenced this pull request Jun 13, 2019
… case

b5a4abe Add test for GCC bug 90348 (Pieter Wuille)
05fb9f7 build with -fstack-reuse=none (MarcoFalke)

Pull request description:

  Backports:

  * [build with -fstack-reuse=none](#15983)
  * [Add test for GCC bug 90348](#15985)

  b5a4abe has been modified to replace the `setup_common.h` with `test_bitcoin.h` include.

ACKs for commit b5a4ab:
  Empact:
    ACK b5a4abe by review of the linked PRs, the GCC bug and option, and visual inspection/comparison of the ported code
  laanwj:
    Code review + relevancy for backport ACK b5a4abe

Tree-SHA512: cdfdc6e2f208e8dc6a8a86cd7a7ed0f2a6f96604a0663efc970f580f693c1975353341fa8434b23de3cb681e03c6918e3342178752ed595d16a0ec50db913266
HashUnlimited pushed a commit to HashUnlimited/chaincoin that referenced this pull request Aug 23, 2019
Bushstar pushed a commit to Bushstar/omnicore that referenced this pull request Aug 24, 2019
deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Oct 9, 2020
Summary:
Add a unit test for compiler bug fixed in D5040

This is a backport of Core [[bitcoin/bitcoin#15985 | PR15985]]

Test Plan:
```
cmake .. -GNinja
ninja && ninja check
```

Reviewers: O1 Bitcoin ABC, #bitcoin_abc, deadalnix

Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, deadalnix

Subscribers: deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D7817
Munkybooty pushed a commit to Munkybooty/dash that referenced this pull request Nov 9, 2021
58e291c Add test for GCC bug 90348 (Pieter Wuille)

Pull request description:

  This adds a test for GCC bug 90348 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90348), using a test case extracted from our own `sha256d64` test in crypto_tests.cpp, which was failing on some platforms.

  This is based on top of bitcoin#15983 to make sure the bug doesn't trigger (it does in some Travis configurations without it).

ACKs for commit 58e291:

Tree-SHA512: 4dc9084e92dd143a53930e42bb68e33d922a2a2b891406b259d3a0bed4511dcc49e7447a7a8e4eb793a26e3eacb188ca293b71e0e061f9b3230f8e7fcfd29525
pravblockc pushed a commit to pravblockc/dash that referenced this pull request Nov 18, 2021
58e291c Add test for GCC bug 90348 (Pieter Wuille)

Pull request description:

  This adds a test for GCC bug 90348 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90348), using a test case extracted from our own `sha256d64` test in crypto_tests.cpp, which was failing on some platforms.

  This is based on top of bitcoin#15983 to make sure the bug doesn't trigger (it does in some Travis configurations without it).

ACKs for commit 58e291:

Tree-SHA512: 4dc9084e92dd143a53930e42bb68e33d922a2a2b891406b259d3a0bed4511dcc49e7447a7a8e4eb793a26e3eacb188ca293b71e0e061f9b3230f8e7fcfd29525
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Dec 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants