6

Ranted earlier about how my debugger was fucking up. Jokes on me, it's now the only thing that works well.
The fucking C++ code behaves normally in debug build, but when in release build throws a SEGFAULT out of nowhere. Bet it's tellg() or my unsigned to signed conversion that fuck things up (while they work perfectly in debug, I repeat). But I can't tell, since the only way I have to trace back the issue is the disassembly ¯\_(ツ)_/¯

Comments
  • 3
    Good luck
  • 1
    @melezorus34 Thanks, though I'm wondering if I would rather need a gun
  • 0
    You did already use -Wall -Wextra, right? Also remember that signed integer overflow is undefined behaviour in C/C++, unless you relax the compiler about that one to not handle it strictly.
  • 0
    @Fast-Nop I let CLion do the compiler settings, I didn't think about tweaking it myself

    That's what I told myself, reason why I came up with a fix removing the overflow, but for some reason it doesn't seem to change much
  • 0
    @highlight
    int pos = 1000 - (int) x; // x is unsigned, and obligatorily lower or equal to 1000
    file.seekg(-pos, std::ios_base::cur);
  • 0
  • 0
    You sure it's not a race condition? That is something often random and a heisenbug if you already checked the under/overruns.
Add Comment