Bug 1419687 - possible compiler error - mame does not build with gcc-7
Summary: possible compiler error - mame does not build with gcc-7
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-02-06 18:37 UTC by Julian Sikorski
Modified: 2017-02-14 06:37 UTC (History)
5 users (show)

Fixed In Version: 7.0.1-0.8.fc26
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-02-14 06:37:51 UTC
Type: Bug


Attachments (Terms of Use)
hlekbd.ii for gcc7 (f26) (2.45 MB, text/plain)
2017-02-06 22:54 UTC, Julian Sikorski
no flags Details


Links
System ID Private Priority Status Summary Last Updated
GNU Compiler Collection 79401 0 None None None 2017-02-07 10:01:27 UTC

Description Julian Sikorski 2017-02-06 18:37:02 UTC
Description of problem:
Koschei has informed me that since rawhide was upgraded to gcc-7 (7.0.1-0.2.fc26), mame would no longer build [1]. The latest error is:
g++    -MMD -MP -MP -DPTR64=1 -DNDEBUG -DCRLF=2 -DLSB_FIRST -DXMD_H -DFLAC__NO_DLL -DNATIVE_DRC=drcbe_x64 -DLUA_COMPAT_ALL -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -I../../../../../src/osd -I../../../../../src/emu -I../../../../../src/devices -I../../../../../src/lib/netlist -I../../../../../src/mame -I../../../../../src/lib -I../../../../../src/lib/util -I../../../../../3rdparty -I../../../../generated/emu -I../../../../generated/emu/layout -I../../../../../scripts -I../../../../../3rdparty/asio/include   -m64 -pipe -Wno-deprecated-declarations -O2 -fno-strict-aliasing -O2 -g1 -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -Wno-unknown-pragmas -Wall -Wcast-align -Wundef -Wformat-security -Wwrite-strings -Wno-sign-compare -Wno-conversion -Wno-unused-result -Wno-array-bounds -m64 -x c++ -std=c++14 -Woverloaded-virtual -Wsuggest-override -flifetime-dse=1 -include ../../../../linux_gcc/obj/x64/Release/emu.h -o "../../../../linux_gcc/obj/x64/Release/src/devices/bus/sunkbd/hlekbd.o" -c "../../../../../src/devices/bus/sunkbd/hlekbd.cpp"
../../../../../src/devices/bus/sunkbd/hlekbd.cpp: In constructor 'bus::sunkbd::hle_type4_device::hle_type4_device(const machine_config&, const char*, device_t*, uint32_t)':
../../../../../src/devices/bus/sunkbd/hlekbd.cpp:1140:12: error: 'bus::sunkbd::hle_device_base::hle_device_base(const machine_config&, device_type, const char*, const char*, device_t*, uint32_t, const char*, const char*)' is protected within this context
    __FILE__)
            ^
../../../../../src/devices/bus/sunkbd/hlekbd.cpp:752:1: note: declared protected here
 hle_device_base::hle_device_base(
 ^~~~~~~~~~~~~~~
../../../../../src/devices/bus/sunkbd/hlekbd.cpp: In constructor 'bus::sunkbd::hle_type5_device::hle_type5_device(const machine_config&, const char*, device_t*, uint32_t)':
../../../../../src/devices/bus/sunkbd/hlekbd.cpp:1179:12: error: 'bus::sunkbd::hle_device_base::hle_device_base(const machine_config&, device_type, const char*, const char*, device_t*, uint32_t, const char*, const char*)' is protected within this context
    __FILE__)
            ^
../../../../../src/devices/bus/sunkbd/hlekbd.cpp:752:1: note: declared protected here
 hle_device_base::hle_device_base(
 ^~~~~~~~~~~~~~~
../../../../../src/devices/bus/sunkbd/hlekbd.cpp: In constructor 'bus::sunkbd::hle_type5_gb_device::hle_type5_gb_device(const machine_config&, const char*, device_t*, uint32_t)':
../../../../../src/devices/bus/sunkbd/hlekbd.cpp:1218:12: error: 'bus::sunkbd::hle_device_base::hle_device_base(const machine_config&, device_type, const char*, const char*, device_t*, uint32_t, const char*, const char*)' is protected within this context
    __FILE__)
            ^
../../../../../src/devices/bus/sunkbd/hlekbd.cpp:752:1: note: declared protected here
 hle_device_base::hle_device_base(
 ^~~~~~~~~~~~~~~
../../../../../src/devices/bus/sunkbd/hlekbd.cpp: In constructor 'bus::sunkbd::hle_type5_se_device::hle_type5_se_device(const machine_config&, const char*, device_t*, uint32_t)':
../../../../../src/devices/bus/sunkbd/hlekbd.cpp:1257:12: error: 'bus::sunkbd::hle_device_base::hle_device_base(const machine_config&, device_type, const char*, const char*, device_t*, uint32_t, const char*, const char*)' is protected within this context
    __FILE__)
            ^
