Skip to content

OpenSSL 1.0.2n fails to build with clang 4 #4865

@Sp1l

Description

@Sp1l

This fails to build with clang. Discovered when updating the port to 1.0.2n for FreeBSD of which I am the maintainer.

cc -I.. -I../include  -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -pthread -D_THREAD_SAFE -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DL_ENDIAN -O3 -Wall -O2 -fno-strict-aliasing -pipe -march=native  -Werror -Qunused-arguments -fstack-protector -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DRC4_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -c fatalerrtest.c -o fatalerrtest.o
fatalerrtest.c:79:47: error: sizeof on pointer operation will return size of 'char *' instead of 'char [80]' [-Werror,-Wsizeof-array-decay]
    if ((len = SSL_read(sssl, buf, sizeof(buf - 1))) > 0) {
                                          ~~~ ^
fatalerrtest.c:48:9: error: variable 'sssl' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
    if (!SSL_CTX_set_cipher_list(sctx, "AES128-SHA")
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fatalerrtest.c:91:14: note: uninitialized use occurs here
    SSL_free(sssl);
             ^~~~
fatalerrtest.c:48:5: note: remove the 'if' if its condition is always false
    if (!SSL_CTX_set_cipher_list(sctx, "AES128-SHA")
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fatalerrtest.c:48:9: error: variable 'sssl' is used uninitialized whenever '||' condition is true [-Werror,-Wsometimes-uninitialized]
    if (!SSL_CTX_set_cipher_list(sctx, "AES128-SHA")
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fatalerrtest.c:91:14: note: uninitialized use occurs here
    SSL_free(sssl);
             ^~~~
fatalerrtest.c:48:9: note: remove the '||' if its condition is always false
    if (!SSL_CTX_set_cipher_list(sctx, "AES128-SHA")
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fatalerrtest.c:38:9: error: variable 'sssl' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
    if (!create_ssl_ctx_pair(SSLv23_method(), SSLv23_method(), &sctx, &cctx,
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fatalerrtest.c:91:14: note: uninitialized use occurs here
    SSL_free(sssl);
             ^~~~
fatalerrtest.c:38:5: note: remove the 'if' if its condition is always false
    if (!create_ssl_ctx_pair(SSLv23_method(), SSLv23_method(), &sctx, &cctx,
fatalerrtest.c:48:9: error: variable 'sssl' is used uninitialized whenever '||' condition is true [-Werror,-Wsometimes-uninitialized]
    if (!SSL_CTX_set_cipher_list(sctx, "AES128-SHA")
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fatalerrtest.c:91:14: note: uninitialized use occurs here
    SSL_free(sssl);
             ^~~~
fatalerrtest.c:48:9: note: remove the '||' if its condition is always false
    if (!SSL_CTX_set_cipher_list(sctx, "AES128-SHA")
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fatalerrtest.c:38:9: error: variable 'sssl' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
    if (!create_ssl_ctx_pair(SSLv23_method(), SSLv23_method(), &sctx, &cctx,
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fatalerrtest.c:91:14: note: uninitialized use occurs here
    SSL_free(sssl);
             ^~~~
fatalerrtest.c:38:5: note: remove the 'if' if its condition is always false
    if (!create_ssl_ctx_pair(SSLv23_method(), SSLv23_method(), &sctx, &cctx,
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fatalerrtest.c:17:14: note: initialize the variable 'sssl' to silence this warning
    SSL *sssl, *cssl;
             ^
              = NULL
fatalerrtest.c:48:9: error: variable 'cssl' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
    if (!SSL_CTX_set_cipher_list(sctx, "AES128-SHA")
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fatalerrtest.c:92:14: note: uninitialized use occurs here
    SSL_free(cssl);
             ^~~~
fatalerrtest.c:48:5: note: remove the 'if' if its condition is always false
    if (!SSL_CTX_set_cipher_list(sctx, "AES128-SHA")
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fatalerrtest.c:48:9: error: variable 'cssl' is used uninitialized whenever '||' condition is true [-Werror,-Wsometimes-uninitialized]
    if (!SSL_CTX_set_cipher_list(sctx, "AES128-SHA")
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fatalerrtest.c:92:14: note: uninitialized use occurs here
    SSL_free(cssl);
             ^~~~
fatalerrtest.c:48:9: note: remove the '||' if its condition is always false
    if (!SSL_CTX_set_cipher_list(sctx, "AES128-SHA")
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fatalerrtest.c:38:9: error: variable 'cssl' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
    if (!create_ssl_ctx_pair(SSLv23_method(), SSLv23_method(), &sctx, &cctx,
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fatalerrtest.c:92:14: note: uninitialized use occurs here
    SSL_free(cssl);
             ^~~~
fatalerrtest.c:38:5: note: remove the 'if' if its condition is always false
    if (!create_ssl_ctx_pair(SSLv23_method(), SSLv23_method(), &sctx, &cctx,
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fatalerrtest.c:17:21: note: initialize the variable 'cssl' to silence this warning
    SSL *sssl, *cssl;
                    ^
                     = NULL
7 errors generated.
*** Error code 1

Stop.
make[3]: stopped in /usr/ports/security/openssl/work/openssl-1.0.2n/test
*** Error code 1

Stop.
make[2]: stopped in /usr/ports/security/openssl/work/openssl-1.0.2n
*** Error code 1

Stop.

FreeBSD 11.1 amd64
clang 4.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions