Tip on xcheck=init_local for those who may not know ...

 

So, speaking of the new flag in Sun Studio 12,  -W0,-xcheck=init_local. As I was trying it out recently, giving it a spin, I noticed that I wasn't getting any floating point traps, even though I was using the init_local flag as described and knew I was using a floating point variable in a computation before it was assigned a legitimate value. I was perplexed, but only for a moment :-)

You see, as I had barreled ahead in trying things out, I'd completely forgotten that traps are turned off by default in Sun Studio C. In appendix B, section 2.28, you can see that the default for -ftrap is -ftrap=%none. Accordingly, the traps I was expecting just weren't going to happen. A simple addition of -ftrap=common on the command line, however, and I saw the expected traps. Nice!

A useful little thing to remember if using this flag to help debug your program ... 

Comments:

Like to do it

Posted by free pictures on June 22, 2007 at 10:51 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

dpagan

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today