deepmodeling / deepmodeling/tbplas
[Code scan] Store FFTW plans in a pointer-sized integer
- Dominant language
- No language data
- Stars
- 19
- Forks
- 6
- PR merge metrics
- No merged PRs in 30d
Description
This issue comes from a Codex global scan of deepmodeling/tbplas at commit 4d3652b3dba8eb930e4869a6d41074f62d703692.
Severity: High
The FFTW plan handle is declared as default `INTEGER`. FFTW plan handles are pointer-sized; on 64-bit builds this can truncate the handle before `dfftw_execute_dft` or `dfftw_destroy_plan` sees it. That can produce crashes or undefined behavior in FFTW/MKL FFT builds.
Code reference:
https://github.com/deepmodeling/tbplas/blob/4d3652b3dba8eb930e4869a6d41074f62d703692/tbplas/fortran/fft.F90#L24-L30
Suggested fix: use a pointer-sized representation for the plan, such as `integer(kind=8)` for the legacy Fortran FFTW API or an `iso_c_binding`/`type(C_PTR)` based interface.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at tbplas/fortran/fft.F90 lines 24-30 and inspect how the FFTW plan is declared and passed to dfftw_execute_dft and dfftw_destroy_plan. Compare the legacy integer(kind=8) option with the iso_c_binding/type(C_PTR) approach, then verify that 64-bit FFTW/MKL builds preserve the handle and avoid crashes or undefined behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- fortran
- Domain
- hpc
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 64/100