Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/cgo: ThreadSanitizer barks about data races in all.bash #14602

Closed
ALTree opened this issue Mar 2, 2016 · 18 comments
Closed

cmd/cgo: ThreadSanitizer barks about data races in all.bash #14602

ALTree opened this issue Mar 2, 2016 · 18 comments
Milestone

Comments

@ALTree
Copy link
Member

ALTree commented Mar 2, 2016

go version devel +b83f397 Wed Mar 2 19:32:41 2016 +0000 linux/amd64

I'm seeing this on tip:

##### ../misc/cgo/testasan

##### ../misc/cgo/testsanitizers
skipping msan tests: -fsanitize=memory not supported
==================
WARNING: ThreadSanitizer: data race (pid=2282)
  Write of size 4 at 0x0000006d20b8 by thread T2:
    #0 setVal /home/alberto/go/misc/cgo/testsanitizers/tsan.go:22 (tsan+0x00000044b9b0)
    #1 _cgo_82605fb7dc7c_Cfunc_setVal /home/alberto/go/misc/cgo/testsanitizers/tsan.go:96 (tsan+0x00000044ba31)
    #2 runtime.asmcgocall <null> (tsan+0x00000044782f)

  Previous write of size 4 at 0x0000006d20b8 by main thread:
    #0 setVal /home/alberto/go/misc/cgo/testsanitizers/tsan.go:22 (tsan+0x00000044b9b0)
    #1 _cgo_82605fb7dc7c_Cfunc_setVal /home/alberto/go/misc/cgo/testsanitizers/tsan.go:96 (tsan+0x00000044ba31)
    #2 runtime.asmcgocall <null> (tsan+0x00000044782f)

  Location is global 'val' of size 4 at 0x0000006d20b8 (tsan+0x0000006d20b8)

  Thread T2 (tid=2285, running) created by main thread at:
    #0 pthread_create <null> (libtsan.so.0+0x000000026e74)
    #1 _cgo_sys_thread_start /home/alberto/go/src/runtime/cgo/gcc_linux_amd64.c:75 (tsan+0x00000044bd3e)

SUMMARY: ThreadSanitizer: data race /home/alberto/go/misc/cgo/testsanitizers/tsan.go:22 setVal
==================
FAIL: tsan
==================
WARNING: ThreadSanitizer: data race (pid=2412)
  Write of size 4 at 0x0000006d2018 by thread T2:
    #0 setVal /home/alberto/go/misc/cgo/testsanitizers/tsan2.go:32 (tsan2+0x00000044ba90)
    #1 _cgo_b3c556dc7343_Cfunc_setVal /home/alberto/go/misc/cgo/testsanitizers/tsan2.go:106 (tsan2+0x00000044bc01)
    #2 runtime.asmcgocall <null> (tsan2+0x00000044793f)

  Previous write of size 4 at 0x0000006d2018 by main thread:
    #0 run /home/alberto/go/misc/cgo/testsanitizers/tsan2.go:24 (tsan2+0x00000044baf9)
    #1 _cgo_b3c556dc7343_Cfunc_run /home/alberto/go/misc/cgo/testsanitizers/tsan2.go:92 (tsan2+0x00000044bbad)
    #2 runtime.asmcgocall <null> (tsan2+0x00000044793f)

  Location is global 'val' of size 4 at 0x0000006d2018 (tsan2+0x0000006d2018)

  Thread T2 (tid=2416, running) created by main thread at:
    #0 pthread_create <null> (libtsan.so.0+0x000000026e74)
    #1 _cgo_sys_thread_start /home/alberto/go/src/runtime/cgo/gcc_linux_amd64.c:75 (tsan2+0x00000044bf0e)

SUMMARY: ThreadSanitizer: data race /home/alberto/go/misc/cgo/testsanitizers/tsan2.go:32 setVal
==================
FAIL: tsan2
2016/03/02 20:59:43 Failed: exit status 1
$ uname -a
Linux gauss 4.3.0-1-amd64 #1 SMP Debian 4.3.5-1 (2016-02-06) x86_64 GNU/Linux
$ gcc --version
gcc (Debian 5.3.1-8) 5.3.1 20160205
@ALTree
Copy link
Member Author

ALTree commented Mar 2, 2016

Unsurprisingly, c8ef0df is the first commit that triggers the failure.

