Skip to content

Commit 92ecdb3

Browse files
committed
Properly reset 'DoNotUse' tag property on overwrite.
1 parent 1aa49c8 commit 92ecdb3

3 files changed

Lines changed: 11 additions & 3 deletions

File tree

documentation/Changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ Changelog {#Changelog}
55
- Features:
66
* Specialization for Eigen math traits.
77

8+
- Bugfix:
9+
* Tag property 'DoNotUse' is now properly reset on overwrite.
10+
811
### v3.1.0 - 2026-02-02
912
- Features:
1013
* It is now possible to define custom tape evaluators for all CoDiPack tapes. The evaluators have access to the full

include/codi/tapes/tagging/tagTapeBase.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ namespace codi {
207207
} else {
208208
resetTag(lhs.values[i.value].getTapeData().tag);
209209
}
210+
lhs.values[i.value].getTapeData().properties.reset(TagFlags::DoNotUse);
210211
lhs.values[i.value].value() = AggregatedTraits::template arrayAccess<i.value>(real);
211212
});
212213
}
@@ -236,6 +237,7 @@ namespace codi {
236237
} else {
237238
resetTag(lhs.cast().getTapeData().tag);
238239
}
240+
lhs.cast().getTapeData().properties.reset(TagFlags::DoNotUse);
239241

240242
lhs.cast().value() = rhs.cast().getValue();
241243
}

tests/functional/src/testTagging.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,12 @@ int main(int nargs, char** args) {
9595
w = w * z;
9696

9797
out << "Do not use error:" << std::endl;
98-
tape.setTagPropertyOnVariable(x, codi::TagFlags::DoNotUse);
99-
w = func(x, y);
100-
tape.clearTagPropertiesOnVariable(x);
98+
Real t = x;
99+
tape.setTagPropertyOnVariable(t, codi::TagFlags::DoNotUse);
100+
w = func(t, y); // Error is thrown.
101+
t = func(x, y); // t is overwritten
102+
w = func(t, y); // Error is not thrown.
103+
w = func(x, y); // Reset w.
101104

102105
out << "Do not change with same value:" << std::endl;
103106
tape.setTagPropertyOnVariable(w, codi::TagFlags::DoNotChange);

0 commit comments

Comments
 (0)