Repository: godot
Issue: Linux unable to compile `window template_release` with `lto=full production=yes`
Labels: bug,platform:linuxbsd,topic:buildsystem,needs testing

### Tested versions

4.4 master

### System information

ArchLinux 6.12.9-zen1-1.1-zen (64)

### Issue description

Full command: 
`pyston-scons platform=windows target=template_release module_mono_enabled=yes linker=mold lto=full optimize=size production=yes vulkan=no speechd=no fast_unsafe=yes disable_3d=yes disable_2d_physics=yes disable_3d_physics=yes disable_navigation=yes openxr=no rendering_device=no`

Error:
```
./core/templates/cowdata.h: In function '_copy_on_write.constprop.isra':
./core/templates/cowdata.h:301: internal compiler error: in binds_to_current_def_p, at symtab.cc:2589
  301 | typename CowData<T>::USize CowData<T>::_copy_on_write() {
0x1d64449 internal_error(char const*, ...)
        ???:0
0x6eb1a2 fancy_abort(char const*, int, char const*)
        ???:0
0xd425a8 ref_maybe_used_by_stmt_p(gimple*, ao_ref*, bool)
        ???:0
0xd6bb99 dse_classify_store(ao_ref*, gimple*, bool, simple_bitmap_def*, bool*, tree_node*)
        ???:0
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
See <https://bugs.archlinux.org/> for instructions.
make: *** [/tmp/ccVBDCsI.mk:374: /tmp/ccebIWPQ.ltrans124.ltrans.o] Error 1
make: *** Waiting for unfinished jobs....
during GIMPLE pass: dse
./core/templates/cowdata.h: In member function '_copy_on_write.isra':
./core/templates/cowdata.h:301:28: internal compiler error: in binds_to_current_def_p, at symtab.cc:2589
  301 | typename CowData<T>::USize CowData<T>::_copy_on_write() {
      |                            ^
0x1d64449 internal_error(char const*, ...)
        ???:0
0x6eb1a2 fancy_abort(char const*, int, char const*)
        ???:0
0xd425a8 ref_maybe_used_by_stmt_p(gimple*, ao_ref*, bool)
        ???:0
0xd6bb99 dse_classify_store(ao_ref*, gimple*, bool, simple_bitmap_def*, bool*, tree_node*)
        ???:0
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
See <https://bugs.archlinux.org/> for instructions.
make: *** [/tmp/ccVBDCsI.mk:383: /tmp/ccebIWPQ.ltrans127.ltrans.o] Error 1
during GIMPLE pass: dse
./core/templates/cowdata.h: In member function '_copy_on_write.isra':
./core/templates/cowdata.h:301: internal compiler error: in binds_to_current_def_p, at symtab.cc:2589
  301 | typename CowData<T>::USize CowData<T>::_copy_on_write() {
0x1d64449 internal_error(char const*, ...)
        ???:0
0x6eb1a2 fancy_abort(char const*, int, char const*)
        ???:0
0xd425a8 ref_maybe_used_by_stmt_p(gimple*, ao_ref*, bool)
        ???:0
0xd6bb99 dse_classify_store(ao_ref*, gimple*, bool, simple_bitmap_def*, bool*, tree_node*)
        ???:0
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
See <https://bugs.archlinux.org/> for instructions.
make: *** [/tmp/ccVBDCsI.mk:377: /tmp/ccebIWPQ.ltrans125.ltrans.o] Error 1
during GIMPLE pass: dse
./core/templates/cowdata.h: In member function '_copy_on_write.isra':
./core/templates/cowdata.h:301: internal compiler error: in binds_to_current_def_p, at symtab.cc:2589
  301 | typename CowData<T>::USize CowData<T>::_copy_on_write() {
0x1d64449 internal_error(char const*, ...)
        ???:0
0x6eb1a2 fancy_abort(char const*, int, char const*)
        ???:0
0xd425a8 ref_maybe_used_by_stmt_p(gimple*, ao_ref*, bool)
        ???:0
0xd6bb99 dse_classify_store(ao_ref*, gimple*, bool, simple_bitmap_def*, bool*, tree_node*)
        ???:0
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
See <https://bugs.archlinux.org/> for instructions.
make: *** [/tmp/ccVBDCsI.mk:380: /tmp/ccebIWPQ.ltrans126.ltrans.o] Error 1
during GIMPLE pass: dse
./core/object/ref_counted.h: In member function 'instantiate.constprop':
./core/object/ref_counted.h:191:14: internal compiler error: in binds_to_current_def_p, at symtab.cc:2589
  191 |         void instantiate(VarArgs... p_params) {
      |              ^
0x1d64449 internal_error(char const*, ...)
        ???:0
0x6eb1a2 fancy_abort(char const*, int, char const*)
        ???:0
0xd425a8 ref_maybe_used_by_stmt_p(gimple*, ao_ref*, bool)
        ???:0
0xd6bb99 dse_classify_store(ao_ref*, gimple*, bool, simple_bitmap_def*, bool*, tree_node*)
        ???:0
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
See <https://bugs.archlinux.org/> for instructions.
make: *** [/tmp/ccVBDCsI.mk:371: /tmp/ccebIWPQ.ltrans123.ltrans.o] Error 1
during GIMPLE pass: dse
core/string/ustring.cpp: In function 'num':
core/string/ustring.cpp:1601: internal compiler error: in binds_to_current_def_p, at symtab.cc:2589
 1601 | String String::num(double p_num, int p_decimals) {
0x1d64449 internal_error(char const*, ...)
        ???:0
0x6eb1a2 fancy_abort(char const*, int, char const*)
        ???:0
0xd425a8 ref_maybe_used_by_stmt_p(gimple*, ao_ref*, bool)
        ???:0
0xd6bb99 dse_classify_store(ao_ref*, gimple*, bool, simple_bitmap_def*, bool*, tree_node*)
        ???:0
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
See <https://bugs.archlinux.org/> for instructions.
make: *** [/tmp/ccVBDCsI.mk:344: /tmp/ccebIWPQ.ltrans114.ltrans.o] Error 1
lto-wrapper: fatal error: make returned 2 exit status
compilation terminated.
/usr/lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
scons: *** [bin/godot.windows.template_release.x86_64.mono.exe] Error 1
scons: building terminated because of errors.
```

### Steps to reproduce

Use `platform=windows target=template_release linker=mold lto=full production=yes` to compile godot on linux

### Minimal reproduction project (MRP)

N/A