Clangのバグと戦うために173210氏に助けを求めた話

msys2 mingw32 clang3.8でビルドしたときだけ再現するよくわからないバグと戦うために知り合いのハッカー173210氏に助けを求めた。 clang3.9で治ってたっぽい
4
前へ 1 ・・ 5 6

暗中模索

173210 @173210

x86でEmitNeonCallって…

2016-09-19 09:06:41
173210 @173210

clang分かんねえなあ。

2016-09-19 09:13:18
173210 @173210

LLVMのvectorization関連の文書化が狂ってて殺意

2016-09-19 10:50:34
173210 @173210

LLVM/clang嫌いになりそう

2016-09-19 10:54:39

敗北

173210 @173210

@yumetodo clang詰んだので最小限の再現方法とスタックトレースだけ貼っとく。無念。 gist.github.com/173210/bcd1ed3… なんかこのスタックトレースもぶっ壊れてる感はある。

2016-09-19 21:38:41
yumetodo @yumetodo

@173210 詰んだというと?なんかx86なのにneonとかいう文字が見えるツイートがあったのは一体・・・

2016-09-19 23:03:33
173210 @173210

@yumetodo 諦めた。これ以上調べるには、膨大なclangとllvmのコミットの中からmasterとrelease_38の間で例の問題が発現しなくなるコミットを見つけるか、SLP Vectorization関連のコードをひたすら洗うしかない。

2016-09-20 15:42:24
173210 @173210

@yumetodo release_39だと再現しなかったのでその間を当たるべきだな。

2016-09-20 16:42:26
173210 @173210

@yumetodo Revisionsを見ればわかるけど、スタックトレースの内容が変わっている。NEONが見えたのはCMAKE_BUILD_TYPEが設定されていなかったとき。Releaseにすると消える。

2016-09-20 15:43:47

msys2側で動きが

https://github.com/Alexpux/MINGW-packages/issues/1669#issuecomment-249714934
Fixed in upcoming Clang 3.9 package.

https://github.com/Alexpux/MINGW-packages/issues/1669#issuecomment-249723596
@mati865 Wow, that sounds brilliant. May I know what was the cause?

yumetodo @yumetodo

ん?msys2 mingw32 clangが-O2でコケる問題、次のclang 3.9でfixしたっぽい? github.com/Alexpux/MINGW-… @173210

2016-09-27 14:54:58
173210 @173210

@yumetodo twitter.com/173210/status/… fixされたかは知らないけど少なくとも再現しない。

2016-09-27 15:24:44

https://github.com/Alexpux/MINGW-packages/issues/1669#issuecomment-249728631
Wait, that's weird. i686 toolchain is in fact 64 bit toolchain:

$ clang -v
clang version 3.9.0 (tags/RELEASE_390/final)
Target: x86_64-pc-windows-gnu
Thread model: posix
InstalledDir: D:\projekty\msys2\clang\msys64\mingw32\bin

Something terrible must have happened in build system, looks like a lot of digging.

EDIT: file shows: clang.exe: PE32 executable (console) Intel 80386 (stripped to external PDB), for MS Windows

EDIT2: Looks like target defaults to 64 bit but Clang itself is 32 bit and is able to build 32 bit test case from this issue after adding -target i686-pc-windows-gnu:

$ llvm-objdump -d clang_test.o
clang_test.o:   file format COFF-i386
Disassembly of section .text:
_main:
0:       55      pushl   %ebp
1:       89 e5   movl    %esp, %ebp
3:       e8 00 00 00 00  calll   0 <_main+0x8>
8:       80 3d 00 00 00 00 00    cmpb    $0, 0
f:       74 0a   je      10 <_main+0x1B>
11:       b9 00 00 00 00  movl    $0, %ecx
16:       e8 00 00 00 00  calll   0 <_main+0x1B>
1b:       31 c0   xorl    %eax, %eax
1d:       5d      popl    %ebp
1e:       c3      retl

Still need to do some digging.

https://github.com/Alexpux/MINGW-packages/issues/1669#issuecomment-250028024
Ok, resolved for good with new Clang: clang -cc1 version 3.9.0 based upon LLVM 3.9.0 default target i686-w64-windows-gnu.

総括

  • なんか知らないけどclang3.8からclang3.9の間でいつのまにかfixされていた。
  • pacmanでclang3.9が落ちてくる頃にはfixの恩恵が受けられそう

なおmsys2のclang3.9にする作業ページはここ
https://github.com/Alexpux/MINGW-packages/pull/1768

前へ 1 ・・ 5 6