#784681 g++ fails to build preprocessed code in mednafen

Package:
g++
Source:
gcc-defaults
Description:
GNU C++ compiler
Submitter:
Stephen Kitt
Date:
2015-05-11 21:12:04 UTC
Severity:
normal
#784681#5
Date:
2015-05-07 18:17:04 UTC
From:
To:
Dear Maintainer,

The current version of mednafen (0.9.38.4) fails to build with ccache
(after the first build):

g++ -DLOCALEDIR=\"/usr/share/locale\" -DHAVE_CONFIG_H -I../include -I../include -I../intl   -D_FORTIFY_SOURCE=2   -fsigned-char  -Wall -Wshadow -Wempty-body -Wignored-qualifiers -Wvla -Wvariadic-macros -Wdisabled-optimization  -fno-fast-math -fno-unsafe-math-optimizations -fno-aggressive-loop-optimizations -fomit-frame-pointer -fwrapv  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -std=gnu++11 -c -o hash/sha1.o hash/sha1.cpp
hash/sha1.cpp:161:128: error: invalid digit "9" in octal constant
  assert(sha1(tv, 65) == "079b9ef0684bd9a600b9a23caa4297d064ce076e"_sha1);
                                                                                                                                ^
hash/sha1.cpp: In function ‘void sha1_test()’:
hash/sha1.cpp:156:168: error: unable to find string literal operator ‘operator""e119a863bce69ad1b6ca1a51e94994531d122088’
  assert(sha1(tv, 55) == "e119a863bce69ad1b6ca1a51e94994531d122088"_sha1);
                                                                                                                                                                        ^
hash/sha1.cpp:157:168: error: unable to find string literal operator ‘operator""fd62c272e1f0f24b92a0ec8360519cd64d6ab986’
  assert(sha1(tv, 56) == "fd62c272e1f0f24b92a0ec8360519cd64d6ab986"_sha1);
                                                                                                                                                                        ^
hash/sha1.cpp:158:128: error: expected ‘)’ before numeric constant
  assert(sha1(tv, 57) == "010b0113d06cffb80f2beb657ef39682e5e7de79"_sha1);
                                                                                                                                ^
hash/sha1.cpp:159:168: error: unable to find string literal operator ‘operator""adf8998c4791fc378fa6d8b23666934522546778’
  assert(sha1(tv, 63) == "adf8998c4791fc378fa6d8b23666934522546778"_sha1);
                                                                                                                                                                        ^
hash/sha1.cpp:160:128: error: expected ‘)’ before numeric constant
  assert(sha1(tv, 64) == "787680a25bf74f34c22b2c37d7d5bae2feceb20c"_sha1);
                                                                                                                                ^
hash/sha1.cpp:161:128: error: expected ‘)’ before numeric constant
  assert(sha1(tv, 65) == "079b9ef0684bd9a600b9a23caa4297d064ce076e"_sha1);
                                                                                                                                ^
Makefile:944: recipe for target 'hash/sha1.o' failed


Uninstalling ccache allows the source to build.

Regards,

Stephen

#784681#10
Date:
2015-05-09 20:33:29 UTC
From:
To:
I would say that this is a GCC bug - g++ can't compile its own preprocessed
source code.

The problem can be reproduced without ccache by building src/hash/sha1.cpp
with -save-temps:

% cd src
% /usr/bin/g++ -save-temps -DLOCALEDIR=\"/usr/local/share/locale\"
-DHAVE_CONFIG_H -I../include -I../include -I../intl    -fsigned-char  -Wall
-Wshadow -Wempty-body -Wignored-qualifiers -Wvla -Wvariadic-macros
-Wdisabled-optimization  -fno-fast-math -fno-unsafe-math-optimizations
-fno-aggressive-loop-optimizations -fomit-frame-pointer -fwrapv  -g -O2
-std=gnu++11 -MT hash/sha1.o -MD -MP -MF $depbase.Tpo -c -o hash/sha1.o
hash/sha1.cpp
hash/sha1.cpp:161:128: error: invalid digit "9" in octal constant
  assert(sha1(tv, 65) == "079b9ef0684bd9a600b9a23caa4297d064ce076e"_sha1);

                                                    ^
hash/sha1.cpp: In function 'void sha1_test()':
hash/sha1.cpp:156:168: error: unable to find string literal operator
'operator""e119a863bce69ad1b6ca1a51e94994531d122088'
  assert(sha1(tv, 55) == "e119a863bce69ad1b6ca1a51e94994531d122088"_sha1);


                ^
hash/sha1.cpp:157:168: error: unable to find string literal operator
'operator""fd62c272e1f0f24b92a0ec8360519cd64d6ab986'
  assert(sha1(tv, 56) == "fd62c272e1f0f24b92a0ec8360519cd64d6ab986"_sha1);


                ^
hash/sha1.cpp:158:128: error: expected ')' before numeric constant
  assert(sha1(tv, 57) == "010b0113d06cffb80f2beb657ef39682e5e7de79"_sha1);

                                                    ^
hash/sha1.cpp:159:168: error: unable to find string literal operator
'operator""adf8998c4791fc378fa6d8b23666934522546778'
  assert(sha1(tv, 63) == "adf8998c4791fc378fa6d8b23666934522546778"_sha1);


                ^
hash/sha1.cpp:160:128: error: expected ')' before numeric constant
  assert(sha1(tv, 64) == "787680a25bf74f34c22b2c37d7d5bae2feceb20c"_sha1);

                                                    ^
hash/sha1.cpp:161:128: error: expected ')' before numeric constant
  assert(sha1(tv, 65) == "079b9ef0684bd9a600b9a23caa4297d064ce076e"_sha1);

                                                    ^
% g++ --version | head -n1
g++ (Debian 4.9.2-16) 4.9.2

#784681#21
Date:
2015-05-11 21:10:48 UTC
From:
To:
Hi Joel,

Indeed, I didn't think to check that... I'm reassigning the bug, thanks for
your detective work!

Regards,

Stephen