Path: csiph.com!4.us.feeder.erje.net!2.eu.feeder.erje.net!feeder.erje.net!news.mb-net.net!open-news-network.org!aioe.org!bofh.it!news.nic.it!robomod From: Rick Stanley Newsgroups: linux.debian.bugs.dist Subject: Bug#966194: gcc-9: valgrind error: Conditional jump or move depends on uninitialised value(s) Date: Fri, 24 Jul 2020 17:30:02 +0200 Message-ID: X-Original-To: Debian Bug Tracking System X-Mailbox-Line: From debian-bugs-dist-request@lists.debian.org Fri Jul 24 15:27:10 2020 Old-Return-Path: X-Spam-Flag: NO X-Spam-Score: -0.45 Reply-To: Rick Stanley , 966194@bugs.debian.org Resent-To: debian-bugs-dist@lists.debian.org Resent-Cc: rick@scotsgeek.com, Debian GCC Maintainers X-Debian-Pr-Message: report 966194 X-Debian-Pr-Package: gcc-9 X-Debian-Pr-Source: gcc-9 X-Spam-Bayes: score:0.0000 Tokens: new, 53; hammy, 150; neutral, 115; spammy, 0. spammytokens: hammytokens:0.000-+--H*M:reportbug, 0.000-+--H*MI:reportbug, 0.000-+--H*x:reportbug, 0.000-+--H*UA:reportbug, 0.000-+--X-Debbugs-Cc Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Mailer: reportbug 7.7.0 X-Debian-Message: from BTS X-Mailing-List: archive/latest/1615301 List-ID: List-URL: Approved: robomod@news.nic.it Lines: 87 Organization: linux.* mail to news gateway Sender: robomod@news.nic.it X-Original-Date: Fri, 24 Jul 2020 11:25:53 -0400 X-Original-Message-ID: <159560435318.16195.7592344393259953289.reportbug@desk.rsiny.com> Xref: csiph.com linux.debian.bugs.dist:1019146 Package: gcc-9 Version: 9.3.0-15 Severity: important X-Debbugs-Cc: rick@scotsgeek.com Dear Maintainer, Source: #include #include #define DIM 32 char p[DIM] = "NULL"; int main(void) { strcpy(p, "This is a test."); for(int x = 0 ; x < DIM; ++x) { printf("%02x ", p[x]); } putchar('\n'); return 0; } valgrind output: ==16291== Use of uninitialised value of size 8 ==16291== at 0x48B4E5A: _itoa_word (_itoa.c:180) ==16291== by 0x48CE753: __vfprintf_internal (vfprintf-internal.c:1687) ==16291== by 0x48BAD6A: printf (printf.c:33) ==16291== by 0x10920D: main (ptest.c:33) ==16291== ==16291== Conditional jump or move depends on uninitialised value(s) ==16291== at 0x48B4E6C: _itoa_word (_itoa.c:180) ==16291== by 0x48CE753: __vfprintf_internal (vfprintf-internal.c:1687) ==16291== by 0x48BAD6A: printf (printf.c:33) ==16291== by 0x10920D: main (ptest.c:33) ==16291== ... ==16291== ERROR SUMMARY: 64 errors from 4 contexts (suppressed: 0 from 0) Error only occurs with heap allocation, not with global or local arrays. Error did not occur with previous versions of gcc. Compilation command has not changed. "gcc -std=c18 -Wall -Wextra -Wpedantic -g -I . -o ptest ptest.c" Error should not occur with the code posted here. -- System Information: Debian Release: bullseye/sid APT prefers testing APT policy: (500, 'testing') Architecture: amd64 (x86_64) Kernel: Linux 5.7.0-1-amd64 (SMP w/4 CPU threads) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set Shell: /bin/sh linked to /usr/bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled Versions of packages gcc-9 depends on: ii binutils 2.34.90.20200706-1 ii cpp-9 9.3.0-15 ii gcc-9-base 9.3.0-15 ii libc6 2.31-1 ii libcc1-0 10.1.0-6 ii libgcc-9-dev 9.3.0-15 ii libgcc-s1 10.1.0-6 ii libgmp10 2:6.2.0+dfsg-6 ii libisl22 0.22.1-1 ii libmpc3 1.1.0-1 ii libmpfr6 4.0.2-1 ii libstdc++6 10.1.0-6 ii zlib1g 1:1.2.11.dfsg-2 Versions of packages gcc-9 recommends: ii libc6-dev 2.31-1 Versions of packages gcc-9 suggests: pn gcc-9-doc pn gcc-9-locales pn gcc-9-multilib -- no debconf information