`SignpostIntrinsicTriangulation::splitEdge` on a boundary edge always throws in optimized Clang builds (uninitialized `outgoingVec`)
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 1/5
- Thời gian dự kiến
- Dưới một giờ
- Mức phù hợp với người mới
- 85/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- cpp
- Lĩnh vực
- computer-graphics
Hướng nghiên cứu
Issue chỉ thẳng vào src/surface/signpost_intrinsic_triangulation.cpp: resolveNewVertex khai báo Vector2 outgoingVec; quanh dòng 678, chỉ gán nó cho các cạnh bên trong gần dòng 736, và gọi outgoingVec.arg() ở dòng 743 trước khi kiểm tra biên ghi đè incomingAngle. Hãy tái hiện bằng đoạn mã Clang Release được cung cấp, áp dụng khởi tạo Vector2::zero(), và xác nhận rằng ví dụ in ra split ok trong Release trong khi các bài kiểm thử surface hiện có vẫn biên dịch và vượt qua.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- C++
- Star
- 1.3k
- Fork
- 188
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của nmwsharp/geometry-central
-
warning: control reaches end of non-void function in VectorHeatMethodSolver::computeLogMapCó thể đã có người làm @dyollb đã nhận 105 ngày trước. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
nmwsharp/geometry-central#256 ·
-
BFF::flattenFromScaleFactors gives an overlap where it should give a notch (sign bug in dirichletToNeumann)Có thể đã có người làm @joaoajmatos đã nhận 19 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
nmwsharp/geometry-central#263 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 56/100
nmwsharp/geometry-central#260 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
nmwsharp/geometry-central#255 · 1 bình luận ·
-
FlipEdgeNetwork::iterativeShorten() hangs on a contractible closed loopCó thể đã có người làm @designbynumbers đã nhận 156 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
nmwsharp/geometry-central#253 ·
Tất cả issue của nmwsharp/geometry-central
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
uxlfoundation/oneDNN#6604 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[Bug]: RoundToNearest truncates in plugins compiled with spcomp 1.13Có thể đã có người làm @fmu1337 đã nhận hôm nay. Đang mởBug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
alliedmodders/sourcemod#2627 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
lballabio/QuantLib#3134 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
new issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
llvm/llvm-project#245835 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
EchoTools/nevr-runtime#2823 ·
Maintainer thường phản hồi trong vòng 1 ngày