All of lore.kernel.org
 help / color / mirror / Atom feed
* grub/head build with pre-release GCC10 ; fail @ "grub-core/disk/mdraid1x_linux.c:181:15: error: ..."
@ 2020-03-24  4:00 PGNet Dev
  2020-03-24 14:51 ` Paul Menzel
  0 siblings, 1 reply; 18+ messages in thread
From: PGNet Dev @ 2020-03-24  4:00 UTC (permalink / raw)
  To: grub-devel

 building curren head,

	git clone https://git.savannah.gnu.org/git/grub.git
	cd grub
	git describe
		grub-2.04-71-g552c9fd08

with soon(ish)-to-be-release GCC10

	gcc --version
		gcc (SUSE Linux) 10.0.1 20200320 (experimental) [revision 7d4549b2cd209eb621453ce13be7ffd84ffa720a]

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/disk/mdraid1x_linux.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/disk/libgrubmods_a-mdraid1x_linux.o -MD -MP -MF grub-core/disk/.deps-util/libgrubmods_a-mdraid1x_linux.Tpo -c -o grub-core/disk/libgrubmods_a-mdraid1x_linux.o `test -f 'grub-core/disk/mdraid1x_linux.c' || echo './'`grub-core/disk/mdraid1x_linux.c
	grub-core/disk/mdraid1x_linux.c: In function ‘grub_mdraid_detect’:
	grub-core/disk/mdraid1x_linux.c:181:15: error: array subscript <unknown> is outside array bounds of ‘grub_uint16_t[0]’ {aka ‘short unsigned int[0]’} [-Werror=array-bounds]
	  181 |      (char *) &sb.dev_roles[grub_le_to_cpu32 (sb.dev_number)]
	      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	grub-core/disk/mdraid1x_linux.c:98:17: note: while referencing ‘dev_roles’
	   98 |   grub_uint16_t dev_roles[0]; /* Role in array, or 0xffff for a spare, or 0xfffe for faulty.  */
	      |                 ^~~~~~~~~
	grub-core/disk/mdraid1x_linux.c:127:33: note: defined here ‘sb’
	  127 |       struct grub_raid_super_1x sb;
	      |                                 ^~
	cc1: all warnings being treated as errors
	make[2]: *** [Makefile:7059: grub-core/disk/libgrubmods_a-mdraid1x_linux.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


known/expected issue? bug-worthy?  or still too early for GCC10 issues?




^ permalink raw reply	[flat|nested] 18+ messages in thread
* disk/mdraid1x_linux.c:181:15: warning: array subscript <unknown> is outside array bounds of ‘grub_uint16_t[0]’ {aka ‘short unsigned int[0]’} [-Warray-bounds]
@ 2020-03-20  8:24 Paul Menzel
  2020-03-20 13:05 ` disk/mdraid1x_linux.c:181:15: warning: array subscript Thomas Schmitt
  0 siblings, 1 reply; 18+ messages in thread
From: Paul Menzel @ 2020-03-20  8:24 UTC (permalink / raw)
  To: The development of GNU GRUB

Dear GRUB folks,


Using Debian Sid/unstable with

     gcc (Debian 10-20200312-2) 10.0.1 20200312 (experimental) [master 
revision c56871dd15a:7ba6e7f0f21:daf2852b883762d921361462dad1f99320faca2a]

building GRUB fails with the error below due to treating warnings as errors.

> gcc -DHAVE_CONFIG_H -I. -I..  -Wall -W  -DGRUB_MACHINE_EFI=1 -DGRUB_MACHINE=X86_64_EFI -m64 -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/10/include -I../include -I../include -DGRUB_FILE=\"disk/mdraid1x_linux.c\" -I. -I. -I.. -I.. -I../include -I../include -I../grub-core/lib/libgcrypt-grub/src/    -D_FILE_OFFSET_BITS=64 -Os -m64 -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 -g -Wredundant-decls -Wmissing-prototypes -Wmissing-declarations  -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 -freg-struct-return -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow -msoft-float -fno-dwarf2-cfi-asm -mno-stack-arg-probe -fno-asynchronous-unwind-tables -fno-unwind-tables -fno-ident -mcmodel=large -mno-red-zone -fno-PIE -fno-pie -fno-stack-protector -Wtrampolines   -ffreestanding   -MT disk/mdraid1x_module-mdraid1x_linux.o -MD -MP -MF disk/.deps-core/mdraid1x_module-mdraid1x_linux.Tpo -c -o disk/mdraid1x_module-mdraid1x_linux.o `test -f 'disk/mdraid1x_linux.c' || echo './'`disk/mdraid1x_linux.c
> disk/mdraid1x_linux.c: In function ‘grub_mdraid_detect’:
> disk/mdraid1x_linux.c:181:15: warning: array subscript <unknown> is outside array bounds of ‘grub_uint16_t[0]’ {aka ‘short unsigned int[0]’} [-Warray-bounds]
>   181 |      (char *) &sb.dev_roles[grub_le_to_cpu32 (sb.dev_number)]
>       |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> disk/mdraid1x_linux.c:98:17: note: while referencing ‘dev_roles’
>    98 |   grub_uint16_t dev_roles[]; /* Role in array, or 0xffff for a spare, or 0xfffe for faulty.  */
>       |                 ^~~~~~~~~
> disk/mdraid1x_linux.c:127:33: note: defined here ‘sb’
>   127 |       struct grub_raid_super_1x sb;
>       |

Code in question seems to be:

       if (grub_disk_read (disk, sector,
                           (char *) &sb.dev_roles[grub_le_to_cpu32 
(sb.dev_number)]
                           - (char *) &sb,
                           sizeof (role), &role))
         return NULL;

Normally, it should be fixed by using `grub_uint16_t[]` instead of 
`grub_uint16_t[0]`, but I haven’t found out where yet.


Kind regards,

Paul

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2020-03-26  4:26 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-24  4:00 grub/head build with pre-release GCC10 ; fail @ "grub-core/disk/mdraid1x_linux.c:181:15: error: ..." PGNet Dev
2020-03-24 14:51 ` Paul Menzel
2020-03-24 16:52   ` PGNet Dev
2020-03-24 17:04     ` PGNet Dev
2020-03-24 17:54     ` disk/mdraid1x_linux.c:181:15: warning: array subscript Thomas Schmitt
2020-03-25  7:27       ` Michael Chang
2020-03-25 11:13         ` Thomas Schmitt
2020-03-26  3:08           ` Michael Chang
2020-03-25 15:35         ` PGNet Dev
2020-03-25 15:52           ` Paul Menzel
2020-03-25 15:54             ` PGNet Dev
2020-03-25 16:08               ` Paul Menzel
2020-03-26  3:29           ` Michael Chang
2020-03-26  4:05             ` PGNet Dev
2020-03-25 18:35         ` Daniel Kiper
2020-03-26  4:13           ` Michael Chang
2020-03-26  4:24             ` Michael Chang
  -- strict thread matches above, loose matches on Subject: below --
2020-03-20  8:24 disk/mdraid1x_linux.c:181:15: warning: array subscript <unknown> is outside array bounds of ‘grub_uint16_t[0]’ {aka ‘short unsigned int[0]’} [-Warray-bounds] Paul Menzel
2020-03-20 13:05 ` disk/mdraid1x_linux.c:181:15: warning: array subscript Thomas Schmitt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.