Re: [dev] [st] can't set reverse cursor

From: Markus Wichmann <nullplan_AT_gmx.net>
Date: Wed, 19 Oct 2016 18:57:32 +0200

On Wed, Oct 19, 2016 at 11:02:03AM +0100, Cág wrote:
> Hi,
>
> I have 16 colours in config.h from my palette, from 0 to 15,
> with 0 (black) being defaultbg and 7 (white) being defaultfg.
> My cursor is 12 (brblue) and reverse cursor is set 7 (white).
> However, in reality reverse cursor is 0 (black), which is bg.
> Also, setting rcs to any other colour doesn't help and it
> remains the same, that of defaultbg.
>
> Also, compiling gives me this:
> --------------------------------
> st.c:3135:14: warning: 'width' may be used uninitialized in this function
> [-Wmaybe-uninitialized]
> if (term.c.x+width < term.col) {
> ~~~~~~~~^~~~~~
> --------------------------------
>
>
> Cág
>

That message is strange, because I thought GCC performed control flow
analysis to see if variables are initialized or not. But here there
appears to be a bug in it.

The statement in question appears in the function tputc(), which is
rather large. However, it starts with an if-else selection, The only way
to get past it without assigning some value to width is by having the
UTF-8 or SIXEL mode bits set and control be set to nonzero. If control
is set to nonzero then the function will return early directly after
"check_control_code:", so the statement in question here is never
reached.

So, GCC is talking bollocks here.

Ciao,
Markus
Received on Wed Oct 19 2016 - 18:57:32 CEST

This archive was generated by hypermail 2.3.0 : Wed Oct 19 2016 - 19:00:14 CEST