Warnings from Clang 3.7

Paul Menzel paulepanter at users.sourceforge.net
Sat Apr 11 22:18:38 CEST 2015


Dear Werner,


Thank you for the quick reply!


Am Samstag, den 11.04.2015, 14:57 +0200 schrieb Werner Koch:
> On Sat, 11 Apr 2015 10:14, paulepanter at users.sourceforge.net said:
> 
> > Clang 3.7 reports some warnings. Are these expected? If not, could you
> 
> I recently spend a lot of time with the STACK utility to make the code
> more robust.

Could you please give me an URL to that utility? Searching with the
keywords *stack* and *utility* does not give any useful results.

> Backporting these changes is not necessary justified.

Agreed.

> This if you want the latest code please use git master.

Ah, I didn’t know about the official Git repository. The search engine
had the page at the Free Software Directory [1] sorted at the top. This
seems outdated as it shows Libgrypt 1.6.2 as the latest release and
lists a CVS command to get a VCS checkout.

        -d :pserver:anoncvs at cvs.gnupg.org:/cvs/gnupg

And on the „official“ site [2], I overread it in the sentence.

        Development versions are available at
        ftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/. To access the GIT
        repository you may use this command: "git clone
        git://git.gnupg.org/libgcrypt.git"

I think I was distracted, because clicking on the FTP URL gives an
error, that the directory does not exist.

Could you please also add a link to the Gitweb installation to browse
the repository online. Lastly, on the Gitweb page [1], it’d be great to
have the clone URL listed.

With commit a06fbc0 (wipememory: use one-byte aligned type for unaligned
memory accesses), Clang 3.7 shows the following warnings.

        $ CC=clang-3.7 ./configure --disable-bindings --disable-doc
        $ CC=clang-3.7 make -j 6
        […]
        /bin/bash ../libtool  --tag=CC   --mode=compile clang-3.7 -DHAVE_CONFIG_H -I. -I..  -I../src -I../src   -g -O2 -fvisibility=hidden -Wall -MT primegen.lo -MD -MP -MF .deps/primegen.Tpo -c -o primegen.lo primegen.c
        poly1305.c:351:29: warning: unused variable 'poly1305_default_ops' [-Wunused-const-variable]
        static const poly1305_ops_t poly1305_default_ops = {
                                    ^
        […]
        liblibtool: compile:  clang-3.7 -DHAVE_CONFIG_H -I. -I.. -g -O2 -fvisibility=hidden -Wall -MT libgcrypt_la-hwfeatures.lo -MD -MP -MF .deps/libgcrypt_la-hwfeatures.Tpo -c hwfeatures.c  -fPIC -DPIC -o .libs/libgcrypt_la-hwfeatures.o
        global.c:578:10: warning: case value not in enumerated type 'enum gcry_ctl_cmds' [-Wswitch]
            case 58:  /* Init external random test.  */
                 ^
        global.c:595:10: warning: case value not in enumerated type 'enum gcry_ctl_cmds' [-Wswitch]
            case 59:  /* Run external random test.  */
                 ^
        global.c:606:10: warning: case value not in enumerated type 'enum gcry_ctl_cmds' [-Wswitch]
            case 60:  /* Deinit external random test.  */
                 ^
        global.c:612:10: warning: case value not in enumerated type 'enum gcry_ctl_cmds' [-Wswitch]
            case 61:  /* Run external lock test */
                 ^
        global.c:615:10: warning: case value not in enumerated type 'enum gcry_ctl_cmds' [-Wswitch]
            case 62:  /* RFU */
                 ^tool: compile:  clang-3.7 -DHAVE_CONFIG_H -I. -I.. -g -O2 -fvisibility=hidden -Wall -MT libgcrypt_la-hwfeatures.lo -MD -MP -MF .deps/libgcrypt_la-hwfeatures.Tpo -c hwfeatures.c  -fPIC -DPIC -o .libs/libgcrypt_la-hwfeatures.o
        global.c:578:10: warning: case value not in enumerated type 'enum gcry_ctl_cmds' [-Wswitch]
            case 58:  /* Init external random test.  */
                 ^
        global.c:595:10: warning: case value not in enumerated type 'enum gcry_ctl_cmds' [-Wswitch]
            case 59:  /* Run external random test.  */
                 ^
        global.c:606:10: warning: case value not in enumerated type 'enum gcry_ctl_cmds' [-Wswitch]
            case 60:  /* Deinit external random test.  */
                 ^
        global.c:612:10: warning: case value not in enumerated type 'enum gcry_ctl_cmds' [-Wswitch]
            case 61:  /* Run external lock test */
                 ^
        global.c:615:10: warning: case value not in enumerated type 'enum gcry_ctl_cmds' [-Wswitch]
            case 62:  /* RFU */
                 ^
        […]
        clang-3.7 -DHAVE_CONFIG_H -I. -I..  -I../src -I../src   -g -O2 -fvisibility=hidden -Wall -MT hmac.o -MD -MP -MF .deps/hmac.Tpo -c -o hmac.o hmac.c
        basic.c:7170:7: warning: variable 'pkey' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
          if (!err)
              ^~~~
        basic.c:7176:33: note: uninitialized use occurs here
          do_check_one_pubkey (n, skey, pkey,
                                        ^~~~
        basic.c:7170:3: note: remove the 'if' if its condition is always true
          if (!err)
          ^~~~~~~~~
        basic.c:7166:25: note: initialize the variable 'pkey' to silence this warning
          gcry_sexp_t skey, pkey;
                                ^
                                 = NULL
        mv -f .deps/t-sexp.Tpo .deps/t-sexp.Po
        clang-3.7 -DHAVE_CONFIG_H -I. -I..  -I../src -I../src   -g -O2 -fvisibility=hidden -Wall -MT hashtest.o -MD -MP -MF .deps/hashtest.Tpo -c -o hashtest.o hashtest.c
        pubkey.c:341:7: warning: variable 'sec_key' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
          if (!rc)
              ^~~
        pubkey.c:347:11: note: uninitialized use occurs here
          *skey = sec_key;
                  ^~~~~~~
        pubkey.c:341:3: note: remove the 'if' if its condition is always true
          if (!rc)
          ^~~~~~~~
        pubkey.c:326:31: note: initialize the variable 'sec_key' to silence this warning
          gcry_sexp_t pub_key, sec_key;   
                                      ^
                                       = NULL
        mv -f .deps/t-mpi-point.Tpo .deps/t-mpi-point.Po
        […]

> > fipsdrv.c:752:7: warning: variable 's_sig' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
> 
> This is in the regression test suite and in particular this program is
> not actually used.

I see. I don’t paste the warnings in here then. Should the file then be
removed from the repository?


Thanks,

Paul


[1] http://directory.fsf.org/wiki/Libgcrypt
[2] https://www.gnu.org/software/libgcrypt/
[3] http://git.gnupg.org/cgi-bin/gitweb.cgi?p=libgcrypt.git;a=summary
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part
URL: </pipermail/attachments/20150411/a9a25a1e/attachment.sig>


More information about the Gcrypt-devel mailing list