../../../../../src/devices/bus/sunkbd/hlekbd.cpp:752:1: note: declared protected here
 hle_device_base::hle_device_base(
 ^~~~~~~~~~~~~~~
../../../../../src/devices/bus/sunkbd/hlekbd.cpp: In constructor 'bus::sunkbd::hle_type5_jp_device::hle_type5_jp_device(const machine_config&, const char*, device_t*, uint32_t)':
../../../../../src/devices/bus/sunkbd/hlekbd.cpp:1296:12: error: 'bus::sunkbd::hle_device_base::hle_device_base(const machine_config&, device_type, const char*, const char*, device_t*, uint32_t, const char*, const char*)' is protected within this context
    __FILE__)
            ^
../../../../../src/devices/bus/sunkbd/hlekbd.cpp:752:1: note: declared protected here
 hle_device_base::hle_device_base(
 ^~~~~~~~~~~~~~~
make[2]: *** [optional.make:13532: ../../../../linux_gcc/obj/x64/Release/src/devices/bus/sunkbd/hlekbd.o] Error 1

When I raised this to upstream [2], the feedback was pointing towards a compiler bug. In particular, one upstream dev could not find anything wrong illegal in the code wrt. P0136.

Version-Release number of selected component (if applicable):
7.0.1-0.6.fc26

How reproducible:
always

Steps to Reproduce:
1. fedpkg clone mame
2. cd mame
3. fedpkg mockbuild

Actual results:
build fails

Expected results:
build succeeds

Additional info:
[1] https://apps.fedoraproject.org/koschei/package/mame?collection=f26
[2] http://forums.bannister.org/ubbthreads.php?ubb=showflat&Number=108717

Comment 2 Julian Sikorski 2017-02-06 18:57:36 UTC
Upstream argumentation:

- hle_device_base has a protected constructor - this is accessible by all directly derived classes, that's the point of protected members
- hle_type4_device_base derives from hle_device_base inherits the constructor with a using statement in its protected section, making it accessible to derived classes
- hle_type4_device_base has no data members without default constructors to prevent the inherited constructor from being used (it has no data members at all)
- The concrete Type 4/5 device classes derive from hle_type4_device_base and call its inherited constructor from their public constructors
- Initialisation of bases/members is in class scope, so protected members of bases are accessible

Comment 3 Jakub Jelinek 2017-02-06 19:18:35 UTC
Can you please attach preprocessed source?
The build fails for me with:
+ RPM_OPT_FLAGS='-O2 -g1 -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic'
+ /usr/bin/make -O -j24 NOWERROR=1 OPTIMIZE=2 VERBOSE=1 USE_SYSTEM_LIB_EXPAT=1 USE_SYSTEM_LIB_ZLIB=1 USE_SYSTEM_LIB_JPEG=1 USE_SYSTEM_LIB_FLAC=1 USE_SYSTEM_LIB_LUA=1 USE_SYSTEM_LIB_SQLITE3=1 USE_SYSTEM_LIB_PORTMIDI=1 USE_SYSTEM_LIB_PORTAUDIO=1 USE_SYSTEM_LIB_UTF8PROC=1 'SDL_INI_PATH=/etc/mame;' TOOLS=1 'OPT_FLAGS=-O2 -g1 -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic' 'LDOPTS=-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld'
GCC 7 detected
makefile:939: *** Python is not available in path.  Stop.
error: Bad exit status from /var/tmp/rpm-tmp.KXtmhK (%build)
    Bad exit status from /var/tmp/rpm-tmp.KXtmhK (%build)
(both with gcc7 and 6).

Comment 4 Julian Sikorski 2017-02-06 22:54:57 UTC
Created attachment 1248208 [details]
hlekbd.ii for gcc7 (f26)

I reduced the number of components built to save some compilation time, the error now is:


Compiling src/devices/bus/sunkbd/hlekbd.cpp...
g++    -MMD -MP -MP -DPTR64=1 -DNDEBUG -DCRLF=2 -DLSB_FIRST -DXMD_H -DFLAC__NO_DLL -DNATIVE_DRC=drcbe_x64 -DLUA_COMPAT_ALL -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -I../../../../../src/osd -I../../../../../src/emu -I../../../../../src/devices -I../../../../../src/lib/netlist -I../../../../../src/mame -I../../../../../src/lib -I../../../../../src/lib/util -I../../../../../3rdparty -I../../../../generated/emu -I../../../../generated/emu/layout -I../../../../../scripts -I../../../../../3rdparty/asio/include   -m64 -pipe -Wno-deprecated-declarations -O2 -fno-strict-aliasing -O2 -g1 -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -save-temps -Wno-unknown-pragmas -Wall -Wcast-align -Wundef -Wformat-security -Wwrite-strings -Wno-sign-compare -Wno-conversion -Wno-unused-result -Wno-array-bounds -m64 -x c++ -std=c++14 -Woverloaded-virtual -Wsuggest-override -flifetime-dse=1  -o "../../../../linux_gcc/obj/x64/Release/src/devices/bus/sunkbd/hlekbd.o" -c "../../../../../src/devices/bus/sunkbd/hlekbd.cpp"
g++: warning: -pipe ignored because -save-temps specified
../../../../../src/devices/bus/sunkbd/hlekbd.cpp: In constructor 'bus::sunkbd::hle_type4_device::hle_type4_device(const machine_config&, const char*, device_t*, uint32_t)':
../../../../../src/devices/bus/sunkbd/hlekbd.cpp:1140:54: error: 'bus::sunkbd::hle_device_base::hle_device_base(const machine_config&, device_type, const char*, const char*, device_t*, uint32_t, const char*, const char*)' is protected within this context
    __FILE__)
                                                      ^
