Skip to content

gcc 3 warnings & errors #4271

@solardiz

Description

@solardiz

Not sure if we care, but gcc 3.4.6 on x86_64 gives:

yescrypt/yescrypt-opt.c: In function `yescrypt_kdf_body':
yescrypt/yescrypt-opt.c:1192: warning: comparison is always false due to limited range of data type
sha2.c:706:7: warning: no newline at end of file
stribog_fmt_plug.c:472:2: warning: #warning Stribog-256 and Stribog-512 formats require SSE 4.1, formats disabled
memory.c: In function `alloc_region_t':
memory.c:625: warning: dereferencing type-punned pointer will break strict-aliasing rules
loader.c: In function `ldr_fill_user_words':
loader.c:1975: warning: comparison is always true due to limited range of data type
loader.c:1975: warning: comparison is always true due to limited range of data type
loader.c:2002: warning: comparison is always true due to limited range of data type
racf2john.c: In function `main':
racf2john.c:100: warning: 'h1_len' might be used uninitialized in this function
racf2john.c:102: warning: 'h2_len' might be used uninitialized in this function
ztex.c: In function `ztex_scan_new_devices':
ztex.c:444: warning: 'result_open' might be used uninitialized in this function
In file included from dmg2john.c:41:
filevault.h:5: warning: malformed '#pragma pack(push[, id], <n>)' - ignored
filevault.h:73: warning: #pragma pack (pop) encountered without matching #pragma pack (push, <n>)
In file included from wpapcap2john.c:37:
jumbo.h:38:1: warning: "__STDC_FORMAT_MACROS" redefined
wpapcap2john.c:29:1: warning: this is the location of the previous definition
ar: creating aes.a
memory.c: In function `alloc_region_t':
memory.c:625: warning: dereferencing type-punned pointer will break strict-aliasing rules
memory.c: In function `alloc_region_t':
memory.c:625: warning: dereferencing type-punned pointer will break strict-aliasing rules
memory.c: In function `alloc_region_t':
memory.c:625: warning: dereferencing type-punned pointer will break strict-aliasing rules

Yet the build succeeds.

gcc 3.3.6:

In file included from lzma/LzmaDec.h:7,
                 from 7z_common.h:13,
                 from 7z_common_plug.c:31:
lzma/7zTypes.h:66: warning: redefinition of `Byte'
/usr/include/zconf.h:261: warning: `Byte' previously declared here
In file included from lzma/LzmaDec.h:7,
                 from 7z_common.h:13,
                 from 7z_fmt_plug.c:73:
