Opened 7 months ago

Last modified 7 months ago

#69374 new defect

gcc13 optimizer bug in ncurses — at Initial Version

Reported by: ThomasDickey (Thomas Dickey) Owned by:
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: gcc13

Description

I noticed a problem in ncurses not displaying multibyte characters (used in line-drawing), and narrowed it down to a problem optimizing an expression in tty_update.c, using this chunk(https://github.com/ThomasDickey/ncurses-snapshots/blob/a98f459acb17efd5c1754d12efdfeba8cdb70e68/ncurses/curses.priv.h#L1458):

} else { \

int PUTC_j; \ for (PUTC_j = 0; PUTC_j < PUTC_n; ++PUTC_j) { \

TR_PUTC(PUTC_buf[PUTC_j]); \ NCURSES_OUTC_FUNC (NCURSES_SP_ARGx PUTC_buf[PUTC_j]); \

} \

} \

used here(https://github.com/ThomasDickey/ncurses-snapshots/blob/a98f459acb17efd5c1754d12efdfeba8cdb70e68/ncurses/tty/tty_update.c#L357):

PUTC(CHDEREF(ch));

There's no issue reported in valgrind, address sanitizer, etc., in other environments, which would indicate a problem in ncurses, but with optimization that goes through the loop the expected number of times but fails to call the output NCURSES_OUTC_FUNC more than once.

If it helps, I can attach the generated assembly for gcc12 (working) and gcc13 (nonworking).

Change History (0)

Note: See TracTickets for help on using tickets.