https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122639
Bug ID: 122639
Summary: d21 loops in getcacheinfoCPUID2 in Solaris/x86 kernel
zone
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: d
Assignee: ibuclaw at gdcproject dot org
Reporter: ro at gcc dot gnu.org
Target Milestone: ---
Target: i386-pc-solaris2.11, amd64-pc-solaris2.11
Created attachment 62762
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=62762&action=edit
Proposed patch
When I recently migrated a Solaris 11.4 kernel zone from an Intel CPU (Xeon(r)
Gold 6132)
to an AMD CPU (AMD EPYC 7452), I hit another instance of PR d/112408: d21
loops here:
28488: /var/gcc/regression/master/11-gcc/build/./gcc/d21 conftest.d -quiet -d
0c4e3021 core.cpuid.getcacheinfoCPUID2() (0xfaa20058, 0x10000, 0xc4c65eb,
0x41000000, 0x5010800, 0xcf2e010) + a1
0c4e371f core.cpuid.cpuidX86() (0xcdaf288, 0xcf7bab0, 0xfeff8f98, 0xc4d31d1,
0xcdaf288, 0x20) + 3bf
0c4e3d95 core.cpuid._sharedStaticCtor1() (0xc4e3de9, 0xc52aac8, 0xfeff8fd8,
0xc4ce78c, 0xcf2ec58, 0x0) + 515
0c4e3df7 core.cpuid.__modsharedctor() (0xcf2ec58, 0x0, 0x0, 0x6, 0xc52aac8,
0xa04181) + 17
0c4ce78c rt.minfo.ModuleGroup.runCtors() (0xcf2ec58, 0xc4f8e70, 0xc4c992e,
0xc4cfc7d) + 7c
0c4cfca4 rt.minfo.rt_moduleCtor().__foreachbody1(ref gcc.sections.elf.DSO)
(0x0, 0xcf2ec58, 0xfeff9038, 0xc4c201f) + 34
0c4c2061 gcc.sections.elf.DSO.opApply(scope int(ref gcc.sections.elf.DSO)
delegate) (0x0, 0xc4cfc70, 0xc4d4e4b, 0xc52aac8, 0xc4ce9fb, 0xc52aac8) + 61
0c4cea11 rt_moduleCtor (0x4, 0xfeff9160, 0xfeff9088, 0xfeff9160, 0xfeff914c,
0xfeff9560) + 21
0c4c1808 rt_init (0x1c, 0xfeff9160, 0xfeff90a8, 0xa4c5fbc, 0xcf7c620,
0xcf7d0d0) + 68
09cd64b4 _ZL14d_init_optionsjP17cl_decoded_option (0x13, 0xcf7cf10, 0xcf00fc0,
0xcf00fc4) + c
0a4c4f34 _ZN6toplev4mainEiPPc (0xfeff913a, 0x1c, 0xfeff9190, 0xfeff914c) + 18a
0c06e0a4 main (0xfeff9560, 0xfeff9164, 0x9a90b7d) + 38
when using GCC 11.5.0 as bootstrap compiler.
Running
$ cat conftest.d
module object;
extern(C) int main() {
return 0;
}
$ d21 conftest.d -o conftest.s
I find
Thread 2 received signal SIGINT, Interrupt.
[Switching to Thread 1 (LWP 1)]
0x0c4e3021 in core.cpuid.getcacheinfoCPUID2() ()
at /vol/gcc/src/gcc-11.5.0/libphobos/libdruntime/core/cpuid.d:516
516 "cpuid" : "=a" (a[0]), "=b" (a[1]), "=c" (a[2]), "=d"
(a[3]) : "a" (2);
(gdb) bt
#0 0x0c4e3021 in core.cpuid.getcacheinfoCPUID2() ()
at /vol/gcc/src/gcc-11.5.0/libphobos/libdruntime/core/cpuid.d:516
#1 0x0c4e371f in core.cpuid.cpuidX86() ()
at /vol/gcc/src/gcc-11.5.0/libphobos/libdruntime/core/cpuid.d:937
#2 0x0c4e3d95 in core.cpuid._sharedStaticCtor1() ()
at /vol/gcc/src/gcc-11.5.0/libphobos/libdruntime/core/cpuid.d:1076
#3 0x0c4e3df7 in _D4core5cpuid15__modsharedctorFZv ()
at
/var/gcc/gcc-11.5.0/11-gcc-gas/i386-pc-solaris2.11/libphobos/libdruntime/<no_file>:1
#4 0x0c4ce78c in runModuleFuncs (this=0x0, modules=...)
at /vol/gcc/src/gcc-11.5.0/libphobos/libdruntime/rt/minfo.d:858
#5 rt.minfo.ModuleGroup.runCtors() (this=...)
at /vol/gcc/src/gcc-11.5.0/libphobos/libdruntime/rt/minfo.d:728
#6 0x0c4cfca4 in __foreachbody1 (this=0x0, sg=...)
at /vol/gcc/src/gcc-11.5.0/libphobos/libdruntime/rt/minfo.d:796
#7 0x0c4c2061 in gcc.sections.elf.DSO.opApply(scope int(ref
gcc.sections.elf.DSO) delegate) (dg=...)
at /vol/gcc/src/gcc-11.5.0/libphobos/libdruntime/gcc/sections/elf.d:106
#8 0x0c4cea11 in rt_moduleCtor ()
at /vol/gcc/src/gcc-11.5.0/libphobos/libdruntime/rt/minfo.d:793
#9 0x0c4c1808 in rt_init ()
at /vol/gcc/src/gcc-11.5.0/libphobos/libdruntime/rt/dmain2.d:129
#10 0x09cd64b4 in d_init_options (decoded_options=0xcf7bc48)
at /vol/gcc/src/hg/master/local/gcc/d/d-lang.cc:291
#11 0x0a4c4f34 in toplev::main (this=0xfeffdeca, argc=4, argv=0xfeffdf28)
at /vol/gcc/src/hg/master/local/gcc/toplev.cc:2341
#12 0x0c06e0a4 in main (argc=4, argv=0xfeffdf28)
at /vol/gcc/src/hg/master/local/gcc/main.cc:39
where numinfos grows without bound.
I've used the attached patch (hack) to avoid this.