[cfe-dev] FW: GSL 'make check' failure

Eli Friedman eli.friedman at gmail.com
Tue Jul 8 09:20:29 PDT 2008


On Tue, Jul 8, 2008 at 12:15 AM, Kelly Wilson <wilsonkk at shaw.ca> wrote:
> Hello Matthijs,
>
> Actually I just checked and the problem with this bit of code is an unsigned
> integer value for 'i'.
>
> What I previously failed to show in the code snippet was that 'i' is
> declared as type 'size_t'...which I'm guessing defaults to uint32 in this
> case.

Can you give a reduced testcase, i.e. something that I could actually
compile to reproduce the issue?  If you have trouble reducing it, the
output of clang -E for the whole file would be fine.  I'll try to
figure it out, but having actual code will make it a lot easier.

(That said, this looks a bit similar to a bug I fixed recently; are
you updated to trunk?)

Another thing that might help is a diff between the output of clang
-emit-llvm of the unsigned int version vs the output of clang
-emit-llvm for the int version.  That would help narrow down the
problem.

> Instead of using 'size_t i;' I replaced it with a signed int and things
> worked fine. But if I used an unsigned variable then things blew up. Here is
> a failure table:
>
> short           pass
> ushort  pass
>
> int             pass
> uint            fail
>
> long            pass
> ulong           fail
>
> long long       pass
> ulong long      fail
>
>
> Unsigned short doesn't blow up???? Hmmmm....

My guess is that's because unsigned short promotes to int.  Although,
it's not obvious to me why signed vs unsigned would result in
different code...

-Eli



More information about the cfe-dev mailing list