I guess you are trying to pass a pointer to the variable and, while editing your question, you removed the pointer declaration in order to simplify, but that also changed your question. If you are passing a value to the function, there isn't any problem.
Now, if you are passing a pointer, the volatile modifier tells that the compiler should expect the value of the variable to change by means other than the compiled code. You really shouldn't pass a volatile variable as a non-volatile parameter to a function. The function itself must be changed to have the volatile parameter, and recompiled. Then function (with volatile parameter) is prepared to deal with a volatile variable.