From 494cadd44b28002bfb2727a173fae89dd309ff34 Mon Sep 17 00:00:00 2001 From: Adonis Ling Date: Mon, 10 Oct 2022 15:43:31 +0800 Subject: [PATCH] Fix "sched_to itself" error when buidling by Clang on Linux aarch64 --- src/bthread/task_group.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/bthread/task_group.cpp b/src/bthread/task_group.cpp index b8ead16342..94ce5eb784 100644 --- a/src/bthread/task_group.cpp +++ b/src/bthread/task_group.cpp @@ -248,6 +248,9 @@ int TaskGroup::init(size_t runqueue_capacity) { return 0; } +#if defined(__linux__) && defined(__aarch64__) && defined(__clang__) + __attribute__((optnone)) +#endif void TaskGroup::task_runner(intptr_t skip_remained) { // NOTE: tls_task_group is volatile since tasks are moved around // different groups. @@ -567,6 +570,9 @@ void TaskGroup::sched(TaskGroup** pg) { sched_to(pg, next_tid); } +#if defined(__linux__) && defined(__aarch64__) && defined(__clang__) + __attribute__((optnone)) +#endif void TaskGroup::sched_to(TaskGroup** pg, TaskMeta* next_meta) { TaskGroup* g = *pg; #ifndef NDEBUG