Skip to content

fix: add const qualifier to y_col pointer (Clang 20 compatibility)#484

Closed
Jah-yee wants to merge 1 commit intomicrosoft:mainfrom
Jah-yee:fix/const-y-col-pointer
Closed

fix: add const qualifier to y_col pointer (Clang 20 compatibility)#484
Jah-yee wants to merge 1 commit intomicrosoft:mainfrom
Jah-yee:fix/const-y-col-pointer

Conversation

@Jah-yee
Copy link

@Jah-yee Jah-yee commented Mar 18, 2026

Summary

Line 811 in src/ggml-bitnet-mad.cpp initializes y_col as int8_t* but it is only read from (used as const in the py pointer below).

Problem

Clang 20 is stricter about const-correctness and throws error:

cannot initialize a variable of type int8_t* with an rvalue of type const int8_t*

Fix

Changed line 811 from:

int8_t * y_col = y + col * by;

to:

const int8_t * y_col = y + col * by;

This fix aligns with line 906 which already uses const int8_t*.

Testing

This fix resolves the Clang 20 build error on Ubuntu 24.04.

Line 811 initializes y_col as int8_t* but it's only read from
(used as const in py pointer below). Clang 20 is stricter about
const-correctness and throws error:
'cannot initialize a variable of type int8_t* with an rvalue
of type const int8_t*'

This fix aligns with line 906 which already uses const int8_t*.
@Rubenisme
Copy link

We have a lot of the same PRs, you even did one yourself. Why?

#384
#392
#409
#426
#436
#451 -- YOURS!
#465
#471
#482
#483

@Jah-yee
Copy link
Author

Jah-yee commented Mar 18, 2026

didn't notice about that, sry about this

@Jah-yee Jah-yee closed this Mar 18, 2026
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