diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2024-09-06 08:49:44 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2024-09-06 08:49:44 +0200 |
| commit | 1fcba7fcea462d67379c8d289bd7e0ad52170e02 (patch) | |
| tree | 20d9fd74a81111ba84099ca215d6723a621b736e /src/core | |
| parent | f85ac77efc0feeeab183e509a7baca1c507da3c5 (diff) | |
| download | nissy-core-1fcba7fcea462d67379c8d289bd7e0ad52170e02.tar.gz nissy-core-1fcba7fcea462d67379c8d289bd7e0ad52170e02.zip | |
Patch up spurious warning
Diffstat (limited to '')
| -rw-r--r-- | src/core/moves.h | 25 |
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 | /* | ||
| 186 | GCC has issues when -Wstringop-overflow is used together with O3. It produces | ||
| 187 | warnings like the following: | ||
| 188 | |||
| 189 | In 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: | ||
| 192 | warning: writing 32 bytes into a region of size 0 [-Wstringop-overflow=] | ||
| 193 | 197 | ret[i] = inverse_move(moves[nmoves - i - 1]); | ||
| 194 | | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 195 | In function 'solve_h48_dfs.isra': | ||
| 196 | note: at offset 192 into destination object 'invertedpremoves' of size 20 | ||
| 197 | 71 | uint8_t invertedpremoves[MAXLEN]; | ||
| 198 | |||
| 199 | Clang does not give any warning. | ||
| 200 | Someone else complained here: https://access.redhat.com/solutions/6755371 | ||
| 201 | |||
| 202 | To solve this issue temporarily, we use a lower optimization setting for | ||
| 203 | this function only. | ||
| 204 | |||
| 205 | TODO check if the issue is resolved | ||
| 206 | */ | ||
| 207 | #pragma GCC push_options | ||
| 208 | #pragma GCC optimize ("O2") | ||
| 185 | STATIC void | 209 | STATIC void |
| 186 | invertmoves(uint8_t *moves, uint8_t nmoves, uint8_t *ret) | 210 | invertmoves(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 | ||
| 194 | STATIC int | 219 | STATIC int |
| 195 | readmoves(const char *buf, int max, uint8_t *ret) | 220 | readmoves(const char *buf, int max, uint8_t *ret) |