@ianlancetaylor ianlancetaylor changed the title cgo: ThreadSanitizer barks about data races in all.bash cmd/cgo: ThreadSanitizer barks about data races in all.bash Mar 3, 2016
@ianlancetaylor ianlancetaylor added this to the Go1.7 milestone Mar 3, 2016
@ianlancetaylor ianlancetaylor self-assigned this Mar 3, 2016
@ianlancetaylor
Copy link
Contributor

Do you have clang installed on your system? Which version?

@ALTree
Copy link
Member Author

ALTree commented Mar 3, 2016

I don't have clang installed.

@shuLhan
Copy link
Contributor

shuLhan commented Mar 3, 2016

I can confirm this in Linux with commit 686fbdb.

  • What version of Go are you using (go version)?

go version devel +686fbdb Thu Mar 3 18:03:45 2016 +0000 linux/amd64

  • What operating system and processor architecture are you using (go env)?
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/ms/go/work"
GORACE=""
GOROOT="/home/ms/git/go"
GOTOOLDIR="/home/ms/git/go/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build621757699=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
  • What did you do?
    (Use play.golang.org to provide a runnable example, if possible.)
$ cd src && ./all.bash
  • What did you expect to see?

All test passed and new Go binaries installed.

  • What did you see instead?
Skipping msan tests: -fsanitize=memory not supported
==================
WARNING: ThreadSanitizer: data race (pid=24774)
  Write of size 4 at 0x0000006d20b8 by thread T2:
    #0 setVal /home/ms/git/go/misc/cgo/testsanitizers/tsan.go:22 (tsan+0x00000044b990)
    #1 _cgo_82605fb7dc7c_Cfunc_setVal /home/ms/git/go/misc/cgo/testsanitizers/tsan.go:96 (tsan+0x00000044ba11)
    #2 runtime.asmcgocall <null> (tsan+0x00000044780f)

  Previous write of size 4 at 0x0000006d20b8 by main thread:
    #0 setVal /home/ms/git/go/misc/cgo/testsanitizers/tsan.go:22 (tsan+0x00000044b990)
    #1 _cgo_82605fb7dc7c_Cfunc_setVal /home/ms/git/go/misc/cgo/testsanitizers/tsan.go:96 (tsan+0x00000044ba11)
    #2 runtime.asmcgocall <null> (tsan+0x00000044780f)

  Location is global 'val' of size 4 at 0x0000006d20b8 (tsan+0x0000006d20b8)

  Thread T2 (tid=24778, running) created by main thread at:
    #0 pthread_create /build/gcc/src/gcc-5-20160209/libsanitizer/tsan/tsan_interceptors.cc:895 (libtsan.so.0+0x0000000274d7)
    #1 _cgo_sys_thread_start /home/ms/git/go/src/runtime/cgo/gcc_linux_amd64.c:75 (tsan+0x00000044bd1e)

SUMMARY: ThreadSanitizer: data race /home/ms/git/go/misc/cgo/testsanitizers/tsan.go:22 setVal
==================
FAIL: tsan
==================
WARNING: ThreadSanitizer: data race (pid=24864)
  Write of size 4 at 0x0000006d2018 by thread T2:
    #0 setVal /home/ms/git/go/misc/cgo/testsanitizers/tsan2.go:32 (tsan2+0x00000044ba70)
    #1 _cgo_b3c556dc7343_Cfunc_setVal /home/ms/git/go/misc/cgo/testsanitizers/tsan2.go:106 (tsan2+0x00000044bbe1)
    #2 runtime.asmcgocall <null> (tsan2+0x00000044791f)

  Previous write of size 4 at 0x0000006d2018 by main thread:
    #0 run /home/ms/git/go/misc/cgo/testsanitizers/tsan2.go:24 (tsan2+0x00000044bad9)
    #1 _cgo_b3c556dc7343_Cfunc_run /home/ms/git/go/misc/cgo/testsanitizers/tsan2.go:92 (tsan2+0x00000044bb8d)
    #2 runtime.asmcgocall <null> (tsan2+0x00000044791f)

  Location is global 'val' of size 4 at 0x0000006d2018 (tsan2+0x0000006d2018)

  Thread T2 (tid=24867, running) created by main thread at:
    #0 pthread_create /build/gcc/src/gcc-5-20160209/libsanitizer/tsan/tsan_interceptors.cc:895 (libtsan.so.0+0x0000000274d7)
    #1 _cgo_sys_thread_start /home/ms/git/go/src/runtime/cgo/gcc_linux_amd64.c:75 (tsan2+0x00000044beee)

