Skip to content

Commit

Permalink
Help gcc-11.4
Browse files Browse the repository at this point in the history
  • Loading branch information
WillAyd committed Jan 8, 2025
1 parent dd4f4ac commit 618e4cd
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pandas/_libs/hashtable_func_helper.pxi.in
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,15 @@ cdef value_count_{{dtype}}(const {{dtype}}_t[:] values, bint dropna, const uint8
result_counts[i] = table.vals[k]

if na_counter > 0:
assert n > 0 # val will be uninitialized without this
# gcc-11.4 on ubuntu 22.04 cannot see that val won't be unassigned
# when we make it into this branch
assert n > 0
{{if dtype == 'object'}}
val = values[n - 1]
{{else}}
val = {{to_c_type}}(values[n - 1])
{{endif}}

result_counts[table.size] = na_counter
result_keys.append(val)

Expand Down

0 comments on commit 618e4cd

Please sign in to comment.