sem_open really strange behavior

Ian Lance Taylor iant@google.com
Tue Jun 22 14:57:00 GMT 2010


Sergio Sobarzo <ssobarzo@gmail.com> writes:

> I read that paragraph thousand of times. However it is not an answer
> why it works if a line is commented or not. I cannot figure an
> acceptable explanation, that's why I thought it will be a gcc
> question.

Commenting or uncommenting the variable declaration is just changing
the random values that are on the stack when sem_open is called.  In
this case I expect it happens to be changing the values between valid
and invalid ones.

Failing to pass required arguments to a variadic function gives you
random behaviour, and that is just what you are seeing.

Ian



More information about the Gcc-help mailing list