SUMMARY: ThreadSanitizer: data race /home/ms/git/go/misc/cgo/testsanitizers/tsan2.go:32 setVal
==================
FAIL: tsan2
2016/03/04 01:10:19 Failed: exit status 1

##### ../misc/cgo/errors

##### ../misc/cgo/testsigfwd

##### ../test/bench/go1
testing: warning: no tests to run
PASS
ok      _/home/ms/git/go/test/bench/go1 2.233s

##### ../test
skipped due to earlier error
skipped due to earlier error
skipped due to earlier error
skipped due to earlier error
skipped due to earlier error

##### API check
skipped due to earlier error
2016/03/04 01:10:22 FAILED

@ianlancetaylor
Copy link
Contributor

@shuLhan Same questions as above: do you have clang installed? What version? If clang is not installed, what version of GCC is installed? Thanks.

@shuLhan
Copy link
Contributor

shuLhan commented Mar 4, 2016

@ianlancetaylor,

Same questions as above: do you have clang installed? What version?

No.

If clang is not installed, what version of GCC is installed? Thanks.

gcc (GCC) 5.3.0
glibc 2.23-1

System: Linux xenom-bubu 4.4.3-1-ARCH #1 SMP PREEMPT x86_64 GNU/Linux

@shuLhan
Copy link
Contributor

shuLhan commented Mar 11, 2016

Just a side note, in case someone search and found this issue.

If you want to make all.bash works either,

  • install clang and set CC=clang, or
  • set CGO=0 (at current tip it has been changed to CGO_ENABLED) before running all.bash.

Build and test works with clang version 3.7.1.

@nadiasvertex
Copy link
Contributor

  1. What version of Go are you using (go version)?

go version devel +a145378 Mon Mar 21 20:24:06 2016 +0000 linux/amd64

  1. What operating system and processor architecture are you using (go env)?
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH=""
GORACE=""
GOROOT="/home/christopher/workspace/go-official"
GOTOOLDIR="/home/christopher/workspace/go-official/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build420019199=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
  1. What did you do?

Executed src/all.bash

  1. What did you expect to see?

All tests passed.

  1. What did you see instead?
##### ../misc/cgo/testsanitizers
skipping msan tests: -fsanitize=memory not supported
==================
WARNING: ThreadSanitizer: data race (pid=14437)
  Write of size 4 at 0x0000006b2e78 by thread T2:
    #0 setVal /home/christopher/workspace/go-official/misc/cgo/testsanitizers/tsan.go:22 (tsan+0x000000445070)
    #1 _cgo_82605fb7dc7c_Cfunc_setVal /home/christopher/workspace/go-official/misc/cgo/testsanitizers/tsan.go:96 (tsan+0x0000004450f1)
    #2 runtime.asmcgocall <null> (tsan+0x00000044235f)

  Previous write of size 4 at 0x0000006b2e78 by main thread:
    #0 setVal /home/christopher/workspace/go-official/misc/cgo/testsanitizers/tsan.go:22 (tsan+0x000000445070)
    #1 _cgo_82605fb7dc7c_Cfunc_setVal /home/christopher/workspace/go-official/misc/cgo/testsanitizers/tsan.go:96 (tsan+0x0000004450f1)
    #2 runtime.asmcgocall <null> (tsan+0x00000044235f)

  Location is global 'val' of size 4 at 0x0000006b2e78 (tsan+0x0000006b2e78)

  Thread T2 (tid=14440, running) created by main thread at:
    #0 pthread_create <null> (libtsan.so.0+0x000000027537)
    #1 _cgo_sys_thread_start /home/christopher/workspace/go-official/src/runtime/cgo/gcc_linux_amd64.c:73 (tsan+0x000000445471)

