Skip to content

Conversation

@NiceAndPeter
Copy link
Owner

Changes:

  • CMakeLists.txt: Add LUA_ENABLE_LTO option with safety flags

    • Uses -fno-strict-aliasing to handle type punning
    • Uses -ffat-lto-objects to reduce LTO aggressiveness
    • Default: OFF (LTO currently doesn't work)
  • GC code fixes for LTO:

    • gc_core.cpp: Handle VUPVAL, strings in getgclist()
    • gc_weak.cpp: Remove duplicate getgclist(), use GCCore version
  • Documentation:

    • docs/LTO_STATUS.md: Comprehensive LTO status report
    • Details issues found, root cause analysis, path forward

Status: LTO exposes undefined behavior in the codebase

  • Corrupted type values (0xab)
  • Memory corruption in GC
  • Tests fail immediately with LTO enabled
  • Tests pass normally without LTO

Recommendation: Do not enable LTO until UB is fixed

Changes:
- CMakeLists.txt: Add LUA_ENABLE_LTO option with safety flags
  - Uses -fno-strict-aliasing to handle type punning
  - Uses -ffat-lto-objects to reduce LTO aggressiveness
  - Default: OFF (LTO currently doesn't work)

- GC code fixes for LTO:
  - gc_core.cpp: Handle VUPVAL, strings in getgclist()
  - gc_weak.cpp: Remove duplicate getgclist(), use GCCore version

- Documentation:
  - docs/LTO_STATUS.md: Comprehensive LTO status report
  - Details issues found, root cause analysis, path forward

Status: LTO exposes undefined behavior in the codebase
- Corrupted type values (0xab)
- Memory corruption in GC
- Tests fail immediately with LTO enabled
- Tests pass normally without LTO

Recommendation: Do not enable LTO until UB is fixed
@NiceAndPeter NiceAndPeter merged commit 0343b99 into main Nov 21, 2025
11 of 19 checks passed
@NiceAndPeter NiceAndPeter deleted the claude/enable-lto-01PgXp84kTTXxbiY32w1gXPN 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.

3 participants