Commit 3acecd9
fix: restore Linux link of FFT_CPU<float> and harden parse_expression
Two issues from code review of the Windows-port commits:
1. FFT_CPU<float> undefined references on Linux (regression). The port removed
__attribute__((weak)) from the FFT virtuals (it left null vtable slots on
PE/MinGW and crashed). But the real FFT_CPU<float> methods live in
fft_cpu_float.cpp, which is compiled only when ENABLE_FLOAT_FFTW=ON. With
weak gone and float off (the Linux default), the FFT_CPU<float> vtable --
still emitted wherever the class is constructed (FFT_Bundle) -- referenced
undefined symbols:
undefined reference to `ModuleBase::FFT_CPU<float>::setupFFT()' ...
Provide trivial FFT_CPU<float> method definitions in the always-compiled
fft_cpu.cpp, guarded by `#if !defined(__ENABLE_FLOAT_FFTW)`, so every vtable
slot is valid on any ABI without weak and without pulling in libfftw3f. The
float CPU path stays unreachable at runtime (FFT_Bundle::setupFFT
WARNING_QUITs for single/mixing CPU FFT unless the macro is set). When the
macro is on, the stubs are excluded and fft_cpu_float.cpp supplies the real
definitions -- no duplicate symbols. Verified by linking the float vtable TU
against fft_cpu.o in both macro states (off: links via stubs; on: links via
fft_cpu_float.o), and that dropping both reproduces the reported errors.
2. parse_expression (input_conv.h) could push indeterminate values into vec.
If std::regex_search found no match, sub_str stayed empty and was parsed
anyway; in the non-multiplication branch `T occ` was uninitialized and the
`convert >> occ` extraction was unchecked. Now: a no-match token is an input
error (WARNING_QUIT), occ is value-initialized, and a failed extraction
fails fast. Consistent with the other expression parsers.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 763f788 commit 3acecd9
2 files changed
Lines changed: 47 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
508 | 508 | | |
509 | 509 | | |
510 | 510 | | |
511 | | - | |
| 511 | + | |
512 | 512 | | |
513 | | - | |
| 513 | + | |
514 | 514 | | |
515 | | - | |
| 515 | + | |
516 | 516 | | |
517 | 517 | | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
518 | 543 | | |
519 | 544 | | |
520 | 545 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
94 | 103 | | |
95 | 104 | | |
96 | 105 | | |
97 | 106 | | |
98 | 107 | | |
99 | 108 | | |
100 | | - | |
| 109 | + | |
101 | 110 | | |
102 | 111 | | |
103 | 112 | | |
| |||
107 | 116 | | |
108 | 117 | | |
109 | 118 | | |
110 | | - | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
111 | 122 | | |
112 | 123 | | |
113 | | - | |
114 | | - | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
115 | 130 | | |
116 | 131 | | |
117 | 132 | | |
| |||
0 commit comments