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

Summary: Variadic arguments are missing from debugging data when building with -flto
Product: [Fedora] Fedora Reporter: Petr Pisar <ppisar>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 34CC: aoliva, dmalcolm, dominik, fweimer, jakub, jwakely, law, mpolacek, msebor, nickc, sipoyare
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1893340 (view as bug list) Environment:
Last Closed: 2021-11-04 16:06:00 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1893340    

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.