Skip to content

Include the BottomUpChildIter<PolyNf> specialization in Polynomial.hpp - #1014

Merged
MichaelRawson merged 1 commit into
masterfrom
martin-polynf-odr
Oct 10, 2026
Merged

MichaelRawson merged 1 commit into
masterfrom
martin-polynf-odr

Conversation

@quickbeam123

@quickbeam123 quickbeam123 commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

PolyNf::SubtermIter holds a Stack<BottomUpChildIter<PolyNf>>, but Polynomial.hpp only included the primary template (BottomUpEvaluation.hpp). A TU that destroys a SubtermIter without including PolynomialBottomUpEvaluation.hpp itself (e.g. ALASCA/VariableElimination.cpp) instantiated ~Stack with the empty primary template: an ODR violation that frees the stack buffer with a wrong (too small) size.

Reproducer: GCC LTO build warns
Kernel/PolynomialBottomUpEvaluation.hpp:26:8: warning: type 'struct
BottomUpChildIter' violates the C++ One Definition Rule [-Wodr]
and c++ -std=c++17 -I. -E Inferences/ALASCA/VariableElimination.cpp | grep -c PolynomialBottomUpChildIter printed 0 before this commit.

PolyNf::SubtermIter holds a Stack<BottomUpChildIter<PolyNf>>, but
Polynomial.hpp only included the primary template (BottomUpEvaluation.hpp).
A TU that destroys a SubtermIter without including
PolynomialBottomUpEvaluation.hpp itself (e.g. ALASCA/VariableElimination.cpp)
instantiated ~Stack with the empty primary template: an ODR violation that
frees the stack buffer with a wrong (too small) size.

Reproducer: GCC LTO build warns
  Kernel/PolynomialBottomUpEvaluation.hpp:26:8: warning: type 'struct
  BottomUpChildIter' violates the C++ One Definition Rule [-Wodr]
and `c++ -std=c++17 -I. -E Inferences/ALASCA/VariableElimination.cpp |
grep -c PolynomialBottomUpChildIter` printed 0 before this commit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@quickbeam123
quickbeam123 added this pull request to stack #1016 October 9, 2026 17:40
@MichaelRawson
MichaelRawson merged commit 7c404db into master Oct 10, 2026
1 check passed
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.

2 participants