Skip to content

Commit 9c7bfec

Browse files
vtjnashKristofferC
authored andcommitted
atomics: fix setonce runtime intrinsic (#55530)
1 parent d28719a commit 9c7bfec

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/datatype.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2188,7 +2188,7 @@ inline int setonce_bits(jl_datatype_t *rty, char *p, jl_value_t *parent, jl_valu
21882188
}
21892189
else {
21902190
char *px = lock(p, parent, needlock, isatomic);
2191-
success = undefref_check(rty, (jl_value_t*)px) != NULL;
2191+
success = undefref_check(rty, (jl_value_t*)px) == NULL;
21922192
if (success)
21932193
memassign_safe(hasptr, px, rhs, fsz);
21942194
unlock(p, parent, needlock, isatomic);

test/atomics.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,7 @@ test_field_orderings(ARefxy{Union{Nothing,Missing}}(nothing, missing), nothing,
319319
test_field_orderings(ARefxy{Union{Nothing,Int}}(nothing, 123_1), nothing, 123_1)
320320
test_field_orderings(Complex{Int128}(10, 30), Complex{Int128}(20, 40))
321321
test_field_orderings(Complex{Real}(10, 30), Complex{Real}(20, 40))
322+
test_field_orderings(Complex{Rational{Integer}}(10, 30), Complex{Rational{Integer}}(20, 40))
322323
test_field_orderings(10.0, 20.0)
323324
test_field_orderings(NaN, Inf)
324325

0 commit comments

Comments
 (0)