Mailing List Archive

"initializer does not fit or is out of range" warnings with Sun C compiler
The Sun C compiler gives the following warning when compiling
src/hmac256.c:

cc -DHAVE_CONFIG_H -I. -I.. -DSTANDALONE -mr -Qn -xstrconst -xO2 -xtarget=ultra2 -xarch=v8plusa -c -o hmac256-hmac256.o `test -f 'hmac256.c' || echo './'`hmac256.c
"hmac256.c", line 535: warning: initializer does not fit or is out of range: 220
"hmac256.c", line 535: warning: initializer does not fit or is out of range: 193
"hmac256.c", line 535: warning: initializer does not fit or is out of range: 191
"hmac256.c", line 536: warning: initializer does not fit or is out of range: 149
"hmac256.c", line 536: warning: initializer does not fit or is out of range: 199
"hmac256.c", line 537: warning: initializer does not fit or is out of range: 157
"hmac256.c", line 537: warning: initializer does not fit or is out of range: 131
...

Should we change:
const char expect[32]
to:
const unsigned char expect[32]

--
albert chin (china@thewrittenword.com)

_______________________________________________
Gcrypt-devel mailing list
Gcrypt-devel@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gcrypt-devel
Re: "initializer does not fit or is out of range" warnings with Sun C compiler [ In reply to ]
On Fri, 17 Oct 2008 21:24, gcrypt-devel@mlists.thewrittenword.com said:
> The Sun C compiler gives the following warning when compiling
> src/hmac256.c:
>
> cc -DHAVE_CONFIG_H -I. -I.. -DSTANDALONE -mr -Qn -xstrconst -xO2 -xtarget=ultra2 -xarch=v8plusa -c -o hmac256-hmac256.o `test -f 'hmac256.c' || echo './'`hmac256.c
> "hmac256.c", line 535: warning: initializer does not fit or is out of range: 220

I guess that char is signed and initializing with a value > 127 leads to
this error. I changed the type to an unsigned char array in 1.4.4.

Thanks,

Werner

--
Die Gedanken sind frei. Auschnahme regelt ein Bundeschgesetz.


_______________________________________________
Gcrypt-devel mailing list
Gcrypt-devel@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gcrypt-devel