`SignpostIntrinsicTriangulation::splitEdge` on a boundary edge always throws in optimized Clang builds (uninitialized `outgoingVec`)
まだ誰も着手していません。
評価
- 難易度
- 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() の初期化を適用し、既存の surface テストが引き続きビルドおよびパスする一方で、Release で例が split ok を出力することを確認する。
索引モデルが 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 にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
nmwsharp/geometry-central のほかの issue
-
warning: control reaches end of non-void function in VectorHeatMethodSolver::computeLogMap対応中かも @dyollb が 105 日前に担当しました。 オープン
難易度 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
-
new issue
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
llvm/llvm-project#245835 ·
メンテナーはふだん 1 日以内に返信
-
documentation
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
EchoTools/nevr-runtime#2823 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
triton-lang/triton#12945 ·
メンテナーはふだん 1 日以内に返信
-
Releases do not move the `latest` Docker tag: the branch `30.12` is taken for the latest release branch対応中かも @alexey-milovidov が今日担当しました。 オープンcomp-ci-infrastructure unexpected behaviour
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
ClickHouse/ClickHouse#134282 ·
メンテナーはふだん 1 日以内に返信