Hi Yongqiang,

On Thu, Sep 03, 2026 at 06:49:40AM +1000, Yongqiang Tian wrote:
> Hi Willy,
> 
> Thank you for looking into this. Please let me know if any additional
> information or testing from my side would be helpful.

Sorry for the delay. I've run some extra tests, and I found that indeed
as you said, your change is generally enough for clang 14+ to place a
tail jump, while without the change it wouldn't do it. So that's great.
I also noticed that clang 13 shows complain_with_dbg() and that my
previous attempt didn't help, so happy to drop it.

Out of curiosity I tried the [[clang::musttail]] attribute on the
return statement, then the compiler yells at me:

  src/debug.c:1119:23: error: cannot perform a tail call to function 
'ha_backtrace_to_stderr' because its signature is
        incompatible with the calling function
   1119 |                 [[clang::musttail]] return 
ha_backtrace_to_stderr(!!(dbg->details & DBG_DET_FAT_FATL));
        |                                     ^
  src/debug.c:296:1: note: target function has type mismatch at 1st parameter
        (expected 'int' but has 'struct debug_count *')
    296 | __attribute__((noinline)) void ha_backtrace_to_stderr(int hint)
        | ^

while we don't really care since the args don't play a role here (and
the best proof is that the compiler happily does the job without being
asked to do so).

So I'm merging your patch, adding one line about clang 13 for posterity.

Thank you!
Willy


Reply via email to