Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gcc 编译器问题 internal compiler error: in output_constructor_regular_field, at varasm.c:5512 #12

Closed
phorcys opened this issue Jan 1, 2022 · 17 comments

Comments

@phorcys
Copy link

phorcys commented Jan 1, 2022

github.com/loongson/gcc 的loongarch-12分支
编译 poppler时,会出错

 g++ poppler_Decrypt_preprocessed.cc -c
/var/tmp/portage/app-text/poppler-21.12.0/work/poppler-21.12.0/poppler/Decrypt.cc:1826:1: 编译器内部错误:在 output_constructor_regular_field 中,于 varasm.c:5512
 1826 | }
      | ^
0x1134277 internal_error(char const*, ...)
        ???:0
0x1a2887 fancy_abort(char const*, int, char const*)
        ???:0
0xbdecbf assemble_variable(tree_node*, int, int, int)
        ???:0
0xbe24ab varpool_node::assemble_decl()
        ???:0
0x4c2067 symbol_table::finalize_compilation_unit()
        ???:0
请提交一份完整的错误报告,
如有可能请附上经预处理后的源文件。
Please include the complete backtrace with any bug report.
参阅 <https://bugs.gentoo.org/> 以获取指示。

使用clfs原生工具链,也类似

/opt/clfs/usr/bin/g++ poppler_Decrypt_preprocessed.cc -c 
/var/tmp/portage/app-text/poppler-21.12.0/work/poppler-21.12.0/poppler/Decrypt.cc:1826:1: internal compiler error: in output_constructor_regular_field, at varasm.c:5512
 1826 | }
      | ^
0x12110ad07 internal_error(char const*, ...)
        ???:0
0x1201b4aff fancy_abort(char const*, int, char const*)
        ???:0
0x120bccb07 assemble_variable(tree_node*, int, int, int)
        ???:0
0x120bd0223 varpool_node::assemble_decl()
        ???:0
0x1204d4b23 symbol_table::finalize_compilation_unit()
        ???:0
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

使用clfs cross工具链,则无问题

llvm 则基本一致
使用loongarch工具链有问题,clfs la原生工具链有问题
使用gcc 11 x86编译无问题,clfs cross工具链无问题
使用loongarch源码编译的 x86_64 g++则有同样问题

gcc bugzilla有类似报告,不过看起来不像是同一个问题
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102434

@phorcys
Copy link
Author

phorcys commented Jan 1, 2022

preprocessed_cpp.zip
附件是预处理过的cpp,可以用来测试

@phorcys
Copy link
Author

phorcys commented Jan 12, 2022

qtcore 也有类似的问题,预处理的 qtextcodec_preprocessed.cpp放附件了
···
/opt/clfs/usr/bin/g++ -c qtextcodec_preprocessed.cpp
/var/tmp/portage/dev-qt/qtcore-5.15.2-r12/work/qtbase-7c6c0030cf80ef7b9ace42996b0e0c3a72f76860/src/corelib/codecs/qtextcodec.cpp:1276:1: internal compiler error: in output_constructor_regular_field, at varasm.c:5512
1276 | }
| ^
0x7ffff06f5beb __libc_start_call_main
../sysdeps/nptl/libc_start_call_main.h:58
0x7ffff06f5cd7 __libc_start_main_impl
/var/tmp/portage/sys-libs/glibc-2.34-r4/work/glibc-2.34/csu/libc-start.c:409
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See https://gcc.gnu.org/bugs/ for instructions.
···
qtextcodec_preprocessed.zip

@sunhaiyong1978
Copy link
Collaborator

咨询了一下,等待一下gcc的新代码。

@ChenghuaXu
Copy link

loongarch-12分支有点滞后,我们近期会rebase到最新代码,在次期间,可以先用https://github.com/loongson/gcc/tree/loongarch_upstream_v4.1

@ChenghuaXu
Copy link

另外,gcc也开了issues,可以直接报到那边去,这个一直没注意到。

@phorcys
Copy link
Author

phorcys commented Jan 15, 2022

更新gcc到 https://github.com/loongson/gcc/tree/loongarch_upstream_v4.1
状况依旧

@Makiras
Copy link

Makiras commented Jan 23, 2022

@Makiras
Copy link

Makiras commented Jan 24, 2022

感觉可能和这个问题有关
gcc-mirror/gcc@4d7dfad
目前loongarch没有处理这个问题相关的代码

@ChenghuaXu
Copy link

