Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.bugs.dist > #1019146 > unrolled thread

Bug#966194: gcc-9: valgrind error: Conditional jump or move depends on uninitialised value(s)

Started byRick Stanley <rick@scotsgeek.com>
First post2020-07-24 17:30 +0200
Last post2020-07-25 20:00 +0200
Articles 3 — 1 participant

Back to article view | Back to linux.debian.bugs.dist


Contents

  Bug#966194: gcc-9: valgrind error: Conditional jump or move depends on uninitialised value(s) Rick Stanley <rick@scotsgeek.com> - 2020-07-24 17:30 +0200
    Bug#966194: Wrong code in the report Rick Stanley <rick@scotsgeek.com> - 2020-07-24 22:40 +0200
    Bug#966194: Cancel report! Rick Stanley <rick@scotsgeek.com> - 2020-07-25 20:00 +0200

#1019146 — Bug#966194: gcc-9: valgrind error: Conditional jump or move depends on uninitialised value(s)

FromRick Stanley <rick@scotsgeek.com>
Date2020-07-24 17:30 +0200
SubjectBug#966194: gcc-9: valgrind error: Conditional jump or move depends on uninitialised value(s)
Message-ID<Aw7O2-wk-5@gated-at.bofh.it>
Package: gcc-9
Version: 9.3.0-15
Severity: important
X-Debbugs-Cc: rick@scotsgeek.com

Dear Maintainer,

Source:
#include <stdio.h>
#include <string.h>

#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       <none>
pn  gcc-9-locales   <none>
pn  gcc-9-multilib  <none>

-- no debconf information

[toc] | [next] | [standalone]


#1019190 — Bug#966194: Wrong code in the report

FromRick Stanley <rick@scotsgeek.com>
Date2020-07-24 22:40 +0200
SubjectBug#966194: Wrong code in the report
Message-ID<AwcE1-3p5-3@gated-at.bofh.it>
In reply to#1019146
Correct code that created the error message in valgrind:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define DIM 32

int main(void)
{
   char *p = NULL;

   p = malloc(DIM);

   if(p == NULL)
   {
      printf("Allocation error.\n");
      exit(1);
   }

   strcpy(p, "This is a test.");

   for(int x = 0 ; x < DIM; ++x)
   {
      printf("%02x ",  p[x]);
   }
   putchar('\n');

   free(p);

   return 0;
}

[toc] | [prev] | [next] | [standalone]


#1019271 — Bug#966194: Cancel report!

FromRick Stanley <rick@scotsgeek.com>
Date2020-07-25 20:00 +0200
SubjectBug#966194: Cancel report!
Message-ID<AwwCK-6Yz-3@gated-at.bofh.it>
In reply to#1019146
Please cancel and delete this entire report.  This was a valgrind
issue.

Sorry for bothering you.

Thank you!

Rick Stanley

-- 
RSI (Rick Stanley, Inc.)
(917) 822-7771
www.rsiny.com
Computer Systems Consulting
Linux & Open Source Specialists

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.bugs.dist


csiph-web