Hi! On Sat, Sep 12, 2020 at 03:17:03PM -0500, William Tambe via Gcc-help wrote: > I am currently using following for trap instruction: > > (define_insn "trap" > [(trap_if (const_int 1) (const_int 0))] > "" > "brk") This looks fine. > However it causes the compiler to generate a trap when address 0 is > used; in the example below, I have a function that prints characters > through the UART using address 0; but the resulting assembly generates > a function that traps instead. > > #define UART_ADDR 0 > void uart_print (char *s) { > while (*s) { > *(volatile char *)UART_ADDR = *s; > ++s; > } > } > > How can one implement unconditional trap ? You should implement TARGET_ADDR_SPACE_ZERO_ADDRESS_VALID to make 0 a valid address. Segher