This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler/C6000-CGT: support of __builtin_return_address()

Part Number: C6000-CGT

Tool/software: TI C/C++ Compiler

Could you add to CGT real support of __builtin_return_address() compiler intrinsic ?

While I call it, it returns always zero. I am interested only in current function return address => __builtin_return_address(0);

  • To address your request, I filed the entry CODEGEN-6049 in the SDOWP system.  You are welcome to follow it with the SDOWP link below in my signature.  Note this entry does not report a bug, but requests a change in the compiler.  

    Such change requests are reviewed on a routine basis.  Please give me more detail, as much as you can, on the problems you plan to solve with __builtin_return_address.  That information will be helpful in the review.

    Thanks and regards,

    -George

  • Thank you George for your response.
    I have two use cases for such feature:

    1. printf-like logging function with offline formatting. We use currently macro that wraps PCE1 read and real logging function call in order to save address where log was taken. Having working __builtin_return_address(0) ,we don't have to read PCE1 every time and this reduces code size. Good example is this article : www.embeddedrelated.com/.../518.php

    2. when implementing fatal error handling function it is convenient to save the fatal error caller address to "crash log"
  • Thank you!  -George