Skip to contentSkip to conversation

GCC 3.4-20041224: __attribute__ ((regparm)) misbehaviour

BUG Denis Zaitsev 2 participants 5 messages Dec 28, 2004

lore
Share & tools
lore
#0 lore raw

This program:

static
int x(int y)
__attribute__ ((regparm(1)));

static
int x(int y)

{
    return y;
}

can't be compiled with GCC 3.4.4 20041224. The compiler complains:

y-bug.c:7: error: conflicting types for 'x' y-bug.c:3: error: previous declaration of 'x' was here y-bug.c:7: error: conflicting types for 'x' y-bug.c:3: error: previous declaration of 'x' was here

It seems that it's a bug.

#1 lore raw
Quoted 7 lines · Denis Zaitsev

This program:

static
int x(int y)
__attribute__ ((regparm(1)));

Quoted 6 lines

static
int x(int y)

{
    return y;
}

No this is not a bug. You need regparm attribute on the function definition too.

-- Pinski

#2 lore raw
Quoted 17 lines · Andrew Pinski
Quoted 7 lines · Denis Zaitsev

This program:

static
int x(int y)
__attribute__ ((regparm(1)));

Quoted 6 lines

static
int x(int y)

{
    return y;
}
Quoted 2 lines

No this is not a bug. You need regparm attribute on the function definition too.

Hmm... Is it regparm-only related? And is it something new though? GCC 3.3.x doesnt show this behaviour.

#4 lore raw
Quoted 5 lines · Andrew Pinski
Quoted 2 lines · Denis Zaitsev

Hmm... Is it regparm-only related? And is it something new though? GCC 3.3.x doesnt show this behaviour.

Ok, thanks.