As with gcc 8: > -----Original Message----- > From: fio-owner@xxxxxxxxxxxxxxx [mailto:fio-owner@xxxxxxxxxxxxxxx] On Behalf Of Jens Axboe > Sent: Tuesday, June 5, 2018 9:54 AM > To: fio@xxxxxxxxxxxxxxx > Subject: gcc 8/8.1 warnings > > Hi, > > If someone is looking for a little project, compiling fio with > gcc 8/8.1 triggers a new set of overflow warnings. I've included > them below. gcc 9.1.1, included in Fedora 30, triggers some new warnings on x86: $ gcc --version gcc (GCC) 9.1.1 20190503 (Red Hat 9.1.1-1) $ make CC engines/mmap.o eta.c: In function 'calc_thread_status': eta.c:510:7: warning: taking address of packed member of 'struct jobs_eta' may result in an unaligned pointer value [-Waddress-of-packed-member] 510 | je->rate); | ~~^~~~~~ eta.c:522:66: warning: taking address of packed member of 'struct jobs_eta' may result in an unaligned pointer value [-Waddress-of-packed-member] 522 | calc_rate(unified_rw_rep, disp_time, io_bytes, disp_io_bytes, je->rate); | ~~^~~~~~ eta.c:523:64: warning: taking address of packed member of 'struct jobs_eta' may result in an unaligned pointer value [-Waddress-of-packed-member] 523 | calc_iops(unified_rw_rep, disp_time, io_iops, disp_io_iops, je->iops); | ~~^~~~~~ ... CC profiles/act.o In file included from /usr/include/string.h:494, from filesetup.c:3: In function 'strncpy', inlined from 'get_fs_free_counts' at filesetup.c:832:3: /usr/include/bits/string_fortified.h:106:10: warning: '__builtin_strncpy' output may be truncated copying 255 bytes from a string of length 255 [-Wstringop-truncation] 106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ... CC blktrace.o In file included from /usr/include/string.h:494, from /usr/include/sys/un.h:37, from server.c:10: In function 'strncpy', inlined from 'fio_server_send_ts' at server.c:1473:2: /usr/include/bits/string_fortified.h:106:10: warning: '__builtin_strncpy' output may be truncated copying 127 bytes from a string of length 127 [-Wstringop-truncation] 106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In function 'strncpy', inlined from 'fio_server_send_ts' at server.c:1474:2: /usr/include/bits/string_fortified.h:106:10: warning: '__builtin_strncpy' output may be truncated copying 127 bytes from a string of length 127 [-Wstringop-truncation] 106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In function 'strncpy', inlined from 'fio_server_send_ts' at server.c:1475:2: /usr/include/bits/string_fortified.h:106:10: warning: '__builtin_strncpy' output may be truncated copying 255 bytes from a string of length 255 [-Wstringop-truncation] 106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/string.h:494, from init.c:8: In function 'strncpy', inlined from 'make_filename' at init.c:1356:4, inlined from 'add_job' at init.c:1478:18: /usr/include/bits/string_fortified.h:106:10: warning: '__builtin_strncpy' output may be truncated copying 4095 bytes from a string of length 4095 [-Wstringop-truncation] 106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ... LINK t/fio-verify-state In function 'strncpy', inlined from '__parse_jobs_ini' at init.c:2042:6: /usr/include/bits/string_fortified.h:106:10: warning: '__builtin_strncpy' output truncated before terminating nul copying as many bytes from a string as its length [-Wstringop-truncation] 106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ init.c: In function '__parse_jobs_ini': init.c:2042:6: note: length computed here 2042 | strncpy(full_fn + (ts - file) + 1, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2043 | filename, strlen(filename)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ... LINK t/lfsr-test In file included from /usr/include/string.h:494, from y.tab.c:87: In function 'strncpy', inlined from 'setup_to_parse_string' at y.tab.c:1708:2, inlined from 'evaluate_arithmetic_expression' at y.tab.c:1720:2: /usr/include/bits/string_fortified.h:106:10: warning: '__builtin___strncpy_chk' specified bound depends on the length of the source argument [-Wstringop-overflow=] 106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ y.tab.c: In function 'evaluate_arithmetic_expression': y.tab.c:1704:8: note: length computed here 1704 | len = strlen(string); | ^~~~~~~~~~~~~~ --- Robert Elliott, HPE Persistent Memory