You copied the Doc URL to your clipboard.

Arm Compiler armclang Reference Guide : -ftrapv


Instructs the compiler to generate traps for signed arithmetic overflow on addition, subtraction, and multiplication operations.


The compiler inserts code that checks for overflow and traps the overflow with an undefined instruction. An undefined instruction handler must be provided for the overflow to get caught at run-time.


When both -fwrapv and -ftrapv are used in a single command, the furthest-right option overrides the other.

For example, here -ftrapv overrides -fwrapv:

armclang --target=aarch64-arm-none-eabi -fwrapv -c -ftrapv hello.c
Was this page helpful? Yes No