thomas-maeder/popeye

Bug: reading outside of zzzan (3)

JoshuaGreen opened this issue · 1 comments

When Popeye is run on BEISPIEL/glasgow.inp, UndefinedBehaviorSanitizer issues the complaint:

conditions/circe/glasgow.c:38:7: runtime error: index -17 out of bounds for type 'SquareFlags[176]'
    #0 0x5600da42390a in circe_glasgow_adjust_rebirth_square_solve /home/joshua/clean/popeye/conditions/circe/glasgow.c:38:7
    #1 0x5600da3b18e1 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:1157:7
    #2 0x5600da4a7698 in pipe_dispatch_delegate /home/joshua/clean/popeye/solving/pipe.c:199:3
    #3 0x5600da418b3f in circe_determine_rebirth_square_solve /home/joshua/clean/popeye/conditions/circe/circe.c:324:3
    #4 0x5600da3b18d4 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:1149:7
    #5 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #6 0x5600da4a1753 in binary_solve_if_then_else /home/joshua/clean/popeye/solving/binary.c:21:5
    #7 0x5600da41ea72 in circe_prevent_king_rebirth_solve /home/joshua/clean/popeye/conditions/circe/rex_inclusive.c:32:3
    #8 0x5600da3b0b2b in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:1093:7
    #9 0x5600da4a7698 in pipe_dispatch_delegate /home/joshua/clean/popeye/solving/pipe.c:199:3
    #10 0x5600da4235f8 in circe_initialise_relevant_from_reborn /home/joshua/clean/popeye/conditions/circe/relevant_piece.c:80:3
    #11 0x5600da3b0b38 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:1097:7
    #12 0x5600da4a7698 in pipe_dispatch_delegate /home/joshua/clean/popeye/solving/pipe.c:199:3
    #13 0x5600da422848 in circe_initialise_reborn_from_capturee_solve /home/joshua/clean/popeye/conditions/circe/reborn_piece.c:190:3
    #14 0x5600da3b1886 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:1109:7
    #15 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #16 0x5600da4a1753 in binary_solve_if_then_else /home/joshua/clean/popeye/solving/binary.c:21:5
    #17 0x5600da41d175 in circe_capture_fork_solve /home/joshua/clean/popeye/conditions/circe/capture_fork.c:60:3
    #18 0x5600da3b0b11 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:1089:7
    #19 0x5600da4a7698 in pipe_dispatch_delegate /home/joshua/clean/popeye/solving/pipe.c:199:3
    #20 0x5600da423362 in circe_make_current_move_relevant_solve /home/joshua/clean/popeye/conditions/circe/relevant_capture.c:75:3
    #21 0x5600da3b0b45 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:1101:7
    #22 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #23 0x5600da4e82f9 in en_passant_adjuster_solve /home/joshua/clean/popeye/pieces/walks/pawns/en_passant.c:468:3
    #24 0x5600da3b04d0 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:732:7
    #25 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #26 0x5600da4e5f98 in pawn_promoter_solve /home/joshua/clean/popeye/pieces/walks/pawns/promotion.c:309:5
    #27 0x5600da3b04dd in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:740:7
    #28 0x5600da49b255 in post_move_iteration_solve_recurse /home/joshua/clean/popeye/solving/post_move_iteration.c:131:3
    #29 0x5600da4e5fa9 in pawn_promoter_solve /home/joshua/clean/popeye/pieces/walks/pawns/promotion.c:320:7
    #30 0x5600da3b04dd in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:740:7
    #31 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #32 0x5600da4a231b in move_player_solve /home/joshua/clean/popeye/solving/move_player.c:59:3
    #33 0x5600da3b12f0 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:728:7
    #34 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #35 0x5600da49605d in castling_player_solve /home/joshua/clean/popeye/solving/castling.c:130:7
    #36 0x5600da3b12fd in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:724:7
    #37 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #38 0x5600da49b2e8 in move_execution_post_move_iterator_solve /home/joshua/clean/popeye/solving/post_move_iteration.c:235:3
    #39 0x5600da3b049c in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:712:7
    #40 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #41 0x5600da48fe78 in move_effect_journal_undoer_solve /home/joshua/clean/popeye/solving/move_effect_journal.c:250:3
    #42 0x5600da3b04c3 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:716:7
    #43 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #44 0x5600da49569d in find_defense_solve /home/joshua/clean/popeye/solving/find_move.c:139:5
    #45 0x5600da3b048f in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:700:7
    #46 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #47 0x5600da494879 in king_move_generator_solve /home/joshua/clean/popeye/solving/king_move_generator.c:61:3
    #48 0x5600da3b06c3 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:1602:7
    #49 0x5600da4a7363 in pipe_this_move_doesnt_solve_if /home/joshua/clean/popeye/solving/pipe.c:63:5
    #50 0x5600da4a17e8 in dead_end_solve /home/joshua/clean/popeye/solving/dead_end.c:36:3
    #51 0x5600da3b0260 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:841:7
    #52 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #53 0x5600da49922f in reset_unsolvable_solve /home/joshua/clean/popeye/solving/avoid_unsolvable.c:235:3
    #54 0x5600da3b12d6 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:893:7
    #55 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #56 0x5600da4acf9c in defense_adapter_solve /home/joshua/clean/popeye/solving/battle_play/defense_adapter.c:61:3
    #57 0x5600da3b127b in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:1695:7
    #58 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #59 0x5600da4ad73c in and_solve /home/joshua/clean/popeye/solving/boolean/and.c:30:3
    #60 0x5600da3b064e in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:1703:7
    #61 0x5600da4a7708 in fork_solve_delegate /home/joshua/clean/popeye/solving/fork.c:16:3
    #62 0x5600da4a7e9a in conditional_pipe_solve_delegate /home/joshua/clean/popeye/solving/conditional_pipe.c:26:3
    #63 0x5600da4af0fc in goal_immobile_reached_tester_solve /home/joshua/clean/popeye/solving/goals/immobile.c:32:37
    #64 0x5600da3b13e7 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:1934:7
    #65 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #66 0x5600da4993ee in selfcheck_guard_solve /home/joshua/clean/popeye/solving/selfcheck_guard.c:61:5
    #67 0x5600da3b027a in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:908:7
    #68 0x5600da4a7363 in pipe_this_move_doesnt_solve_if /home/joshua/clean/popeye/solving/pipe.c:63:5
    #69 0x5600da4af9d4 in goal_check_reached_tester_solve /home/joshua/clean/popeye/solving/goals/check.c:35:3
    #70 0x5600da3b05ba in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:1885:7
    #71 0x5600da4a7708 in fork_solve_delegate /home/joshua/clean/popeye/solving/fork.c:16:3
    #72 0x5600da4a7e9a in conditional_pipe_solve_delegate /home/joshua/clean/popeye/solving/conditional_pipe.c:26:3
    #73 0x5600da4ad97c in goal_reached_tester_solve /home/joshua/clean/popeye/solving/goals/reached_tester.c:27:11
    #74 0x5600da3b05ad in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:885:7
    #75 0x5600da4a7708 in fork_solve_delegate /home/joshua/clean/popeye/solving/fork.c:16:3
    #76 0x5600da4a1f8c in end_of_branch_goal_solve /home/joshua/clean/popeye/solving/end_of_branch_goal.c:27:3
    #77 0x5600da3b0239 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:881:7
    #78 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #79 0x5600da4a1753 in binary_solve_if_then_else /home/joshua/clean/popeye/solving/binary.c:21:5
    #80 0x5600da4991fd in avoid_unsolvable_solve /home/joshua/clean/popeye/solving/avoid_unsolvable.c:186:3
    #81 0x5600da3b12c9 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:889:7
    #82 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #83 0x5600da437ad8 in killer_attack_collector_solve /home/joshua/clean/popeye/optimisations/killer_move/collector.c:112:3
    #84 0x5600da3b07c4 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:2130:7
    #85 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #86 0x5600da4a20d4 in attack_played_solve /home/joshua/clean/popeye/solving/move_played.c:29:3
    #87 0x5600da3b1317 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:812:7
    #88 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #89 0x5600da496925 in castling_rights_adjuster_solve /home/joshua/clean/popeye/solving/castling.c:435:3
    #90 0x5600da3b1435 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:1647:7
    #91 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #92 0x5600da59baa1 in king_square_updater_solve /home/joshua/clean/popeye/position/effects/king_square.c:204:5
    #93 0x5600da3b0593 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:2042:7
    #94 0x5600da4a7698 in pipe_dispatch_delegate /home/joshua/clean/popeye/solving/pipe.c:199:3
    #95 0x5600da418fff in circe_done_with_rebirth /home/joshua/clean/popeye/conditions/circe/circe.c:385:3
    #96 0x5600da3b1970 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:1229:7
    #97 0x5600da4a7708 in fork_solve_delegate /home/joshua/clean/popeye/solving/fork.c:16:3
    #98 0x5600da4a174c in binary_solve_if_then_else /home/joshua/clean/popeye/solving/binary.c:19:5
    #99 0x5600da41d175 in circe_capture_fork_solve /home/joshua/clean/popeye/conditions/circe/capture_fork.c:60:3
    #100 0x5600da3b0b11 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:1089:7
    #101 0x5600da4a7698 in pipe_dispatch_delegate /home/joshua/clean/popeye/solving/pipe.c:199:3
    #102 0x5600da423362 in circe_make_current_move_relevant_solve /home/joshua/clean/popeye/conditions/circe    /relevant_capture.c:75:3
    #103 0x5600da3b0b45 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:1101:7
    #104 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #105 0x5600da4e82f9 in en_passant_adjuster_solve /home/joshua/clean/popeye/pieces/walks/pawns/en_passant.c:468:3
    #106 0x5600da3b04d0 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:732:7
    #107 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #108 0x5600da4e5f98 in pawn_promoter_solve /home/joshua/clean/popeye/pieces/walks/pawns/promotion.c:309:5
    #109 0x5600da3b04dd in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:740:7
    #110 0x5600da49b255 in post_move_iteration_solve_recurse /home/joshua/clean/popeye/solving/post_move_iteration.c:131:3
    #111 0x5600da4e5fa9 in pawn_promoter_solve /home/joshua/clean/popeye/pieces/walks/pawns/promotion.c:320:7
    #112 0x5600da3b04dd in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:740:7
    #113 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #114 0x5600da4a231b in move_player_solve /home/joshua/clean/popeye/solving/move_player.c:59:3
    #115 0x5600da3b12f0 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:728:7
    #116 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #117 0x5600da49605d in castling_player_solve /home/joshua/clean/popeye/solving/castling.c:130:7
    #118 0x5600da3b12fd in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:724:7
    #119 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #120 0x5600da49b2e8 in move_execution_post_move_iterator_solve /home/joshua/clean/popeye/solving/post_move_iteration.c:235:3
    #121 0x5600da3b049c in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:712:7
    #122 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #123 0x5600da48fe78 in move_effect_journal_undoer_solve /home/joshua/clean/popeye/solving/move_effect_journal.c:250:3
    #124 0x5600da3b04c3 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:716:7
    #125 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #126 0x5600da4952df in find_attack_solve /home/joshua/clean/popeye/solving/find_move.c:54:5
    #127 0x5600da3b0482 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:692:7
    #128 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #129 0x5600da438969 in killer_move_prioriser_solve /home/joshua/clean/popeye/optimisations/killer_move/prioriser.c:91:3
    #130 0x5600da3b1505 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:2122:7
    #131 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #132 0x5600da491eb8 in move_generator_solve /home/joshua/clean/popeye/solving/move_generator.c:440:3
    #133 0x5600da3b06b6 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:684:7
    #134 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #135 0x5600da499258 in learn_unsolvable_solve /home/joshua/clean/popeye/solving/avoid_unsolvable.c:282:3
    #136 0x5600da3b12e3 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:897:7
    #137 0x5600da4a7363 in pipe_this_move_doesnt_solve_if /home/joshua/clean/popeye/solving/pipe.c:63:5
    #138 0x5600da4a17e8 in dead_end_solve /home/joshua/clean/popeye/solving/dead_end.c:36:3
    #139 0x5600da3b0260 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:841:7
    #140 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #141 0x5600da48ffc7 in find_shortest_solve /home/joshua/clean/popeye/solving/find_shortest.c:74:5
    #142 0x5600da3b06a9 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:680:7
    #143 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #144 0x5600da47f9c3 in delegate_can_attack_in_n /home/joshua/clean/popeye/optimisations/hash.c:2289:3
    #145 0x5600da47f885 in attack_hashed_tester_solve /home/joshua/clean/popeye/optimisations/hash.c:2339:20
    #146 0x5600da3b1657 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:861:7
    #147 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #148 0x5600da4993ee in selfcheck_guard_solve /home/joshua/clean/popeye/solving/selfcheck_guard.c:61:5
    #149 0x5600da3b027a in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:908:7
    #150 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #151 0x5600da437978 in killer_defense_collector_solve /home/joshua/clean/popeye/optimisations/killer_move/collector.c:66:3
    #152 0x5600da3b14f8 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:1482:7
    #153 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #154 0x5600da49922f in reset_unsolvable_solve /home/joshua/clean/popeye/solving/avoid_unsolvable.c:235:3
    #155 0x5600da3b12d6 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:893:7
    #156 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #157 0x5600da4a2114 in defense_played_solve /home/joshua/clean/popeye/solving/move_played.c:63:3
    #158 0x5600da3b0504 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:2102:7
    #159 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #160 0x5600da496925 in castling_rights_adjuster_solve /home/joshua/clean/popeye/solving/castling.c:435:3
    #161 0x5600da3b1435 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:1647:7
    #162 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #163 0x5600da59baa1 in king_square_updater_solve /home/joshua/clean/popeye/position/effects/king_square.c:204:5
    #164 0x5600da3b0593 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:2042:7
    #165 0x5600da4a7698 in pipe_dispatch_delegate /home/joshua/clean/popeye/solving/pipe.c:199:3
    #166 0x5600da418fff in circe_done_with_rebirth /home/joshua/clean/popeye/conditions/circe/circe.c:385:3
    #167 0x5600da3b1970 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:1229:7
    #168 0x5600da4a7708 in fork_solve_delegate /home/joshua/clean/popeye/solving/fork.c:16:3
    #169 0x5600da4a174c in binary_solve_if_then_else /home/joshua/clean/popeye/solving/binary.c:19:5
    #170 0x5600da41d175 in circe_capture_fork_solve /home/joshua/clean/popeye/conditions/circe/capture_fork.c:60:3
    #171 0x5600da3b0b11 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:1089:7
    #172 0x5600da4a7698 in pipe_dispatch_delegate /home/joshua/clean/popeye/solving/pipe.c:199:3
    #173 0x5600da423362 in circe_make_current_move_relevant_solve /home/joshua/clean/popeye/conditions/circe/relevant_capture.c:75:3
    #174 0x5600da3b0b45 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:1101:7
    #175 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #176 0x5600da4e82f9 in en_passant_adjuster_solve /home/joshua/clean/popeye/pieces/walks/pawns/en_passant.c:468:3
    #177 0x5600da3b04d0 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:732:7
    #178 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #179 0x5600da4e5f98 in pawn_promoter_solve /home/joshua/clean/popeye/pieces/walks/pawns/promotion.c:309:5
    #180 0x5600da3b04dd in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:740:7
    #181 0x5600da49b255 in post_move_iteration_solve_recurse /home/joshua/clean/popeye/solving/post_move_iteration.c:131:3
    #182 0x5600da4e5fa9 in pawn_promoter_solve /home/joshua/clean/popeye/pieces/walks/pawns/promotion.c:320:7
    #183 0x5600da3b04dd in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:740:7
    #184 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #185 0x5600da4a231b in move_player_solve /home/joshua/clean/popeye/solving/move_player.c:59:3
    #186 0x5600da3b12f0 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:728:7
    #187 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #188 0x5600da49605d in castling_player_solve /home/joshua/clean/popeye/solving/castling.c:130:7
    #189 0x5600da3b12fd in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:724:7
    #190 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #191 0x5600da49b2e8 in move_execution_post_move_iterator_solve /home/joshua/clean/popeye/solving/post_move_iteration.c:235:3
    #192 0x5600da3b049c in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:712:7
    #193 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #194 0x5600da48fe78 in move_effect_journal_undoer_solve /home/joshua/clean/popeye/solving/move_effect_journal.c:250:3
    #195 0x5600da3b04c3 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:716:7
    #196 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #197 0x5600da49569d in find_defense_solve /home/joshua/clean/popeye/solving/find_move.c:139:5
    #198 0x5600da3b048f in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:700:7
    #199 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #200 0x5600da438969 in killer_move_prioriser_solve /home/joshua/clean/popeye/optimisations/killer_move/prioriser.c:91:3
    #201 0x5600da3b1505 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:2122:7
    #202 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #203 0x5600da491eb8 in move_generator_solve /home/joshua/clean/popeye/solving/move_generator.c:440:3
    #204 0x5600da3b06b6 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:684:7
    #205 0x5600da4a7363 in pipe_this_move_doesnt_solve_if /home/joshua/clean/popeye/solving/pipe.c:63:5
    #206 0x5600da4a17e8 in dead_end_solve /home/joshua/clean/popeye/solving/dead_end.c:36:3
    #207 0x5600da3b0260 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:841:7
    #208 0x5600da4a7708 in fork_solve_delegate /home/joshua/clean/popeye/solving/fork.c:16:3
    #209 0x5600da4a8800 in continuation_solver_solve /home/joshua/clean/popeye/solving/battle_play/continuation.c:49:3
    #210 0x5600da3b0701 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:2098:7
    #211 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #212 0x5600da4993ee in selfcheck_guard_solve /home/joshua/clean/popeye/solving/selfcheck_guard.c:61:5
    #213 0x5600da3b027a in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:908:7
    #214 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #215 0x5600da4a1fa7 in end_of_branch_goal_solve /home/joshua/clean/popeye/solving/end_of_branch_goal.c:30:5
    #216 0x5600da3b0239 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:881:7
    #217 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #218 0x5600da4a1753 in binary_solve_if_then_else /home/joshua/clean/popeye/solving/binary.c:21:5
    #219 0x5600da4991fd in avoid_unsolvable_solve /home/joshua/clean/popeye/solving/avoid_unsolvable.c:186:3
    #220 0x5600da3b12c9 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:889:7
    #221 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #222 0x5600da591f28 in output_plaintext_end_of_solution_writer_solve /home/joshua/clean/popeye/output/plaintext/tree/end_of_solution_writer.c:47:3
    #223 0x5600da3b1be0 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:2114:7
    #224 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #225 0x5600da4a20d4 in attack_played_solve /home/joshua/clean/popeye/solving/move_played.c:29:3
    #226 0x5600da3b1317 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:812:7
    #227 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #228 0x5600da496925 in castling_rights_adjuster_solve /home/joshua/clean/popeye/solving/castling.c:435:3
    #229 0x5600da3b1435 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:1647:7
    #230 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #231 0x5600da59baa1 in king_square_updater_solve /home/joshua/clean/popeye/position/effects/king_square.c:204:5
    #232 0x5600da3b0593 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:2042:7
    #233 0x5600da4a7698 in pipe_dispatch_delegate /home/joshua/clean/popeye/solving/pipe.c:199:3
    #234 0x5600da418fff in circe_done_with_rebirth /home/joshua/clean/popeye/conditions/circe/circe.c:385:3
    #235 0x5600da3b1970 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:1229:7
    #236 0x5600da4a7708 in fork_solve_delegate /home/joshua/clean/popeye/solving/fork.c:16:3
    #237 0x5600da4a174c in binary_solve_if_then_else /home/joshua/clean/popeye/solving/binary.c:19:5
    #238 0x5600da41d175 in circe_capture_fork_solve /home/joshua/clean/popeye/conditions/circe/capture_fork.c:60:3
    #239 0x5600da3b0b11 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:1089:7
    #240 0x5600da4a7698 in pipe_dispatch_delegate /home/joshua/clean/popeye/solving/pipe.c:199:3
    #241 0x5600da423362 in circe_make_current_move_relevant_solve /home/joshua/clean/popeye/conditions/circe/relevant_capture.c:75:3
    #242 0x5600da3b0b45 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:1101:7
    #243 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #244 0x5600da4e82f9 in en_passant_adjuster_solve /home/joshua/clean/popeye/pieces/walks/pawns/en_passant.c:468:3
    #245 0x5600da3b04d0 in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:732:7
    #246 0x5600da4a73f8 in pipe_solve_delegate /home/joshua/clean/popeye/solving/pipe.c:93:3
    #247 0x5600da4e5f98 in pawn_promoter_solve /home/joshua/clean/popeye/pieces/walks/pawns/promotion.c:309:5
    #248 0x5600da3b04dd in dispatch /home/joshua/clean/popeye/solving/machinery/dispatch.c:740:7
    #249 0x5600da49b255 in post_move_iteration_solve_recurse /home/joshua/clean/popeye/solving/post_move_iteration.c:131:3

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior conditions/circe/glasgow.c:38:7 in

This may be related to Issue #413 and/or Issue #414.

I think that we should either

  • extend SquareFlags to cover the entire range 0..maxsquare-1, or
  • ask code that accesses SquareFlags to only do so for indices that actually refer to squares of the board

So what do you think of doing

if (is_on_board(candidate) && TSTFLAG(sq_spec(candidate),prom))

instead of just

if (TSTFLAG(sq_spec(candidate),prom))

in circe_glasgow_adjust_rebirth_square_solve()?