https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120714

--- Comment #3 from Alexey Merzlyakov <alexey.merzlyakov at samsung dot com> ---
I've checked the patch from the above suggested link. Unfortunately, it does
not work for the reported in this ticket test-case: GDB is missing to get into
goo() breakpoint.

I also tested it on the test-case taken from the patch for this PR:
https://gcc.gnu.org/pipermail/gcc-patches/2025-June/687773.html, which is using
internal "backtrace()" function for verification. Produced code also crashes
with the suggested above patch:

  $ cat run.sh 
  #!/bin/bash
  CC="riscv64-rise-linux-gnu-gcc"
  QEMU="qemu-riscv64"
  SYSROOT=`$CC --print-sysroot`
  TEST="pr120714"

  OPTS="-O1 -Os -Og -Oz"
  SC_OPT="-fstack-clash-protection"
  for OPT in $OPTS; do
    echo "OPT: $OPT"
    set -e
    $CC $OPT -g $SC_OPT -I$SYSROOT/usr/include/ -static ${TEST}.c -o ${TEST}.x
    set +e
    $QEMU -L $SYSROOT ${TEST}.x
  done

  $ ./run.sh
  OPT: -O1
  ./run.sh: line 14: 114555 Segmentation fault      (core dumped) $QEMU -L
$SYSROOT ${TEST}.x
  OPT: -Os
  ./run.sh: line 14: 114563 Segmentation fault      (core dumped) $QEMU -L
$SYSROOT ${TEST}.x
  OPT: -Og
  ./run.sh: line 14: 114571 Segmentation fault      (core dumped) $QEMU -L
$SYSROOT ${TEST}.x
  OPT: -Oz
  ./run.sh: line 14: 114579 Segmentation fault      (core dumped) $QEMU -L
$SYSROOT ${TEST}.x

Reply via email to