• Linus Torvalds's avatar
    gcc-12: disable '-Wdangling-pointer' warning for now · f7d63b50
    Linus Torvalds authored
    [ Upstream commit 49beadbd ]
    
    While the concept of checking for dangling pointers to local variables
    at function exit is really interesting, the gcc-12 implementation is not
    compatible with reality, and results in false positives.
    
    For example, gcc sees us putting things on a local list head allocated
    on the stack, which involves exactly those kinds of pointers to the
    local stack entry:
    
      In function ‘__list_add’,
          inlined from ‘list_add_tail’ at include/linux/list.h:102:2,
          inlined from ‘rebuild_snap_realms’ at fs/ceph/snap.c:434:2:
      include/linux/list.h:74:19: warning: storing the address of local variable ‘realm_queue’ in ‘*&realm_27(D)->rebuild_item.prev’ [-Wdangling-pointer=]
         74 |         new->prev = prev;
            |         ~~~~~~~~~~^~~~~~
    
    But then gcc - understandably - doesn't really understand the big
    picture how the doubly linked list works, so doesn't see how we then end
    up...
    f7d63b50
Makefile 64.1 KB