From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13764 invoked by alias); 8 Apr 2008 16:34:30 -0000 Received: (qmail 13745 invoked by uid 22791); 8 Apr 2008 16:34:29 -0000 X-Spam-Check-By: sourceware.org Received: from gw.ac.upc.edu (HELO gw.ac.upc.edu) (147.83.30.3) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 08 Apr 2008 16:33:57 +0000 Received: from localhost (dync-30-217.ac.upc.es [147.83.30.217]) by gw.ac.upc.edu (Postfix) with ESMTP id 2516B6B0237; Tue, 8 Apr 2008 18:33:55 +0200 (CEST) Date: Tue, 08 Apr 2008 18:08:00 -0000 From: Ramon Bertran Monfort To: Andrew Haley Cc: Ramon Bertran Monfort , gcc-help@gcc.gnu.org Subject: Re: Stricter requirements for function main signature Message-ID: <20080408163355.GA1955@rbertran-workstation> References: <20080407164106.GA11348@rbertran-workstation> <47FB2DD7.9090009@redhat.com> <20080408102154.GA31292@rbertran-workstation> <47FB7027.1040309@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="SLDf9lqlvOQaIe6s" Content-Disposition: inline In-Reply-To: <47FB7027.1040309@redhat.com> User-Agent: Mutt 1.5.17+20080114 (2008-01-14) X-Editor: VIM - Vi IMproved 7.1 (2007 May 12, compiled Jan 31 2008 12:25:03) X-Operating-System: Debian GNU/Linux Kernel 2.6.24-15-generic (x86_64) Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2008-04/txt/msg00104.txt.bz2 --SLDf9lqlvOQaIe6s Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 3381 El Tue, Apr 08, 2008 at 02:16:23PM +0100, Andrew Haley ens deleit=E0 amb le= s seg=FCents paraules: > Ramon Bertran Monfort wrote: >> Well,=20 >> first of all, thanks for answering. >>=20 >>> Why don't you just define main() correctly? argv should be 'char **',= =20 >>> and envp should probably be 'char **'. How can you possibly have an=20 >>> envp that's a long long unsigned int? >>=20 >> If a follow the SDK3.0 programming guide, it tells me that the spe main= =20 >> function has three parameters: the spe id, and two pointers to applicati= on=20 >> specific data. The last two are optional. >=20 > But you passed not a pointer but a long long unsigned int. Why not pass = a=20 > pointer instead of a long long unsigned int, especially since that's=20 > what the programming guide tells you to do? >=20 I've just used the same main signature that they use. I thought that they=20 used that strange signature for something... Now, I've change the signature= =20 to the 'correct' one : main ( int, char**, char**) and the program seems to compile correctly. However, if I execute it, it=20 fails. I get a 'bus error' when trying to do a dma_transfer from the=20 address of the second parameter. So, I guess that this kind of 'implicit'=20 casting do not like to the Cell runtime... it should be a uint64_t, as is=20 stated in the programming guide.=20 >> I can try to change the signature to the 'correctly' one ... but doing t= his=20 >> will break the spe run-time probably. (I've to experiment with this).=20= =20 >> Anyway, sometimes I use three parameters witch is not allowed with the=20 >> 'correct' strict signature. >=20 > g++ allows the third argument to be a pointer. >=20 Oups, sorry for my ignorance. >> I know that there are workarounds for solving this issues, but I'm=20 >> wondering if there is any gcc flag to relax this strict condition. It wo= uld=20 >> be easy to port applications to gcc 4.3.0 such as the Cell application=20 >> which changing the code is not as straightforward as the example shown i= n=20 >> http://www.gnu.org/software/gcc/gcc-4.3/porting_to.html . >=20 >>> Also, what are the compiler options you're using? >>=20 >> I guess that does not matter. I'm using just 'spu-g++ -O2' for testing. >=20 > Ah, OK. It seems that you have been caught by a version of gcc that trea= ts=20 > this as an error rather than a warning. I'm not sure exactly when this=20 > changed, but the current development version has a warning, not an error. >=20 Yes, the version is gcc 4.3.0 . I do not know if they relaxed this=20 condition afterwards. I will try a newer version of gcc if this condition=20 is relaxed. Do you know from which gcc version the error is just a warning= =20 again?=20 > Andrew. Thanks in advance, Salut! --=20 ---------------------------------------------------------------------------= ---- Ramon Bertran Monfort Departament d'Arquitectura de Computa= dors Telefon (+34) 93 4054033/54055 Universitat Politecnica de Catal= unya Fax (+34) 93 4017055 Despatx C6-103/C6-221-9 Campus = Nord e-mail rbertran@ac.upc.edu C. Jordi Girona 1-3 - 08034 Barce= lona http://rbm.pc.ac.upc.edu ---------------------------------------------------------------------------= ---- Listening: Hall of the king (Follow the blind) - Blind Guardian --SLDf9lqlvOQaIe6s Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline Content-length: 189 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFH+55yfBCHHutrsdsRAu0KAJ9TbRMWJXQVb6OJ+BKROjp7iuKPlgCg2/o2 tdEp+IMvm8wApqGygLFH1TI= =DkfU -----END PGP SIGNATURE----- --SLDf9lqlvOQaIe6s--