Skip to content

Commit 86094cf

Browse files
committed
Implemented fix for issue #22
Fixed the memmove() issue reported in issue #22: - memcpy(), memmove() and memset() are completely disabled in circle-newlib. - Circle in release 44.1 now always provides memmove(). - Added a slightly modified version of the test program from issue #22 to the smoke test.
1 parent 811854b commit 86094cf

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

libs/circle-newlib

Submodule circle-newlib updated 223 files

samples/05-smoketest/kernel.cpp

+20
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,26 @@ CKernel::IoTest (void)
284284
}
285285

286286
Report ("unlink () test succeeded");
287+
288+
// Test fix for issue #22
289+
// https://github.com/smuehlst/circle-stdlib/issues/22
290+
#define SIZE_A 10
291+
292+
uint32_t referenceArray[SIZE_A];
293+
auto const testArray = (uint32_t *) malloc(sizeof(uint32_t) * (SIZE_A + 1));
294+
for (int i = 0; i < SIZE_A; i++) {
295+
testArray[i] = i;
296+
}
297+
memcpy(referenceArray, testArray, sizeof(referenceArray));
298+
memmove(&testArray[1], &testArray[0], sizeof(uint32_t) * SIZE_A);
299+
300+
if (memcmp(referenceArray, testArray + 1, sizeof(referenceArray)) != 0)
301+
{
302+
PErrorExit ("Fix for issue #22 is broken");
303+
}
304+
free(testArray);
305+
306+
Report ("Fix for issue #22 works as expected");
287307
}
288308

289309
void

0 commit comments

Comments
 (0)