All of lore.kernel.org
 help / color / mirror / Atom feed
From: rubisher <rubisher@scarlet.be>
To: linux-sparse@vger.kernel.org
Subject: Re: sparse 0.4.2: cgcc issue
Date: Sun, 06 Dec 2009 12:01:46 +0000	[thread overview]
Message-ID: <4B1B9D2A.6080804@scarlet.be> (raw)
In-Reply-To: <4B1AE007.8000509@scarlet.be>

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.


  reply	other threads:[~2009-12-06 12:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-05 22:34 sparse 0.4.2: cgcc issue rubisher
2009-12-06 12:01 ` rubisher [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B1B9D2A.6080804@scarlet.be \
    --to=rubisher@scarlet.be \
    --cc=linux-sparse@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.