[Toybox] ls.c compile error

enh enh at google.com
Wed Nov 6 20:20:20 PST 2019


On Wed, Nov 6, 2019 at 5:43 PM Rob Landley <rob at landley.net> wrote:
>
> On 11/6/19 3:41 PM, enh via Toybox wrote:
> > external/toybox/toys/posix/ls.c:408:53: error: variable 'curcol' is
> > uninitialized when used here
> >     unsigned curcol, lastlen = *len, lastcol = ul ? curcol : 0, color = 0;
> >                                                     ^~~~~~
> >
> > should this line have come *after* the next line?
>
> No, there was a declaration that wasn't at the start of the block and I collated
> it, but that changed the lifetime rules. (Well, it didn't _really_ and all the
> tests still pass, but it gave the optimizer the opportunity to screw stuff up,
> so a future version will. Oddly gcc doesn't complain about it being uninitialized.)
>
> The thing is, the logic wants the version from _last_ time through the loop, or
> zero the first time through. So putting it after curcol gets overwritten is
> still wrong.
>
> Lemme take a proper look at the logic and see what I can unravel here. (After
> breakfast, I'm late...)

(no hurry --- i still haven't had chance to investigate the xargs
issue. i'm just trying to keep on top of new stuff so i don't have a
big backlog of other stuff when i do.)

> Rob


More information about the Toybox mailing list