[cfe-dev] Static Analyzer "Uninitialized argument value checks for Unions"

Aditya Kumar hiraditya at codeaurora.org
Wed Jan 8 11:56:09 PST 2014


In the CallAndMessageChecker.cpp, is it possible to implement checks for
uninitialized unions?

E.g., for the following example, I do not get any static analysis report
even if the union 'uoff' is passed uninitialized to the function 'bar'.

 

#include<stdint.h>

 

typedef union {

  uint32_t Reg;

  struct {

    uint16_t Cx;

    uint16_t sf;

  };

} tf;

 

typedef struct {

  uint16_t i;

  uint16_t j;

} st;

 

int bar(tf, tf, st);

 

int foo(tf t0, int32_t offset) {

  tf uoff;

   st s;

   s.i = 10;

  s.j = 100;

  return bar(t0, uoff, s);

}

 

 

 

-Aditya

-- 

Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 

hosted by The Linux Foundation

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140108/9d6475ce/attachment.html>


More information about the cfe-dev mailing list