Bug 2043357

Summary: ICE when compiling mpqc
Product: [Fedora] Fedora Reporter: Mamoru TASAKA <mtasaka>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: aoliva, dmalcolm, dominik, fweimer, jakub, jwakely, law, mpolacek, msebor, nickc, sipoyare
Target Milestone: ---   
Target Release: ---   
Hardware: ppc64le   
OS: Linux   
Whiteboard:
Fixed In Version: gcc-12.0.1-0.3.fc36 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-01-27 12:54:47 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
preprocessed source none

Description Mamoru TASAKA 2022-01-21 05:32:37 UTC
Created attachment 1852412 [details]
preprocessed source

Description of problem:
compiling mpqc-2.3.1-51.fc36 on ppc64le with gcc-12.0.1-0.2.fc36.ppc64le causes ICE

Version-Release number of selected component (if applicable):
gcc-12.0.1-0.2.fc36.ppc64le
mpqc-2.3.1-51.fc36

How reproducible:
100%

Steps to Reproduce:
1. rebuild mpqc-2.3.1-51.fc36
2.
3.

Actual results:
(This one is with disabling annobin)
https://koji.fedoraproject.org/koji/taskinfo?taskID=81565637

$ g++ -DHAVE_CONFIG_H -D_REENTRANT -I../../../../../src/lib -I/builddir/build/BUILD/mpqc-2.3.1/include -I/builddir/build/BUILD/mpqc-2.3.1/src/lib -std=c++14 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -m64 -mcpu=power8 -mtune=power8 -fasynchronous-unwind-tables -fstack-clash-protection -c psiwfn.cc  -fPIC -DPIC -o .libs/psiwfn.o
psiwfn.cc: In constructor 'sc::PsiWavefunction::PsiWavefunction(const sc::Ref<sc::KeyVal>&)':
psiwfn.cc:47:23: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'int' [-Wformat=]
   47 |   sprintf(memory_,"(%ld B)",bytes);
      |                     ~~^     ~~~~~
      |                       |     |
      |                       |     int
      |                       long int
      |                     %d
psiwfn.cc: In member function 'virtual int sc::PsiCCSD_T::gradient_implemented() const':
psiwfn.cc:457:19: warning: unused variable 'reftype' [-Wunused-variable]
  457 |   PsiSCF::RefType reftype = reference_->reftype();
      |                   ^~~~~~~
during RTL pass: final
psiwfn.cc: In member function 'sc::PsiWavefunction::PsiWavefunction(sc::Ref<sc::KeyVal> const&)':
psiwfn.cc:27:1: internal compiler error: Segmentation fault
   27 | PsiWavefunction::PsiWavefunction(const Ref<KeyVal>&keyval):
      | ^~~~~~~~~~~~~~~
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.

Comment 1 Marek Polacek 2022-01-21 17:15:11 UTC
I can't reproduce this:

$ ./cc1plus -quiet ~/x/trunk/gcc/m.ii -Iinclude  -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -Wall  -fstack-protector-strong -m64 -mcpu=power8 -mtune=power8 -fasynchronous-unwind-tables -fstack-clash-protection -O3  -flto=auto -ffat-lto-objects
psiwfn.cc: In constructor ‘sc::PsiWavefunction::PsiWavefunction(const sc::Ref<sc::KeyVal>&)’:
psiwfn.cc:47:19: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 3 has type ‘int’ [-Wformat=]
psiwfn.cc: In member function ‘virtual int sc::PsiCCSD_T::gradient_implemented() const’:
psiwfn.cc:457:19: warning: unused variable ‘reftype’ [-Wunused-variable]


Probably related to the long double changes.

Comment 2 Marek Polacek 2022-01-21 17:16:50 UTC
Oh, but I can with -mabi=ieeelongdouble:

$ ./cc1plus -quiet ~/m.ii -Iinclude  -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -Wall  -fstack-protector-strong -m64 -mcpu=power8 -mtune=power8 -fasynchronous-unwind-tables -fstack-clash-protection  -flto=auto -ffat-lto-objects -mabi=ieeelongdouble
cc1plus: warning: Using IEEE extended precision ‘long double’ [-Wpsabi]
psiwfn.cc: In constructor ‘sc::PsiWavefunction::PsiWavefunction(const sc::Ref<sc::KeyVal>&)’:
psiwfn.cc:47:19: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 3 has type ‘int’ [-Wformat=]
psiwfn.cc: In member function ‘virtual int sc::PsiCCSD_T::gradient_implemented() const’:
psiwfn.cc:457:19: warning: unused variable ‘reftype’ [-Wunused-variable]
during RTL pass: final
psiwfn.cc: In member function ‘sc::PsiWavefunction::PsiWavefunction(sc::Ref<sc::KeyVal> const&)’:
psiwfn.cc:27:1: internal compiler error: tree check: expected class ‘type’, have ‘declaration’ (namespace_decl) in base_ctor_omit_inherited_parms, at cp/method.cc:568
0x1024ace3 tree_class_check_failed(tree_node const*, tree_code_class, char const*, int, char const*)
	/home/polacek/src/gcc/gcc/tree.cc:8755
0x10484f03 tree_class_check
	/home/polacek/src/gcc/gcc/tree.h:3564
0x10484f03 base_ctor_omit_inherited_parms(tree_node*)
	/home/polacek/src/gcc/gcc/cp/method.cc:568
0x1046f7b3 write_method_parms
	/home/polacek/src/gcc/gcc/cp/mangle.cc:2798
0x1046fbf3 write_bare_function_type
	/home/polacek/src/gcc/gcc/cp/mangle.cc:2760
0x1046fd1b write_encoding
	/home/polacek/src/gcc/gcc/cp/mangle.cc:834
0x104722f3 mangle_decl_string
	/home/polacek/src/gcc/gcc/cp/mangle.cc:4034
0x1047251f get_mangled_id
	/home/polacek/src/gcc/gcc/cp/mangle.cc:4055
0x104728ff mangle_decl(tree_node*)
	/home/polacek/src/gcc/gcc/cp/mangle.cc:4093
0x113f92f3 rs6000_globalize_decl_name
	/home/polacek/src/gcc/gcc/config/rs6000/rs6000.cc:28218
0x113b7c93 globalize_decl
	/home/polacek/src/gcc/gcc/varasm.cc:6146
0x113befff assemble_start_function(tree_node*, char const*)
	/home/polacek/src/gcc/gcc/varasm.cc:1965
0x10a0670f rest_of_handle_final
	/home/polacek/src/gcc/gcc/final.cc:4281
0x10a0670f execute
	/home/polacek/src/gcc/gcc/final.cc:4363

Comment 3 Jakub Jelinek 2022-01-25 09:28:18 UTC
https://koji.fedoraproject.org/scratch/jakub/task_81787698/ is a scratch build of gcc that could fix this.

Comment 4 Mamoru TASAKA 2022-01-25 13:49:51 UTC
(In reply to Jakub Jelinek from comment #3)
> https://koji.fedoraproject.org/scratch/jakub/task_81787698/ is a scratch
> build of gcc that could fix this.

I am now trying rebuilding mpqc locally. At least psiwfn.cc (which caused ICE with gcc-12.0.1-0.2.fc36.ppc64le) now compiles with the above scratch build.

Comment 5 Jakub Jelinek 2022-01-27 10:34:33 UTC
Please retry against gcc-12.0.1-0.3.fc36 and annobin-10.51-2.fc36 now in rawhide.

Comment 6 Mamoru TASAKA 2022-01-27 12:54:47 UTC
mpqc is now successfully built, thank you.