1 int *ptr;
   2 int x, y, z;
   3 void frob(void) {
   4         if ((y && !ptr) || z)
   5                 return;
   6         if (ptr) {
   7                 /* in the current version of smatch this erases
   8                    the old implications.  Later version should 
   9                    fix this.  --Dec 2 2009 */
  10                 x = *ptr;
  11         }
  12         if (!y && ptr)
  13                 *ptr = 0; // smatch used to print an error here.
  14         if (!y)
  15                 *ptr = 1;
  16 }
  17 /*
  18  * check-name: Dereferencing Undefined
  19  * check-command: smatch sm_null_deref2.c
  20  *
  21  * check-output-start
  22 sm_null_deref2.c:15 frob() error: we previously assumed 'ptr' could be null (see line 12)
  23  * check-output-end
  24  */