Skip to content

调整项目构建工具为CMake - #5

Open
c101088 wants to merge 5 commits into
SHUD-System:masterfrom
c101088:dev-feature-cmakeBuild
Open

c101088 wants to merge 5 commits into
SHUD-System:masterfrom
c101088:dev-feature-cmakeBuild

Conversation

@c101088

@c101088 c101088 commented Nov 13, 2024

Copy link
Copy Markdown
  1. 引入CMake作为项目的构建工具
  2. 使用vcpkg管理项目的依赖包
  3. 引入gtest框架,配置简单的单元测试示例

2. 引入vcpkg作为包管理工具,安装依赖sundials
3. 引入GTest作为测试框架,给出简单示例
@c101088

c101088 commented Nov 13, 2024

Copy link
Copy Markdown
Author

macos的适配没有来得及做,先适配了windows和linux

DankerMu added a commit that referenced this pull request Jun 28, 2026
…er UB)

FloodAlert dtor unconditionally `delete[] itype` + `fclose(fid)` regardless of
whether InitAlert/InitFile was ever called. With itype + fid declared without
default initializers, the values were undefined behavior — Mac happened to
zero them (so `if(itype!=NULL) delete[]` was a no-op), but Linux g++ left
garbage that passed the `!=NULL` check and triggered SEGV on `delete[]` of a
bogus pointer (and would also crash `fclose` on a stale fid).

The PR-0 spike binaries (dump_adjacency etc) construct Model_Data → loadinput
→ initialize but never invoke FloodAlert::InitAlert/InitFile (no flood mesh).
On Linux this guaranteed segfault during ~Model_Data → FreeData → ~FloodAlert.
ASan stack trace (sbatch run on cn-node, jobid 9759):

    #4 in FloodAlert::~FloodAlert() src/classes/FloodAlert.cpp:29
    #5 in Model_Data::FreeData() src/ModelData/MD_readin.cpp:688
    #6 in Model_Data::~Model_Data() src/ModelData/Model_Data.cpp:20
    #7 in main /scratch/.../tools/p8tune.D/dump_adjacency.cpp:433

Fix:
  - hpp: int *itype = NULL; and FILE *fid = NULL;
  - cpp: guard if(fid != NULL) fclose(fid); (consistency with other guards)

Zero impact on legacy shud/shud_omp flow that does call InitAlert + InitFile.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant