https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96937
Will Cohen <wcohen at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |wcohen at redhat dot com
--- Comment #6 from Will Cohen <wcohen at redhat dot com> ---
I have similar duplications of formal parameters in some of the code compiled
linux kernel code. I had a dwgrep (https://pmachata.github.io/dwgrep/) that
would print out each function and location with more formal parameters than
listed in the abstract origin:
dwgrep vmlinux -e '
let A := entry (?TAG_subprogram) !AT_declaration;
let FSTART := ((A ?AT_entry_pc @AT_entry_pc) || (A ?AT_ranges @AT_ranges low)
|| ( A low));
let B := [A child ?TAG_formal_parameter name] ;
let ABS_ORIGIN := A @AT_abstract_origin;
let C := [ABS_ORIGIN child ?TAG_formal_parameter name];
(C length != B length) B C A name FSTART'
Looking through the functions flagged I found match_id in
/arch/x86/kernel/probe_roms.c looked small and could be a starting point for a
reproducer (two pdev formal parameters):
0xffffffff8102eec0
match_id
["pdev", "vendor", "device"]
["vendor", "device", "pdev", "pdev"]
<Dwarf "vmlinux">
The "llvm-dwarfdump -c --name=match_id vmlinux" show the duplicate pdev formal
parameters in its output:
0x005741ea: DW_TAG_subprogram
DW_AT_abstract_origin (0x00574134 "match_id")
DW_AT_low_pc (0xffffffff8102eec0)
DW_AT_high_pc (0xffffffff8102ef1a)
DW_AT_frame_base (DW_OP_call_frame_cfa)
DW_AT_call_all_calls (true)
DW_AT_sibling (0x00574291)
0x00574206: DW_TAG_formal_parameter
DW_AT_abstract_origin (0x00574151 "vendor")
DW_AT_location (0x0006ebe0:
[0xffffffff8102eec0, 0xffffffff8102eee0): DW_OP_reg2 RCX
[0xffffffff8102eee0, 0xffffffff8102ef1a): DW_OP_reg4 RSI)
DW_AT_GNU_entry_view (0x0006ebdc)
0x00574213: DW_TAG_formal_parameter
DW_AT_abstract_origin (0x0057415d "device")
DW_AT_location (DW_OP_reg8 R8)
0x0057421b: DW_TAG_variable
DW_AT_abstract_origin (0x00574169 "drv")
DW_AT_location (0x0006ebf6:
[0xffffffff8102eeeb, 0xffffffff8102eeff): DW_OP_reg2 RCX)
DW_AT_GNU_entry_view (0x0006ebf4)
0x00574228: DW_TAG_variable
DW_AT_abstract_origin (0x00574174 "id")
DW_AT_location (0x0006ec09:
[0xffffffff8102eef8, 0xffffffff8102eeff): DW_OP_reg1 RDX
[0xffffffff8102eeff, 0xffffffff8102ef03): DW_OP_breg1
RDX+40, DW_OP_stack_value
[0xffffffff8102ef03, 0xffffffff8102ef19): DW_OP_reg1 RDX)
DW_AT_GNU_entry_view (0x0006ec03)
0x00574235: DW_TAG_formal_parameter
DW_AT_abstract_origin (0x00574145 "pdev")
DW_AT_location (0x0006ec26:
[0xffffffff8102eec0, 0xffffffff8102ef1a): <decoding error>
fa c7 cc 00 00 9f)
DW_AT_GNU_entry_view (0x0006ec24)
0x00574242: DW_TAG_formal_parameter
DW_AT_abstract_origin (0x00574145 "pdev")
The probe_rom.i file was used a a starting point to create a smaller reproducer
with creduce which can be compiled with:
gcc -Wp,-MMD,arch/x86/kernel/.probe_roms.o.d -nostdinc -D__KERNEL__
-fmacro-pre
fix-map=./= -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs
-fno-strict-a
liasing -fno-common -fshort-wchar -fno-PIE
-Werror=implicit-function-declaration
-Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu89
-mno-s
se -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -fcf-protection=none -m64
-falign-jump
s=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3
-
mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -Wno-sign-compare
-
fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern
-mindirect-branch-
register -fno-jump-tables -fno-delete-null-pointer-checks -Wno-frame-address
-Wn
o-format-truncation -Wno-format-overflow -Wno-address-of-packed-member -O2
-fno-
allow-store-data-races -Wframe-larger-than=2048 -fstack-protector-strong
"-Wimpl
icit-fallthrough=5" -Wno-main -Wno-unused-but-set-variable
-Wno-unused-const-var
iable -fno-stack-clash-protection -pg -mrecord-mcount -mfentry
-DCC_USING_FENTRY
-Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-stringop-truncation
-Wno-zero-length-bounds -Wno-array-bounds -Wno-stringop-overflow -Wno-restrict
-
Wno-maybe-uninitialized -Wno-alloc-size-larger-than -fno-strict-overflow
-fno-st
ack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types
-Werror=designated-init -Wno-packed-not-aligned -g
-DKBUILD_MODFILE='"arch/x8
6/kernel/probe_roms"' -DKBUILD_BASENAME='"probe_roms"'
-DKBUILD_MODNAME='"probe_
roms"' -D__KBUILD_MODNAME=kmod_probe_roms -c -o probe_roms.o probe_roms.i