Sun Studio 12: C User's Guide

2.10 The Value of errno

If you specify -fast, you should not rely on the value of errno because the value can change as a result of code optimization. The easiest way to avoid this problem is to not specify -fast.

If, however, you specify -fast and you are relying on the value of errno, do the following: