ssrg-vt / popcorn-kernel

Popcorn Linux kernel for distributed thread execution
Other
156 stars 22 forks source link

[Merge] GCC-9 Compiler warnings #92

Open cesarjp opened 4 years ago

cesarjp commented 4 years ago

I'm seeing the following warnings when building the merge branch for x86-64 with GCC 9 after I updated to Fedora 31.

kernel/popcorn/page_server.c: In function 'free_remote_context_pages': kernel/popcorn/page_server.c:127:9: warning: ISO C90 forbids array 'pages' whose size can't be evaluated [-Wvla] 127 | struct page *pages[FREE_BATCH]; | ^~~~ kernel/popcorn/page_server.c: In function '__claim_remote_page.isra.0': kernel/popcorn/page_server.c:1128:3: warning: 'from_nid' may be used uninitialized in this function [-Wmaybe-uninitialized] 1128 | clear_bit(from_nid, pi); | ^~~~~~~

In file included from ./include/linux/export.h:45, from ./include/linux/linkage.h:7, from ./include/linux/kernel.h:8, from kernel/popcorn/remote_info.c:11: kernel/popcorn/remote_info.c: In function 'fill_meminfo_response': ./include/linux/compiler.h:183:26: warning: array subscript 16 is outside array bounds of 'atomic_long_t[12]' {aka 'struct [12]'} [-Warray-bounds] 183 | case 8: (__u64 )res = (volatile __u64 )p; break; \ | ^~~~~~~~ ./include/linux/compiler.h:194:2: note: in expansion of macro 'READ_ONCE_SIZE' 194 | READ_ONCE_SIZE; | ^~~~ In file included from ./include/linux/mm.h:1316, from kernel/popcorn/remote_info.c:12: ./include/linux/vmstat.h:131:22: note: while referencing 'vm_zone_stat' 131 | extern atomic_long_t vm_zone_stat[NR_VM_ZONE_STAT_ITEMS]; | ^~~~ In file included from ./include/linux/export.h:45, from ./include/linux/linkage.h:7, from ./include/linux/kernel.h:8, from kernel/popcorn/remote_info.c:11: ./include/linux/compiler.h:183:26: warning: array subscript 17 is outside array bounds of 'atomic_long_t[12]' {aka 'struct [12]'} [-Warray-bounds] 183 | case 8: (__u64 )res = (volatile __u64 )p; break; \ | ^~~~~~~~ ./include/linux/compiler.h:194:2: note: in expansion of macro 'READ_ONCE_SIZE' 194 | READ_ONCE_SIZE; | ^~~~ In file included from ./include/linux/mm.h:1316, from kernel/popcorn/remote_info.c:12: ./include/linux/vmstat.h:131:22: note: while referencing 'vm_zone_stat' 131 | extern atomic_long_t vm_zone_stat[NR_VM_ZONE_STAT_ITEMS]; | ^~~~ In file included from ./include/linux/export.h:45, from ./include/linux/linkage.h:7, from ./include/linux/kernel.h:8, from kernel/popcorn/remote_info.c:11: ./include/linux/compiler.h:183:26: warning: array subscript 18 is outside array bounds of 'atomic_long_t[12]' {aka 'struct [12]'} [-Warray-bounds] 183 | case 8: (__u64 )res = (volatile __u64 )p; break; \ | ^~~~~~~~ ./include/linux/compiler.h:194:2: note: in expansion of macro 'READ_ONCE_SIZE' 194 | READ_ONCE_SIZE; | ^~~~ In file included from ./include/linux/mm.h:1316, from kernel/popcorn/remote_info.c:12: ./include/linux/vmstat.h:131:22: note: while referencing 'vm_zone_stat' 131 | extern atomic_long_t vm_zone_stat[NR_VM_ZONE_STAT_ITEMS]; | ^~~~ In file included from ./include/linux/export.h:45, from ./include/linux/linkage.h:7, from ./include/linux/kernel.h:8, from kernel/popcorn/remote_info.c:11: ./include/linux/compiler.h:183:26: warning: array subscript 14 is outside array bounds of 'atomic_long_t[12]' {aka 'struct [12]'} [-Warray-bounds] 183 | case 8: (__u64 )res = (volatile __u64 )p; break; \ | ^~~~~~~~ ./include/linux/compiler.h:194:2: note: in expansion of macro 'READ_ONCE_SIZE' 194 | READ_ONCE_SIZE; | ^~~~ In file included from ./include/linux/mm.h:1316, from kernel/popcorn/remote_info.c:12: ./include/linux/vmstat.h:131:22: note: while referencing 'vm_zone_stat' 131 | extern atomic_long_t vm_zone_stat[NR_VM_ZONE_STAT_ITEMS]; | ^~~~ In file included from ./include/linux/export.h:45, from ./include/linux/linkage.h:7, from ./include/linux/kernel.h:8, from kernel/popcorn/remote_info.c:11: ./include/linux/compiler.h:183:26: warning: array subscript 15 is outside array bounds of 'atomic_long_t[12]' {aka 'struct [12]'} [-Warray-bounds] 183 | case 8: (__u64 )res = (volatile __u64 )p; break; \ | ^~~~~~~~ ./include/linux/compiler.h:194:2: note: in expansion of macro 'READ_ONCE_SIZE' 194 | READ_ONCE_SIZE; | ^~~~ In file included from ./include/linux/mm.h:1316, from kernel/popcorn/remote_info.c:12: ./include/linux/vmstat.h:131:22: note: while referencing 'vm_zone_stat' 131 | extern atomic_long_t vm_zone_stat[NR_VM_ZONE_STAT_ITEMS]; | ^~~~ In file included from ./include/linux/export.h:45, from ./include/linux/linkage.h:7, from ./include/linux/kernel.h:8, from kernel/popcorn/remote_info.c:11: ./include/linux/compiler.h:183:26: warning: array subscript 24 is outside array bounds of 'atomic_long_t[12]' {aka 'struct [12]'} [-Warray-bounds] 183 | case 8: (__u64 )res = (volatile __u64 )p; break; \ | ^~~~~~~~ ./include/linux/compiler.h:194:2: note: in expansion of macro 'READ_ONCE_SIZE' 194 | READ_ONCE_SIZE; | ^~~~ In file included from ./include/linux/mm.h:1316, from kernel/popcorn/remote_info.c:12: ./include/linux/vmstat.h:131:22: note: while referencing 'vm_zone_stat' 131 | extern atomic_long_t vm_zone_stat[NR_VM_ZONE_STAT_ITEMS]; | ^~~~ In file included from ./include/linux/export.h:45, from ./include/linux/linkage.h:7, from ./include/linux/kernel.h:8, from kernel/popcorn/remote_info.c:11: ./include/linux/compiler.h:183:26: warning: array subscript 19 is outside array bounds of 'atomic_long_t[12]' {aka 'struct [12]'} [-Warray-bounds] 183 | case 8: (__u64 )res = (volatile __u64 )p; break; \ | ^~~~~~~~ ./include/linux/compiler.h:194:2: note: in expansion of macro 'READ_ONCE_SIZE' 194 | READ_ONCE_SIZE; | ^~~~ In file included from ./include/linux/mm.h:1316, from kernel/popcorn/remote_info.c:12: ./include/linux/vmstat.h:131:22: note: while referencing 'vm_zone_stat' 131 | extern atomic_long_t vm_zone_stat[NR_VM_ZONE_STAT_ITEMS]; | ^~~~

AHatnarf commented 4 years ago

Nice find, maybe we see about adding in different compiler checks to circleci? I don't know how it's currently set up or managed though.

cesarjp commented 4 years ago

I'm not familiar with circleci, but it appears to be using docker. Maybe all you need to do is update the docker image to use a newer version of GCC. To build this kernel, I just used the config-x86_64-qemu config and run make without any special compiler flags.