[ccan] [PATCH 1/3] configurator: avoid leaks that LeakSanitizer doesn't like and hide type punning

Rusty Russell rusty at rustcorp.com.au
Mon Aug 17 12:30:37 AEST 2015


Cody P Schafer <dev at codyps.com> writes:
> These leaks aren't really an issue since they are completely bounded,
> but if one is building with leak sanitizer enabled (as
> -fsanitize=address does in gcc-5.1), it kills the configurator, which
> isn't very useful for us. Add the few free() calls it's looking for.

No problem, I've applied this part.

> As for the type punning: gcc-5.1 (at least) warns about type punning in
> the previous example. The new usage should be exactly equivalent to the
> old, but just seperates the cast and deref into 2 statements. Frankly,
> I'm suprised gcc's type-punning analysis is so limited.

AFAICT you're always allowed to cast char, it's special.

Hmm, gcc-5 here doesn't give a warning:

$ gcc-5 -std=gnu11 -Wall -c /tmp/foo.c
$ gcc-5 --version
gcc-5 (Ubuntu 5.1.1-4ubuntu12) 5.1.1 20150504

Confused,
Rusty.


More information about the ccan mailing list