[cfe-dev] warnings in clang
Ted Kremenek
kremenek at apple.com
Mon Nov 17 10:09:04 PST 2008
On Nov 14, 2008, at 3:51 PM, Mike Stump wrote:
> As I read that, it sounds like someone is praying and hoping and
> violating the language standard. Don't do that. We don't trick gcc
> into not complaining, if you do that, you _will_ lose. One _must_
> write code that is type safe. That isn't a trick. I reviewed lib/
> Bitcode/Reader/Deserialize.cpp Deserializer::ReadUIntPtr. :-( I
> don't see anything that is type safe about this code.
>
> :-(
>
> It is really easy to fix, for example:
>
> PtrRef = 0;
>
> becomes:
>
> uintptr_t x = 0;
> memcpy (&PtrRef, x, sizeof());
>
> suddenly, perfectly type safe, and, not an instruction larger, not a
> single clock slower to boot.
>
> Welcome to C.
Mike,
Thanks for reviewing the deserializer code. If you are up for it, it
would be really helpful if you submitted a patch that addresses your
concerns. That way our dialogue can certain around your patch.
Ted
More information about the cfe-dev
mailing list