SUMMARY: ThreadSanitizer: data race /home/christopher/workspace/go-official/misc/cgo/testsanitizers/tsan.go:22 setVal
==================
FAIL: tsan
==================
WARNING: ThreadSanitizer: data race (pid=14631)
  Write of size 4 at 0x0000006b3dd8 by thread T3:
    #0 setVal /home/christopher/workspace/go-official/misc/cgo/testsanitizers/tsan2.go:32 (tsan2+0x000000445150)
    #1 _cgo_b3c556dc7343_Cfunc_setVal /home/christopher/workspace/go-official/misc/cgo/testsanitizers/tsan2.go:106 (tsan2+0x0000004452e1)
    #2 runtime.asmcgocall <null> (tsan2+0x00000044246f)

  Previous write of size 4 at 0x0000006b3dd8 by main thread:
    #0 run /home/christopher/workspace/go-official/misc/cgo/testsanitizers/tsan2.go:24 (tsan2+0x0000004451d9)
    #1 _cgo_b3c556dc7343_Cfunc_run /home/christopher/workspace/go-official/misc/cgo/testsanitizers/tsan2.go:92 (tsan2+0x00000044528d)
    #2 runtime.asmcgocall <null> (tsan2+0x00000044246f)

  Location is global '<null>' of size 0 at 0x000000000000 (tsan2+0x0000006b3dd8)

  Thread T3 (tid=14650, running) created by main thread at:
    #0 pthread_create <null> (libtsan.so.0+0x000000027537)
    #1 _cgo_sys_thread_start /home/christopher/workspace/go-official/src/runtime/cgo/gcc_linux_amd64.c:73 (tsan2+0x000000445661)

SUMMARY: ThreadSanitizer: data race /home/christopher/workspace/go-official/misc/cgo/testsanitizers/tsan2.go:32 setVal
==================
FAIL: tsan2
2016/03/21 18:56:53 Failed: exit status 1

I do not have clang installed. My gcc is:

gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.3.1-11ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 5.3.1 20160311 (Ubuntu 5.3.1-11ubuntu1) 

@rjammala
Copy link

I too see this on Ubuntu with gcc 5.3.1 20160320. clang is not installed.
I tried to build tip using go1.6
Here are the details:

$ uname -a
Linux ubuntu 4.4.0-15-generic #31-Ubuntu SMP Fri Mar 18 19:08:31 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

$ gcc --version
gcc (Ubuntu/Linaro 5.3.1-12ubuntu4) 5.3.1 20160320
Copyright (C) 2015 Free Software Foundation, Inc.

$ go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/rjammalamadaka/gocode"
GORACE=""
GOROOT="/home/rjammalamadaka/go"
GOTOOLDIR="/home/rjammalamadaka/go/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build653676224=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"

 ../misc/cgo/testasan

 ../misc/cgo/testsanitizers
skipping msan tests: -fsanitize=memory not supported
WARNING: ThreadSanitizer: data race (pid=33614)
  Write of size 4 at 0x0000006ace98 by thread T3:
    #0 setVal /home/rjammalamadaka/go/misc/cgo/testsanitizers/tsan.go:22 (tsan+0x000000445350)
    #1 _cgo_82605fb7dc7c_Cfunc_setVal /home/rjammalamadaka/go/misc/cgo/testsanitizers/tsan.go:96 (tsan+0x0000004453d1)
    #2 runtime.asmcgocall <null> (tsan+0x00000044265f)

  Previous write of size 4 at 0x0000006ace98 by main thread:
    #0 setVal /home/rjammalamadaka/go/misc/cgo/testsanitizers/tsan.go:22 (tsan+0x000000445350)
    #1 _cgo_82605fb7dc7c_Cfunc_setVal /home/rjammalamadaka/go/misc/cgo/testsanitizers/tsan.go:96 (tsan+0x0000004453d1)
    #2 runtime.asmcgocall <null> (tsan+0x00000044265f)

  Location is global 'val' of size 4 at 0x0000006ace98 (tsan+0x0000006ace98)

  Thread T3 (tid=33619, running) created by main thread at:
    #0 pthread_create <null> (libtsan.so.0+0x000000027597)
    #1 _cgo_sys_thread_start /home/rjammalamadaka/go/src/runtime/cgo/gcc_linux_amd64.c:73 (tsan+0x000000445751)

