Re: Explicitly cast the return variable in tls_load_file()
I could have an answer that this compilation error was a bug of compiler, and that bug will be tracked. https://software.intel.com/en-us/forums/intel-c-compiler/topic/698109 I saw the type of buf was changed in cvs, then I can avoid this compilation problem. Thanks. Kinichiro
Re: Explicitly cast the return variable in tls_load_file()
Thanks, that is apparently better than I suggested and reasonable. And I confirmed it can also avoid the issue. I appreciate if this is applied. And, yes I believe compilation error is bug of compiler, not source code. I posted this compilation error to Intel C++ compiler forum on Sunday. https://software.intel.com/en-us/forums/intel-c-compiler My post is not showed up yet since it is not approved on weekend, though, I would like to confirm the thoughts of compiler side.
Re: Explicitly cast the return variable in tls_load_file()
Brent Cook wrote: > Why not just make the variable type match the return type to begin with? sure, that's reasonable. > > --- a/src/lib/libtls/tls_util.c > +++ b/src/lib/libtls/tls_util.c > @@ -105,7 +105,8 @@ tls_load_file(const char *name, size_t *len, char > *password) > FILE *fp; > EVP_PKEY *key = NULL; > BIO *bio = NULL; > - char *data, *buf = NULL; > + char *data; > + uint8_t *buf = NULL; > struct stat st; > size_t size; > int fd = -1;
Re: Explicitly cast the return variable in tls_load_file()
On Sat, Oct 1, 2016 at 7:12 PM, Ted Unangst <t...@tedunangst.com> wrote: > Kinichiro Inoguchi wrote: > > I would like to cast the return variable explicitly in tls_load_file(). > > This fix also avoiding Intel C++ compiler "assertion failed" described > here. > > https://github.com/libressl-portable/portable/issues/209# > issuecomment-249587024 > > This is a compiler bug? The code doesn't change, and there's no bug in the > library that I see. > If the compiler is implying that the code is incorrect, it has a funny way of saying it. This looks not-dissimilar to a gcc ICE: 1>C:\libressl-2.5.0\tls\tls_util.c(157): error : assertion failed: construct_message: not all fill-ins used (shared/cfe/edgcpfe/error.c, line 3586) 1> Why not just make the variable type match the return type to begin with? --- a/src/lib/libtls/tls_util.c +++ b/src/lib/libtls/tls_util.c @@ -105,7 +105,8 @@ tls_load_file(const char *name, size_t *len, char *password) FILE *fp; EVP_PKEY *key = NULL; BIO *bio = NULL; - char *data, *buf = NULL; + char *data; + uint8_t *buf = NULL; struct stat st; size_t size; int fd = -1;
Re: Explicitly cast the return variable in tls_load_file()
Kinichiro Inoguchi wrote: > I would like to cast the return variable explicitly in tls_load_file(). > This fix also avoiding Intel C++ compiler "assertion failed" described here. > https://github.com/libressl-portable/portable/issues/209#issuecomment-249587024 This is a compiler bug? The code doesn't change, and there's no bug in the library that I see.
Explicitly cast the return variable in tls_load_file()
I would like to cast the return variable explicitly in tls_load_file(). This fix also avoiding Intel C++ compiler "assertion failed" described here. https://github.com/libressl-portable/portable/issues/209#issuecomment-249587024 ok ? Index: tls_util.c === RCS file: /cvs/src/lib/libtls/tls_util.c,v retrieving revision 1.3 diff -u -p -r1.3 tls_util.c --- tls_util.c 9 Sep 2015 19:49:07 - 1.3 +++ tls_util.c 1 Oct 2016 11:30:28 - @@ -154,7 +154,7 @@ tls_load_file(const char *name, size_t * done: *len = size; - return (buf); + return ((uint8_t *)buf); fail: free(buf);