Re: Detecting Reads of Global Uninitialized Variables




jyu.james@xxxxxxxxx wrote:
> I'm trying to detect reads of uninitialized global variables (that are
> declared in one file, and used in another as an extern).
>
> I know that ANSI C initializes all global variables to 0, however, I do
> not want to rely on this for initialization. Instead, I want to
> explicity initialize all variables myself. I've looked at tools like
> Compuware BoundsChecker, which does an amazing job in detecting
> uninitialized variables, but doesn't detect reads of GLOBAL
> uninitialized variables.
>
> Is there a tool out there that can do this? Or is there a particular
> technique that can be used to automate this?

The best solution will be to find all such uninitialized global
variables
using some tool (like cscope) and initialize them appropriately
depending on their types.

.



Relevant Pages

  • [PATCHv3 2/7] [POWERPC] Rename m8xx_pic_init to mpc8xx_pics_init
    ... -/* Initialize the internal interrupt controller. ... +/* Initialize the internal interrupt controllers. ... extern unsigned int mpc8xx_get_irq; ...
    (Linux-Kernel)
  • Re: exported symbols
    ... your header file should contain ... put the 'extern' in the C file. ... to initialize your variable, it is okay to put 'extern type_id ... it to zero ...
    (comp.unix.programmer)
  • Re: exported symbols
    ... extern to my C file for the variables, but now I get an error: ... your header file should contain ... to initialize your variable, it is okay to put 'extern type_id ... it to zero ...
    (comp.unix.programmer)
  • network / PCMCIA
    ... the network parts tried to initialize but ... so manually after boot time. ... What would the be the "proper" method to get the PCMCIA NIC and the network ... initialization to work so as to automate the connection on startup? ...
    (Fedora)
  • Re: Using MIME::Lite to send email and hash
    ... I am trying to use MIME::Lite to automate some testing cases. ... This module requires the following to initialize the email. ... I put all these information in an xml file as the following, ... file in a hash. ...
    (comp.lang.perl.misc)