Page MenuHome GnuPG

2.3.2: compile and link time warnings
Closed, WontfixPublic

Description

gcc 11.2.1
Summary stats about compile and link time warnings:

[tkloczko@barrel SPECS]$ rpmbuild -ba gnupg2.spec --quiet 2>&1 | grep -- -W | sed 's/.*\[//; s/\]//' | sort | uniq -c | sort -nr
     29 -Wunused-result
     25 -Wlto-type-mismatch
      7 -Wstringop-overflow=

No one really build gnupg using LTO??
And those Wstringop-overflow= looks bad as well :/

Below detailed log is with autoconf 2.71 warnings as well

autoreconf: export WARNINGS=
autoreconf: Entering directory '.'
autoreconf: running: autopoint --force
autoreconf: running: aclocal --force -I m4
autoreconf: configure.ac: tracing
autoreconf: configure.ac: not using Libtool
autoreconf: configure.ac: not using Intltool
autoreconf: configure.ac: not using Gtkdoc
autoreconf: running: /usr/bin/autoconf --force
configure.ac:86: warning: The macro `AC_CONFIG_HEADER' is obsolete.
configure.ac:86: You should run autoupdate.
./lib/autoconf/status.m4:719: AC_CONFIG_HEADER is expanded from...
configure.ac:86: the top level
configure.ac:1303: warning: The macro `AC_TRY_LINK' is obsolete.
configure.ac:1303: You should run autoupdate.
./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
./lib/autoconf/general.m4:2249: AC_CACHE_VAL is expanded from...
./lib/autoconf/general.m4:2270: AC_CACHE_CHECK is expanded from...
m4/iconv.m4:20: AM_ICONV_LINK is expanded from...
m4/iconv.m4:154: AM_ICONV is expanded from...
configure.ac:1303: the top level
configure.ac:1303: warning: The macro `AC_TRY_RUN' is obsolete.
configure.ac:1303: You should run autoupdate.
./lib/autoconf/general.m4:2997: AC_TRY_RUN is expanded from...
lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
./lib/autoconf/general.m4:2249: AC_CACHE_VAL is expanded from...
./lib/autoconf/general.m4:2270: AC_CACHE_CHECK is expanded from...
m4/iconv.m4:20: AM_ICONV_LINK is expanded from...
m4/iconv.m4:154: AM_ICONV is expanded from...
configure.ac:1303: the top level
configure.ac:1303: warning: The macro `AC_TRY_COMPILE' is obsolete.
configure.ac:1303: You should run autoupdate.
./lib/autoconf/general.m4:2847: AC_TRY_COMPILE is expanded from...
lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
./lib/autoconf/general.m4:2249: AC_CACHE_VAL is expanded from...
m4/iconv.m4:154: AM_ICONV is expanded from...
configure.ac:1303: the top level
configure.ac:1322: warning: The macro `AC_TRY_LINK' is obsolete.
configure.ac:1322: You should run autoupdate.
./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
./lib/autoconf/general.m4:2249: AC_CACHE_VAL is expanded from...
./lib/autoconf/general.m4:2270: AC_CACHE_CHECK is expanded from...
m4/intlmacosx.m4:18: gt_INTL_MACOSX is expanded from...
m4/gettext.m4:55: AM_GNU_GETTEXT is expanded from...
configure.ac:1322: the top level
configure.ac:1322: warning: The macro `AC_TRY_LINK' is obsolete.
configure.ac:1322: You should run autoupdate.
./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
./lib/autoconf/general.m4:2249: AC_CACHE_VAL is expanded from...
./lib/autoconf/general.m4:2270: AC_CACHE_CHECK is expanded from...
m4/iconv.m4:20: AM_ICONV_LINK is expanded from...
m4/gettext.m4:55: AM_GNU_GETTEXT is expanded from...
configure.ac:1322: the top level
configure.ac:1322: warning: The macro `AC_TRY_RUN' is obsolete.
configure.ac:1322: You should run autoupdate.
./lib/autoconf/general.m4:2997: AC_TRY_RUN is expanded from...
lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
./lib/autoconf/general.m4:2249: AC_CACHE_VAL is expanded from...
./lib/autoconf/general.m4:2270: AC_CACHE_CHECK is expanded from...
m4/iconv.m4:20: AM_ICONV_LINK is expanded from...
m4/gettext.m4:55: AM_GNU_GETTEXT is expanded from...
configure.ac:1322: the top level
configure.ac:1359: warning: The macro `AC_HEADER_STDC' is obsolete.
configure.ac:1359: You should run autoupdate.
./lib/autoconf/headers.m4:704: AC_HEADER_STDC is expanded from...
configure.ac:1359: the top level
configure.ac:1360: warning: The macro `AC_HEADER_TIME' is obsolete.
configure.ac:1360: You should run autoupdate.
./lib/autoconf/headers.m4:743: AC_HEADER_TIME is expanded from...
configure.ac:1360: the top level
autoreconf: running: /usr/bin/autoheader --force
autoreconf: running: automake --add-missing --copy --force-missing
autoreconf: Leaving directory '.'
dotlock.c: In function 'use_hardlinks_p':
dotlock.c:641:10: warning: ignoring return value of 'link' declared with attribute 'warn_unused_result' [-Wunused-result]
  641 |   (void) link (tname, lname);
      |          ^~~~~~~~~~~~~~~~~~~
dotlock.c: In function 'dotlock_take_unix':
dotlock.c:1084:14: warning: ignoring return value of 'link' declared with attribute 'warn_unused_result' [-Wunused-result]
 1084 |       (void) link (h->tname, h->lockname);
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
signal.c: In function 'got_fatal_signal':
signal.c:111:9: warning: ignoring return value of 'write' declared with attribute 'warn_unused_result' [-Wunused-result]
  111 |   (void)write (2, "\n", 1 );
      |         ^~~~~~~~~~~~~~~~~~~
signal.c:114:11: warning: ignoring return value of 'write' declared with attribute 'warn_unused_result' [-Wunused-result]
  114 |     (void)write(2, s, strlen (s));
      |           ^~~~~~~~~~~~~~~~~~~~~~~
signal.c:115:9: warning: ignoring return value of 'write' declared with attribute 'warn_unused_result' [-Wunused-result]
  115 |   (void)write (2, ": signal ", 9 );
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
signal.c:118:12: warning: ignoring return value of 'write' declared with attribute 'warn_unused_result' [-Wunused-result]
  118 |     (void) write (2, s, strlen(s) );
      |            ^~~~~~~~~~~~~~~~~~~~~~~~
signal.c:128:15: warning: ignoring return value of 'write' declared with attribute 'warn_unused_result' [-Wunused-result]
  128 |         (void)write (2, "?", 1);
      |               ^~~~~~~~~~~~~~~~~
signal.c:137:25: warning: ignoring return value of 'write' declared with attribute 'warn_unused_result' [-Wunused-result]
  137 |                   (void)write (2, &"0123456789"[value/i], 1);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
signal.c:145:9: warning: ignoring return value of 'write' declared with attribute 'warn_unused_result' [-Wunused-result]
  145 |   (void)write (2, " caught ... exiting\n", 20);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dotlock.c: In function 'use_hardlinks_p':
dotlock.c:641:10: warning: ignoring return value of 'link' declared with attribute 'warn_unused_result' [-Wunused-result]
  641 |   (void) link (tname, lname);
      |          ^~~~~~~~~~~~~~~~~~~
dotlock.c: In function 'dotlock_take_unix':
dotlock.c:1084:14: warning: ignoring return value of 'link' declared with attribute 'warn_unused_result' [-Wunused-result]
 1084 |       (void) link (h->tname, h->lockname);
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
signal.c: In function 'got_fatal_signal':
signal.c:111:9: warning: ignoring return value of 'write' declared with attribute 'warn_unused_result' [-Wunused-result]
  111 |   (void)write (2, "\n", 1 );
      |         ^~~~~~~~~~~~~~~~~~~
signal.c:114:11: warning: ignoring return value of 'write' declared with attribute 'warn_unused_result' [-Wunused-result]
  114 |     (void)write(2, s, strlen (s));
      |           ^~~~~~~~~~~~~~~~~~~~~~~
signal.c:115:9: warning: ignoring return value of 'write' declared with attribute 'warn_unused_result' [-Wunused-result]
  115 |   (void)write (2, ": signal ", 9 );
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
signal.c:118:12: warning: ignoring return value of 'write' declared with attribute 'warn_unused_result' [-Wunused-result]
  118 |     (void) write (2, s, strlen(s) );
      |            ^~~~~~~~~~~~~~~~~~~~~~~~
signal.c:128:15: warning: ignoring return value of 'write' declared with attribute 'warn_unused_result' [-Wunused-result]
  128 |         (void)write (2, "?", 1);
      |               ^~~~~~~~~~~~~~~~~
signal.c:137:25: warning: ignoring return value of 'write' declared with attribute 'warn_unused_result' [-Wunused-result]
  137 |                   (void)write (2, &"0123456789"[value/i], 1);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
signal.c:145:9: warning: ignoring return value of 'write' declared with attribute 'warn_unused_result' [-Wunused-result]
  145 |   (void)write (2, " caught ... exiting\n", 20);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
t-exechelp.c: In function 'test_close_all_fds':
t-exechelp.c:96:3: warning: ignoring return value of 'dup' declared with attribute 'warn_unused_result' [-Wunused-result]
   96 |   dup (1);
      |   ^~~~~~~
t-exechelp.c:97:3: warning: ignoring return value of 'dup' declared with attribute 'warn_unused_result' [-Wunused-result]
   97 |   dup (1);
      |   ^~~~~~~
t-exechelp.c:99:3: warning: ignoring return value of 'dup' declared with attribute 'warn_unused_result' [-Wunused-result]
   99 |   dup (1);
      |   ^~~~~~~
t-exechelp.c:140:9: warning: ignoring return value of 'dup' declared with attribute 'warn_unused_result' [-Wunused-result]
  140 |         dup (1);
      |         ^~~~~~~
t-exechelp.c:147:11: warning: ignoring return value of 'dup' declared with attribute 'warn_unused_result' [-Wunused-result]
  147 |           dup (1);
      |           ^~~~~~~
photoid.c: In function 'run_with_pipe':
photoid.c:512:7: warning: ignoring return value of 'write' declared with attribute 'warn_unused_result' [-Wunused-result]
  512 |       write (to[1], image, len);
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~
photoid.h:31:6: warning: type of 'show_photos' does not match original declaration [-Wlto-type-mismatch]
   31 | void show_photos (ctrl_t ctrl, const struct user_attribute *attrs, int count,
      |      ^
test-stubs.c:385:1: note: type mismatch in parameter 2
  385 | show_photos (const struct user_attribute *attrs, int count, PKT_public_key *pk)
      | ^
test-stubs.c:385:1: note: 'show_photos' was previously declared here
keyserver-internal.h:34:24: warning: type of 'parse_keyserver_uri' does not match original declaration [-Wlto-type-mismatch]
   34 | struct keyserver_spec *parse_keyserver_uri (const char *string,
      |                        ^
test-stubs.c:367:1: note: type mismatch in parameter 3
  367 | parse_keyserver_uri (const char *uri, int require_scheme,
      | ^
test-stubs.c:367:1: note: 'parse_keyserver_uri' was previously declared here
keyserver-internal.h:61:5: warning: type of 'keyserver_import_ldap' does not match original declaration [-Wlto-type-mismatch]
   61 | int keyserver_import_ldap (ctrl_t ctrl, const char *name,
      |     ^
test-stubs.c:253:1: note: type mismatch in parameter 2
  253 | keyserver_import_ldap (const char *name)
      | ^
test-stubs.c:253:1: note: 'keyserver_import_ldap' was previously declared here
keyserver-internal.h:58:5: warning: type of 'keyserver_import_mbox' does not match original declaration [-Wlto-type-mismatch]
   58 | int keyserver_import_mbox (ctrl_t ctrl, const char *mbox,
      |     ^
test-stubs.c:234:1: note: type mismatch in parameter 3
  234 | keyserver_import_mbox (const char *name,struct keyserver_spec *spec)
      | ^
test-stubs.c:234:1: note: 'keyserver_import_mbox' was previously declared here
keyserver-internal.h:51:5: warning: type of 'keyserver_import_cert' does not match original declaration [-Wlto-type-mismatch]
   51 | int keyserver_import_cert (ctrl_t ctrl, const char *name, int dane_mode,
      |     ^
test-stubs.c:215:1: note: type mismatch in parameter 2
  215 | keyserver_import_cert (const char *name)
      | ^
test-stubs.c:215:1: note: 'keyserver_import_cert' was previously declared here
keyserver-internal.h:45:5: warning: type of 'keyserver_import_keyid' does not match original declaration [-Wlto-type-mismatch]
   45 | int keyserver_import_keyid (ctrl_t ctrl, u32 *keyid,
      |     ^
test-stubs.c:184:1: note: type mismatch in parameter 3
  184 | keyserver_import_keyid (u32 *keyid, void *dummy, unsigned int flags)
      | ^
test-stubs.c:184:1: note: 'keyserver_import_keyid' was previously declared here
photoid.h:31:6: warning: type of 'show_photos' does not match original declaration [-Wlto-type-mismatch]
   31 | void show_photos (ctrl_t ctrl, const struct user_attribute *attrs, int count,
      |      ^
test-stubs.c:385:1: note: type mismatch in parameter 2
  385 | show_photos (const struct user_attribute *attrs, int count, PKT_public_key *pk)
      | ^
test-stubs.c:385:1: note: 'show_photos' was previously declared here
keyserver-internal.h:34:24: warning: type of 'parse_keyserver_uri' does not match original declaration [-Wlto-type-mismatch]
   34 | struct keyserver_spec *parse_keyserver_uri (const char *string,
      |                        ^
test-stubs.c:367:1: note: type mismatch in parameter 3
  367 | parse_keyserver_uri (const char *uri, int require_scheme,
      | ^
test-stubs.c:367:1: note: 'parse_keyserver_uri' was previously declared here
keyserver-internal.h:61:5: warning: type of 'keyserver_import_ldap' does not match original declaration [-Wlto-type-mismatch]
   61 | int keyserver_import_ldap (ctrl_t ctrl, const char *name,
      |     ^
test-stubs.c:253:1: note: type mismatch in parameter 2
  253 | keyserver_import_ldap (const char *name)
      | ^
test-stubs.c:253:1: note: 'keyserver_import_ldap' was previously declared here
keyserver-internal.h:58:5: warning: type of 'keyserver_import_mbox' does not match original declaration [-Wlto-type-mismatch]
   58 | int keyserver_import_mbox (ctrl_t ctrl, const char *mbox,
      |     ^
test-stubs.c:234:1: note: type mismatch in parameter 3
  234 | keyserver_import_mbox (const char *name,struct keyserver_spec *spec)
      | ^
test-stubs.c:234:1: note: 'keyserver_import_mbox' was previously declared here
keyserver-internal.h:51:5: warning: type of 'keyserver_import_cert' does not match original declaration [-Wlto-type-mismatch]
   51 | int keyserver_import_cert (ctrl_t ctrl, const char *name, int dane_mode,
      |     ^
test-stubs.c:215:1: note: type mismatch in parameter 2
  215 | keyserver_import_cert (const char *name)
      | ^
test-stubs.c:215:1: note: 'keyserver_import_cert' was previously declared here
keyserver-internal.h:45:5: warning: type of 'keyserver_import_keyid' does not match original declaration [-Wlto-type-mismatch]
   45 | int keyserver_import_keyid (ctrl_t ctrl, u32 *keyid,
      |     ^
test-stubs.c:184:1: note: type mismatch in parameter 3
  184 | keyserver_import_keyid (u32 *keyid, void *dummy, unsigned int flags)
      | ^
test-stubs.c:184:1: note: 'keyserver_import_keyid' was previously declared here
photoid.h:31:6: warning: type of 'show_photos' does not match original declaration [-Wlto-type-mismatch]
   31 | void show_photos (ctrl_t ctrl, const struct user_attribute *attrs, int count,
      |      ^
test-stubs.c:385:1: note: type mismatch in parameter 2
  385 | show_photos (const struct user_attribute *attrs, int count, PKT_public_key *pk)
      | ^
test-stubs.c:385:1: note: 'show_photos' was previously declared here
keyserver-internal.h:34:24: warning: type of 'parse_keyserver_uri' does not match original declaration [-Wlto-type-mismatch]
   34 | struct keyserver_spec *parse_keyserver_uri (const char *string,
      |                        ^
test-stubs.c:367:1: note: type mismatch in parameter 3
  367 | parse_keyserver_uri (const char *uri, int require_scheme,
      | ^
test-stubs.c:367:1: note: 'parse_keyserver_uri' was previously declared here
keyserver-internal.h:61:5: warning: type of 'keyserver_import_ldap' does not match original declaration [-Wlto-type-mismatch]
   61 | int keyserver_import_ldap (ctrl_t ctrl, const char *name,
      |     ^
test-stubs.c:253:1: note: type mismatch in parameter 2
  253 | keyserver_import_ldap (const char *name)
      | ^
test-stubs.c:253:1: note: 'keyserver_import_ldap' was previously declared here
keyserver-internal.h:58:5: warning: type of 'keyserver_import_mbox' does not match original declaration [-Wlto-type-mismatch]
   58 | int keyserver_import_mbox (ctrl_t ctrl, const char *mbox,
      |     ^
test-stubs.c:234:1: note: type mismatch in parameter 3
  234 | keyserver_import_mbox (const char *name,struct keyserver_spec *spec)
      | ^
test-stubs.c:234:1: note: 'keyserver_import_mbox' was previously declared here
keyserver-internal.h:51:5: warning: type of 'keyserver_import_cert' does not match original declaration [-Wlto-type-mismatch]
   51 | int keyserver_import_cert (ctrl_t ctrl, const char *name, int dane_mode,
      |     ^
test-stubs.c:215:1: note: type mismatch in parameter 2
  215 | keyserver_import_cert (const char *name)
      | ^
test-stubs.c:215:1: note: 'keyserver_import_cert' was previously declared here
keyserver-internal.h:45:5: warning: type of 'keyserver_import_keyid' does not match original declaration [-Wlto-type-mismatch]
   45 | int keyserver_import_keyid (ctrl_t ctrl, u32 *keyid,
      |     ^
test-stubs.c:184:1: note: type mismatch in parameter 3
  184 | keyserver_import_keyid (u32 *keyid, void *dummy, unsigned int flags)
      | ^
test-stubs.c:184:1: note: 'keyserver_import_keyid' was previously declared here
photoid.h:31:6: warning: type of 'show_photos' does not match original declaration [-Wlto-type-mismatch]
   31 | void show_photos (ctrl_t ctrl, const struct user_attribute *attrs, int count,
      |      ^
gpgv.c:628:1: note: type mismatch in parameter 2
  628 | show_photos (const struct user_attribute *attrs, int count, PKT_public_key *pk)
      | ^
gpgv.c:628:1: note: 'show_photos' was previously declared here
keyserver-internal.h:34:24: warning: type of 'parse_keyserver_uri' does not match original declaration [-Wlto-type-mismatch]
   34 | struct keyserver_spec *parse_keyserver_uri (const char *string,
      |                        ^
gpgv.c:610:1: note: type mismatch in parameter 3
  610 | parse_keyserver_uri (const char *uri, int require_scheme,
      | ^
gpgv.c:610:1: note: 'parse_keyserver_uri' was previously declared here
keyserver-internal.h:61:5: warning: type of 'keyserver_import_ldap' does not match original declaration [-Wlto-type-mismatch]
   61 | int keyserver_import_ldap (ctrl_t ctrl, const char *name,
      |     ^
gpgv.c:495:1: note: type mismatch in parameter 2
  495 | keyserver_import_ldap (const char *name)
      | ^
gpgv.c:495:1: note: 'keyserver_import_ldap' was previously declared here
keyserver-internal.h:58:5: warning: type of 'keyserver_import_mbox' does not match original declaration [-Wlto-type-mismatch]
   58 | int keyserver_import_mbox (ctrl_t ctrl, const char *mbox,
      |     ^
gpgv.c:476:1: note: type mismatch in parameter 3
  476 | keyserver_import_mbox (const char *name,struct keyserver_spec *spec)
      | ^
gpgv.c:476:1: note: 'keyserver_import_mbox' was previously declared here
keyserver-internal.h:51:5: warning: type of 'keyserver_import_cert' does not match original declaration [-Wlto-type-mismatch]
   51 | int keyserver_import_cert (ctrl_t ctrl, const char *name, int dane_mode,
      |     ^
gpgv.c:457:1: note: type mismatch in parameter 2
  457 | keyserver_import_cert (const char *name)
      | ^
gpgv.c:457:1: note: 'keyserver_import_cert' was previously declared here
keyserver-internal.h:45:5: warning: type of 'keyserver_import_keyid' does not match original declaration [-Wlto-type-mismatch]
   45 | int keyserver_import_keyid (ctrl_t ctrl, u32 *keyid,
      |     ^
gpgv.c:426:1: note: type mismatch in parameter 3
  426 | keyserver_import_keyid (u32 *keyid, void *dummy, unsigned int flags)
      | ^
gpgv.c:426:1: note: 'keyserver_import_keyid' was previously declared here
call-dirmngr.c: In function 'gpgsm_dirmngr_isvalid.part.0':
call-dirmngr.c:575:24: warning: 'gpgsm_validate_chain' accessing 16 bytes in a region of size 1 [-Wstringop-overflow=]
  575 |                   rc = gpgsm_validate_chain (ctrl, rspcert, "", NULL, 0, NULL,
      |                        ^
call-dirmngr.c:575:24: note: referencing argument 3 of type 'char *'
certchain.c:2125:1: note: in a call to function 'gpgsm_validate_chain'
 2125 | gpgsm_validate_chain (ctrl_t ctrl, ksba_cert_t cert, ksba_isotime_t checktime,
      | ^
certlist.c: In function 'gpgsm_add_to_certlist':
certlist.c:446:22: warning: 'gpgsm_validate_chain' accessing 16 bytes in a region of size 1 [-Wstringop-overflow=]
  446 |                 rc = gpgsm_validate_chain (ctrl, cert, "", NULL,
      |                      ^
certlist.c:446:22: note: referencing argument 3 of type 'char *'
certchain.c:2125:1: note: in a call to function 'gpgsm_validate_chain'
 2125 | gpgsm_validate_chain (ctrl_t ctrl, ksba_cert_t cert, ksba_isotime_t checktime,
      | ^
keylist.c: In function 'list_cert_std':
keylist.c:1425:13: warning: 'gpgsm_validate_chain' accessing 16 bytes in a region of size 1 [-Wstringop-overflow=]
 1425 |       err = gpgsm_validate_chain (ctrl, cert, "", NULL, 1, fp, 0, NULL);
      |             ^
keylist.c:1425:13: note: referencing argument 3 of type 'char *'
certchain.c:2125:1: note: in a call to function 'gpgsm_validate_chain'
 2125 | gpgsm_validate_chain (ctrl_t ctrl, ksba_cert_t cert, ksba_isotime_t checktime,
      | ^
keylist.c: In function 'list_cert_colon':
keylist.c:451:14: warning: 'gpgsm_validate_chain' accessing 16 bytes in a region of size 1 [-Wstringop-overflow=]
  451 |     valerr = gpgsm_validate_chain (ctrl, cert, "", NULL, 1, NULL, 0, NULL);
      |              ^
keylist.c:451:14: note: referencing argument 3 of type 'char *'
certchain.c:2125:1: note: in a call to function 'gpgsm_validate_chain'
 2125 | gpgsm_validate_chain (ctrl_t ctrl, ksba_cert_t cert, ksba_isotime_t checktime,
      | ^
keylist.c: In function 'list_cert_raw.constprop':
keylist.c:1176:13: warning: 'gpgsm_validate_chain' accessing 16 bytes in a region of size 1 [-Wstringop-overflow=]
 1176 |       err = gpgsm_validate_chain (ctrl, cert, "", NULL, 1, fp, 0, NULL);
      |             ^
keylist.c:1176:13: note: referencing argument 3 of type 'char *'
certchain.c:2125:1: note: in a call to function 'gpgsm_validate_chain'
 2125 | gpgsm_validate_chain (ctrl_t ctrl, ksba_cert_t cert, ksba_isotime_t checktime,
      | ^
import.c: In function 'check_and_store':
import.c:194:10: warning: 'gpgsm_validate_chain' accessing 16 bytes in a region of size 1 [-Wstringop-overflow=]
  194 |     rc = gpgsm_validate_chain (ctrl, cert, "", NULL, 0, NULL, 0, NULL);
      |          ^
import.c:194:10: note: referencing argument 3 of type 'char *'
certchain.c:2125:1: note: in a call to function 'gpgsm_validate_chain'
 2125 | gpgsm_validate_chain (ctrl_t ctrl, ksba_cert_t cert, ksba_isotime_t checktime,
      | ^
sign.c: In function 'gpgsm_sign':
sign.c:507:14: warning: 'gpgsm_validate_chain' accessing 16 bytes in a region of size 1 [-Wstringop-overflow=]
  507 |         rc = gpgsm_validate_chain (ctrl, cert, "", NULL, 0, NULL, 0, NULL);
      |              ^
sign.c:507:14: note: referencing argument 3 of type 'char *'
certchain.c:2125:1: note: in a call to function 'gpgsm_validate_chain'
 2125 | gpgsm_validate_chain (ctrl_t ctrl, ksba_cert_t cert, ksba_isotime_t checktime,
      | ^
cvt-openpgp.h:27:13: warning: type of 'convert_from_openpgp_native' does not match original declaration [-Wlto-type-mismatch]
   27 | gpg_error_t convert_from_openpgp_native (ctrl_t ctrl,
      |             ^
t-protect.c:344:1: note: type mismatch in parameter 4
  344 | convert_from_openpgp_native (gcry_sexp_t s_pgp, const char *passphrase,
      | ^
t-protect.c:344:1: note: 'convert_from_openpgp_native' was previously declared here
scdaemon.c: In function 'handle_connections':
scdaemon.c:1391:11: warning: ignoring return value of 'read' declared with attribute 'warn_unused_result' [-Wunused-result]
 1391 |           read (pipe_fd[0], buf, sizeof buf);
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
scdaemon.c: In function 'scd_kick_the_loop':
scdaemon.c:1230:3: warning: ignoring return value of 'write' declared with attribute 'warn_unused_result' [-Wunused-result]
 1230 |   write (notify_fd, "", 1);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~
yat2m: writing 'gnupg.7'
yat2m: writing 'gpg.1'
yat2m: writing 'gpgsm.1'
yat2m: writing 'gpg-agent.1'
yat2m: writing 'dirmngr.8'
yat2m: writing 'scdaemon.1'
yat2m: writing 'watchgnupg.1'
yat2m: writing 'gpgv.1'
yat2m: writing 'addgnupghome.8'
yat2m: writing 'gpgconf.1'
yat2m: writing 'applygnupgdefaults.8'
yat2m: writing 'gpg-preset-passphrase.1'
yat2m: writing 'gpg-connect-agent.1'
yat2m: writing 'dirmngr-client.1'
yat2m: writing 'gpgparsemail.1'
yat2m: writing 'gpgtar.1'
yat2m: writing 'gpg-check-pattern.1'
yat2m: writing 'gpg-wks-client.1'
yat2m: writing 'gpg-wks-server.1'
yat2m: writing 'gpg-card.1'
ffi.c: In function 'do_file_equal':
ffi.c:1044:3: warning: ignoring return value of 'fread' declared with attribute 'warn_unused_result' [-Wunused-result]
 1044 |   fread (b_buf, 1, 1, b_stream);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gpgsm: WARNING: running with faked system time: 2002-12-02 13:29:59
gpgsm: keybox '/home/tkloczko/rpmbuild/BUILD/gnupg-2.3.2/tests/cms/pubring.kbx' created
gpgsm: total number processed: 1
gpgsm:               imported: 1
gpgsm: WARNING: running with faked system time: 2002-12-02 13:29:59
gpgsm: total number processed: 1
gpgsm:               imported: 1
gpgsm: WARNING: running with faked system time: 2002-12-02 13:29:59
gpgsm: total number processed: 1
gpgsm:               imported: 1
tpm2daemon.c: In function 'handle_connections':
tpm2daemon.c:1231:11: warning: ignoring return value of 'read' declared with attribute 'warn_unused_result' [-Wunused-result]
 1231 |           read (pipe_fd[0], buf, sizeof buf);
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tpm2daemon.c: In function 'tpm2d_kick_the_loop':
tpm2daemon.c:1062:3: warning: ignoring return value of 'write' declared with attribute 'warn_unused_result' [-Wunused-result]
 1062 |   write (notify_fd, "", 1);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~

Details

Version
2.3.2

Event Timeline

werner claimed this task.
werner added a subscriber: werner.

Thanks for reporting. However, many gcc warnings produce a lot of false positives. Thus to be useful all the warnings need to be scrutinized. Let's do this for one example

keylist.c:1176:13: warning: 'gpgsm_validate_chain' accessing 16 bytes in a region of size 1 [-Wstringop-overflow=]
 1176 |       err = gpgsm_validate_chain (ctrl, cert, "", NULL, 1, fp, 0, NULL);
      |             ^
keylist.c:1176:13: note: referencing argument 3 of type 'char *'

The 3rd arg is named checktime and here is its description:

If you are verifying a signature you should set CHECKTIME to the
creation time of the signature.  If your are verifying a
certificate, set it nil (i.e. the empty string).  If the creation
date of the signature is not known use the special date
"19700101T000000" which is treated in a special way here. */

Thus passing the empty string is correct. You may follow the call chain to see that gcc is wrong here. Actually there is a reason why not all warnings are enabled.. If you find a real case for any of thewarnings, please be so kind to describe this in detail and re-open this bug.

LTO warnings are trashing LTO optimised binaries and that is definitelly gnupg code issiues.
Just check each two places where rowtines are defined and declared in header files.

Just checked got repo and none of those issues have been fixed so to be honest I really do not understand why thi ticket has been closed.

As I mention LTO warnings are most important.
Just retested 2.4.1 and I still see LTO warnings which still not been sorted out and those warnings are not false positives.

[tkloczko@pers-jacek build]$ rpmbuild -ba --with check --with failing_tests gnupg2.spec --quiet 2>&1 | grep -- \\[-W | sed 's/.*\[//; s/\]//' | sort | uniq -c | sort -nr
     28 -Wunused-result
     22 -Wlto-type-mismatch
      4 -Wenum-int-mismatch

<details>

console
autoreconf: export WARNINGS=
autoreconf: Entering directory '.'
autoreconf: running: autopoint --force
autoreconf: running: aclocal --force -I m4
autoreconf: configure.ac: tracing
autoreconf: configure.ac: not using Libtool
autoreconf: configure.ac: not using Intltool
autoreconf: configure.ac: not using Gtkdoc
autoreconf: running: /usr/bin/autoconf --force
configure.ac:1278: warning: The macro `AC_TRY_LINK' is obsolete.
configure.ac:1278: You should run autoupdate.
./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
./lib/autoconf/general.m4:2249: AC_CACHE_VAL is expanded from...
./lib/autoconf/general.m4:2270: AC_CACHE_CHECK is expanded from...
m4/iconv.m4:20: AM_ICONV_LINK is expanded from...
m4/iconv.m4:154: AM_ICONV is expanded from...
configure.ac:1278: the top level
configure.ac:1278: warning: The macro `AC_TRY_RUN' is obsolete.
configure.ac:1278: You should run autoupdate.
./lib/autoconf/general.m4:2997: AC_TRY_RUN is expanded from...
lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
./lib/autoconf/general.m4:2249: AC_CACHE_VAL is expanded from...
./lib/autoconf/general.m4:2270: AC_CACHE_CHECK is expanded from...
m4/iconv.m4:20: AM_ICONV_LINK is expanded from...
m4/iconv.m4:154: AM_ICONV is expanded from...
configure.ac:1278: the top level
configure.ac:1278: warning: The macro `AC_TRY_COMPILE' is obsolete.
configure.ac:1278: You should run autoupdate.
./lib/autoconf/general.m4:2847: AC_TRY_COMPILE is expanded from...
lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
./lib/autoconf/general.m4:2249: AC_CACHE_VAL is expanded from...
m4/iconv.m4:154: AM_ICONV is expanded from...
configure.ac:1278: the top level
configure.ac:1297: warning: The macro `AC_TRY_LINK' is obsolete.
configure.ac:1297: You should run autoupdate.
./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
./lib/autoconf/general.m4:2249: AC_CACHE_VAL is expanded from...
./lib/autoconf/general.m4:2270: AC_CACHE_CHECK is expanded from...
m4/intlmacosx.m4:18: gt_INTL_MACOSX is expanded from...
m4/gettext.m4:55: AM_GNU_GETTEXT is expanded from...
configure.ac:1297: the top level
configure.ac:1297: warning: The macro `AC_TRY_LINK' is obsolete.
configure.ac:1297: You should run autoupdate.
./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
./lib/autoconf/general.m4:2249: AC_CACHE_VAL is expanded from...
./lib/autoconf/general.m4:2270: AC_CACHE_CHECK is expanded from...
m4/iconv.m4:20: AM_ICONV_LINK is expanded from...
m4/gettext.m4:55: AM_GNU_GETTEXT is expanded from...
configure.ac:1297: the top level
configure.ac:1297: warning: The macro `AC_TRY_RUN' is obsolete.
configure.ac:1297: You should run autoupdate.
./lib/autoconf/general.m4:2997: AC_TRY_RUN is expanded from...
lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
./lib/autoconf/general.m4:2249: AC_CACHE_VAL is expanded from...
./lib/autoconf/general.m4:2270: AC_CACHE_CHECK is expanded from...
m4/iconv.m4:20: AM_ICONV_LINK is expanded from...
m4/gettext.m4:55: AM_GNU_GETTEXT is expanded from...
configure.ac:1297: the top level
autoreconf: running: /usr/bin/autoheader --force
autoreconf: running: automake --add-missing --copy --force-missing
doc/Makefile.am:55: warning: EXTRA_DIST multiply defined in condition TRUE ...
doc/Makefile.am:38: ... 'EXTRA_DIST' previously defined here
autoreconf: Leaving directory '.'
./configure: line 4037: hostname: command not found
signal.c: In function 'got_fatal_signal':
signal.c:113:9: warning: ignoring return value of 'write' declared with attribute 'warn_unused_result' [-Wunused-result]
  113 |   (void)write (2, "\n", 1 );
      |         ^~~~~~~~~~~~~~~~~~~
signal.c:116:11: warning: ignoring return value of 'write' declared with attribute 'warn_unused_result' [-Wunused-result]
  116 |     (void)write(2, s, strlen (s));
      |           ^~~~~~~~~~~~~~~~~~~~~~~
signal.c:117:9: warning: ignoring return value of 'write' declared with attribute 'warn_unused_result' [-Wunused-result]
  117 |   (void)write (2, ": signal ", 9 );
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
signal.c:120:12: warning: ignoring return value of 'write' declared with attribute 'warn_unused_result' [-Wunused-result]
  120 |     (void) write (2, s, strlen(s) );
      |            ^~~~~~~~~~~~~~~~~~~~~~~~
signal.c:130:15: warning: ignoring return value of 'write' declared with attribute 'warn_unused_result' [-Wunused-result]
  130 |         (void)write (2, "?", 1);
      |               ^~~~~~~~~~~~~~~~~
signal.c:139:25: warning: ignoring return value of 'write' declared with attribute 'warn_unused_result' [-Wunused-result]
  139 |                   (void)write (2, &"0123456789"[value/i], 1);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
signal.c:147:9: warning: ignoring return value of 'write' declared with attribute 'warn_unused_result' [-Wunused-result]
  147 |   (void)write (2, " caught ... exiting\n", 20);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dotlock.c: In function 'use_hardlinks_p':
dotlock.c:640:10: warning: ignoring return value of 'link' declared with attribute 'warn_unused_result' [-Wunused-result]
  640 |   (void) link (tname, lname);
      |          ^~~~~~~~~~~~~~~~~~~
dotlock.c: In function 'dotlock_take_unix':
dotlock.c:1082:14: warning: ignoring return value of 'link' declared with attribute 'warn_unused_result' [-Wunused-result]
 1082 |       (void) link (h->tname, h->lockname);
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
dotlock.c: In function 'use_hardlinks_p':
dotlock.c:640:10: warning: ignoring return value of 'link' declared with attribute 'warn_unused_result' [-Wunused-result]
  640 |   (void) link (tname, lname);
      |          ^~~~~~~~~~~~~~~~~~~
dotlock.c: In function 'dotlock_take_unix':
dotlock.c:1082:14: warning: ignoring return value of 'link' declared with attribute 'warn_unused_result' [-Wunused-result]
 1082 |       (void) link (h->tname, h->lockname);
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
signal.c: In function 'got_fatal_signal':
signal.c:113:9: warning: ignoring return value of 'write' declared with attribute 'warn_unused_result' [-Wunused-result]
  113 |   (void)write (2, "\n", 1 );
      |         ^~~~~~~~~~~~~~~~~~~
signal.c:116:11: warning: ignoring return value of 'write' declared with attribute 'warn_unused_result' [-Wunused-result]
  116 |     (void)write(2, s, strlen (s));
      |           ^~~~~~~~~~~~~~~~~~~~~~~
signal.c:117:9: warning: ignoring return value of 'write' declared with attribute 'warn_unused_result' [-Wunused-result]
  117 |   (void)write (2, ": signal ", 9 );
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
signal.c:120:12: warning: ignoring return value of 'write' declared with attribute 'warn_unused_result' [-Wunused-result]
  120 |     (void) write (2, s, strlen(s) );
      |            ^~~~~~~~~~~~~~~~~~~~~~~~
signal.c:130:15: warning: ignoring return value of 'write' declared with attribute 'warn_unused_result' [-Wunused-result]
  130 |         (void)write (2, "?", 1);
      |               ^~~~~~~~~~~~~~~~~
signal.c:139:25: warning: ignoring return value of 'write' declared with attribute 'warn_unused_result' [-Wunused-result]
  139 |                   (void)write (2, &"0123456789"[value/i], 1);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
signal.c:147:9: warning: ignoring return value of 'write' declared with attribute 'warn_unused_result' [-Wunused-result]
  147 |   (void)write (2, " caught ... exiting\n", 20);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
t-exechelp.c: In function 'test_close_all_fds':
t-exechelp.c:96:3: warning: ignoring return value of 'dup' declared with attribute 'warn_unused_result' [-Wunused-result]
   96 |   dup (1);
      |   ^~~~~~~
t-exechelp.c:97:3: warning: ignoring return value of 'dup' declared with attribute 'warn_unused_result' [-Wunused-result]
   97 |   dup (1);
      |   ^~~~~~~
t-exechelp.c:99:3: warning: ignoring return value of 'dup' declared with attribute 'warn_unused_result' [-Wunused-result]
   99 |   dup (1);
      |   ^~~~~~~
t-exechelp.c:140:9: warning: ignoring return value of 'dup' declared with attribute 'warn_unused_result' [-Wunused-result]
  140 |         dup (1);
      |         ^~~~~~~
t-exechelp.c:147:11: warning: ignoring return value of 'dup' declared with attribute 'warn_unused_result' [-Wunused-result]
  147 |           dup (1);
      |           ^~~~~~~
photoid.c: In function 'run_with_pipe':
photoid.c:619:7: warning: ignoring return value of 'write' declared with attribute 'warn_unused_result' [-Wunused-result]
  619 |       write (to[1], image, len);
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~
photoid.h:31:6: warning: type of 'show_photos' does not match original declaration [-Wlto-type-mismatch]
   31 | void show_photos (ctrl_t ctrl, const struct user_attribute *attrs, int count,
      |      ^
test-stubs.c:391:1: note: type mismatch in parameter 2
  391 | show_photos (const struct user_attribute *attrs, int count, PKT_public_key *pk)
      | ^
test-stubs.c:391:1: note: 'show_photos' was previously declared here
keyserver-internal.h:34:24: warning: type of 'parse_keyserver_uri' does not match original declaration [-Wlto-type-mismatch]
   34 | struct keyserver_spec *parse_keyserver_uri (const char *string,
      |                        ^
test-stubs.c:373:1: note: type mismatch in parameter 3
  373 | parse_keyserver_uri (const char *uri, int require_scheme,
      | ^
test-stubs.c:373:1: note: 'parse_keyserver_uri' was previously declared here
keyserver-internal.h:61:5: warning: type of 'keyserver_import_ldap' does not match original declaration [-Wlto-type-mismatch]
   61 | int keyserver_import_ldap (ctrl_t ctrl, const char *name,
      |     ^
test-stubs.c:257:1: note: type mismatch in parameter 2
  257 | keyserver_import_ldap (const char *name)
      | ^
test-stubs.c:257:1: note: 'keyserver_import_ldap' was previously declared here
keyserver-internal.h:51:5: warning: type of 'keyserver_import_cert' does not match original declaration [-Wlto-type-mismatch]
   51 | int keyserver_import_cert (ctrl_t ctrl, const char *name, int dane_mode,
      |     ^
test-stubs.c:215:1: note: type mismatch in parameter 2
  215 | keyserver_import_cert (const char *name)
      | ^
test-stubs.c:215:1: note: 'keyserver_import_cert' was previously declared here
keyserver-internal.h:45:5: warning: type of 'keyserver_import_keyid' does not match original declaration [-Wlto-type-mismatch]
   45 | int keyserver_import_keyid (ctrl_t ctrl, u32 *keyid,
      |     ^
test-stubs.c:184:1: note: type mismatch in parameter 3
  184 | keyserver_import_keyid (u32 *keyid, void *dummy, unsigned int flags)
      | ^
test-stubs.c:184:1: note: 'keyserver_import_keyid' was previously declared here
photoid.h:31:6: warning: type of 'show_photos' does not match original declaration [-Wlto-type-mismatch]
   31 | void show_photos (ctrl_t ctrl, const struct user_attribute *attrs, int count,
      |      ^
test-stubs.c:391:1: note: type mismatch in parameter 2
  391 | show_photos (const struct user_attribute *attrs, int count, PKT_public_key *pk)
      | ^
test-stubs.c:391:1: note: 'show_photos' was previously declared here
keyserver-internal.h:34:24: warning: type of 'parse_keyserver_uri' does not match original declaration [-Wlto-type-mismatch]
   34 | struct keyserver_spec *parse_keyserver_uri (const char *string,
      |                        ^
test-stubs.c:373:1: note: type mismatch in parameter 3
  373 | parse_keyserver_uri (const char *uri, int require_scheme,
      | ^
test-stubs.c:373:1: note: 'parse_keyserver_uri' was previously declared here
keyserver-internal.h:61:5: warning: type of 'keyserver_import_ldap' does not match original declaration [-Wlto-type-mismatch]
   61 | int keyserver_import_ldap (ctrl_t ctrl, const char *name,
      |     ^
test-stubs.c:257:1: note: type mismatch in parameter 2
  257 | keyserver_import_ldap (const char *name)
      | ^
test-stubs.c:257:1: note: 'keyserver_import_ldap' was previously declared here
keyserver-internal.h:51:5: warning: type of 'keyserver_import_cert' does not match original declaration [-Wlto-type-mismatch]
   51 | int keyserver_import_cert (ctrl_t ctrl, const char *name, int dane_mode,
      |     ^
test-stubs.c:215:1: note: type mismatch in parameter 2
  215 | keyserver_import_cert (const char *name)
      | ^
test-stubs.c:215:1: note: 'keyserver_import_cert' was previously declared here
keyserver-internal.h:45:5: warning: type of 'keyserver_import_keyid' does not match original declaration [-Wlto-type-mismatch]
   45 | int keyserver_import_keyid (ctrl_t ctrl, u32 *keyid,
      |     ^
test-stubs.c:184:1: note: type mismatch in parameter 3
  184 | keyserver_import_keyid (u32 *keyid, void *dummy, unsigned int flags)
      | ^
test-stubs.c:184:1: note: 'keyserver_import_keyid' was previously declared here
photoid.h:31:6: warning: type of 'show_photos' does not match original declaration [-Wlto-type-mismatch]
   31 | void show_photos (ctrl_t ctrl, const struct user_attribute *attrs, int count,
      |      ^
test-stubs.c:391:1: note: type mismatch in parameter 2
  391 | show_photos (const struct user_attribute *attrs, int count, PKT_public_key *pk)
      | ^
test-stubs.c:391:1: note: 'show_photos' was previously declared here
keyserver-internal.h:34:24: warning: type of 'parse_keyserver_uri' does not match original declaration [-Wlto-type-mismatch]
   34 | struct keyserver_spec *parse_keyserver_uri (const char *string,
      |                        ^
test-stubs.c:373:1: note: type mismatch in parameter 3
  373 | parse_keyserver_uri (const char *uri, int require_scheme,
      | ^
test-stubs.c:373:1: note: 'parse_keyserver_uri' was previously declared here
keyserver-internal.h:61:5: warning: type of 'keyserver_import_ldap' does not match original declaration [-Wlto-type-mismatch]
   61 | int keyserver_import_ldap (ctrl_t ctrl, const char *name,
      |     ^
test-stubs.c:257:1: note: type mismatch in parameter 2
  257 | keyserver_import_ldap (const char *name)
      | ^
test-stubs.c:257:1: note: 'keyserver_import_ldap' was previously declared here
keyserver-internal.h:51:5: warning: type of 'keyserver_import_cert' does not match original declaration [-Wlto-type-mismatch]
   51 | int keyserver_import_cert (ctrl_t ctrl, const char *name, int dane_mode,
      |     ^
test-stubs.c:215:1: note: type mismatch in parameter 2
  215 | keyserver_import_cert (const char *name)
      | ^
test-stubs.c:215:1: note: 'keyserver_import_cert' was previously declared here
keyserver-internal.h:45:5: warning: type of 'keyserver_import_keyid' does not match original declaration [-Wlto-type-mismatch]
   45 | int keyserver_import_keyid (ctrl_t ctrl, u32 *keyid,
      |     ^
test-stubs.c:184:1: note: type mismatch in parameter 3
  184 | keyserver_import_keyid (u32 *keyid, void *dummy, unsigned int flags)
      | ^
test-stubs.c:184:1: note: 'keyserver_import_keyid' was previously declared here
photoid.h:31:6: warning: type of 'show_photos' does not match original declaration [-Wlto-type-mismatch]
   31 | void show_photos (ctrl_t ctrl, const struct user_attribute *attrs, int count,
      |      ^
gpgv.c:630:1: note: type mismatch in parameter 2
  630 | show_photos (const struct user_attribute *attrs, int count, PKT_public_key *pk)
      | ^
gpgv.c:630:1: note: 'show_photos' was previously declared here
keyserver-internal.h:34:24: warning: type of 'parse_keyserver_uri' does not match original declaration [-Wlto-type-mismatch]
   34 | struct keyserver_spec *parse_keyserver_uri (const char *string,
      |                        ^
gpgv.c:612:1: note: type mismatch in parameter 3
  612 | parse_keyserver_uri (const char *uri, int require_scheme,
      | ^
gpgv.c:612:1: note: 'parse_keyserver_uri' was previously declared here
keyserver-internal.h:61:5: warning: type of 'keyserver_import_ldap' does not match original declaration [-Wlto-type-mismatch]
   61 | int keyserver_import_ldap (ctrl_t ctrl, const char *name,
      |     ^
gpgv.c:495:1: note: type mismatch in parameter 2
  495 | keyserver_import_ldap (const char *name)
      | ^
gpgv.c:495:1: note: 'keyserver_import_ldap' was previously declared here
keyserver-internal.h:58:5: warning: type of 'keyserver_import_mbox' does not match original declaration [-Wlto-type-mismatch]
   58 | int keyserver_import_mbox (ctrl_t ctrl, const char *mbox,
      |     ^
gpgv.c:476:1: note: type mismatch in parameter 3
  476 | keyserver_import_mbox (const char *name,struct keyserver_spec *spec)
      | ^
gpgv.c:476:1: note: 'keyserver_import_mbox' was previously declared here
keyserver-internal.h:51:5: warning: type of 'keyserver_import_cert' does not match original declaration [-Wlto-type-mismatch]
   51 | int keyserver_import_cert (ctrl_t ctrl, const char *name, int dane_mode,
      |     ^
gpgv.c:457:1: note: type mismatch in parameter 2
  457 | keyserver_import_cert (const char *name)
      | ^
gpgv.c:457:1: note: 'keyserver_import_cert' was previously declared here
keyserver-internal.h:45:5: warning: type of 'keyserver_import_keyid' does not match original declaration [-Wlto-type-mismatch]
   45 | int keyserver_import_keyid (ctrl_t ctrl, u32 *keyid,
      |     ^
gpgv.c:426:1: note: type mismatch in parameter 3
  426 | keyserver_import_keyid (u32 *keyid, void *dummy, unsigned int flags)
      | ^
gpgv.c:426:1: note: 'keyserver_import_keyid' was previously declared here
cvt-openpgp.h:27:13: warning: type of 'convert_from_openpgp_native' does not match original declaration [-Wlto-type-mismatch]
   27 | gpg_error_t convert_from_openpgp_native (ctrl_t ctrl,
      |             ^
t-protect.c:344:1: note: type mismatch in parameter 4
  344 | convert_from_openpgp_native (gcry_sexp_t s_pgp, const char *passphrase,
      | ^
t-protect.c:344:1: note: 'convert_from_openpgp_native' was previously declared here
scdaemon.c: In function 'handle_connections':
scdaemon.c:1391:11: warning: ignoring return value of 'read' declared with attribute 'warn_unused_result' [-Wunused-result]
 1391 |           read (pipe_fd[0], buf, sizeof buf);
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
scdaemon.c: In function 'scd_kick_the_loop':
scdaemon.c:1231:3: warning: ignoring return value of 'write' declared with attribute 'warn_unused_result' [-Wunused-result]
 1231 |   write (notify_fd, "", 1);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~
fakecrl.c:57:1: warning: conflicting types for 'fakecrl_isvalid' due to enum/integer mismatch; have 'gpg_error_t(struct server_control_s *, const char *, const char *)' {aka 'unsigned int(struct server_control_s *, const char *, const char *)'} [-Wenum-int-mismatch]
   57 | fakecrl_isvalid (ctrl_t ctrl, const char *issuer_hash, const char *cert_id)
      | ^~~~~~~~~~~~~~~
In file included from fakecrl.c:49:
crlcache.h:73:20: note: previous declaration of 'fakecrl_isvalid' with type 'crl_cache_result_t(struct server_control_s *, const char *, const char *)'
   73 | crl_cache_result_t fakecrl_isvalid (ctrl_t ctrl,
      |                    ^~~~~~~~~~~~~~~
http.c:2559:1: warning: conflicting types for 'parse_response' due to enum/integer mismatch; have 'gpg_err_code_t(struct http_context_s *)' [-Wenum-int-mismatch]
 2559 | parse_response (http_t hd)
      | ^~~~~~~~~~~~~~
http.c:163:20: note: previous declaration of 'parse_response' with type 'gpg_error_t(struct http_context_s *)' {aka 'unsigned int(struct http_context_s *)'}
  163 | static gpg_error_t parse_response (http_t hd);
      |                    ^~~~~~~~~~~~~~
http.c:2559:1: warning: conflicting types for 'parse_response' due to enum/integer mismatch; have 'gpg_err_code_t(struct http_context_s *)' [-Wenum-int-mismatch]
 2559 | parse_response (http_t hd)
      | ^~~~~~~~~~~~~~
http.c:163:20: note: previous declaration of 'parse_response' with type 'gpg_error_t(struct http_context_s *)' {aka 'unsigned int(struct http_context_s *)'}
  163 | static gpg_error_t parse_response (http_t hd);
      |                    ^~~~~~~~~~~~~~
http.c:2559:1: warning: conflicting types for 'parse_response' due to enum/integer mismatch; have 'gpg_err_code_t(struct http_context_s *)' [-Wenum-int-mismatch]
 2559 | parse_response (http_t hd)
      | ^~~~~~~~~~~~~~
http.c:163:20: note: previous declaration of 'parse_response' with type 'gpg_error_t(struct http_context_s *)' {aka 'unsigned int(struct http_context_s *)'}
  163 | static gpg_error_t parse_response (http_t hd);
      |                    ^~~~~~~~~~~~~~
gpg-auth.c: In function 'getpin':
gpg-auth.c:962:3: warning: ignoring return value of 'fgets' declared with attribute 'warn_unused_result' [-Wunused-result]
  962 |   fgets (line, ASSUAN_LINELENGTH, stdin);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ffi.c: In function 'do_file_equal':
ffi.c:1052:3: warning: ignoring return value of 'fread' declared with attribute 'warn_unused_result' [-Wunused-result]
 1052 |   fread (b_buf, 1, 1, b_stream);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

</details>

I'm reopening this ticket.

To sort out LTO warning someone needs to make the decision which one routines declarations are correct (those in header files or those in .c files).

(void)write (2, "\n", 1 );

This is a standard C pattern to declare that one is not interested in the return value. In this case a return value won't help us because we can't log that anyway because we are in a signal handler.

We don't support that stupid -Wenum-int-mismatch - after all we are not on OS/2 where the size of on enum depends on the values of the enum elements. And this is also no C++ code.

But you are right in that some of the stubs in gpgv have a wrong type. You better don't use LTO then with gpgv. Or better avoid it all - I see no benefits, only problems. LTO is spaghetti code created by the compiler ;-)