fix: undefined behavior when transforming non-existing edges in a subgraph#525
Open
Becheler wants to merge 5 commits into
Open
fix: undefined behavior when transforming non-existing edges in a subgraph#525Becheler wants to merge 5 commits into
Becheler wants to merge 5 commits into
Conversation
|
Boost dependency footprint vs Header-inclusion weights (graph files pulling each direct dependency in): No header-inclusion-weight changes. Transitive Boost modules: 70 → 70 (0) |
|
An automated preview of the documentation is available at https://525.graph.prtest3.cppalliance.org/index.html If more commits are pushed to the pull request, the docs will rebuild at the same URL. 2026-07-14 14:50:22 UTC |
|
Compiler-warning counts vs
|
Collaborator
Author
|
On Clang-19, C++14, UB is left to user: |
…the vertex overload
Collaborator
Author
|
On Clang-19, C++14, UB fails loudly and helpfully: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes bug #124
Before submitting
developbranch.Type of change
Does this PR introduce a breaking change?
What this PR does
find_vertexandfind_edge) and lock in invariants without touching header.subgraph.hpp(global_to_localdelegates tofind_edge+ assert) turning CI error into a loud meaningfull assertion failure that mirrorsfind_vertexfind_edge first, CI greenMotivation
In #124 it was shown that
subgraph::global_to_local(edge_descriptor)is only defined when the input edge is actually in the subgraph. For edges not in the subgraph, the behavior is undefined (it dereferencesend()). But its signature, name, and documentation all present it as being well-defined irrespective of the input.Testing
Added a new subgraph test file. There are currently 5
subgraph_XXX.cppfiles that should be tightened in a single test file, but it's outside the scope of this first PR.Note: Although not a breaking change, someone will notice the change if in a debug build their code that previously invoked the UB and happened to get away with it (garbage returned but never actually used): this will now abort at the assertion instead of running away silently.
Checklist
b2in thetest/directory).