Skip to content

fix: resolve const-correctness error in ggml-bitnet-mad.cpp#409

Open
eon-ic wants to merge 1 commit intomicrosoft:mainfrom
eon-ic:main
Open

fix: resolve const-correctness error in ggml-bitnet-mad.cpp#409
eon-ic wants to merge 1 commit intomicrosoft:mainfrom
eon-ic:main

Conversation

@eon-ic
Copy link

@eon-ic eon-ic commented Feb 4, 2026

Fixes the following build error:
ggml-bitnet-mad.cpp:811:17: error: cannot initialize a variable of type 'int8_t *' with an rvalue of type 'const int8_t *'

Changed int8_t *y_col to const int8_t *y_col to respect const correctness, as y is a const input pointer and its data should not be modified.

@EdwardLarson
Copy link

+1

I had the same issue and this fixed it. @tsong-ms PTAL 🙏

}

int8_t * y_col = y + col * by;
const int8_t * y_col = y + col * by;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The following worked for me:

Suggested change
const int8_t * y_col = y + col * by;
int8_t * y_col = (int8_t *)(y + col * by);

But yours also should work off course.

@jmleksan
Copy link

jmleksan commented Mar 3, 2026

I have the same issue!

@Bortlesboat
Copy link

Validated this locally as part of a Windows LLVM/x64 build pass.

Environment:

  • Windows 11 x64
  • AMD Ryzen 7 5800X3D
  • Visual Studio 2022 Developer PowerShell
  • LLVM 22.1.0
  • CMake 3.31.6
  • Ninja generator

What I observed:

  • This const-correctness error is still present on current main.
  • After fixing the separate Windows std::chrono include issue discussed in #440, this line became the next compile blocker:

cpp int8_t * y_col = y + col * by;

Changing it to:

cpp const int8_t * y_col = y + col * by;

resolved that compile error and allowed the build to continue.

So from another independent reproduction: this PR fixes a real current blocker, not just an older environment-specific failure.

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.

5 participants