GCC DejaGnu scan-tree-dump for [tail call] fails / how to correctly escape and verify tail-call in -fdump-tree-optimized?

1 day ago 1
ARTICLE AD BOX

GCC: xgcc version 16.0.1 20260203 (experimental)

Host: aarch64-unknown-linux-gnu, DejaGnu/Expect standard with Ubuntu

Testcase gcc/testsuite/gcc.dg/pr105495.c:

/* { dg-do compile { target aarch64*-*-* } } */ /* { dg-options "-O2 -fdump-tree-optimized" } */ typedef struct { int b; } cond; __attribute__((noinline)) int __MCF_batch_release_common (cond *p, int c); __attribute__((noinline)) int test_struct (cond *p, int x) { cond c = { x }, n = { 2 }; __atomic_compare_exchange (p, &c, &n, 1, 0, 0); return __MCF_batch_release_common (p, x); } /* { dg-final { scan-tree-dump "__MCF_batch_release_common.*\\\[tail call\\\]" "optimized" } } */ Run: make -j1 check-gcc RUNTESTFLAGS="dg.exp=pr105495.c"

Result:

FAIL: ... scan-tree-dump optimized "__MCF_batch_release_common.*\\[tail call\\]"

Question:

Is the escaping above the recommended/canonical form for matching [tail call] markers in tree dumps?

If the dump doesn’t contain [tail call], what GCC passes/flags can be used to confirm whether sibling-call optimization happened (tree vs rtl), and what’s the best testsuite check?

Read Entire Article