ARM Technical Support Knowledge Articles

RVCT 2.2 or 3.0 compiler reports Internal Fault 0x040b for large Thumb leaf functions

Applies to: RealView Development Suite (RVDS)


The root cause of this problem is the limited branch range of the Thumb B instruction.  The problem occurs typically with a large leaf function being compiled for Thumb with -Otime optimization.  If some of the internal branches in the function are too far and can not be reached by the Thumb B instruction, the compiler will fail with Internal fault 0x040b.

This problem is fixed in the RVCT 3.0 SP1 and later compilers.


Use any of the following workarounds to overcome the problem:

1. Compile the failing module for ARM rather than Thumb, i.e. compile with '--arm' instead of '--thumb'.  '#pragma arm' may also be used to generate ARM code for individual functions.

2. Compile the failing module with -Ospace instead of -Otime.

3. Add a call to a dummy function within the leaf function so that it becomes non-leaf.  Example:

    extern void dummy(void);

    void failing_function(void)

where dummy() is defined externally as, for example,

    void dummy(void) { }

Rate this article

Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential