The openrisc bugtracker has been moved to: bugzilla.opencores.org. This page is read-only
GDB does not handle functions with float args with K&R prototypes
Information:
Type :: BUG
Status :: CLOSED
Assigned to ::
Jeremy, Bennett
Description:
GDB has a problem passing args correctly to dummy function calls if that function takes a float argument, and is specified using a Kernigan & Ritchie style function prototype, rather than an ANSI prototype.
Test program:
float foo = '1';
float L;
#ifdef KR
void Fun (foo)
float foo;
#else
void Fun (float foo)
#endif
{
L = foo;
} /* Fun () */
int main ()
{
Fun (foo);
return 0;
} /* main () */
This can be compiled using the ANSI function prototype using:
or32-elf-gcc -g -mor32-newlib call-test.c
And as K&R function prototype using:
or32-elf-gcc -g -mor32-newlib -DKR call-test.c
This should be debugged with GDB, using the following commands
file a.out target sim load break main run call Fun(foo) print /c L
Fun should set the float global variable L to the value in the float global variable foo, which as a char is '1'. It works with the ANSI version, not the K&R version.
It seems that the K&R version effectively treats the argument as double, even though declared float. However when called as a dummy function within GDB, the argument is set up as a float.
Not clear if this is a generic GDB issue, or a fault in the OR32 function to set up a dummy call.
No one is likely to write (and hence debug) K&R code today, but there is still a lot out there, so we should support this. For now the regression is run using -DPROTOTYPES in the C flags, which means all tests are compiled using prototypes.
Jeremy
--
Tel: +44 (1590) 610184
Cell: +44 (7970) 676050
SkypeID: jeremybennett
Email: jeremy.bennett@embecosm.com
Web: www.embecosm.com
Comments:
| Bennett, Jeremy | Jul 4, 2011 |
|---|---|
|
Transferred to OpenRISC bugzilla (Bug 22). Marking closed in this bugtracker. |
|
| Bennett, Jeremy | Aug 21, 2010 |
|---|---|
|
The known regression test that can trigger this is in gdb.base/call-sc.exp. |
|
Post a comment:
Login to post comments!
