`SignpostIntrinsicTriangulation::splitEdge` on a boundary edge always throws in optimized Clang builds (uninitialized `outgoingVec`)
還沒有人認領這個 Issue。
評估
- 難度
- 1/5
- 預估耗時
- 1 小時以內
- 新手友好度
- 85/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- cpp
研究方向
該 issue 直接指向 src/surface/signpost_intrinsic_triangulation.cpp:resolveNewVertex 在第 678 行附近宣告 Vector2 outgoingVec;,僅在第 736 行附近為內部邊賦值,並在邊界檢查覆寫 incomingAngle 之前於第 743 行呼叫 outgoingVec.arg()。使用提供的 Clang Release 片段重現,套用 Vector2::zero() 初始化,並確認範例在 Release 中輸出 split ok,同時現有的 surface 測試仍能建置並通過。
由索引模型根據 Issue 內容生成。
描述
Splitting a boundary edge of a SignpostIntrinsicTriangulation throws in Release builds with Clang:
edge split problem: no boundary edge connecting vertices in boundary insertion
Debug builds and GCC builds work fine.
Steps to reproduce
#include "geometrycentral/surface/signpost_intrinsic_triangulation.h"
#include "geometrycentral/surface/surface_mesh_factories.h"
#include <iostream>
using namespace geometrycentral;
using namespace geometrycentral::surface;
int main() {
std::vector<Vector3> positions = {{0, 0, 0}, {1, 0, 0}, {0, 1, 0}};
std::vector<std::vector<size_t>> faces = {{0, 1, 2}};
auto [mesh, geometry] = makeManifoldSurfaceMeshAndGeometry(faces, positions);
SignpostIntrinsicTriangulation intrinsic(*mesh, *geometry);
intrinsic.splitEdge(intrinsic.intrinsicMesh->edge(0).halfedge(), 0.5);
std::cout << "split ok" << std::endl;
}
CMakeLists.txt
cmake_minimum_required(VERSION 3.25)
project(BoundarySplitRepro LANGUAGES C CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
include(FetchContent)
FetchContent_Declare(
geometry-central
GIT_REPOSITORY https://github.com/nmwsharp/geometry-central.git
GIT_TAG 019669ddabda05e0f71fa3587cfb3c1dadf19cb8
SYSTEM
)
FetchContent_MakeAvailable(geometry-central)
add_executable(boundary_split boundary_split.cc)
target_link_libraries(boundary_split PRIVATE geometry-central)
Release build, throws:
cmake -S . -B build/Release -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=clang++
cmake --build build/Release
build/Release/boundary_split
Debug build, prints split ok:
cmake -S . -B build/Debug -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER=clang++
cmake --build build/Debug
build/Debug/boundary_split
Environment: geometry-central 019669d (current master), Clang 18.1.3, Pop!_OS 24.04 (Ubuntu 24.04 based). GCC 13.3 does not show the problem at any optimization level.
Cause
In SignpostIntrinsicTriangulation::resolveNewVertex (src/surface/signpost_intrinsic_triangulation.cpp), Vector2 outgoingVec; (line 678) is only assigned for interior edges (line 736), but outgoingVec.arg() is evaluated in every case (line 743):
double incomingAngle = standardizeAngle(newV, outgoingVec.arg());
if (!inputTraceHe.isInterior()) {
incomingAngle = 0;
}
For boundary edges the result is overwritten with 0 anyway, but reading the uninitialized value is undefined behavior, and in optimized Clang builds it leads to the exception above.
Fix
- Vector2 outgoingVec;
+ Vector2 outgoingVec = Vector2::zero();
With this change the example prints split ok in Release builds. I'm happy to open a PR with this change if you'd like.
- 主要語言
- C++
- 星號
- 1.3k
- 分支
- 188
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
nmwsharp/geometry-central 的其他 Issue
-
warning: control reaches end of non-void function in VectorHeatMethodSolver::computeLogMap可能已有人在做 @dyollb 於 106 天前認領。 未關閉
難度 1/5 1 小時以內 新手友好度 88/100
nmwsharp/geometry-central#256 ·
-
BFF::flattenFromScaleFactors gives an overlap where it should give a notch (sign bug in dirichletToNeumann)可能已有人在做 @joaoajmatos 於 19 天前認領。 未關閉
難度 4/5 3-5 天 新手友好度 25/100
nmwsharp/geometry-central#263 ·
-
難度 4/5 3-5 天 新手友好度 56/100
nmwsharp/geometry-central#260 ·
-
難度 4/5 3-5 天 新手友好度 48/100
nmwsharp/geometry-central#255 · 1 則留言 ·
-
FlipEdgeNetwork::iterativeShorten() hangs on a contractible closed loop可能已有人在做 @designbynumbers 於 156 天前認領。 未關閉
難度 4/5 3-5 天 新手友好度 30/100
nmwsharp/geometry-central#253 ·
查看 nmwsharp/geometry-central 的全部 Issue
相似的 Issue
-
enhancement
難度 2/5 1-3 小時 新手友好度 70/100
raspberrypi/rpi-imager#1804 ·
-
difficulty: easy docs good first issue help wanted
難度 2/5 1-3 小時 新手友好度 74/100
Ryan-Millard/Img2Num#842 ·
維護者通常 12 天內回覆
-
難度 2/5 1-3 小時 新手友好度 72/100
microsoft/calculator#2532 ·
-
難度 2/5 1-3 小時 新手友好度 64/100
-
bug difficulty:easy prio:normal
難度 2/5 1-3 小時 新手友好度 62/100
NatronGitHub/openfx-misc#411 ·
維護者通常 1 天內回覆