Linux SPARSE checker discussions
 help / color / mirror / Atom feed
* sparse 0.4.2: cgcc issue
@ 2009-12-05 22:34 rubisher
  2009-12-06 12:01 ` rubisher
  0 siblings, 1 reply; 6+ messages in thread
From: rubisher @ 2009-12-05 22:34 UTC (permalink / raw)
  To: linux-sparse

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.


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

* Re: sparse 0.4.2: cgcc issue
  2009-12-05 22:34 sparse 0.4.2: cgcc issue rubisher
@ 2009-12-06 12:01 ` rubisher
  2009-12-07  9:10   ` Christopher Li
  0 siblings, 1 reply; 6+ messages in thread
From: rubisher @ 2009-12-06 12:01 UTC (permalink / raw)
  To: linux-sparse

rubisher wrote:
> 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.
> 
> 
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.orig	2009-11-28 17:41:28.000000000 +0000
+++ /usr/bin/cgcc	2009-12-06 11:55:32.000000000 +0000
@@ -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.


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

* Re: sparse 0.4.2: cgcc issue
  2009-12-06 12:01 ` rubisher
@ 2009-12-07  9:10   ` Christopher Li
  2009-12-07 18:04     ` Blue Swirl
  0 siblings, 1 reply; 6+ messages in thread
From: Christopher Li @ 2009-12-07  9:10 UTC (permalink / raw)
  To: rubisher, Blue Swirl; +Cc: linux-sparse

On Sun, Dec 6, 2009 at 4:01 AM, rubisher <rubisher@scarlet.be> wrote:
> 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]) .

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 majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: sparse 0.4.2: cgcc issue
  2009-12-07  9:10   ` Christopher Li
@ 2009-12-07 18:04     ` Blue Swirl
  2009-12-08  2:47       ` Christopher Li
  0 siblings, 1 reply; 6+ messages in thread
From: Blue Swirl @ 2009-12-07 18:04 UTC (permalink / raw)
  To: Christopher Li; +Cc: rubisher, linux-sparse

On Mon, Dec 7, 2009 at 11:10 AM, Christopher Li <sparse@chrisli.org> wrote:
> On Sun, Dec 6, 2009 at 4:01 AM, rubisher <rubisher@scarlet.be> wrote:
>> 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]) .
>
> 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 majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: sparse 0.4.2: cgcc issue
  2009-12-07 18:04     ` Blue Swirl
@ 2009-12-08  2:47       ` Christopher Li
  2009-12-08 19:03         ` rubisher
  0 siblings, 1 reply; 6+ messages in thread
From: Christopher Li @ 2009-12-08  2:47 UTC (permalink / raw)
  To: Blue Swirl, rubisher; +Cc: linux-sparse

On Mon, Dec 7, 2009 at 10:04 AM, Blue Swirl <blauwirbel@gmail.com> wrote:
>
> My Perl skills are not very bright, but the suggested patch
> (http://marc.info/?l=linux-sparse&m=126010091922942&w=2) looks
> correct.

Same here.

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

Thanks

Chris

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

* Re: sparse 0.4.2: cgcc issue
  2009-12-08  2:47       ` Christopher Li
@ 2009-12-08 19:03         ` rubisher
  0 siblings, 0 replies; 6+ messages in thread
From: rubisher @ 2009-12-08 19:03 UTC (permalink / raw)
  To: Christopher Li; +Cc: Blue Swirl, linux-sparse

[-- Attachment #1: Type: text/plain, Size: 1161 bytes --]

Christopher Li wrote:
> On Mon, Dec 7, 2009 at 10:04 AM, Blue Swirl <blauwirbel@gmail.com> wrote:
>> My Perl skills are not very bright, but the suggested patch
>> (http://marc.info/?l=linux-sparse&m=126010091922942&w=2) looks
>> correct.
> 
> 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.

Signed-off-by: Joel Soete <rubisher@scarlet.be>

--- cgcc.orig	2009-11-28 17:41:28.000000000 +0000
+++ cgcc	2009-12-06 11:55:32.000000000 +0000
@@ -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.

[-- Attachment #2: CGCC.diff.gz --]
[-- Type: application/x-gzip, Size: 308 bytes --]

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

end of thread, other threads:[~2009-12-08 19:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-05 22:34 sparse 0.4.2: cgcc issue rubisher
2009-12-06 12:01 ` rubisher
2009-12-07  9:10   ` Christopher Li
2009-12-07 18:04     ` Blue Swirl
2009-12-08  2:47       ` Christopher Li
2009-12-08 19:03         ` rubisher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox