Skip to content

Commit 05e10b7

Browse files
committed
tests: fix placement of test coroutine stacks
placing the coroutine stacks on the main coroutine stack is undefined behavior. found with clang -fstack-protector-strong. fixes #75 Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
1 parent 76f6755 commit 05e10b7

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

test_libucontext.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ static void f2 (void) {
5454
}
5555

5656

57-
int main (int argc, const char *argv[]) {
58-
char st1[8192];
59-
char st2[8192];
60-
volatile int done = 0;
57+
char st1[8192];
58+
char st2[8192];
59+
volatile int done = 0;
6160

6261

62+
int main (int argc, const char *argv[]) {
6363
/* poison each coroutine's stack memory for debugging purposes */
6464
memset(st1, 'A', sizeof st1);
6565
memset(st2, 'B', sizeof st2);

test_libucontext_posix.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,12 @@ static void f2 (void) {
5454
}
5555

5656

57+
char st1[8192];
58+
char st2[8192];
59+
volatile int done = 0;
60+
61+
5762
int main (int argc, const char *argv[]) {
58-
char st1[8192];
59-
char st2[8192];
60-
volatile int done = 0;
6163

6264

6365
/* poison each coroutine's stack memory for debugging purposes */

0 commit comments

Comments
 (0)