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 17:42

>>18

Exactly. Thank you for your kind and precise observation, even if it was directed to a troll.

And yes, the behavior can change if different compiler settings are used.

To illustrate that using GCC, just compile the program with -O3 and you'll see that the control flow analysis has decided that f() does nothing, thus removing the call to it. The result is simply an empty program.

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