Hi,

My coreutils CI contains a "make distcheck" step. Up to now, it was
running on Ubuntu 22.04, with gcc 11.x as compiler. This week, due
to last week's 3 changes to src/copy-file-data.c, there is an error.
I can reproduce it with a gcc 11.5.0 built from source:

gcc-11.5.0  -I. -I./lib  -Ilib -I./lib -Isrc -I./src  -Werror -Wall 
-Warith-conversion -Wbad-function-cast -Wcast-align=strict -Wdate-time 
-Wdouble-promotion -Wduplicated-branches -Wduplicated-cond -Wextra 
-Wformat-signedness -Winit-self -Winvalid-pch -Wlogical-op 
-Wmissing-declarations -Wmissing-include-dirs -Wmissing-prototypes 
-Wnested-externs -Wnull-dereference -Wold-style-definition -Wopenmp-simd 
-Woverlength-strings -Wpacked -Wpointer-arith -Wshadow -Wstrict-overflow 
-Wstrict-prototypes -Wsuggest-attribute=cold -Wsuggest-attribute=const 
-Wsuggest-attribute=format -Wsuggest-attribute=malloc 
-Wsuggest-attribute=noreturn -Wsuggest-attribute=pure -Wsuggest-final-methods 
-Wsuggest-final-types -Wsync-nand -Wtrampolines -Wuninitialized 
-Wunknown-pragmas -Wunsafe-loop-optimizations -Wunused-macros -Wvariadic-macros 
-Wvector-operation-performance -Wvla -Wwrite-strings -Warray-bounds=2 
-Wattribute-alias=2 -Wformat=2 -Wimplicit-fallthrough=5 -Wshift-overflow=2 
-Wunused-const-variable=2 -Wvla-larger-than=4031 -Wswitch-enum 
-Wno-sign-compare -Wno-format-nonliteral -g -O2 -MT src/copy-file-data.o -MD 
-MP -MF $depbase.Tpo -c -o src/copy-file-data.o src/copy-file-data.c &&\
mv -f $depbase.Tpo $depbase.Po
src/copy-file-data.c: In function 'copy_file_data':
src/copy-file-data.c:428:50: error: 'scan_inference.ext_start' may be used 
uninitialized in this function [-Werror=maybe-uninitialized]
  428 |   *hole_size += src_total_size - (last_ext_start + last_ext_len);
      |                                  ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
src/copy-file-data.c:530:25: note: 'scan_inference.ext_start' was declared here
  530 |   struct scan_inference scan_inference;
      |                         ^~~~~~~~~~~~~~
src/copy-file-data.c:345:17: error: 'scan_inference.hole_start' may be used 
uninitialized in this function [-Werror=maybe-uninitialized]
  345 |         ext_end = MIN (ext_end, max_ipos);
      |                 ^
src/copy-file-data.c:530:25: note: 'scan_inference.hole_start' was declared here
  530 |   struct scan_inference scan_inference;
      |                         ^~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [Makefile:13481: src/copy-file-data.o] Error 1

The warning is gone with gcc 12 or newer. I'm switching the CI over to
Ubuntu 24.04. But I nevertheless wanted to give you a notice.

Bruno




Reply via email to