lzma/7zTypes.h:66: warning: redefinition of `Byte'
/usr/include/zconf.h:261: warning: `Byte' previously declared here
yescrypt/yescrypt-opt.c: In function `yescrypt_kdf_body':
yescrypt/yescrypt-opt.c:1192: warning: comparison is always false due to limited range of data type
In file included from argon2_core_plug.c:32:
blake2.h:13:9: warning: #pragma once is obsolete
In file included from argon2_core_plug.c:33:
blake2-impl.h:13:9: warning: #pragma once is obsolete
In file included from argon2_opt_plug.c:22:
blake2.h:13:9: warning: #pragma once is obsolete
In file included from blamka-round-opt.h:4,
                 from argon2_opt_plug.c:23:
blake2-impl.h:13:9: warning: #pragma once is obsolete
In file included from blake2b_plug.c:20:
blake2.h:13:9: warning: #pragma once is obsolete
In file included from chacha_plug.c:7:
chacha.h:16: warning: redefinition of `u_char'
/usr/include/sys/types.h:34: warning: `u_char' previously declared here
chacha.h:18: warning: redefinition of `u_int'
/usr/include/sys/types.h:36: warning: `u_int' previously declared here
In file included from blake2b_plug.c:21:
blake2-impl.h:13:9: warning: #pragma once is obsolete
In file included from blake2b_plug.c:37:
blake2b-round.h:13:9: warning: #pragma once is obsolete
In file included from blake2b-round.h:146,
                 from blake2b_plug.c:37:
blake2b-load-sse2.h:13:9: warning: #pragma once is obsolete
blake2b_plug.c: In function `blake2b_compress':
blake2b_plug.c:194: warning: dereferencing type-punned pointer will break strict-aliasing rules
sha2.c:706:7: warning: no newline at end of file
In file included from jh_plug.c:16:
jh.h:15:9: warning: #pragma once is obsolete
In file included from keepass_fmt_plug.c:44:
chacha.h:16: warning: redefinition of `u_char'
/usr/include/sys/types.h:34: warning: `u_char' previously declared here
chacha.h:18: warning: redefinition of `u_int'
/usr/include/sys/types.h:36: warning: `u_int' previously declared here
In file included from monero_fmt_plug.c:37:
chacha.h:16: warning: redefinition of `u_char'
/usr/include/sys/types.h:34: warning: `u_char' previously declared here
chacha.h:18: warning: redefinition of `u_int'
/usr/include/sys/types.h:36: warning: `u_int' previously declared here
In file included from rawBLAKE2_512_fmt_plug.c:22:
blake2.h:13:9: warning: #pragma once is obsolete
In file included from slow_hash_plug.c:11:
int-util.h:5:9: warning: #pragma once is obsolete
In file included from slow_hash_plug.c:15:
jh.h:15:9: warning: #pragma once is obsolete
stribog_fmt_plug.c:472:2: warning: #warning Stribog-256 and Stribog-512 formats require SSE 4.1, formats disabled
In file included from tezos_fmt_plug.c:36:
blake2.h:13:9: warning: #pragma once is obsolete
dynamic_fmt.c: In function `LoadOneFormat':
dynamic_fmt.c:7976: warning: unused variable `options'
In file included from loader.c:51:
mgetl.h: In function `mgetl':
mgetl.h:46: warning: implicit declaration of function `__builtin_ctzl'
In file included from wordlist.c:73:
mgetl.h: In function `mgetl':
mgetl.h:46: warning: implicit declaration of function `__builtin_ctzl'
memory.c: In function `alloc_region_t':
memory.c:625: warning: dereferencing type-punned pointer will break strict-aliasing rules
loader.c: In function `ldr_fill_user_words':
loader.c:1975: warning: comparison is always true due to limited range of data type
loader.c:1975: warning: comparison is always true due to limited range of data type
loader.c:2002: warning: comparison is always true due to limited range of data type
racf2john.c: In function `process_user_rec':
racf2john.c:100: warning: `h1_len' might be used uninitialized in this function
racf2john.c:102: warning: `h2_len' might be used uninitialized in this function
In file included from dmg2john.c:41:
filevault.h:5: warning: malformed '#pragma pack(push[, id], <n>)' - ignored
filevault.h:73: warning: #pragma pack (pop) encountered without matching #pragma pack (push, <n>)
In file included from wpapcap2john.c:37:
jumbo.h:38:1: warning: "__STDC_FORMAT_MACROS" redefined
wpapcap2john.c:29:1: warning: this is the location of the previous definition
ztex.c: In function `ztex_scan_new_devices':
ztex.c:444: warning: `result_open' might be used uninitialized in this function
ar: creating aes.a
memory.c: In function `alloc_region_t':
memory.c:625: warning: dereferencing type-punned pointer will break strict-aliasing rules
memory.c: In function `alloc_region_t':
memory.c:625: warning: dereferencing type-punned pointer will break strict-aliasing rules
memory.c: In function `alloc_region_t':
memory.c:625: warning: dereferencing type-punned pointer will break strict-aliasing rules
ar: creating secp256k1.a
ar: creating ed25519-donna.a
loader.o: In function `mgetl':
/home/solar/j/bleeding-jumbo-20200607/src/mgetl.h:46: undefined reference to `__builtin_ctzl'
wordlist.o: In function `mgetl':
/home/solar/j/bleeding-jumbo-20200607/src/mgetl.h:46: undefined reference to `__builtin_ctzl'

Build succeeds after this fix:

+++ b/src/mgetl.h
@@ -42,7 +42,7 @@ static MAYBE_INLINE char *mgetl(char *res)
 
                vstoreu((vtype*)pos, x);
                if (v) {
-#ifdef __GNUC__
+#if __GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
                        unsigned int r = __builtin_ctzl(v);
 #else
                        unsigned int r = ffs(v) - 1;

This is the exact same check that we already have in gost.h for the same reason, so I think we should commit it.

With both builds, all 408 CPU format tests pass.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions