This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: __attribute__ ((regparm(...))) in function declaration and gcc 3.4.0
- From: "Giovanni Bajo" <giovannibajo at libero dot it>
- To: "Nicholas Nethercote" <njn25 at cam dot ac dot uk>,"Serge Belyshev" <1319 at bot dot ru>
- Cc: <gcc at gcc dot gnu dot org>,"Zack Weinberg" <zack at codesourcery dot com>
- Date: Mon, 1 Mar 2004 01:41:45 +0100
- Subject: Re: __attribute__ ((regparm(...))) in function declaration and gcc 3.4.0
- References: <87oerix8sf.fsf@bot.ru> <Pine.SOL.4.58.0402292216350.18360@red.csi.cam.ac.uk>
Nicholas Nethercote wrote:
>> Why this fails to compile with gcc 3.4.0 (i686-pc-linux-gnu,
>> 20030229)?
>>
>> $ cat > test.h
>> int plus (int a, int b) __attribute__ ((regparm (2)));
>> $ cat > test.c
>> #include "test.h"
>>
>> int plus (int a, int b)
>> {
>> return a + b;
>> }
>> $ gcc -c test.c
>> test.c:4: error: conflicting types for 'plus'
>> test.h:1: error: previous declaration of 'plus' was here
>> test.c:4: error: conflicting types for 'plus'
>> test.h:1: error: previous declaration of 'plus' was here
>
> Try adding the __attribute__((regparm(2))) to the function definition
> as well. It seems this behaviour is new with 3.4.0.
Yes, but I don't know if this is intended. Maybe someone can clarify this?
Otherwise we should file a bugreport.
Giovanni Bajo