Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1MjDtn-0004VA-Ff for mharc-grub-devel@gnu.org; Thu, 03 Sep 2009 11:06:55 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MjDtl-0004UR-RA for grub-devel@gnu.org; Thu, 03 Sep 2009 11:06:53 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MjDti-0004SN-24 for grub-devel@gnu.org; Thu, 03 Sep 2009 11:06:53 -0400 Received: from [199.232.76.173] (port=36441 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MjDth-0004SC-Kb for grub-devel@gnu.org; Thu, 03 Sep 2009 11:06:49 -0400 Received: from mail-bw0-f220.google.com ([209.85.218.220]:42225) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MjDte-0005ap-VA; Thu, 03 Sep 2009 11:06:47 -0400 Received: by bwz20 with SMTP id 20so877800bwz.42 for ; Thu, 03 Sep 2009 08:06:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=UqIT/WY7yDLJPrbVk/0Wvb5DokWoJIly0SGwkp6mD2w=; b=lvJI2V0SbTV1YrkDbS5n7LBvH24Gjsq8urzUCEaAGb5QGXB0SgDXOegkfQhSGH3nGI aio2ciHgbq+Dxmrt9u4EszV6kNdLgeZG+m5aWGDm3aE6rVlZynMhE8KCOVk0Not8TQem 9UxAtiE9+vJ8Ra+hyspd6ylr72SiaTWJzGbWk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=opGyUAyqJNFiB+kbTwq0w1dLOoE2m4nw1PEsypbVK7qHZV32aFnANVOYJFaI6slNZ7 YuSU0srNL8E8raX10b7lYlrKiDZLygy2V2ZU61tZOcHEJlSKKfVibi1MskCYarNDG5iC htDJQaEXT6xLes1llO7KbTUKU3ZUHL3ip1s04= MIME-Version: 1.0 Received: by 10.204.154.142 with SMTP id o14mr7915825bkw.125.1251990405715; Thu, 03 Sep 2009 08:06:45 -0700 (PDT) In-Reply-To: References: Date: Thu, 3 Sep 2009 17:06:45 +0200 Message-ID: From: "Vladimir 'phcoder' Serbinenko" To: The development of GRUB 2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: gcc@gnu.org Subject: Re: [RFC] Eliminate NESTED_ATTR_FUNC X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Sep 2009 15:06:54 -0000 > Hi, > > Oh, I was wrong previously, gcc does respect __attribute__ > ((__regparm__ (3))) flag (I forget to add -Os so it still uses stack > to store value). And the bug is still there ! Try this test program: I confirm with gcc-4.4 This is a grave problem then. This check was added by Marco Gerards (maintainer) in 2003. He added a workaround but I don't believe such behaviour to be correct. We're both GNU projects. IMO the correct action would have been to report the bug to gcc-devel and refuse to compile unless bug is fixed. This way users would update to newer gcc patchlevel (e.g. 4.2.(X+1) instead of 4.2.X) instead of compiling with buggy compiler. One GNU project shouldn't have expensive workaround (we had bugs because of NESTED_FUNC_ATTR misuse) Now we're in feature freeze but I hope in the future we'll be able to change to correct behaviour when freeze is over. > > #include > > void foo (int a, int b, void (*hook) (int aa, int bb, int cc)) > { > =A0b +=3D a; > =A0hook (a, b, a + b); > } > > void qq (int a) > { > =A0auto void q1 (int aa, int bb, int cc); > =A0void q1 (int aa, int bb, int cc) > =A0 =A0{ > =A0 =A0 =A0printf ("%d %d %d\n", a, aa + bb, cc); > =A0 =A0} > > =A0foo (a, a + 1, q1); > } > > int main() > { > =A0qq (10); > } > > Compile with: > gcc -m32 -mregparm=3D3 -Os test.c > > ./a.out > 10 31 -6674368 > > gcc is 4.3.4 from debian. > --- > Bean > > gitgrub home: http://github.com/grub/grub/ > my fork page: http://github.com/bean123/grub/ > > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > http://lists.gnu.org/mailman/listinfo/grub-devel > --=20 Regards Vladimir 'phcoder' Serbinenko Personal git repository: http://repo.or.cz/w/grub2/phcoder.git