Skip to content

Potential C FFI regression #19342

@johnnovak

Description

@johnnovak

Summary

Found a potential C FFI regression with 1.6.2. A library of mine that has been in use for years has started crashing on 1.6.2. Tried turning off the GC with gc:none but the crash still happens, hence I think it's an FFI regression.

I can't really isolate it easily, but it's very easy to compile and run an example app included in the project that will result in a crash. No dependencies are required whatsoever.

Tested on

Win 10 (x64) and Mac OS X Big Sur 10.6.2 with Nim 1.6.2 and Nim 1.6.0

How to reproduce

  1. Check out this repo: https://github.com/johnnovak/nim-nanovg
  2. Compile & run the example with 1.6.2:
nimble examplesGL3Debug
cd examples
example_gl3.exe
  1. The program will immediately crash with the following error:
Traceback (most recent call last)
D:\Work\Code\nim-nanovg\examples\example_gl3.nim(161) example_gl3
D:\Work\Code\nim-nanovg\examples\example_gl3.nim(116) main
D:\Work\Code\nim-nanovg\examples\demo.nim(1017) renderDemo
D:\Work\Code\nim-nanovg\examples\demo.nim(305) drawEyes
SIGSEGV: Illegal storage access. (Attempt to read from nil?)
  1. Repeat with 1.6.2 with gc:none or any other GC setting -- the exact same crash will happen
  2. Repeat with 1.6.0 with any GC setting -- the program will run correctly (it will open a window with some OpenGL demo graphics)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions