Skip to contentSkip to conversation

sparse 0.4.2: cgcc issue

DISCUSSION rubisher 3 participants 6 messages Dec 5, 2009 – Dec 8, 2009

Subsystems (2)
lore
Share & tools
lore

rubisher

author
#0 lore raw

Hello all,

Trying to 'sparse' grub2 with cgcc wrapper, I got following error:

REAL_CC=gcc-4.4 cgcc -v -Ikern -I/Develop/jso/GRUB2/Grub2.deb/exp-bzr1417/kern -I. -I./include -I/Develop/jso/GRUB2/Grub2.deb/exp-bzr1417/gnulib -I/Develop/jso/GRUB2/Grub2.deb/exp-bzr1417/include -Wall -W -DGRUB_LIBDIR=\"/opt/grub2/exp1417/lib/echo grub/i386-pc | sed 's,x,x,'\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -Wbitwise -Wnon-pointer-null -DGRUB_UTIL=1 -MD -c -o grub_setup-kern_partition.o /Develop/jso/GRUB2/Grub2.deb/exp-bzr1417/kern/partition.c Use of uninitialized value $bits in exists at /usr/bin/cgcc line 139.
/usr/bin/cgcc: weird number of bits. at /usr/bin/cgcc line 139.
make: *** [grub_setup-kern_partition.o] Error 9

Fortunately debian pkg sparse (0.4.1+git20081218-1) doesn't shows this error?

Any idea?

Tia,

	J.
author
#1 lore raw
Quoted 16 lines · rubisher

Hello all,

Trying to 'sparse' grub2 with cgcc wrapper, I got following error:

REAL_CC=gcc-4.4 cgcc -v -Ikern

(quoted diff) +0 -4
-I/Develop/jso/GRUB2/Grub2.deb/exp-bzr1417/kern -I. -I./include 
-I/Develop/jso/GRUB2/Grub2.deb/exp-bzr1417/gnulib 
-I/Develop/jso/GRUB2/Grub2.deb/exp-bzr1417/include -Wall -W 
-DGRUB_LIBDIR=\"/opt/grub2/exp1417/lib/`echo grub/i386-pc | sed 

's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -Wbitwise -Wnon-pointer-null -DGRUB_UTIL=1 -MD -c -o grub_setup-kern_partition.o /Develop/jso/GRUB2/Grub2.deb/exp-bzr1417/kern/partition.c Use of uninitialized value $bits in exists at /usr/bin/cgcc line 139. /usr/bin/cgcc: weird number of bits. at /usr/bin/cgcc line 139.
make: *** [grub_setup-kern_partition.o] Error 9

Quoted 8 lines

Fortunately debian pkg sparse (0.4.1+git20081218-1) doesn't shows this error?

Any idea?

Tia,

    J.