SUMMARY: ThreadSanitizer: data race /home/rjammalamadaka/go/misc/cgo/testsanitizers/tsan.go:22 setVal
FAIL: tsan
WARNING: ThreadSanitizer: data race (pid=33736)
  Write of size 4 at 0x0000006acdf8 by thread T4:
    #0 setVal /home/rjammalamadaka/go/misc/cgo/testsanitizers/tsan2.go:32 (tsan2+0x000000445430)
    #1 _cgo_b3c556dc7343_Cfunc_setVal /home/rjammalamadaka/go/misc/cgo/testsanitizers/tsan2.go:106 (tsan2+0x0000004455c1)
    #2 runtime.asmcgocall <null> (tsan2+0x00000044276f)

  Previous write of size 4 at 0x0000006acdf8 by main thread:
    #0 run /home/rjammalamadaka/go/misc/cgo/testsanitizers/tsan2.go:24 (tsan2+0x0000004454b9)
    #1 _cgo_b3c556dc7343_Cfunc_run /home/rjammalamadaka/go/misc/cgo/testsanitizers/tsan2.go:92 (tsan2+0x00000044556d)
    #2 runtime.asmcgocall <null> (tsan2+0x00000044276f)

  Location is global '<null>' of size 0 at 0x000000000000 (tsan2+0x0000006acdf8)

  Thread T4 (tid=33741, running) created by thread T2 at:
    #0 pthread_create <null> (libtsan.so.0+0x000000027597)
    #1 _cgo_sys_thread_start /home/rjammalamadaka/go/src/runtime/cgo/gcc_linux_amd64.c:73 (tsan2+0x000000445941)

SUMMARY: ThreadSanitizer: data race /home/rjammalamadaka/go/misc/cgo/testsanitizers/tsan2.go:32 setVal
FAIL: tsan2
2016/03/28 12:03:22 Failed: exit status 1

@dvyukov
Copy link
Member

dvyukov commented Apr 8, 2016

@ianlancetaylor I think gcc does not support __has_feature feature used in src/cmd/cgo/out.go.
Maybe we can just look at presence of -fsanitize=thread flag? If compiler does not support -fsanitize=thread, then we will get compilation errors due to unsupported flag anyway.

@ianlancetaylor
Copy link
Contributor

@dvyukov I agree that GCC doesn't support __has_feature. As far as I know there is no way in GCC to look at whether some option was passed. I don't see anything in GCC that defines any preprocessor macros to indicate -fsanitize=thread. Do you know if there is any way code compiled by GCC can detect whether -fsanitize=thread was used?

@dvyukov
Copy link
Member

dvyukov commented Apr 12, 2016

Gcc provides SANITIZE_ADDRESS, but unfortunately SANITIZE_THREAD is not implemented:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64354

What do you think if we look at presence of -fsanitize=thread flag?
Even if the compiler does not support it, it will bark during compilation of C code before linker reveals our misguess with tsan support.

@ianlancetaylor
Copy link
Contributor

@dvyukov I'm sorry, I don't understand your suggestion of looking at the -fsanitize=thread flag.

Right now the test script verifies that the compiler supports -fsanitize=thread. The bug is because people are using a version of GCC that supports that option, but the generated cgo code doesn't detect it, and so the code intended to tell TSAN that there is no race does not run.

In the absence of SANITIZE_THREAD I don't see a way to fix this. I think we have to change the test to not run when using GCC. But if you have a better idea I would like to understand it.

@dvyukov
Copy link
Member

dvyukov commented Apr 13, 2016

I meant the following:
go tool knows whether -fsanitize=thread will be passed to gcc/clang or not. So if it sees -fsanitize=thread flag, it can as well pass -tsan to cgo command, and that will trigger the tsan support.

@dvyukov
Copy link
Member

dvyukov commented Apr 13, 2016

Another idea:

Enable race support when __has_feature(thread_sanitizer) || defined(__SANITIZE_THREAD).

It will work automatically with clang, but gcc users will need to use -fsanitize=thread -D__SANITIZE_THREAD. Eventually gcc will define the macro internally.
May be better then turning it off entirely under gcc.

@EtienneBruines
Copy link

EtienneBruines commented Apr 21, 2016

Joining the 'bug report', even though most of the problem has been identified.

TL;DR

  • Using the newest version of clang available, brings up another (different) error.
  • Using an old clang the test is skipped, so no errors are thrown.
  • Using CGO_ENABLED=0 also disables those tests.
  • Using no clang reports the error described in this issue.

Longer version

  • Without clang installed (but with gcc 5.3.1):

    the error as described
  • With clang-3.6, env CC=clang, linux 4.3:

    the installation skipped those tests (needed clang 3.8+)
  • With clang-3.8, env CC=clang-3.8, linux 4.3:

    TestCgoConsistentResults: go_test.go:2775: building cgotest twice did not produce the same output
  • With clang-3.8, env CC=clang, linux 4.3 and a symlink from /usr/local/bin/clang to /usr/bin/clang-3.8:

    TestCgoConsistentResults: go_test.go:2775: building cgotest twice did not produce the same output (same)
