https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108968

--- Comment #17 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
...where trunk emits:

test.c:35:22: warning: dereference of NULL 'ptr' [CWE-476]
[-Wanalyzer-null-dereference]
   35 |         ptr[0] = ~ptr[0];
      |                   ~~~^~~
  'foo': events 1-6
    |
    |   27 |     char *ptr = ((void*)0);
    |      |           ^~~
    |      |           |
    |      |           (1) 'ptr' is NULL
    |   28 | 
    |   29 |     if ( ((get_cpu_info()->current_vcpu))->domain )
    |      |        ~   
    |      |        |
    |      |        (2) following 'false' branch...
    |......
    |   32 |     asm volatile ("cmc");
    |      |     ~~~    
    |      |     |
    |      |     (3) ...to here
    |   33 | 
    |   34 |     if ( ((get_cpu_info()->current_vcpu))->domain )
    |      |        ~   
    |      |        |
    |      |        (4) following 'true' branch...
    |   35 |         ptr[0] = ~ptr[0];
    |      |                   ~~~~~~
    |      |                      |
    |      |                      (5) ...to here
    |      |                      (6) dereference of NULL 'ptr'
    |

Reply via email to