Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Program won't crash when it should

Name: Anonymous 2012-01-16 3:24

(GCC C)
I ran a pointer over each member of an integer array, storing one character of input in each cell.

The program seems to consistently crash when I try to store X+3 or more characters, where X is the size of the array, but if I do not exceed X+2 it will not crash.

Why does it crashes exactly at the point it does, but not for X+1 or X+2?

Name: Anonymous 2012-01-16 19:32

To conclude: you can determine how a compiler handles some particular piece of undefined behavior by doing some of the following: examining compiler's source code or debugging the compiler, examining generated output or intermediate files. It may not be possible to generalize this for all implementations or all programs or languages - being able to generalize for all would be impossible as it entails solving the halting problem, nevertheless, this is something which is tractable in practice for most cases people would care about - just like the endeavour of programming is tractable in practice, but a hard AI problem in general.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List