Bug 1511021

Summary: "generic thunk code fails" for overridden function which uses ...
Product: [Fedora] Fedora Reporter: James Legg <jlegg+rbz>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 26CC: aoliva, davejohansen, fweimer, jakub, jwakely, law, mpolacek
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: Environment:
Last Closed: 2018-02-26 18:46:56 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:
Attachments:
Description Flags
Test case none

Description James Legg 2017-11-08 14:37:59 UTC
Created attachment 1349475 [details]
Test case

Description of problem:
When optimisations are enabled, g++ fails to compile an overridden virtual method which takes a variable number of arguments, if there is another base class with virtual functions before the one with the overridden function in the base clause.

Version-Release number of selected component (if applicable):
gcc-7.2.1-2.fc26

How reproducible:
Occurs every time.

Steps to Reproduce:
1. Download test case attachment to a file called test.cpp
2. run g++ -O1 -c test.cpp

Actual results:
Compilation fails with the output:
test.cpp:3:34: error: generic thunk code fails for method ‘virtual void<unnamed class>::_ZThn8_N3._01cEz(...)’ which uses ‘...’
 class : a, b { void c(...) {} } d;
                                  ^
Expected results:
An object file is produced with no error.

Additional info:
I think this is a regression and it previously worked on GCC 6.
It can be worked around by adding the attribute [[gnu::optimize("O0")]] to any offending function definitions.

Comment 1 Marek Polacek 2018-02-26 18:46:56 UTC
Fixed in gcc 8.