Re: grub/head build with pre-release GCC10 ; fail @ "grub-core/disk/mdraid1x_linux.c:181:15: error: ..."

2020-03-24 Thread PGNet Dev
my bad re: patch. pebkac (looking UP might help :-/ )

with

diff -ur grub.ORIG/grub-core/disk/mdraid1x_linux.c 
grub/grub-core/disk/mdraid1x_linux.c
--- grub.ORIG/grub-core/disk/mdraid1x_linux.c   2020-03-24 
09:24:08.656640265 -0700
+++ grub/grub-core/disk/mdraid1x_linux.c2020-03-24 
09:58:27.638619782 -0700
@@ -179,7 +179,8 @@
 
   if (grub_disk_read (disk, sector, 
  (char *) _roles[grub_le_to_cpu32 
(sb.dev_number)]
- - (char *) ,
+ ((char *) _roles - (char *) sb)
+ + grub_le_to_cpu32 (sb.dev_number) * 
sizeof(grub_uint16_t),
  sizeof (role), ))
return NULL;

gcc10 build returns,

...
make
...
grub-core/disk/mdraid1x_linux.c: In function 
‘grub_mdraid_detect’:
grub-core/disk/mdraid1x_linux.c:182:6: error: cannot convert to 
a pointer type
  182 |  ((char *) _roles - (char *) sb)
  |  ^
grub-core/disk/mdraid1x_linux.c:181:16: error: called object is 
not a function or function pointer
  181 |  (char *) _roles[grub_le_to_cpu32 
(sb.dev_number)]
  |^~
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


___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: grub/head build with pre-release GCC10 ; fail @ "grub-core/disk/mdraid1x_linux.c:181:15: error: ..."

2020-03-24 Thread PGNet Dev
Thomas,


On 3/24/20 7:51 AM, Paul Menzel wrote:
> Dear PGNet Dev,
> 
> 
> Already reported and analyzed [1]. It’d be nice, if you could verify Thomas’ 
> analysis.

not sure I'm reading your intent from your post,

>   ...
>   I think that the following expression produces the same number without
>   virtual access to a virtual array member:
>
>(char *) _roles - (char *) sb
>+ grub_le_to_cpu32 (sb.dev_number) * sizeof(grub_uint16_t)
>   ...

with this,

diff -ur grub.ORIG/grub-core/disk/mdraid1x_linux.c 
grub/grub-core/disk/mdraid1x_linux.c
--- grub.ORIG/grub-core/disk/mdraid1x_linux.c   2020-03-24 
09:24:08.656640265 -0700
+++ grub/grub-core/disk/mdraid1x_linux.c2020-03-24 
09:25:20.615871693 -0700
@@ -178,8 +178,9 @@
return NULL;
 
   if (grub_disk_read (disk, sector, 
- (char *) _roles[grub_le_to_cpu32 
(sb.dev_number)]
- - (char *) ,
+ (char *) _roles
+ - (char *) sb
+ + grub_le_to_cpu32 (sb.dev_number) * 
sizeof(grub_uint16_t),
  sizeof (role), ))
return NULL;
 

I'm seeing,

...
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:183:6: error: cannot convert to a 
pointer type
  183 |  + grub_le_to_cpu32 (sb.dev_number) * sizeof(grub_uint16_t),
  |  ^
make[2]: *** [Makefile:7059: 
grub-core/disk/libgrubmods_a-mdraid1x_linux.o] Error 1

my patch attempt wrong? or still needs tweaks?

___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: grub/head build with pre-release GCC10 ; fail @ "grub-core/disk/mdraid1x_linux.c:181:15: error: ..."

2020-03-24 Thread Paul Menzel

Dear PGNet Dev,


Already reported and analyzed [1]. It’d be nice, if you could verify 
Thomas’ analysis.



Kind regards,

Paul


[1]: https://lists.gnu.org/archive/html/grub-devel/2020-03/msg00206.html

___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


grub/head build with pre-release GCC10 ; fail @ "grub-core/disk/mdraid1x_linux.c:181:15: error: ..."

2020-03-23 Thread PGNet Dev
 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 
 is outside array bounds of ‘grub_uint16_t[0]’ {aka ‘short unsigned 
int[0]’} [-Werror=array-bounds]
  181 |  (char *) _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 0x 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?



___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel