This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Linux/PPC gcc 2.95.2 - bad access generated when using inline func
- To: rearnsha at arm dot com
- Subject: Re: Linux/PPC gcc 2.95.2 - bad access generated when using inline func
- From: Franz Sirl <Franz dot Sirl-kernel at lauterbach dot com>
- Date: Fri, 30 Jun 2000 15:55:56 +0200
- Cc: Geoff Keating <geoffk at cygnus dot com>,cort at fsmlabs dot com,gcc-bugs at gcc dot gnu dot org
- References: <Your message of "Fri, 30 Jun 2000 14:30:03 +0200." <4.3.2.7.2.20000630142601.00de6280@mail.lauterbach.com>
At 14:44 30.06.00, Richard Earnshaw wrote:
>You need to provide an eh_epilogue insn when using this technique.
Hmm, we have a eh_epilogue define_expand on PPC, but I guess I trigger
something that isn't handled so far.
Find appended the current patch I'm working with and a testcase. Currently
the testcase still aborts with even my patch, but this is due to bug in
label handling in the current mainline, the buggy code looks like that on PPC:
.L10:
.L11:
slwi 0,30,2
lwzx 0,31,0
mtlr 0
blrl
lis 11,ret_addr@ha
lwz 0,ret_addr@l(11)
lis 9,.L11@ha
la 9,.L11@l(9)
cmpw 0,0,9
beq+ 0,.L9
bl abort
.L9:
Label .L11 has been moved in front of the function call :-(. It should be
placed immediately after the blrl.
It will be a few hours until I can look at that in depth again.
Franz.
extern void exit (int);
extern void abort (void);
extern void *alloca (int);
void * ret_addr;
char * dummy (void);
void test1 (void)
{
ret_addr = __builtin_return_address (0);
return;
}
void test2 (void)
{
dummy ();
ret_addr = __builtin_return_address (0);
return;
}
void test3 (void)
{
ret_addr = __builtin_return_address (0);
dummy ();
return;
}
char * dummy (void)
{
char * save = (char*) alloca (4);
return save;
}
int main (void)
{
#ifndef NO_LABEL_VALUES
void (*func[3])(void) = { test1, test2, test3 };
int i;
for (i = 0; i < 3; i++) {
func[i]();
ret_label:
if (&&ret_label != ret_addr)
abort ();
}
#endif
exit (0);
}
return_addr-try1.patch
20000630-1.c