Linux/PPC gcc 2.95.2 - bad access generated when using inline func

Cort Dougan cort@fsmlabs.com
Tue Jun 27 18:37:00 GMT 2000


GCC and system version
---
Reading specs from /usr/lib/gcc-lib/powerpc-unknown-linux-gnu/2.95.2/specs
gcc version 2.95.2 19991024 (release)
cort@medea<cort>$ uname -a
Linux medea.fsmlabs.com 2.2.17pre5 #8 SMP Sun Jun 25 00:09:10 MDT 2000 ppc unknown

GCC command line and files
---
gcc -I/sys/linux/include -I/sys/rtlinux/include -I/sys/rtlinux/include/compat  -I/sys/rtlinux/include/posix -Wall -Wstrict-prototypes -O2 -g -D__RTL__ -D__KERNEL__ -DMODULE -D__powerpc__ -fsigned-char -msoft-float -pipe -fno-builtin -ffixed-r2 -Wno-uninitialized -mmultiple -mstring -DMODVERSIONS -include /sys/linux/include/linux/modversions.h  -D__powerpc__  -c rtl_core.c -o rtl_core.o

Preprocessed output is attached (rtl_core.i.bz2)

I'm also attaching bitops.h and rtl_core.c.

The problem
---
Calling change_bit() when it's an inline will cause a load from a bad
address when change_bit() is called from a leaf function.  If a call to a
function (even an empty one) in the same function that calls change_bit()
then no bad access happens.

I switched the Linux/PPC bitops (file attached) to be inline rather than
actual function calls.  Now, RTLinux dies when I run it.

The problem shows up in rtl_soft_cli() when it does a L_CLEAR() which is a
define that does a change_bit() (which is now inline).  As the function
rtl_soft_cli() is now gcc produces asm that tries a load from a bad
address.  If I make rtl_soft_cli() a non-leaf function (by making a call to
an empty function) the code runs without trouble.  The only difference in
the asm generated is the prologue/epilogue save/restore of some general
purpose registers.

I've checked the constraints in change_bit() and think they're correct.  I
included bitops.h in case they're not.

I can provide the whole source tree for RTL (it's small) and a recipe to
reproduce the problem and workaround if you need.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rtl_core.i.bz2
Type: application/x-bzip2
Size: 50269 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-bugs/attachments/20000627/c0cb8833/attachment.bz2>


More information about the Gcc-bugs mailing list