1 /* Reproducer for false positive from -Wanalyzer-deref-before-check
2 seen on Linux kernel's block/bdev.c due to -fanalyzer mishandling
5 /* { dg-additional-options "-O2 -g -fno-delete-null-pointer-checks" } */
7 typedef unsigned char u8
;
13 struct inode
*bd_inode
;
15 int sync_blockdev(struct block_device
*bdev
);
16 int set_blocksize(struct block_device
*bdev
, u8 size
) {
17 if (bdev
->bd_inode
->i_blkbits
!= size
) { /* { dg-bogus "pointer 'bdev' is dereferenced here" } */
22 extern int filemap_write_and_wait(void *);
23 int sync_blockdev(struct block_device
*bdev
) {
24 if (!bdev
) /* { dg-bogus "check of 'bdev' for NULL after already dereferencing it" } */
26 return filemap_write_and_wait(bdev
->bd_inode
->i_mapping
);