Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1891787 - Variadic arguments are missing from debugging data when building with -flto
Summary: Variadic arguments are missing from debugging data when building with -flto
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 33
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1893340
TreeView+ depends on / blocked
 
Reported: 2020-10-27 11:22 UTC by Petr Pisar
Modified: 2021-06-22 19:27 UTC (History)
11 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1893340 (view as bug list)
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
GNU Compiler Collection 97599 0 P2 ASSIGNED [8/9 Regression] missing unspecified_parameters DIE in DWARF for functions with variable arguments 2021-01-11 19:15:48 UTC

Description Petr Pisar 2020-10-27 11:22:27 UTC
Debugging an efivar test failure (bug #1863475) leads to the discovery that variadic functions are missing the last variadic argument from their prototype definition in debgging data.

Without -lfto option, foo() is decribe by GDB correctly:

$ cat test.c
#include <stdarg.h>
void foo(int args, ...) {
    va_list ap;
    va_start(ap, args);
    va_end(ap);
}
$ gcc -fPIC -shared -o libtest.so -O0 -g test.c
$ gdb libtest.so
[...]
Reading symbols from libtest.so...
(gdb) info functions foo
All functions matching regular expression "foo":

File test.c:
2:      void foo(int, ...);
(gdb) quit

But when compiling with -flto:

$ gcc -fPIC -shared -o libtest.so -O0 -g -flto test.c
$ gdb libtest.so
[...]
Reading symbols from libtest.so...
(gdb) info functions foo
All functions matching regular expression "foo":

File <artificial>:
2:      void foo(int);
(gdb) quit

The printed prototype is missing the last "..." argument.

I believe this is only a problem in the debugging data, not in the generated code, as processing the variadic arguments in the foo() works as expected. Dissassembly also confirms it. This is probably not a bug in GDB, because abidw tool from libabigail package, which processs the debugging sections of ELF, also suffer from the same issue (as spotted in the efivar bug #1863475).

My toolchain:

$ rpm -q gcc binutils elfutils
gcc-10.2.1-5.fc33.x86_64
binutils-2.35-11.fc33.x86_64
elfutils-0.181-1.fc33.x86_64

Comment 1 Dominik 'Rathann' Mierzejewski 2021-06-22 19:27:13 UTC
According to upstream bug report, this seems to have been fixed back in November 2020 (gcc 10.3 and 11.1) and in April 2021 (gcc 9.x and 8.x).


Note You need to log in before you can comment on or make changes to this bug.