[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC] Eliminate NESTED_ATTR_FUNC
From: |
Vladimir 'phcoder' Serbinenko |
Subject: |
Re: [RFC] Eliminate NESTED_ATTR_FUNC |
Date: |
Thu, 3 Sep 2009 17:06:45 +0200 |
> 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 <stdio.h>
>
> void foo (int a, int b, void (*hook) (int aa, int bb, int cc))
> {
> b += a;
> hook (a, b, a + b);
> }
>
> void qq (int a)
> {
> auto void q1 (int aa, int bb, int cc);
> void q1 (int aa, int bb, int cc)
> {
> printf ("%d %d %d\n", a, aa + bb, cc);
> }
>
> foo (a, a + 1, q1);
> }
>
> int main()
> {
> qq (10);
> }
>
> Compile with:
> gcc -m32 -mregparm=3 -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
> address@hidden
> http://lists.gnu.org/mailman/listinfo/grub-devel
>
--
Regards
Vladimir 'phcoder' Serbinenko
Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
- Re: [RFC] Eliminate NESTED_ATTR_FUNC, (continued)
- Re: [RFC] Eliminate NESTED_ATTR_FUNC, Robert Millan, 2009/09/01
- Re: [RFC] Eliminate NESTED_ATTR_FUNC, Bean, 2009/09/01
- Re: [RFC] Eliminate NESTED_ATTR_FUNC, Yves Blusseau, 2009/09/01
- Re: [RFC] Eliminate NESTED_ATTR_FUNC, David Miller, 2009/09/01
- Re: [RFC] Eliminate NESTED_ATTR_FUNC, Vladimir 'phcoder' Serbinenko, 2009/09/03
- Re: [RFC] Eliminate NESTED_ATTR_FUNC, David Miller, 2009/09/03
- Message not available
- Message not available
- Fwd: [RFC] Eliminate NESTED_ATTR_FUNC, Vladimir 'phcoder' Serbinenko, 2009/09/06
- Re: Fwd: [RFC] Eliminate NESTED_ATTR_FUNC, Robert Millan, 2009/09/08
Re: [RFC] Eliminate NESTED_ATTR_FUNC, Bean, 2009/09/02
Re: [RFC] Eliminate NESTED_ATTR_FUNC, Robert Millan, 2009/09/03
Re: [RFC] Eliminate NESTED_ATTR_FUNC, Felix Zielcke, 2009/09/03
Re: [RFC] Eliminate NESTED_ATTR_FUNC, Vladimir 'phcoder' Serbinenko, 2009/09/03
Re: [RFC] Eliminate NESTED_ATTR_FUNC, Bean, 2009/09/03