../../../../../src/devices/bus/sunkbd/hlekbd.cpp:752:1: note: declared protected here
 hle_device_base::hle_device_base(
 ^~~~~~~~~~~~~~~
../../../../../src/devices/bus/sunkbd/hlekbd.cpp: In constructor 'bus::sunkbd::hle_type5_device::hle_type5_device(const machine_config&, const char*, device_t*, uint32_t)':
../../../../../src/devices/bus/sunkbd/hlekbd.cpp:1179:54: error: 'bus::sunkbd::hle_device_base::hle_device_base(const machine_config&, device_type, const char*, const char*, device_t*, uint32_t, const char*, const char*)' is protected within this context
    __FILE__)
                                                      ^
../../../../../src/devices/bus/sunkbd/hlekbd.cpp:752:1: note: declared protected here
 hle_device_base::hle_device_base(
 ^~~~~~~~~~~~~~~
../../../../../src/devices/bus/sunkbd/hlekbd.cpp: In constructor 'bus::sunkbd::hle_type5_gb_device::hle_type5_gb_device(const machine_config&, const char*, device_t*, uint32_t)':
../../../../../src/devices/bus/sunkbd/hlekbd.cpp:1218:54: error: 'bus::sunkbd::hle_device_base::hle_device_base(const machine_config&, device_type, const char*, const char*, device_t*, uint32_t, const char*, const char*)' is protected within this context
    __FILE__)
                                                      ^
../../../../../src/devices/bus/sunkbd/hlekbd.cpp:752:1: note: declared protected here
 hle_device_base::hle_device_base(
 ^~~~~~~~~~~~~~~
../../../../../src/devices/bus/sunkbd/hlekbd.cpp: In constructor 'bus::sunkbd::hle_type5_se_device::hle_type5_se_device(const machine_config&, const char*, device_t*, uint32_t)':
../../../../../src/devices/bus/sunkbd/hlekbd.cpp:1257:54: error: 'bus::sunkbd::hle_device_base::hle_device_base(const machine_config&, device_type, const char*, const char*, device_t*, uint32_t, const char*, const char*)' is protected within this context
    __FILE__)
                                                      ^
../../../../../src/devices/bus/sunkbd/hlekbd.cpp:752:1: note: declared protected here
 hle_device_base::hle_device_base(
 ^~~~~~~~~~~~~~~
../../../../../src/devices/bus/sunkbd/hlekbd.cpp: In constructor 'bus::sunkbd::hle_type5_jp_device::hle_type5_jp_device(const machine_config&, const char*, device_t*, uint32_t)':
../../../../../src/devices/bus/sunkbd/hlekbd.cpp:1296:54: error: 'bus::sunkbd::hle_device_base::hle_device_base(const machine_config&, device_type, const char*, const char*, device_t*, uint32_t, const char*, const char*)' is protected within this context
    __FILE__)
                                                      ^
../../../../../src/devices/bus/sunkbd/hlekbd.cpp:752:1: note: declared protected here
 hle_device_base::hle_device_base(
 ^~~~~~~~~~~~~~~
make[2]: *** [optional.make:973: ../../../../linux_gcc/obj/x64/Release/src/devices/bus/sunkbd/hlekbd.o] Error 1

Comment 5 Jakub Jelinek 2017-02-06 23:17:18 UTC
This compiles fine with -fno-new-inheriting-ctors, the errors started appearing when -fnew-inheriting-ctors has been added and made default ( http://gcc.gnu.org/r241765 ).

Comment 6 Julian Sikorski 2017-02-06 23:29:42 UTC
Is the mame code wrong then? Upstream argue they are doing nothing illegal as per comment 2.

Comment 7 Jakub Jelinek 2017-02-07 07:44:59 UTC
I don't know, will have to ask our C++ people.  In the mean time, I've reduced it to:

class B
{
protected:
  B (int, int);
};
class C : public B
{
protected:
  using B::B;
};
class A : public C
{
  A (char *);
};
A::A (char *) : C (0, 0)
{
}

which still fails with -fnew-inheriting-ctors (aka http://wg21.link/p0136 , because being a DR applying to older C++ releases too) and succeeds with -fno-new-inheriting-ctors.

Comment 8 Julian Sikorski 2017-02-14 06:37:51 UTC
With 7.0.1-0.8.fc26 mame builds fine, thank you for taking care of this.


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