Project

General

Profile

Bug #15489

Updated by Toomas Soome 6 months ago

Build errors with gcc 12: 
 <pre> 
     ../common/shp.c: In function 'find_physical_slot_names': 
     ../common/shp.c:1166:35: error: the comparison will always evaluate as 'true' for the address of 'slotnames' will never be NULL [-Werror=address] 
      1166 |           if (slotarg->slotnames[0] != NULL) 
           |                                     ^~ 
     ../common/shp.c:274:17: note: 'slotnames' declared here 
       274 |           char      slotnames[MAXDEVS][MAXNAMELEN]; 
           |                   ^~~~~~~~~ 
     cc1: all warnings being treated as errors 
    
     ../common/cfga.c: In function 'find_physical_slot_names': 
     ../common/cfga.c:1296:35: error: the comparison will always evaluate as 'true' for the address of 'slotnames' will never be NULL [-Werror=address] 
      1296 |           if (slotarg->slotnames[0] != NULL) 
           |                                     ^~ 
     ../common/cfga.c:261:17: note: 'slotnames' declared here 
       261 |           char      slotnames[MAXDEVS][MAXNAMELEN]; 
           |                   ^~~~~~~~~ 
     cc1: all warnings being treated as errors 
 </pre> 

 Indeed, the arrays are allocated and therefore never NULL. Which always leads us to the question if the check is needed or if the condition statement is wrong. 

 Testing done: build, wsdiff does show differences in constants, but also the added call to memset() did cause additional noise.

Back