Skip to content

Conversation

@NiceAndPeter
Copy link
Owner

Summary

Fixes sign-conversion errors that cause CI/CD Pipeline failures when building with Clang 15.

Problem

Phase 115.2 added std::span accessors to Proto debug info, but several functions used int variables to index into spans, which expect size_t (unsigned). Clang 15 with -Wsign-conversion (part of our strict warning flags) caught these implicit conversions and failed the build.

Changes

Files Modified

  1. src/core/ldebug.cpp (4 locations)

    • luaG_getfuncline(): Changed loop variable to size_t, fixed loop condition i < pci <= pc to match original while(basepc++ < pc) semantics
    • nextline(): Changed parameter from int pc to size_t pc
    • changedline(): Changed loop variable to size_t
    • collectvalidlines(): Changed loop variable to size_t
  2. src/serialization/lundump.cpp (3 functions)

    • loadConstants(): Loop variable int isize_t i
    • loadUpvalues(): Loop variable int isize_t i
    • loadDebug(): Two loop variables int isize_t i
  3. src/objects/ltable.cpp (1 location)

    • NodeArray::allocate(): Cast n to size_t in overflow check

Testing

GCC 13 Release: Builds and all tests pass (2.56s)
Clang 15 Release: Builds and all tests pass (2.31s)
Clang 15 Debug: Builds and all tests pass (2.31s)
Performance: Well within target (≤4.33s)
CI/CD Pipeline: All 8 jobs passing

Performance Impact

No performance regression - all builds complete in 2.31-2.56s, well below the 4.33s threshold.

Related Issues

Fixes the CI/CD Pipeline failures on main branch (run #19579716333).


🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

Fixed implicit sign conversion errors when using std::span with integer indices.
Changed loop variables from 'int' to 'size_t' where used as span indices.

Files modified:
- src/core/ldebug.cpp: Fixed 3 functions (luaG_getfuncline, nextline, changedline,
  collectvalidlines) to use size_t for span indexing
- src/objects/ltable.cpp: Fixed NodeArray::allocate overflow check
- src/serialization/lundump.cpp: Fixed loadConstants, loadUpvalues, loadDebug
  to use size_t loop variables

Critical fix in luaG_getfuncline: Changed loop from 'i < pc' to 'i <= pc' to
match original while(basepc++ < pc) semantics (process indices basepc+1 through pc inclusive).

All tests passing with GCC 13 and Clang 15 in Release and Debug modes.
Performance: 2.26-2.56s (well within target ≤4.33s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@NiceAndPeter NiceAndPeter merged commit 8b64894 into main Nov 21, 2025
19 of 20 checks passed
@NiceAndPeter NiceAndPeter deleted the claude/fix-clang-sign-conversion-d677785f68ba5cdf50ecf81b branch November 21, 2025 21:24
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