[Toybox] Assigned value is garbage or undefined

Isaac Dunham ibid.ag at gmail.com
Tue Nov 18 15:52:04 PST 2014


On Tue, Nov 18, 2014 at 03:13:17PM -0800, Cynt Rynt wrote:
> Bug reported by the clang static analyzer.
> 
>  void chvt_main(void)
>  {
> -  int vtnum, fd = fd;
> +  int vtnum, fd = -2;
...
>  static void loopback_setup(char *device, char *file)
>  {
>    struct loop_info64 *loop = (void *)(toybuf+32);
> -  int lfd = -1, ffd = ffd;
> +  int lfd = -1, ffd = -1;

"a = a" does nothing useful, but that's the point:
whereever it's used, "a" is something that is assigned to in a way that
GCC is not aware of. It's a "shut up gcc" trick that has no effect on 
code size.


Thanks,
Isaac Dunham

 1416354724.0


More information about the Toybox mailing list