mmm, I figure out that's because the number of args to call this routine integer_types() should be the same as the number of
@types's elements (i.e. 6) which is not allways the case:
e.g.
252 } elsif ($spec eq 'i86') {
253 return (' -Di386=1 -D__i386=1 -D__i386__=1' .

254                 &integer_types (8, 16, 32, $m64 ? 64 : 32, 64) .
255                 &float_types (1, 1, 21, [24,8], [53,11], [64,15]) .
256                 &define_size_t ($m64 ? "long unsigned int" : "unsigned int"));
257     } elsif ($spec eq 'sparc') {
258         return (' -Dsparc=1 -D__sparc=1 -D__sparc__=1' .
259                 &integer_types (8, 16, 32, $m64 ? 64 : 32, 64) .
260                 &float_types (1, 1, 33, [24,8], [53,11], [113,15]) .
261                 &define_size_t ($m64 ? "long unsigned int" : "unsigned int"));

262 } elsif ($spec eq 'sparc64') {
263 return (' -Dsparc=1 -D__sparc=1 -D__sparc__=1 -D__sparcv9__=1 -D__sparc64__=1 -D__arch64__=1 -D__LP64__=1' .
264 &integer_types (8, 16, 32, 64, 64, 128) .
265 &float_types (1, 1, 33, [24,8], [53,11], [113,15]) .

so one possible fix could be:

usr/bin/cgcc renamed from usr/bin/cgcc.orig +1 -1
@@ -133,7 +133,7 @@
     my @types = (['SCHAR',''], ['SHRT',''], ['INT',''], ['LONG','L'], ['LONG_LONG','LL'], ['LONG_LONG_LONG','LLL']);
 
     my $result = " -D__CHAR_BIT__=$char";
-    while (@types) {
+    while (@types && @_) {
 	my $bits = shift @_;
 	my ($name,$suffix) = @{ shift @types };
 	die "$0: weird number of bits." unless exists $pow2m1{$bits};

=== <> ===

Hth,

	J.
maintainer
#2 lore raw
Quoted 13 lines · rubisher

mmm, I figure out that's because the number of args to call this routine integer_types() should be the same as the number of  @types's elements (i.e.
6) which is not allways the case:
e.g.
 252     } elsif ($spec eq 'i86') {
253         return (' -Di386=1 -D__i386=1 -D__i386__=1' .
254                 &integer_types (8, 16, 32, $m64 ? 64 : 32, 64) . 255                 &float_types (1, 1, 21, [24,8], [53,11], [64,15]) . 256                 &define_size_t ($m64 ? "long unsigned int" : "unsigned int"));
257     } elsif ($spec eq 'sparc') {
258         return (' -Dsparc=1 -D__sparc=1 -D__sparc__=1' .
259                 &integer_types (8, 16, 32, $m64 ? 64 : 32, 64) .

Quoted 8 lines

260                 &float_types (1, 1, 33, [24,8], [53,11], [113,15]) . 261                 &define_size_t ($m64 ? "long unsigned int" : "unsigned int"));
262     } elsif ($spec eq 'sparc64') {
263         return (' -Dsparc=1 -D__sparc=1 -D__sparc__=1 -D__sparcv9__=1 -D__sparc64__=1 -D__arch64__=1 -D__LP64__=1' .
264                 &integer_types (8, 16, 32, 64, 64, 128) . 265                 &float_types (1, 1, 33, [24,8], [53,11], [113,15]) .

Seems relate to Blue Swirl's 128 bit changes. Add to the CC list.

Chris
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 23 lines · Christopher Li
Quoted 13 lines · rubisher

mmm, I figure out that's because the number of args to call this routine integer_types() should be the same as the number of  @types's elements (i.e.
6) which is not allways the case:
e.g.
 252     } elsif ($spec eq 'i86') {
253         return (' -Di386=1 -D__i386=1 -D__i386__=1' .
254                 &integer_types (8, 16, 32, $m64 ? 64 : 32, 64) . 255                 &float_types (1, 1, 21, [24,8], [53,11], [64,15]) . 256                 &define_size_t ($m64 ? "long unsigned int" : "unsigned int"));
257     } elsif ($spec eq 'sparc') {
258         return (' -Dsparc=1 -D__sparc=1 -D__sparc__=1' .
259                 &integer_types (8, 16, 32, $m64 ? 64 : 32, 64) .

Quoted 8 lines

260                 &float_types (1, 1, 33, [24,8], [53,11], [113,15]) . 261                 &define_size_t ($m64 ? "long unsigned int" : "unsigned int"));
262     } elsif ($spec eq 'sparc64') {
263         return (' -Dsparc=1 -D__sparc=1 -D__sparc__=1 -D__sparcv9__=1 -D__sparc64__=1 -D__arch64__=1 -D__LP64__=1' .
264                 &integer_types (8, 16, 32, 64, 64, 128) . 265                 &float_types (1, 1, 33, [24,8], [53,11], [113,15]) .

Quoted 1 line

Seems relate to Blue Swirl's 128 bit changes. Add to the CC list.

My Perl skills are not very bright, but the suggested patch
(http://marc.info/?l=linux-sparse&m=126010091922942&w=2) looks correct.
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author
#5 lore raw
Quoted 5 lines · Christopher Li
Quoted 3 lines · Blue Swirl

My Perl skills are not very bright, but the suggested patch
(http://marc.info/?l=linux-sparse&m=126010091922942&w=2) looks correct.

Quoted 9 lines

Same here.

Rubisher, can you please send me a Signed-Off-By: line for the patch you submit?

Thanks

Chris

if that could help you:

a possible fix to cgcc issue in sparse 0.4.2:
Use of uninitialized value $bits in exists at /usr/bin/cgcc line 139. /usr/bin/cgcc: weird number of bits. at /usr/bin/cgcc line 139.

cgcc renamed from cgcc.orig +1 -1
@@ -133,7 +133,7 @@
     my @types = (['SCHAR',''], ['SHRT',''], ['INT',''], ['LONG','L'], ['LONG_LONG','LL'], ['LONG_LONG_LONG','LLL']);
 
     my $result = " -D__CHAR_BIT__=$char";
-    while (@types) {
+    while (@types && @_) {
 	my $bits = shift @_;
 	my ($name,$suffix) = @{ shift @types };
 	die "$0: weird number of bits." unless exists $pow2m1{$bits};

=== <> ===

Also attached in case of mail client issue

Tx a lot,

    J.