#Program crashes, but works in gdb

1 messages · Page 1 of 1 (latest)

kind violet
#

This program segfaults at the highlighted line, but when running in gdb it works fine. Setting "set disable-randomization off" in gdb does reproduce the segfault in gdb.

Maybe this is some address stuff because vertices is constant and not stored on the stack and then not properly set up when the ELF is loaded?

#

Program crashes, but works in gdb

lusty kayak
#

GL_FLOAT does not indicate float size in bytes. It is a constant used by OpenGL to specify types. Use @sizeOf(f32) instead

kind violet
#

Whoops 😂

#

GitHub Copilot really sucks in Zig

swift hound
#

It does

#

But this seems more of an OpenGL issue

kind violet
#

Yes but I usually let Copilot write this sort of standard code, and it seemed about right

#

Of course this has to implicitly cast the "GL_FLOAT" GLenum to a c_int to a GLsizei which is questionable, but if Zig doesn't prohibit this by default I guess it's fine

kindred hazel
#

I guess one of them is a c_uint but C libraries often use these interchangeably so it makes sense to not be as strict here