Your message dated Wed, 05 May 2004 11:39:15 -0400
with message-id <[EMAIL PROTECTED]>
and subject line Bug#247436: libc6-dev: odd dev_t/varargs behavior
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--------------------------------------
Received: (at submit) by bugs.debian.org; 5 May 2004 06:31:29 +0000
>From [EMAIL PROTECTED] Tue May 04 23:31:29 2004
Return-path: <[EMAIL PROTECTED]>
Received: from alb-24-194-33-49.nycap.rr.com (spiral.voxel.net) [24.194.33.49] 
        by spohr.debian.org with esmtp (Exim 3.35 1 (Debian))
        id 1BLFwH-0007g3-00; Tue, 04 May 2004 23:31:29 -0700
Received: by spiral.voxel.net (Postfix, from userid 1000)
        id 579BFF40F3; Wed,  5 May 2004 02:31:27 -0400 (EDT)
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
From: Andres Salomon <[EMAIL PROTECTED]>
To: Debian Bug Tracking System <[EMAIL PROTECTED]>
Subject: libc6-dev: odd dev_t/varargs behavior
X-Mailer: reportbug 2.58
Date: Wed, 05 May 2004 02:31:26 -0400
Message-Id: <[EMAIL PROTECTED]>
Delivered-To: [EMAIL PROTECTED]
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2004_03_25 
        (1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Status: No, hits=-7.0 required=4.0 tests=BAYES_00,HAS_PACKAGE 
        autolearn=no version=2.60-bugs.debian.org_2004_03_25
X-Spam-Level: 
X-CrossAssassin-Score: 1

Package: libc6-dev
Version: 2.3.2.ds1-12
Severity: normal

I'm seeing some very odd behavior with dev_t (defined in linux/kdev_t.h)
and varargs.  I have the following source file:

#include <stdio.h>
#include <sys/types.h>
#include <linux/kdev_t.h>
                                                                                
int main(void)
{
        dev_t x = 0x3af;
        printf("%x %x\n", ((x)>>8), ((x)&0xff));
        return 0;
}


One would think that this would print out "3 af"; however, it displays
"3 0".  If I change that printf to:
        printf("%x %x %x\n", ((x)>>8), ((x)&0xff));
I get "3 0 af".  It would appear that dev_t, when passed as to a vararg
function, adds an additional argument as padding.  So, when I pass "x>>8",
what printf() sees is "x>>8, 0".  This doesn't happen normally; if I
change the definition of x to:
        unsigned int x = 0x3af;
I get "3 af".  Also, if I explicitly cast the args to unsigned int:
        printf("%x %x\n", (unsigned int) ((x)>>8), (unsigned int) ((x)&0xff));
I get "3 af".  So, it's some weird handling of dev_t's.


... I'm not quite sure what to make of it.  I _think_ it's a glibc
problem..
 



-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.5-1-686
Locale: LANG=C, LC_CTYPE=C

Versions of packages libc6-dev depends on:
ii  libc6                2.3.2.ds1-12        GNU C Library: Shared libraries an
ii  linux-kernel-headers 2.5.999-test7-bk-15 Linux Kernel Headers for developme

-- no debconf information

---------------------------------------
Received: (at 247436-done) by bugs.debian.org; 5 May 2004 15:38:43 +0000
>From [EMAIL PROTECTED] Wed May 05 08:38:43 2004
Return-path: <[EMAIL PROTECTED]>
Received: from zero.voxel.net [209.123.232.253] (postfix)
        by spohr.debian.org with esmtp (Exim 3.35 1 (Debian))
        id 1BLOTr-0003ZX-00; Wed, 05 May 2004 08:38:43 -0700
Received: from [192.168.0.200] (hq.voxel.net [66.109.37.2])
        by zero.voxel.net (Postfix) with ESMTP
        id E708524AF20; Wed,  5 May 2004 11:38:34 -0400 (EDT)
Subject: Re: Bug#247436: libc6-dev: odd dev_t/varargs behavior
From: Andres Salomon <[EMAIL PROTECTED]>
To: Herbert Xu <[EMAIL PROTECTED]>,
        [EMAIL PROTECTED]
In-Reply-To: <[EMAIL PROTECTED]>
References: <[EMAIL PROTECTED]>
Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; 
boundary="=-y0XPzIUAYztkbWvhJX/b"
Message-Id: <[EMAIL PROTECTED]>
Mime-Version: 1.0
X-Mailer: Ximian Evolution 1.4.6 
Date: Wed, 05 May 2004 11:39:15 -0400
Delivered-To: [EMAIL PROTECTED]
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2004_03_25 
        (1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Status: No, hits=-5.0 required=4.0 tests=BAYES_00,HAS_BUG_NUMBER 
        autolearn=no version=2.60-bugs.debian.org_2004_03_25
X-Spam-Level: 
X-CrossAssassin-Score: 1


--=-y0XPzIUAYztkbWvhJX/b
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

On Wed, 2004-05-05 at 06:33, Herbert Xu wrote:
[...]
>=20
> Please review the C promotion rules.
>=20
> The 2nd and 3rd arguments are 64-bits long, and therefore they get pushed
> onto the stack as 64-bit values.  Your use of the %x conversion is
> therefore incorrect.
>=20
> In fact, gcc -Wall should've told you about it.

Yes, I realized the problem after submitting the bug.  Closing this...


--=-y0XPzIUAYztkbWvhJX/b
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQBAmQqh78o9R9NraMQRApV7AJ4lWzN7DSMlZFzM5rhIJ5WUTsBufQCfRk9p
+5nAsjwjdod49I2VlXnC6is=
=fv0j
-----END PGP SIGNATURE-----

--=-y0XPzIUAYztkbWvhJX/b--


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to