You can't reliably deduced anything about what your current problem is, if the things it depends on are flaky.
Design by Contract. Understand it. Used it. Turn your asserts on always.
Turn on all warnings that don't give false positives that your compiler / tools provide.
Fix them don't mute them.
Run around your code base and find every damn place where some damn fool has discarded an error code and check and report all failures.
You'd be flabberghasted by how many "it's impossible" bugs I have found and fixed by that one simple action alone!