tests: error_hook: Workaround for RX architecture
GCC for RX would crash with an internal compiler error during DWARF frame generation in `dwarf2out_frame_debug_adjust_cfa()` when compiling the `trigger_fault_illegal_instruction()` test function. This patch adds `__builtin_unreachable()` to help the compiler reason about control flow, preventing incorrect DWARF CFA generation. Signed-off-by: Duy Nguyen <duy.nguyen.xa@renesas.com>
This commit is contained in:
parent
e0a13a6d70
commit
250465566b
@ -52,6 +52,15 @@ __no_optimization static void trigger_fault_illegal_instruction(void)
|
||||
|
||||
/* execute an illegal instruction */
|
||||
((void(*)(void))&a)();
|
||||
#ifdef CONFIG_RX
|
||||
/*
|
||||
* Intentionally execute an illegal instruction by calling a NULL pointer.
|
||||
* Optimization is disabled to avoid GCC internal error during DWARF frame generation.
|
||||
* __builtin_unreachable() hints to the compiler that control flow never returns here,
|
||||
* which prevents faulty CFA emission on RX targets.
|
||||
*/
|
||||
__builtin_unreachable();
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Loading…
Reference in New Issue
Block a user