http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57832 Bug ID: 57832 Summary: compiling sha-256 code (xz 5.0.5) generates false warnings when using -march=native on Atom CPU Product: gcc Version: 4.8.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: olivier.pis.langlois at transport dot alstom.com Created attachment 30465 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30465&action=edit intermediate file When I compile check/sha256.c (from xz 5.0.5) without '-march=native' (should be atom), compiler process the input file. With '-march=native', it generates, IMO, false warnings. lano1106@hpmini ~/dev/packages/xz/repos/core-i686/src/xz-5.0.5/src/liblzma $ gcc -v -std=gnu99 -DHAVE_CONFIG_H -I. -I../.. -I../../src/liblzma/api -I../../src/liblzma/common -I../../src/liblzma/check -I../../src/liblzma/lz -I../../src/liblzma/rangecoder -I../../src/liblzma/lzma -I../../src/liblzma/delta -I../../src/liblzma/simple -I../../src/common -DTUKLIB_SYMBOL_PREFIX=lzma_ -D_FORTIFY_SOURCE=2 -pthread -fvisibility=hidden -Wall -Wextra -Wvla -Wformat=2 -Winit-self -Wmissing-include-dirs -Wstrict-aliasing -Wfloat-equal -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wwrite-strings -Wlogical-op -Waggregate-return -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Wmissing-noreturn -Wredundant-decls -Werror -march=native -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -MT liblzma_la-sha256.lo -MD -MP -MF .deps/liblzma_la-sha256.Tpo -c check/sha256.c -fPIC -DPIC -o .libs/liblzma_la-sha256.o Using built-in specs. COLLECT_GCC=/usr/bin/gcc Target: i686-pc-linux-gnu Configured with: /build/gcc/src/gcc-4.8.1/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --enable-gnu-unique-object --enable-linker-build-id --enable-cloog-backend=isl --disable-cloog-version-check --enable-lto --enable-gold --enable-ld=default --enable-plugin --with-plugin-ld=ld.gold --with-linker-hash-style=gnu --disable-install-libiberty --disable-multilib --disable-libssp --disable-werror --enable-checking=release Thread model: posix gcc version 4.8.1 (GCC) COLLECT_GCC_OPTIONS='-v' '-std=gnu99' '-D' 'HAVE_CONFIG_H' '-I' '.' '-I' '../..' '-I' '../../src/liblzma/api' '-I' '../../src/liblzma/common' '-I' '../../src/liblzma/check' '-I' '../../src/liblzma/lz' '-I' '../../src/liblzma/rangecoder' '-I' '../../src/liblzma/lzma' '-I' '../../src/liblzma/delta' '-I' '../../src/liblzma/simple' '-I' '../../src/common' '-D' 'TUKLIB_SYMBOL_PREFIX=lzma_' '-D' '_FORTIFY_SOURCE=2' '-pthread' '-fvisibility=hidden' '-Wall' '-Wextra' '-Wvla' '-Wformat=2' '-Winit-self' '-Wmissing-include-dirs' '-Wstrict-aliasing' '-Wfloat-equal' '-Wundef' '-Wshadow' '-Wpointer-arith' '-Wbad-function-cast' '-Wwrite-strings' '-Wlogical-op' '-Waggregate-return' '-Wstrict-prototypes' '-Wold-style-definition' '-Wmissing-prototypes' '-Wmissing-declarations' '-Wsuggest-attribute=noreturn' '-Wredundant-decls' '-Werror' '-march=native' '-O2' '-pipe' '-fstack-protector' '--param' 'ssp-buffer-size=4' '-MT' 'liblzma_la-sha256.lo' '-MD' '-MP' '-MF' '.deps/liblzma_la-sha256.Tpo' '-c' '-fPIC' '-D' 'PIC' '-o' '.libs/liblzma_la-sha256.o' /usr/lib/gcc/i686-pc-linux-gnu/4.8.1/cc1 -quiet -v -I . -I ../.. -I ../../src/liblzma/api -I ../../src/liblzma/common -I ../../src/liblzma/check -I ../../src/liblzma/lz -I ../../src/liblzma/rangecoder -I ../../src/liblzma/lzma -I ../../src/liblzma/delta -I ../../src/liblzma/simple -I ../../src/common -MD .libs/liblzma_la-sha256.d -MF .deps/liblzma_la-sha256.Tpo -MP -MT liblzma_la-sha256.lo -D_REENTRANT -D HAVE_CONFIG_H -D TUKLIB_SYMBOL_PREFIX=lzma_ -D _FORTIFY_SOURCE=2 -D PIC check/sha256.c -march=atom -mcx16 -msahf -mmovbe -mno-aes -mno-pclmul -mno-popcnt -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-bmi2 -mno-tbm -mno-avx -mno-avx2 -mno-sse4.2 -mno-sse4.1 -mno-lzcnt -mno-rtm -mno-hle -mno-rdrnd -mno-f16c -mno-fsgsbase -mno-rdseed -mno-prfchw -mno-adx -mfxsr -mno-xsave -mno-xsaveopt --param l1-cache-size=0 --param l1-cache-line-size=0 --param l2-cache-size=512 -mtune=atom -quiet -dumpbase sha256.c -auxbase-strip .libs/liblzma_la-sha256.o -O2 -Wall -Wextra -Wvla -Wformat=2 -Winit-self -Wmissing-include-dirs -Wstrict-aliasing -Wfloat-equal -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wwrite-strings -Wlogical-op -Waggregate-return -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Wsuggest-attribute=noreturn -Wredundant-decls -Werror -std=gnu99 -version -fvisibility=hidden -fstack-protector -fPIC --param ssp-buffer-size=4 -o - | as -v -I . -I ../.. -I ../../src/liblzma/api -I ../../src/liblzma/common -I ../../src/liblzma/check -I ../../src/liblzma/lz -I ../../src/liblzma/rangecoder -I ../../src/liblzma/lzma -I ../../src/liblzma/delta -I ../../src/liblzma/simple -I ../../src/common --32 -o .libs/liblzma_la-sha256.o GNU assembler version 2.23.2 (i686-pc-linux-gnu) using BFD version (GNU Binutils) 2.23.2 GNU C (GCC) version 4.8.1 (i686-pc-linux-gnu) compiled by GNU C version 4.8.1, GMP version 5.1.2, MPFR version 3.1.2, MPC version 1.0.1 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 ignoring nonexistent directory "/usr/lib/gcc/i686-pc-linux-gnu/4.8.1/../../../../i686-pc-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: . ../.. ../../src/liblzma/api ../../src/liblzma/common ../../src/liblzma/check ../../src/liblzma/lz ../../src/liblzma/rangecoder ../../src/liblzma/lzma ../../src/liblzma/delta ../../src/liblzma/simple ../../src/common /usr/lib/gcc/i686-pc-linux-gnu/4.8.1/include /usr/local/include /usr/lib/gcc/i686-pc-linux-gnu/4.8.1/include-fixed /usr/include End of search list. GNU C (GCC) version 4.8.1 (i686-pc-linux-gnu) compiled by GNU C version 4.8.1, GMP version 5.1.2, MPFR version 3.1.2, MPC version 1.0.1 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 2963cf20dad9f99b27bcc12dcdc7b43f check/sha256.c: In function âprocessâ: check/sha256.c:85:11: error: âW[6]â may be used uninitialized in this function [-Werror=maybe-uninitialized] uint32_t W[16]; ^ check/sha256.c:85:11: error: âW[5]â may be used uninitialized in this function [-Werror=maybe-uninitialized] check/sha256.c:85:11: error: âW[13]â may be used uninitialized in this function [-Werror=maybe-uninitialized] check/sha256.c:85:11: error: âW[4]â may be used uninitialized in this function [-Werror=maybe-uninitialized] check/sha256.c:85:11: error: âW[12]â may be used uninitialized in this function [-Werror=maybe-uninitialized] check/sha256.c:85:11: error: âW[3]â may be used uninitialized in this function [-Werror=maybe-uninitialized] check/sha256.c:85:11: error: âW[11]â may be used uninitialized in this function [-Werror=maybe-uninitialized] check/sha256.c:85:11: error: âW[2]â may be used uninitialized in this function [-Werror=maybe-uninitialized] check/sha256.c:85:11: error: âW[10]â may be used uninitialized in this function [-Werror=maybe-uninitialized] check/sha256.c:85:11: error: âW[15]â may be used uninitialized in this function [-Werror=maybe-uninitialized] check/sha256.c:85:11: error: âW[0]â may be used uninitialized in this function [-Werror=maybe-uninitialized] check/sha256.c:85:11: error: âW[1]â may be used uninitialized in this function [-Werror=maybe-uninitialized] check/sha256.c:85:11: error: âW[9]â may be used uninitialized in this function [-Werror=maybe-uninitialized] check/sha256.c:85:11: error: âW[14]â may be used uninitialized in this function [-Werror=maybe-uninitialized] cc1: all warnings being treated as errors lano1106@hpmini ~/dev/packages/xz/repos/core-i686/src/xz-5.0.5/src/liblzma :( $ cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 28 model name : Intel(R) Atom(TM) CPU N455 @ 1.66GHz >From gcc-bugs-return-425830-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Jul 05 19:02:43 2013 Return-Path: Delivered-To: listarch-gcc-bugs@gcc.gnu.org Received: (qmail 4247 invoked by alias); 5 Jul 2013 19:02:43 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Delivered-To: mailing list gcc-bugs@gcc.gnu.org Received: (qmail 4208 invoked by uid 48); 5 Jul 2013 19:02:37 -0000 From: "olivier.pis.langlois at transport dot alstom.com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/57832] compiling sha-256 code (xz 5.0.5) generates false warnings when using -march=native on Atom CPU Date: Fri, 05 Jul 2013 19:02:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 4.8.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: olivier.pis.langlois at transport dot alstom.com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: attachments.created Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-07/txt/msg00337.txt.bz2 Content-length: 892 http://gcc.gnu.org/bugzilla/show_bug.cgi?idW832 --- Comment #1 from Olivier Langlois --- Created attachment 30466 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id0466&actioníit original c file very macro heavy loop unrolling sha-256 code hand optimized code (I have peaked into the resulting intermediate code, yuck!) but the code seems ok: #define blk0(i) (W[i] = data[i]) #define blk2(i) (W[i & 15] += s1(W[(i - 2) & 15]) + W[(i - 7) & 15] \ + s0(W[(i - 15) & 15])) ... #define R(i) \ h(i) += S1(e(i)) + Ch(e(i), f(i), g(i)) + SHA256_K[i + j] \ + (j ? blk2(i) : blk0(i)); \ ... // 64 operations, partially loop unrolled for (unsigned int j = 0; j < 64; j += 16) { R( 0); R( 1); R( 2); R( 3); R( 4); R( 5); R( 6); R( 7); R( 8); R( 9); R(10); R(11); R(12); R(13); R(14); R(15); } so for j = 0, all W items will be initialized.