[openssl-dev] [openssl.org #4422] OS X 32-bit PowerPC: blake2b.c:27: warning: integer constant is too large for 'unsigned long' type

Kurt Roeckx via RT rt at openssl.org
Sun Mar 13 11:40:22 UTC 2016


On Sun, Mar 13, 2016 at 11:27:23AM +0000, noloader at gmail.com via RT wrote:
> >> static const uint64_t blake2b_IV[8] =
> >> {
> >>     0x6a09e667f3bcc908U, 0xbb67ae8584caa73bU,
> >>     0x3c6ef372fe94f82bU, 0xa54ff53a5f1d36f1U,
> >>     0x510e527fade682d1U, 0x9b05688c2b3e6c1fU,
> >>     0x1f83d9abfb41bd6bU, 0x5be0cd19137e2179U
> >> };
> >>
> >> I've run into this before, but in C++. I think you need ULL, and not
> >> U. But I don't know if it will adversely affect other compilers and
> >> platforms.
> >
> > So I guess where in the situation where "U" is not supported by
> > some compilers and "ULL" not by others, where both should be
> > valid.
> 
> I'm guessing GCC 4.0.1 is using an intermediate 32-bit value when it
> encounters the U. Its triggering a warning, but its not causing a
> failure of the self test (presuming there's good code coverage).
> 
> Also see http://gcc.gnu.org/onlinedocs/gcc/Long-Long.html.

If you look at:
http://en.cppreference.com/w/c/language/integer_constant

You'll see that "U" can be "unsigned int", "unsigned long int"
or "unsigned long long int".  "ULL" just forces it to an unsigned
long long.

It might be that in C89/C90 mode it gives a warning about it and
that in C99 it should work, don't know enough about this.

But since this compiles and passes the test suite for you I think
I'll ignore it.


Kurt


-- 
Ticket here: http://rt.openssl.org/Ticket/Display.html?id=4422
Please log in as guest with password guest if prompted



More information about the openssl-dev mailing list