aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/moves.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/core/moves.h b/src/core/moves.h
index 3f285fb..f0d7646 100644
--- a/src/core/moves.h
+++ b/src/core/moves.h
@@ -182,6 +182,30 @@ inverse_move(uint8_t m)
182 return m - 2 * (m % 3) + 2; 182 return m - 2 * (m % 3) + 2;
183} 183}
184 184
185/*
186GCC has issues when -Wstringop-overflow is used together with O3. It produces
187warnings like the following:
188
189In function 'invertmoves',
190 inlined from 'solve_h48_appendsolution' at src/solvers/h48/solve.h:81:3,
191 inlined from 'solve_h48_dfs.isra' at src/solvers/h48/solve.h:139:3:
192warning: writing 32 bytes into a region of size 0 [-Wstringop-overflow=]
193 197 | ret[i] = inverse_move(moves[nmoves - i - 1]);
194 | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
195In function 'solve_h48_dfs.isra':
196note: at offset 192 into destination object 'invertedpremoves' of size 20
197 71 | uint8_t invertedpremoves[MAXLEN];
198
199Clang does not give any warning.
200Someone else complained here: https://access.redhat.com/solutions/6755371
201
202To solve this issue temporarily, we use a lower optimization setting for
203this function only.
204
205TODO check if the issue is resolved
206*/
207#pragma GCC push_options
208#pragma GCC optimize ("O2")
185STATIC void 209STATIC void
186invertmoves(uint8_t *moves, uint8_t nmoves, uint8_t *ret) 210invertmoves(uint8_t *moves, uint8_t nmoves, uint8_t *ret)
187{ 211{
@@ -190,6 +214,7 @@ invertmoves(uint8_t *moves, uint8_t nmoves, uint8_t *ret)
190 for (i = 0; i < nmoves; i++) 214 for (i = 0; i < nmoves; i++)
191 ret[i] = inverse_move(moves[nmoves - i - 1]); 215 ret[i] = inverse_move(moves[nmoves - i - 1]);
192} 216}
217#pragma GCC pop_options
193 218
194STATIC int 219STATIC int
195readmoves(const char *buf, int max, uint8_t *ret) 220readmoves(const char *buf, int max, uint8_t *ret)

Generated with cgit - Back to sebastiano.tronto.net