Incorrect optimization for function__libc_message on C-SKY
Mao Han
han_mao@c-sky.com
Fri Aug 9 09:00:00 GMT 2019
Hi,
I've got some probelm with the optimization of __libc_message on C-SKY.
__libc_message show nothing when MALLOC_CHECK_=3 is set.
./include/stdio.h:101
enum __libc_message_action
{
do_message = 0, /* Print message. */
do_abort = 1 << 0, /* Abort. */
do_backtrace = 1 << 1 /* Backtrace. */
};
sysdeps/posix/libc_fatal.c:175
if ((action & do_abort))
{
if ((action & do_backtrace))
BEFORE_ABORT (do_abort, written, fd);
/* Kill the application. */
abort ();
The type of action is enum __libc_message_action, the C-SKY compiler
think the action can not be both do_abort and do_backtrace at the
same time, this path is supposed to be inaccessible.
./sysdeps/unix/sysv/linux/libc_fatal.c:41
static void
backtrace_and_maps (int do_abort, bool written, int fd)
{
if (do_abort > 1 && written)
{
void *addrs[64];
#define naddrs (sizeof (addrs) / sizeof (addrs[0]))
int n = __backtrace (addrs, naddrs);
backtrace_and_maps is called with BEFORE_ABORT (do_abort, written, fd);
do_abort equals to 1, and the function also check do_abort > 1, so the
entire backtrace_and_maps is optimized.
Some one can explain the excepted logic here?
Thanks
Mao Han
More information about the Libc-alpha
mailing list