This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [GSoC'19] How to test lock-free code?
- From: Jakub Jelinek <jakub at redhat dot com>
- To: 김규래 <msca8h at naver dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 17 Jun 2019 10:24:26 +0200
- Subject: Re: [GSoC'19] How to test lock-free code?
- References: <7eba2d8c6dec5cadbcbd83ecf2bb2e3d@cweb004.nm.nfra.io>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Mon, Jun 17, 2019 at 05:16:18PM +0900, 김규래 wrote:
> Currently, gcc (specifically libgomp) contains some amount of lock-free code.
> Does gcc test for the correctness of the lock-free sections?
No. Well, there is thread sanitizer, -fsanitize=thread, but it isn't able
to understand the futex etc. operations used in the Linux code in libgomp,
so in order to test the library one needs to use --disable-linux-futex
-fsanitize=thread build.
> Or is it tested just as any other code?
Yes, plus of course when designing the code one needs to think about the
consequences of using lock-free code. Some platforms (e.g. aarch64 or
ppc64le) have very sensitive hw to bugs in the C/C++ memory model usage,
so some bugs only show up on those platforms and not e.g. on x86_64.
Jakub