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: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 34
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-11-04 16:06 UTC (History)
11 users (show)

Fixed In Version:
Clone Of:
: 1893340 (view as bug list)
Environment:
Last Closed: 2021-11-04 16:06:00 UTC
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).

Comment 2 Ben Cotton 2021-11-04 13:53:58 UTC
This message is a reminder that Fedora 33 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 33 on 2021-11-30.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '33'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 33 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 3 Ben Cotton 2021-11-04 14:23:23 UTC
This message is a reminder that Fedora 33 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 33 on 2021-11-30.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '33'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 33 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 4 Ben Cotton 2021-11-04 15:21:01 UTC
This message is a reminder that Fedora 33 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 33 on 2021-11-30.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '33'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 33 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 5 Petr Pisar 2021-11-04 16:06:00 UTC
I confirm it's fixed in gcc-11.2.1-1.fc34.


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