--- FAIL: TestCgoConsistentResults (1.10s)
    go_test.go:244: running testgo [build -o /tmp/gotest260338695/cgotest1 cgotest]
    go_test.go:244: running testgo [build -x -o /tmp/gotest260338695/cgotest2 cgotest]
    go_test.go:263: standard error:
    go_test.go:264: WORK=/tmp/go-build737947577
        mkdir -p $WORK/cgotest/_obj/
        mkdir -p $WORK/
        cd /home/etiennebruines/workspaces/go-master/src/cmd/go/testdata/src/cgotest
        CGO_LDFLAGS="-g" "-O2" /home/etiennebruines/workspaces/go-master/pkg/tool/linux_amd64/cgo -objdir $WORK/cgotest/_obj/ -importpath cgotest -- -I $WORK/cgotest/_obj/ m.go
        cd $WORK
        clang-3.8 -fdebug-prefix-map=a=b -c trivial.c
        clang-3.8 -gno-record-gcc-switches -c trivial.c
        cd /home/etiennebruines/workspaces/go-master/src/cmd/go/testdata/src/cgotest
        clang-3.8 -I . -fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -I $WORK/cgotest/_obj/ -g -O2 -o $WORK/cgotest/_obj/_cgo_main.o -c $WORK/cgotest/_obj/_cgo_main.c
        clang-3.8 -I . -fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -I $WORK/cgotest/_obj/ -g -O2 -o $WORK/cgotest/_obj/_cgo_export.o -c $WORK/cgotest/_obj/_cgo_export.c
        clang-3.8 -I . -fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -I $WORK/cgotest/_obj/ -g -O2 -o $WORK/cgotest/_obj/m.cgo2.o -c $WORK/cgotest/_obj/m.cgo2.c
        clang-3.8 -I . -fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -o $WORK/cgotest/_obj/_cgo_.o $WORK/cgotest/_obj/_cgo_main.o $WORK/cgotest/_obj/_cgo_export.o $WORK/cgotest/_obj/m.cgo2.o -g -O2
        /home/etiennebruines/workspaces/go-master/pkg/tool/linux_amd64/cgo -objdir $WORK/cgotest/_obj/ -dynpackage cgotest -dynimport $WORK/cgotest/_obj/_cgo_.o -dynout $WORK/cgotest/_obj/_cgo_import.go
        cd $WORK
        clang-3.8 -no-pie -c trivial.c
        cd /home/etiennebruines/workspaces/go-master/src/cmd/go/testdata/src/cgotest
        clang-3.8 -I . -fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -o $WORK/cgotest/_obj/_all.o $WORK/cgotest/_obj/_cgo_export.o $WORK/cgotest/_obj/m.cgo2.o -g -O2 -Wl,-r -nostdlib -Wl,--build-id=none
        /home/etiennebruines/workspaces/go-master/pkg/tool/linux_amd64/compile -o $WORK/cgotest.a -trimpath $WORK -p cgotest -buildid 1491fc40a2d4f2376923084c60120b2fd293fe0e -D _/home/etiennebruines/workspaces/go-master/src/cmd/go/testdata/src/cgotest -I $WORK -pack $WORK/cgotest/_obj/_cgo_gotypes.go $WORK/cgotest/_obj/m.cgo1.go $WORK/cgotest/_obj/_cgo_import.go
        pack r $WORK/cgotest.a $WORK/cgotest/_obj/_all.o # internal
        mkdir -p /tmp/gotest260338695/
        mv $WORK/cgotest.a /tmp/gotest260338695/cgotest2

    go_test.go:2775: building cgotest twice did not produce the same output
FAIL
FAIL    cmd/go  29.068s

Do you want me to open up a separate issue for the new error? Or is it related to this one?

@ALTree
Copy link
Member Author

ALTree commented Apr 21, 2016

The second one looks like a different bug to me. This one is about threadsanitizer failing when clang is not present, the one you see is triggered by CC=clang.

@gopherbot
Copy link

CL https://golang.org/cl/22688 mentions this issue.

@golang golang locked and limited conversation to collaborators May 3, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants