History

kdb: Avoid array subscript warnings on non-SMP builds

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).

Daniel Thompson committed 7 years ago

Commit d07ce4e1 parent 2277b491 file · +1 −1Browse files

Showing the changes to kernel/debug/debug_core.c (1 of 1 file). Show all

Unified · Split

kernel/debug/debug_core.c+1−1
@@ -444,7 +444,7 @@ setundefined: · 443 unmodified lines
444#ifdef CONFIG_KGDB_KDB444#ifdef CONFIG_KGDB_KDB
445void kdb_dump_stack_on_cpu(int cpu)445void 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 dump_stack();448 dump_stack();
449 return;449 return;
450 }450 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t