From owner-freebsd-current@FreeBSD.ORG Wed Jun 11 21:21:14 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 47C1937B401; Wed, 11 Jun 2003 21:21:14 -0700 (PDT) Received: from smtp01.syd.iprimus.net.au (smtp01.syd.iprimus.net.au [210.50.30.52]) by mx1.FreeBSD.org (Postfix) with ESMTP id AB40C43FAF; Wed, 11 Jun 2003 21:21:13 -0700 (PDT) (envelope-from tim@robbins.dropbear.id.au) Received: from dilbert.robbins.dropbear.id.au (210.50.202.100) by smtp01.syd.iprimus.net.au (7.0.015) id 3EDD516E001B0CAF; Thu, 12 Jun 2003 14:21:12 +1000 Received: by dilbert.robbins.dropbear.id.au (Postfix, from userid 1000) id 2895FC911; Thu, 12 Jun 2003 14:14:20 +1000 (EST) Date: Thu, 12 Jun 2003 14:14:19 +1000 From: Tim Robbins To: Kris Kennaway Message-ID: <20030612141419.A54664@dilbert.robbins.dropbear.id.au> References: <20030610113858.GA99227@rot13.obsecurity.org> <20030612023701.GA33532@rot13.obsecurity.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="9jxsPFA5p3P2qPhR" Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20030612023701.GA33532@rot13.obsecurity.org>; from kris@obsecurity.org on Wed, Jun 11, 2003 at 07:37:01PM -0700 cc: current@freebsd.org Subject: Re: CSTD=c99 breaks package creation X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jun 2003 04:21:14 -0000 --9jxsPFA5p3P2qPhR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Jun 11, 2003 at 07:37:01PM -0700, Kris Kennaway wrote: > It's possible that there's either a bug in gcc or there is C code in > the system that has a different meaning when interpreted to C99 > standards. I think I may have found the problem, and I think it's in GNU tar. GNU tar does this: #ifndef __attribute__ /* This feature is available in gcc versions 2.5 and later. */ # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__ # define __attribute__(Spec) /* empty */ # endif #endif machine/_types.h does this: typedef int __attribute__((__mode__(__DI__))) __int64_t; typedef unsigned int __attribute__((__mode__(__DI__))) __uint64_t; If __attribute__ is empty, __int64_t becomes a synonym for int. Bad. Attached is a test program. Compile it w/o a -std option and see that the output, which is sizeof(int64_t), is 8 as expected. Compile with -std=c99 and see that sizeof(int64_t) is 4. Tim --9jxsPFA5p3P2qPhR Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="test.c" #ifndef __attribute__ /* This feature is available in gcc versions 2.5 and later. */ # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__ # define __attribute__(Spec) /* empty */ # endif #endif #include #include #include #include int main(int argc, char *argv[]) { (void)__bswap64((uint64_t)3); printf("%d\n", (int)sizeof(uint64_t)); exit(0); } --9jxsPFA5p3P2qPhR--