Forum Discussion
Altera_Forum
Honored Contributor
14 years agoThe problem is with your code, not the compiler.
You define mask in two different scopes. All the bit manipulation you do in the first branch of the if-statement is on your second definition of mask. Unfortunately you don't return that one, but the one defined in the outer scope. So basically you're saying to the compiler, return an uninitialised number or 31. In this case the result is undefined, so the compiler is probably free to do what it likes. It likes 31. To fix your code, remove type definition from the first assignment to mask.