This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Morello GNU g++ Compiler bug? - Inline assembler in template function ignores register declarations

Hi

Potential GCC bug? - please advise if this is a known issue, if not please inform how to raise an issue on the Gnu toolchain for Morello.

Issue: When defining register variables in a template function, the compiler ignores the directives.  Does not happen if not using templates.

Found on: ARM GNU Toolchain for Morello release.  Applies to Linux hybrid-cap or Linux pure-cap.
- Note: This behaviour does not apply when using clang.

Example Code Snippet

Note: This is based on Arm Morello compartment demo.
Intent is to call into a function following C calling convention, with C0...C6 set to passed in arguments:

Compile with g++ -march=morello -save-temps -Wall -Wextra -O3 -std=gnu++14 -c test.cpp  (Note: different optimisation levels give same failure behaviour).

Resulting generated assembler (tidied - comment added is mine):

Compare result if not using a template function (modify example code by removing template statement and add using Fn=void *__capability;):

 

Thanks
Pete

0