出現一個莫明奇妙的編譯錯誤:
../../kernel/fork.c
At end of source: : internal error: Uncaught exception Assertion failed raised
at ../../../bril/optimiser/dominators.c:910 (in pass
cleanup_scalar_stores_nonopt during compilation of _copy_process).
Please submit a bug report with this message, the command line used,
type of machine and the output of the compiler when you add -ED -v
to the command line. Please also send us the pre-processed file that
is generated by the -ED option (the file generated is named
<original_filename>.i)
1 catastrophic error detected in the compilation of "../../kernel/fork.c".
Compilation aborted.
cc3089: fatal error: Compilation failed
Tool failed with exit/exception code: 1.
Build was unsuccessful.
注釋掉所有代碼,一步步往上添加,問題出在copy_process函數,進一步查找終於發現問題在於這個函數中的這個語句:
if (unlikely(!cpu_isset(task_cpu(p), p->cpus_allowed) ||
!cpu_online(task_cpu(p))))
set_task_cpu(p, smp_processor_id());
當不加這行時沒有錯誤。當加上這個語句時,出現上述錯誤。
回顧一下unlikely的定義:
#define unlikely(x) expected_false(!!(x))
確實是做優化用的,既然此處編譯不過,就去了它,改為:
if (/*unlikely(*/!cpu_isset(task_cpu(p), p->cpus_allowed) ||
!cpu_online(task_cpu(p))/*)*/)
set_task_cpu(p, smp_processor_id());