Workaround egcs-20000131 c++ compiler bug

Martin Buchholz martin@xemacs.org
Thu Feb 3 13:57:00 GMT 2000


>>>>> "ZW" == Zack Weinberg <zack@wolery.cumb.org> writes:

>> +#if defined (__GNUC__) && defined (__cplusplus)
>> +  alloca (4);
>> +#endif

ZW> The effect of that is simply to shut off the RTL inliner for that
ZW> function.  Is it marked 'inline', and if not, could you add that to
ZW> the declaration and see if the problem comes back?  (The tree inliner,
ZW> which only exists in C++, will inline functions that use alloca, but
ZW> not functions that were not explicitly declared as inline.)

I may not have understood your question completely the first time.  If
I naively add `inline' to my function calling alloca (4), I get:

/hack/import/egcs-20000131/inst/linux-libc2/bin/c++ -c -mcpu=pentiumpro -march=pentiumpro -fstrict-aliasing -O3 -Wall -Wpointer-arith -Winline -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wno-switch -Wno-sign-compare -Wno-uninitialized  -Demacs -I. -DHAVE_CONFIG_H -I/usr/local/include -I/usr/X11R6/include /xemacs/ws/dev/src/minibuf.c
/xemacs/ws/dev/src/minibuf.c: In function `void echo_area_append (frame *, const Bufbyte *, long int, long int, long int, long int)':
/xemacs/ws/dev/src/minibuf.c:708: warning: function using alloca cannot be inline

Despite this, I still get the same crash (after fixing external
dependencies on the function as described in my previous message).

And the stack trace shows that echo_area_append() was in fact inlined
into its caller echo_area_message(), despite the warning that it could
not be.  So this warning also needs to be fixed.  Don't lie to the user!

#0  0x40293111 in __kill ()
#1  0x40292d66 in raise (sig=6) at ../sysdeps/posix/raise.c:27
#2  0x40294447 in abort () at ../sysdeps/generic/abort.c:88
#3  0x8089141 in assert_failed () at /xemacs/ws/dev/src/doprnt.c:890
#4  0x80532f2 in make_uninit_string () at /xemacs/ws/dev/src/abbrev.c:463
#5  0x80578f8 in make_string () at /xemacs/ws/dev/src/abbrev.c:463
#6  0x812dc5e in echo_area_message__FP5framePCUcllll (f=0x82e0258, nonreloc=0x0, reloc=137780028, offset=0, length=-1, label=136758932) at /xemacs/ws/dev/src/minibuf.c:740
#7  0x812df08 in message__FPCce (fmt=0x81ccc08 "Loading %s...") at /xemacs/ws/dev/src/minibuf.c:864


More information about the Gcc-bugs mailing list