From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IrGQN-0004Sg-ME for qemu-devel@nongnu.org; Sun, 11 Nov 2007 12:16:43 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IrGQM-0004R6-4c for qemu-devel@nongnu.org; Sun, 11 Nov 2007 12:16:42 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IrGQL-0004Qu-RC for qemu-devel@nongnu.org; Sun, 11 Nov 2007 12:16:41 -0500 Received: from tapir.sajinet.com.pe ([66.139.79.212]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IrGQL-0000hy-FV for qemu-devel@nongnu.org; Sun, 11 Nov 2007 12:16:41 -0500 Date: Sun, 11 Nov 2007 11:21:22 -0600 From: Carlo Marcelo Arenas Belon Subject: Re: [Qemu-devel] error compiling hw/sh7750.c Message-ID: <20071111172122.GA9387@tapir> References: <20071111093026.NJ0KX.29116.root@eastrmwml27.mgt.cox.net> <20071111160634.GF25322@tapir> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20071111160634.GF25322@tapir> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: sol10x86@cox.net, qemu-devel@nongnu.org On Sun, Nov 11, 2007 at 10:06:34AM -0600, Carlo Marcelo Arenas Belon wrote: > On Sun, Nov 11, 2007 at 09:30:26AM -0500, Ben Taylor wrote: > > So the macro turns the last _INTC_ARRAY(NULL) into > > > > "NULL, sizeof(NULL)/sizeof(*NULL) > > in my 64bit linux using gcc-4.1.2 it becomes instead : > > ((void *)0), sizeof(((void *)0))/sizeof(*((void *)0)) > > what version of gcc (gcc -v) are you using in that Solaris 10 box? (HINT: not > all available versions of gcc compile qemu correctly) : > > http://www.opensolaris.org/os/project/qemu/host/gcc-failures/ That didn't sound as clear as it should, so I booted an OpenSolaris Nevada 70b using the sun provided gcc : $ uname -a SunOS dell 5.11 snv_70b i86pc i386 i86pc $ gcc -v Reading specs from /usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/specs Configured with: /builds2/sfwnv-gate/usr/src/cmd/gcc/gcc-3.4.3/configure --prefix=/usr/sfw --with-as=/usr/sfw/bin/gas --with-gnu-as --with-ld=/usr/ccs/bin/ld --without-gnu-ld --enable-languages=c,c++,f77,objc --enable-shared Thread model: posix gcc version 3.4.3 (csl-sol210-3_4-20050802) and run a test, the problem is in /usr/include/iso/stdio_iso.h that defined NULL as an int and not a pointer as shown by : fndef NULL #if defined(_LP64) #define NULL 0L #else #define NULL 0 #endif #endif contradicting (at least in spirit) the C99 (ISO/IEC 9899:TCS) standard that says : "A pointer to void shall have the same representation and alignment requirements as a pointer to a character type" and therefore makes sizeof(*NULL) == 1 solving the problem to compile as it is done if applying the following patch : Carlo --- --- qemu/hw/sh7750.c Sun Oct 7 09:31:11 2007 +++ qemu/hw/sh7750.c Sun Nov 11 16:13:13 2007 @@ -29,6 +29,9 @@ #include "sh7750_regnames.h" #include "sh_intc.h" +#undef NULL +#define NULL ((void *)0) + #define NB_DEVICES 4 typedef struct SH7750State {