gcc-6.2.0をgcc-7.3.0でビルドするときのエラー対応
Ubuntu 18.04.1 LTSでgcc-6.2.0をビルドすると、次のようなエラーが出た
code:text
g++ -fno-PIE -c -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -I. -I. -I../../gcc-6.2.0/gcc -I../../gcc-6.2.0/gcc/. -I../../gcc-6.2.0/gcc/../include -I../../gcc-6.2.0/gcc/../libcpp/include -I/mnt/clfs/sources/gcc-build/./gmp -I/mnt/clfs/sources/gcc-6.2.0/gmp -I/mnt/clfs/sources/gcc-build/../gcc-6.2.0/mpfr/src -I/mnt/clfs/sources/gcc-6.2.0/mpc/src -I../../gcc-6.2.0/gcc/../libdecnumber -I../../gcc-6.2.0/gcc/../libdecn
umber/dpd -I../libdecnumber -I../../gcc-6.2.0/gcc/../libbacktrace -o ubsan.o -MT ubsan.o -MMD -MP -MF ./.dep$/ubsan.TPo ../../gcc-6.2.0/gcc/ubsan.c ../../gcc-6.2.0/gcc/ubsan.c: In function 'bool ubsan_use_new_style_p(location_t)': ../../gcc-6.2.0/gcc/ubsan.c:1472:23: error: ISO C++ forbids comparison between pointer and integer -fpermissive || xloc.file == '\0' || xloc.file0 == '\xff' ^~~~
gcc7でgcc6.2をビルドするとこのようなエラーが出るらしい
次のように修正するとビルドに成功した
code:diff
diff -Naur gcc-6.2.0.orig/gcc/ubsan.c gcc-6.2.0/gcc/ubsan.c
--- gcc-6.2.0.orig/gcc/ubsan.c 2017-07-13 14:55:44.175133226 -0400
+++ gcc-6.2.0/gcc/ubsan.c 2017-07-13 14:56:32.977783780 -0400
@@ -1469,7 +1469,7 @@
expanded_location xloc = expand_location (loc);
if (xloc.file == NULL || strncmp (xloc.file, "\1", 2) == 0
- || xloc.file == '\0' || xloc.file0 == '\xff' + || xloc.file0 == '\0' || xloc.file0 == '\xff'