critter-mj / akochan

Artificial Intelligence for Japanese mahjong

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Segmentation fault issue in MacOS

Mischrysalis opened this issue · comments

Hi, I'm MacOS 10.13 user and I build my own akochan.

I run lldb to analyze why the segmentation fault is occured.

Process 57764 launched: './system.exe' (x86_64)
0 {"aka_flag": true, "kyoku_first": 4, "type": "start_game"}
1 {"bakaze": "E", "dora_marker": "5s", "haiyama": ["3m", "7m", "9p", "9s", "5s", "4s", "8s", "9s", "7p", "1s", "E", "1m", "3p", "P", "4m", "1p", "8m", "W", "P", "2s", "2s", "1p", "5mr", "W", "E", "7m", "5p", "C", "9m", "7p", "6m", "3p", "S", "C", "1p", "4m", "6s", "9s", "3p", "5sr", "4s", "1m", "8s", "6p", "7s", "6m", "9m", "4p", "8p", "S", "2p", "6m", "3m", "3s", "8s", "5p", "1p", "6p", "5p", "2s", "P", "5m", "7s", "9m", "3s", "4p", "7p", "2m", "N", "W", "N", "9p", "4s", "F", "4s", "1m", "5m", "7m", "8p", "8m", "2p", "2m", "2m", "1s", "2p", "4m", "C", "6p", "8m", "6s", "7s", "F", "S", "9p", "F", "8m", "P", "E", "F", "9p", "2m", "3m", "2s", "9s", "1s", "6s", "7m", "2p", "7s", "W", "1s", "8p", "9m", "8s", "N", "6s", "N", "4m", "8p", "6p", "3s", "5s", "1m", "3m", "7p", "6m", "3s", "E", "C", "S", "5s", "4p", "5pr", "3p", "4p", "5m"], "honba": 0, "kyoku": 1, "kyotaku": 0, "oya": 0, "scores": [25000, 25000, 25000, 25000], "tehais": [["3m", "5s", "7p", "3p", "8m", "2s", "E", "9m", "S", "6s", "4s", "7s", "8p"], ["7m", "4s", "1s", "P", "W", "1p", "7m", "7p", "C", "9s", "1m", "6m", "S"], ["9p", "8s", "E", "4m", "P", "5mr", "5p", "6m", "1p", "3p", "8s", "9m", "2p"], ["9s", "9s", "1m", "1p", "2s", "W", "C", "3p", "4m", "5sr", "6p", "4p", "6m"]], "type": "start_kyoku"}
2 {"actor": 0, "pai": "3m", "type": "tsumo"}
Process 57764 stopped
thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x1efbfc590)
    frame #0: 0x000000010017e8a7 libai.so`Bit_Hai_Num::count_hai(int) const + 39
libai.so`Bit_Hai_Num::count_hai:
->  0x10017e8a7 <+39>: movl   (%rdi,%rax,4), %eax
    0x10017e8aa <+42>: leal   (%rcx,%rcx,2), %ecx
    0x10017e8ad <+45>: addb   $-0x3, %cl
    0x10017e8b0 <+48>: shrl   %cl, %eax
Target 0: (system.exe) stopped.
thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x1efbfc570)
    frame #0: 0x000000010017e887 libai.so`Bit_Hai_Num::count_hai(this=0x00000001efbfc570, hai=1) const at bit_hai_num.cpp:49 [opt]
   46  	
   47  	int Bit_Hai_Num::count_hai(const int hai) const {
   48  	  assert(hai%10 != 0);
-> 49  	  return bit_to_num(color[hai/10],hai%10);
   50  	}
   51  	
   52  	void Bit_Hai_Num::add_hai(const int hai) {

It seems that the array color is not well-assigned in this moment, but I don't know why