奇怪了,我怎么复现不料,编译参数不一致?麻烦在编译出错文件时加-v -save-temps >outpout.txt 2>&1,把出错的预处理后文件*.ii/*.i和output.txt 文件提供一下。另外把gcc -v的输出也提供一下。

@phorcys
Copy link
Author

phorcys commented Jan 25, 2022

g++ -v
使用内建 specs。
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/loongarch64-unknown-linux-gnu/12.0.0/lto-wrapper
目标:loongarch64-unknown-linux-gnu
配置为:/var/tmp/portage/sys-devel/gcc-12.0.0_pre9999/work/gcc-12.0.0_pre9999/configure --host=loongarch64-unknown-linux-gnu --build=loongarch64-unknown-linux-gnu --prefix=/usr --bindir=/usr/loongarch64-unknown-linux-gnu/gcc-bin/12.0.0 --includedir=/usr/lib/gcc/loongarch64-unknown-linux-gnu/12.0.0/include --datadir=/usr/share/gcc-data/loongarch64-unknown-linux-gnu/12.0.0 --mandir=/usr/share/gcc-data/loongarch64-unknown-linux-gnu/12.0.0/man --infodir=/usr/share/gcc-data/loongarch64-unknown-linux-gnu/12.0.0/info --with-gxx-include-dir=/usr/lib/gcc/loongarch64-unknown-linux-gnu/12.0.0/include/g++-v12 --with-python-dir=/share/gcc-data/loongarch64-unknown-linux-gnu/12.0.0/python --enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --enable-nls --without-included-gettext --disable-libunwind-exceptions --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 12.0.0_pre9999 p2, commit 0d88701b3417b755d616bb436eb181bc287964a3' --disable-esp --enable-libstdcxx-time --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --disable-multilib --disable-fixed-point --enable-libgomp --disable-libssp --disable-libada --disable-cet --disable-systemtap --disable-valgrind-annotations --disable-vtable-verify --disable-libvtv --without-zstd --enable-lto --without-isl --disable-libsanitizer --enable-default-pie --enable-default-ssp
线程模型:posix
Supported LTO compression algorithms: zlib
gcc 版本 12.0.0 20220115 (experimental) (Gentoo 12.0.0_pre9999 p2, commit 0d88701b3417b755d616bb436eb181bc287964a3) 

outpout.txt
Decrypt.cc.s.txt
Decrypt.cc.ii.txt

@Makiras
Copy link

Makiras commented Jan 26, 2022

upstream_v5.2的输出

makiras-loongson ~ # /opt/gcc/usr/bin/g++ -v
Using built-in specs.
COLLECT_GCC=/opt/gcc/usr/bin/g++
COLLECT_LTO_WRAPPER=/opt/gcc/usr/bin/../libexec/gcc/loongarch64-unknown-linux-gnu/12.0.1/lto-wrapper
Target: loongarch64-unknown-linux-gnu
Configured with: ../configure --prefix=/usr --libdir=/usr/lib64 --enable-__cxa_atexit --enable-threads=posix --with-system-zlib --enable-libstdcxx-time --enable-checking=release -enable-languages=c,c++,lto
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.0.1 20220123 (experimental) (GCC)

preprocessed_cpp.zip

@xen0n
Copy link

xen0n commented Jan 27, 2022

感觉可能和这个问题有关 gcc-mirror/gcc@4d7dfad 目前loongarch没有处理这个问题相关的代码

跟这个应该没有关系,他修复的是浮点参数 ABI 实现的问题,而我在 loongson/gcc#77 贴的那个例子完全不涉及浮点,并且 gcc 正常工作应该也不会用到浮点

@xen0n
Copy link

xen0n commented Jan 27, 2022

感觉可能和这个问题有关 gcc-mirror/gcc@4d7dfad 目前loongarch没有处理这个问题相关的代码

跟这个应该没有关系,他修复的是浮点参数 ABI 实现的问题,而我在 loongson/gcc#77 贴的那个例子完全不涉及浮点,并且 gcc 正常工作应该也不会用到浮点

确认了,这个修改打到 LoongArch 的相应代码上,解决不了这个问题

@redeastcn
Copy link

有谁试过V6的更新有解决这个问题了吗?

@xen0n
Copy link

xen0n commented Feb 8, 2022

试了,没有解决

@xen0n
Copy link

xen0n commented Feb 9, 2022

昨晚发现stage1工作的原因是没开优化,也就是确定问题出在LoongArch machine description个别只有开优化才生效的pattern上

@ChenghuaXu
Copy link

问题已经定位,正在解决。
另外,把这个issue关了,都去loongson/gcc#77

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants