Skip to content

Commit 05c4c12

Browse files
committed
Help gcc-11.4
1 parent 6e56802 commit 05c4c12

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

pandas/_libs/hashtable_func_helper.pxi.in

+9-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,15 @@ cdef value_count_{{dtype}}(const {{dtype}}_t[:] values, bint dropna, const uint8
114114
result_counts[i] = table.vals[k]
115115

116116
if na_counter > 0:
117-
assert n > 0 # val will be uninitialized without this
117+
# gcc-11.4 on ubuntu 22.04 cannot see that val won't be unassigned
118+
# when we make it into this branch
119+
assert n > 0
120+
{{if dtype == 'object'}}
121+
val = values[n - 1]
122+
{{else}}
123+
val = {{to_c_type}}(values[n - 1])
124+
{{endif}}
125+
118126
result_counts[table.size] = na_counter
119127
result_keys.append(val)
120128

0 commit comments

Comments
 (0)