Recent versions of gcc (reported on gcc-7.4) issue array subscript warnings for builds where SMP is not enabled. kernel/debug/debug_core.c: In function 'kdb_dump_stack_on_cpu': kernel/debug/debug_core.c:452:17: warning: array subscript is outside array +bounds [-Warray-bounds] if (!(kgdb_info[cpu].exception_state & DCPU_IS_SLAVE)) { ~~~~~~~~~^~~~~ kernel/debug/debug_core.c:469:33: warning: array subscript is outside array +bounds [-Warray-bounds] kgdb_info[cpu].exception_state |= DCPU_WANT_BT; kernel/debug/debug_core.c:470:18: warning: array subscript is outside array +bounds [-Warray-bounds] while (kgdb_info[cpu].exception_state & DCPU_WANT_BT) There is no bug here but there is scope to improve the code generation for non-SMP systems (whilst also silencing the warning).
Showing the changes to kernel/debug/debug_core.c (1 of 1 file). Show all
Unified · Split
| @@ -444,7 +444,7 @@ setundefined: · 443 unmodified lines | ||
| 444 | 444 | #ifdef CONFIG_KGDB_KDB |
| 445 | 445 | void kdb_dump_stack_on_cpu(int cpu) |
| 446 | 446 | { |
| 447 | − if (cpu == raw_smp_processor_id()) { | |
| 447 | + if (cpu == raw_smp_processor_id() || !IS_ENABLED(CONFIG_SMP)) { | |
| 448 | 448 | dump_stack(); |
| 449 | 449 | return; |
| 450 | 450 | } |