https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117961
Bug ID: 117961
Summary: testsuite: scan-assembler[-not] is bogus for inline
asm
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: testsuite
Assignee: unassigned at gcc dot gnu.org
Reporter: gjl at gcc dot gnu.org
Target Milestone: ---
The testsuite may have wrong FAILs PASSes for inline assembly.
Steps to reproduce:
1) On x86_64, checkout the GCC sources to a local folder, say
gcc-optimize-move.
2) Bootstrap (though just building without bootstrapping should work, too).
3) Run the test suite, for example
$ make -k check-gcc RUNTESTFLAGS="i386.exp=pr60473.c -all"
...
Running
/home/me/gnu/source/gcc-optimize-move/gcc/testsuite/gcc.target/i386/i386.exp
PASS: gcc.target/i386/pr60473.c (test for excess errors)
FAIL: gcc.target/i386/pr60473.c scan-assembler-not mov
=== gcc Summary ===
# of expected passes 1
# of unexpected failures 1
/home/me/gnu/build/gcc-native/gcc/xgcc version 15.0.0 20241207 (experimental)
(GCC)
The preprocessed source reads something like:
# 0
"/home/me/gnu/source/gcc-optimize-move/gcc/testsuite/gcc.target/i386/pr60473.c"
# 0 "<built-in>"
# 0 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 0 "<command-line>" 2
# 1
"/home/me/gnu/source/gcc-optimize-move/gcc/testsuite/gcc.target/i386/pr60473.c"
unsigned long long foo()
{
unsigned long long h,l;
asm volatile ("rdtsc": "=a" (l), "=d" (h));
return l | (h << 32);
}
The generated assembly reads something like:
.file "pr60473.c"
.text
.p2align 4
.globl foo
.type foo, @function
foo:
.LFB0:
.cfi_startproc
#APP
# 8
"/home/me/gnu/source/gcc-optimize-move/gcc/testsuite/gcc.target/i386/pr60473.c"
1
rdtsc
# 0 "" 2
#NO_APP
salq $32, %rdx
orq %rdx, %rax
ret
.cfi_endproc
.LFE0:
.size foo, .-foo
.section .note.GNU-stack,"",@progbits
Hence the test case fails since there is a "mov" in the line after the #APP
directive.