From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C6BD83858415; Thu, 9 Dec 2021 16:35:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C6BD83858415 From: "wcohen at redhat dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug debug/96937] Duplicate DW_TAG_formal_parameter in out-of-line DW_TAG_subprogram instance Date: Thu, 09 Dec 2021 16:35:24 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: debug X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: wcohen at redhat dot com X-Bugzilla-Status: WAITING X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Dec 2021 16:35:24 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96937 Will Cohen changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |wcohen at redhat dot com --- Comment #6 from Will Cohen --- I have similar duplications of formal parameters in some of the code compil= ed 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 :=3D entry (?TAG_subprogram) !AT_declaration; let FSTART :=3D ((A ?AT_entry_pc @AT_entry_pc) || (A ?AT_ranges @AT_ranges = low) || ( A low)); let B :=3D [A child ?TAG_formal_parameter name] ; let ABS_ORIGIN :=3D A @AT_abstract_origin; let C :=3D [ABS_ORIGIN child ?TAG_formal_parameter name]; (C length !=3D 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 fo= r a reproducer (two pdev formal parameters): 0xffffffff8102eec0 match_id ["pdev", "vendor", "device"] ["vendor", "device", "pdev", "pdev"] The "llvm-dwarfdump -c --name=3Dmatch_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:=20 [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:=20 [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:=20 [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:=20 [0xffffffff8102eec0, 0xffffffff8102ef1a): 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 reprod= ucer with creduce which can be compiled with: gcc -Wp,-MMD,arch/x86/kernel/.probe_roms.o.d -nostdinc -D__KERNEL__ -fmacro-pre fix-map=3D./=3D -Wall -Wundef -Werror=3Dstrict-prototypes -Wno-trigraphs -fno-strict-a liasing -fno-common -fshort-wchar -fno-PIE -Werror=3Dimplicit-function-declaration -Werror=3Dimplicit-int -Werror=3Dreturn-type -Wno-format-security -std=3Dg= nu89 -mno-s se -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -fcf-protection=3Dnone -m64 -falign-jump s=3D1 -falign-loops=3D1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-bou= ndary=3D3 - mskip-rax-setup -mtune=3Dgeneric -mno-red-zone -mcmodel=3Dkernel -Wno-sign-= compare - fno-asynchronous-unwind-tables -mindirect-branch=3Dthunk-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=3D2048 -fstack-protector-strong "-Wimpl icit-fallthrough=3D5" -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-trunca= tion=20 -Wno-zero-length-bounds -Wno-array-bounds -Wno-stringop-overflow -Wno-restr= ict - Wno-maybe-uninitialized -Wno-alloc-size-larger-than -fno-strict-overflow -fno-st ack-check -fconserve-stack -Werror=3Ddate-time -Werror=3Dincompatible-point= er-types=20 -Werror=3Ddesignated-init -Wno-packed-not-aligned -g=20=20=20 -DKBUILD_MODFILE=3D'"arch/x8 6/kernel/probe_roms"' -DKBUILD_BASENAME=3D'"probe_roms"' -DKBUILD_MODNAME=3D'"probe_ roms"' -D__KBUILD_MODNAME=3Dkmod_probe_roms -c -o probe_roms.o probe_roms.i=