Re: fs/ntfscomp.c:82:11: error: ‘flg’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
On Fri, Mar 27, 2020 at 08:38:04AM -0700, PGNet Dev wrote: > On 3/27/20 7:45 AM, Daniel Kiper wrote: > >> _is_ a 'clear' env expected/recommended/required for a grub2 build? > > > > You control your own build environment. So, if you add options which are > > not supported by the GRUB then there is pretty good chance that the > > build or generated output will fall apart at some point. However, if you > > think a given compiler option should be supported by the GRUB or even > > used by default please provide a patch with good explanation why we > > should take it. > > sure. > > builds using opensuse buildservice online are currently failing using > 'default' build env. > > atm, that appears to be just to due to the patches, discussed here, not yet > landing in release used. Patches are in right now. Please test... Daniel ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel
Re: fs/ntfscomp.c:82:11: error: ‘flg’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
On Fri, Mar 27, 2020 at 08:38:04AM -0700, PGNet Dev wrote: > On 3/27/20 7:45 AM, Daniel Kiper wrote: > >> _is_ a 'clear' env expected/recommended/required for a grub2 build? > > > > You control your own build environment. So, if you add options which are > > not supported by the GRUB then there is pretty good chance that the > > build or generated output will fall apart at some point. However, if you > > think a given compiler option should be supported by the GRUB or even > > used by default please provide a patch with good explanation why we > > should take it. > > sure. > > builds using opensuse buildservice online are currently failing using > 'default' build env. I'm using openSUSE build serive too and (with the package maintainer's hats on) I am sure we didn't use those build options/flags you were testing here `as default`. Neither I could tell where your build options came from. > atm, that appears to be just to due to the patches, discussed here, not yet > landing in release used. No. I don't think so. Simply you should go check your build options, not the patch here. Regards, Michael > i can't yet say what, if anything, of the default _flags_ in use cause a > problem -- need to check again if optimization, as causing a problem here, is > among them. > > >> if so, does this need to be handled at config time? > > > > I am not sure what do you mean by that. > > just a simple check at 'configure' ... e.g. if optimization is set, raise an > error. > > thx > ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel
Re: fs/ntfscomp.c:82:11: error: ‘flg’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
On 3/27/20 7:45 AM, Daniel Kiper wrote: >> _is_ a 'clear' env expected/recommended/required for a grub2 build? > > You control your own build environment. So, if you add options which are > not supported by the GRUB then there is pretty good chance that the > build or generated output will fall apart at some point. However, if you > think a given compiler option should be supported by the GRUB or even > used by default please provide a patch with good explanation why we > should take it. sure. builds using opensuse buildservice online are currently failing using 'default' build env. atm, that appears to be just to due to the patches, discussed here, not yet landing in release used. i can't yet say what, if anything, of the default _flags_ in use cause a problem -- need to check again if optimization, as causing a problem here, is among them. >> if so, does this need to be handled at config time? > > I am not sure what do you mean by that. just a simple check at 'configure' ... e.g. if optimization is set, raise an error. thx ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel
Re: fs/ntfscomp.c:82:11: error: ‘flg’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
On Thu, Mar 26, 2020 at 04:10:05AM -0700, PGNet Dev wrote: > On 3/26/20 1:39 AM, Paul Menzel wrote: > > > I am unable to reproduce this with > > 1st sanity re-check: > > > > I _am_ able to reproduce this consistently, with same error. > > > > I've tested now on multiple machines; not identical, but all similarly > opensuse + GCC10 dev envs ... > > > > > > Here is the code in question: > > snip > > > Why is it complaining complaining in line 82 and not 78, where `flg` is > > already accessed? > > On 3/26/20 3:39 AM, Michael Chang wrote: > > Looking into build log, the build option seems to have been overridden > > with CFLAGS settings like this. > > > > CFLAGS="-O3 -Wall -fstack-protector-strong -funwind-tables > > -fasynchronous-unwind-tables -fmessage-length=0 -grecord-gcc-switches > > -march=native -mtune=native" > > > > I'm not sure if -O3 is considered as supported since that will result > > in larger binaries we are striving to reduce all the time. Also the > > optimization it brings would require careful review if we don't enable > > it by default. > > > > In addition, -fstack-protector-strong breaks the build even harder with > > a lot of __stack_chk_fail undefined symbol in the modules. > > > > If going with default build option, I also don't have this compliation > > error. > > > indeed. > > building with > > unset CC CPP > + unset LD CFLAGS CPPFLAGS CXXFLAGS > > ./bootstrap > ./autogen.sh > > ./configure \ > --prefix=/usr/local/grub-build-test > > make V=1 > > completes without error, and installs, > > > /usr/local/grub-build-test/bin/grub-mkrescue --version > /usr/local/grub-build-test/bin/grub-mkrescue (GRUB) 2.05 > > > which I can certainly manage easily enough for local build. > > > If going with default build option > > _is_ a 'clear' env expected/recommended/required for a grub2 build? You control your own build environment. So, if you add options which are not supported by the GRUB then there is pretty good chance that the build or generated output will fall apart at some point. However, if you think a given compiler option should be supported by the GRUB or even used by default please provide a patch with good explanation why we should take it. > if so, does this need to be handled at config time? I am not sure what do you mean by that. Daniel ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel
Re: fs/ntfscomp.c:82:11: error: ‘flg’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
On 3/26/20 1:39 AM, Paul Menzel wrote: > I am unable to reproduce this with 1st sanity re-check: I _am_ able to reproduce this consistently, with same error. I've tested now on multiple machines; not identical, but all similarly opensuse + GCC10 dev envs ... > Here is the code in question: snip > Why is it complaining complaining in line 82 and not 78, where `flg` is > already accessed? On 3/26/20 3:39 AM, Michael Chang wrote: > Looking into build log, the build option seems to have been overridden > with CFLAGS settings like this. > > CFLAGS="-O3 -Wall -fstack-protector-strong -funwind-tables > -fasynchronous-unwind-tables -fmessage-length=0 -grecord-gcc-switches > -march=native -mtune=native" > > I'm not sure if -O3 is considered as supported since that will result > in larger binaries we are striving to reduce all the time. Also the > optimization it brings would require careful review if we don't enable > it by default. > > In addition, -fstack-protector-strong breaks the build even harder with > a lot of __stack_chk_fail undefined symbol in the modules. > > If going with default build option, I also don't have this compliation > error. indeed. building with unset CC CPP + unset LD CFLAGS CPPFLAGS CXXFLAGS ./bootstrap ./autogen.sh ./configure \ --prefix=/usr/local/grub-build-test make V=1 completes without error, and installs, /usr/local/grub-build-test/bin/grub-mkrescue --version /usr/local/grub-build-test/bin/grub-mkrescue (GRUB) 2.05 which I can certainly manage easily enough for local build. > If going with default build option _is_ a 'clear' env expected/recommended/required for a grub2 build? if so, does this need to be handled at config time? in either case, this > Why is it complaining complaining in line 82 and not 78, where `flg` is > already accessed? doesn't make sense to me; code looks straightforward enough. the -03 optimization sounds a good 1st guess. also, Michael, fyi, I _think_ this^ started for me with linked GCC10 builds of grub2 on opensuse OBS ... where, iirc, the builds 1st failed, and I started testing locally. ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel
Re: fs/ntfscomp.c:82:11: error: ‘flg’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
On Thu, Mar 26, 2020 at 09:39:16AM +0100, Paul Menzel wrote: > Dear PGNet Dev, > > > Thank you for your report. > > > Am 26.03.20 um 04:50 schrieb PGNet Dev: > > building > > > > cd grub > > git log | head -n5 > > commit 552c9fd08122a3036c724ce96dfe68aa2f75705f > > Author: Patrick Steinhardt > > Date: Sat Mar 7 17:29:09 2020 +0100 > > > > gnulib: Fix build of base64 when compiling with memory > > debugging > > > > with > > > > gcc --version > > gcc (SUSE Linux) 10.0.1 20200324 (experimental) [revision > > 75c24a08d697d6442fe6c26142f0559f803af977] > > > > patched > > > > patch -p1 < > > /tmp/grub_patches/grub_patches/0001-mdraid1x_linux-Fix-gcc10-error-Werror-array-bounds.patch > > patching file grub-core/disk/mdraid1x_linux.c > > patch -p1 < > > /tmp/grub_patches/grub_patches/0002-zfs-Fix-gcc10-error-Werror-zero-length-bounds.patch > > patching file grub-core/fs/zfs/zfs.c > > patching file include/grub/zfs/zap_leaf.h > > > > from > > > > https://lists.gnu.org/archive/html/grub-devel/2020-03/msg00222.html > > > > config's ok > > > > unset CC CPP > > ./bootstrap > > ./autogen.sh > > ./configure > > > > build FAILs > > > > make V=1 > > > > gcc -DHAVE_CONFIG_H -I. -Wall -W -DGRUB_UTIL=1 > > -D_FILE_OFFSET_BITS=64 -I./include -DGRUB_FILE=\"grub-core/fs/ntfscomp.c\" > > -I. -I. -I. -I. -I./include -I./include > > -I./grub-core/lib/libgcrypt-grub/src/ -I./grub-core/lib/minilzo > > -I./grub-core/lib/xzembed -I./grub-core/lib/zstd -DMINILZO_HAVE_CONFIG_H > > -O3 -Wall -fstack-protector-strong -funwind-tables > > -fasynchronous-unwind-tables -fmessage-length=0 -grecord-gcc-switches > > -march=native -mtune=native -D_FORTIFY_SOURCE=2 -D_FILE_OFFSET_BITS=64 > > -Wall -W -Wshadow -Wpointer-arith -Wundef -Wchar-subscripts -Wcomment > > -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero > > -Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit > > -Wimplicit-function-declaration -Wimplicit-int -Wmain -Wmissing-braces > > -Wmissing-format-attribute -Wmultichar -Wparentheses -Wreturn-type > > -Wsequence-point -Wshadow -Wsign-compare -Wswitch -Wtrigraphs > > -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label > > -Wunused-parameter -Wunused-value -Wunused-variable -Wwrite-strings > > -Wnested-externs -Wstrict-prototypes -Wcast-align -Wextra -Wattributes > > -Wendif-labels -Winit-self -Wint-to-pointer-cast -Winvalid-pch > > -Wmissing-field-initializers -Wnonnull -Woverflow -Wvla > > -Wpointer-to-int-cast -Wstrict-aliasing -Wvariadic-macros > > -Wvolatile-register-var -Wpointer-sign -Wmissing-include-dirs > > -Wmissing-prototypes -Wmissing-declarations -Wformat=2 -Werror > > -fno-builtin -Wno-undef -O3 -Wall -fstack-protector-strong -funwind-tables > > -fasynchronous-unwind-tables -fmessage-length=0 -grecord-gcc-switches > > -march=native -mtune=native -MT grub-core/fs/libgrubmods_a-ntfscomp.o -MD > > -MP -MF grub-core/fs/.deps-util/libgrubmods_a-ntfscomp.Tpo -c -o > > grub-core/fs/libgrubmods_a-ntfscomp.o `test -f 'grub-core/fs/ntfscomp.c' || > > echo './'`grub-core/fs/ntfscomp.c > > grub-core/fs/ntfscomp.c: In function ‘read_block’: > > grub-core/fs/ntfscomp.c:82:11: error: ‘flg’ may be used > > uninitialized in this function [-Werror=maybe-uninitialized] > >82 | if (flg & 0x8000) > > | ^~~ > > grub-core/fs/ntfscomp.c:74:17: note: ‘flg’ was declared here > >74 | grub_uint16_t flg, cnt; > > | ^~~ > > cc1: all warnings being treated as errors > > make[2]: *** [Makefile:7647: > > grub-core/fs/libgrubmods_a-ntfscomp.o] Error 1 > > make[2]: Leaving directory '/usr/local/src/grub' > > make[1]: *** [Makefile:11920: all-recursive] Error 1 > > make[1]: Leaving directory '/usr/local/src/grub' > > make: *** [Makefile:3772: all] Error 2 > > I am unable to reproduce this with > > $ gcc --version > gcc (Debian 10-20200324-1) 10.0.1 20200324 (experimental) [master > revision 596c90d3559:023579257f5:906b3eb9df6c577d3f6e9c3ea5c9d7e4d1e90536] Looking into build log, the build option seems to have been
Re: fs/ntfscomp.c:82:11: error: ‘flg’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
Dear PGNet Dev, Thank you for your report. Am 26.03.20 um 04:50 schrieb PGNet Dev: building cd grub git log | head -n5 commit 552c9fd08122a3036c724ce96dfe68aa2f75705f Author: Patrick Steinhardt Date: Sat Mar 7 17:29:09 2020 +0100 gnulib: Fix build of base64 when compiling with memory debugging with gcc --version gcc (SUSE Linux) 10.0.1 20200324 (experimental) [revision 75c24a08d697d6442fe6c26142f0559f803af977] patched patch -p1 < /tmp/grub_patches/grub_patches/0001-mdraid1x_linux-Fix-gcc10-error-Werror-array-bounds.patch patching file grub-core/disk/mdraid1x_linux.c patch -p1 < /tmp/grub_patches/grub_patches/0002-zfs-Fix-gcc10-error-Werror-zero-length-bounds.patch patching file grub-core/fs/zfs/zfs.c patching file include/grub/zfs/zap_leaf.h from https://lists.gnu.org/archive/html/grub-devel/2020-03/msg00222.html config's ok unset CC CPP ./bootstrap ./autogen.sh ./configure build FAILs make V=1 gcc -DHAVE_CONFIG_H -I. -Wall -W -DGRUB_UTIL=1 -D_FILE_OFFSET_BITS=64 -I./include -DGRUB_FILE=\"grub-core/fs/ntfscomp.c\" -I. -I. -I. -I. -I./include -I./include -I./grub-core/lib/libgcrypt-grub/src/ -I./grub-core/lib/minilzo -I./grub-core/lib/xzembed -I./grub-core/lib/zstd -DMINILZO_HAVE_CONFIG_H -O3 -Wall -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fmessage-length=0 -grecord-gcc-switches -march=native -mtune=native -D_FORTIFY_SOURCE=2 -D_FILE_OFFSET_BITS=64 -Wall -W -Wshadow -Wpointer-arith -Wundef -Wchar-subscripts -Wcomment -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wmain -Wmissing-braces -Wmissing-format-attribute -Wmultichar -Wparentheses -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wswitch -Wtrigraphs -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wwrite-strings -Wnested-externs -Wstrict-prototypes -Wcast-align -Wextra -Wattributes -Wendif-labels -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wmissing-field-initializers -Wnonnull -Woverflow -Wvla -Wpointer-to-int-cast -Wstrict-aliasing -Wvariadic-macros -Wvolatile-register-var -Wpointer-sign -Wmissing-include-dirs -Wmissing-prototypes -Wmissing-declarations -Wformat=2 -Werror -fno-builtin -Wno-undef -O3 -Wall -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fmessage-length=0 -grecord-gcc-switches -march=native -mtune=native -MT grub-core/fs/libgrubmods_a-ntfscomp.o -MD -MP -MF grub-core/fs/.deps-util/libgrubmods_a-ntfscomp.Tpo -c -o grub-core/fs/libgrubmods_a-ntfscomp.o `test -f 'grub-core/fs/ntfscomp.c' || echo './'`grub-core/fs/ntfscomp.c grub-core/fs/ntfscomp.c: In function ‘read_block’: grub-core/fs/ntfscomp.c:82:11: error: ‘flg’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 82 | if (flg & 0x8000) | ^~~ grub-core/fs/ntfscomp.c:74:17: note: ‘flg’ was declared here 74 | grub_uint16_t flg, cnt; | ^~~ cc1: all warnings being treated as errors make[2]: *** [Makefile:7647: grub-core/fs/libgrubmods_a-ntfscomp.o] Error 1 make[2]: Leaving directory '/usr/local/src/grub' make[1]: *** [Makefile:11920: all-recursive] Error 1 make[1]: Leaving directory '/usr/local/src/grub' make: *** [Makefile:3772: all] Error 2 I am unable to reproduce this with $ gcc --version gcc (Debian 10-20200324-1) 10.0.1 20200324 (experimental) [master revision 596c90d3559:023579257f5:906b3eb9df6c577d3f6e9c3ea5c9d7e4d1e90536] Here is the code in question: `` static grub_err_t decomp_get16 (struct grub_ntfs_comp *cc, grub_uint16_t * res) { grub_uint8_t c1 = 0, c2 = 0; if ((decomp_getch (cc, )) || (decomp_getch (cc, ))) return grub_errno; *res = ((grub_uint16_t) c2) * 256 + ((grub_uint16_t) c1); return 0; } […] grub_uint16_t flg, cnt; if (decomp_get16 (cc, )) return grub_errno; cnt = (flg & 0xFFF) + 1; if (dest) { if (flg & 0x8000) […] ``` In the code, the `if (decomp_get16 (cc, ))` ensures, that `flg` is initialized, doesn’t it? Why is it complaining complaining in line 82 and not 78, where `flg` is already accessed? Kind regards, Paul ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel
fs/ntfscomp.c:82:11: error: ‘flg’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
building cd grub git log | head -n5 commit 552c9fd08122a3036c724ce96dfe68aa2f75705f Author: Patrick Steinhardt Date: Sat Mar 7 17:29:09 2020 +0100 gnulib: Fix build of base64 when compiling with memory debugging with gcc --version gcc (SUSE Linux) 10.0.1 20200324 (experimental) [revision 75c24a08d697d6442fe6c26142f0559f803af977] patched patch -p1 < /tmp/grub_patches/grub_patches/0001-mdraid1x_linux-Fix-gcc10-error-Werror-array-bounds.patch patching file grub-core/disk/mdraid1x_linux.c patch -p1 < /tmp/grub_patches/grub_patches/0002-zfs-Fix-gcc10-error-Werror-zero-length-bounds.patch patching file grub-core/fs/zfs/zfs.c patching file include/grub/zfs/zap_leaf.h from https://lists.gnu.org/archive/html/grub-devel/2020-03/msg00222.html config's ok unset CC CPP ./bootstrap ./autogen.sh ./configure build FAILs make V=1 gcc -DHAVE_CONFIG_H -I. -Wall -W -DGRUB_UTIL=1 -D_FILE_OFFSET_BITS=64 -I./include -DGRUB_FILE=\"grub-core/fs/ntfscomp.c\" -I. -I. -I. -I. -I./include -I./include -I./grub-core/lib/libgcrypt-grub/src/ -I./grub-core/lib/minilzo -I./grub-core/lib/xzembed -I./grub-core/lib/zstd -DMINILZO_HAVE_CONFIG_H -O3 -Wall -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fmessage-length=0 -grecord-gcc-switches -march=native -mtune=native -D_FORTIFY_SOURCE=2 -D_FILE_OFFSET_BITS=64 -Wall -W -Wshadow -Wpointer-arith -Wundef -Wchar-subscripts -Wcomment -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wmain -Wmissing-braces -Wmissing-format-attribute -Wmultichar -Wparentheses -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wswitch -Wtrigraphs -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wwrite-strings -Wnested-externs -Wstrict-prototypes -Wcast-align -Wextra -Wattributes -Wendif-labels -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wmissing-field-initializers -Wnonnull -Woverflow -Wvla -Wpointer-to-int-cast -Wstrict-aliasing -Wvariadic-macros -Wvolatile-register-var -Wpointer-sign -Wmissing-include-dirs -Wmissing-prototypes -Wmissing-declarations -Wformat=2 -Werror -fno-builtin -Wno-undef -O3 -Wall -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fmessage-length=0 -grecord-gcc-switches -march=native -mtune=native -MT grub-core/fs/libgrubmods_a-ntfscomp.o -MD -MP -MF grub-core/fs/.deps-util/libgrubmods_a-ntfscomp.Tpo -c -o grub-core/fs/libgrubmods_a-ntfscomp.o `test -f 'grub-core/fs/ntfscomp.c' || echo './'`grub-core/fs/ntfscomp.c grub-core/fs/ntfscomp.c: In function ‘read_block’: grub-core/fs/ntfscomp.c:82:11: error: ‘flg’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 82 | if (flg & 0x8000) | ^~~ grub-core/fs/ntfscomp.c:74:17: note: ‘flg’ was declared here 74 | grub_uint16_t flg, cnt; | ^~~ cc1: all warnings being treated as errors make[2]: *** [Makefile:7647: grub-core/fs/libgrubmods_a-ntfscomp.o] Error 1 make[2]: Leaving directory '/usr/local/src/grub' make[1]: *** [Makefile:11920: all-recursive] Error 1 make[1]: Leaving directory '/usr/local/src/grub' make: *** [Makefile:3772: all] Error 2 ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel