MALLOC_PERTURB_=117 gcc -v gives strange output for OFFLOAD_TARGET_DEFAULT

Bug #1721355 reported by Laurent Bonnaud
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gcc-7 (Ubuntu)
Fix Released
Undecided
Unassigned
Bionic
Fix Released
Undecided
Unassigned
gcc-8 (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Hi,

the problem is junk characters after the value of the OFFLOAD_TARGET_DEFAULT variable:

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.2.0-7ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 7.2.0 (Ubuntu 7.2.0-7ubuntu1)

ProblemType: Bug
DistroRelease: Ubuntu 17.10
Package: gcc-7 7.2.0-7ubuntu1
Uname: Linux 4.13.4-041304-generic x86_64
ApportVersion: 2.20.7-0ubuntu2
Architecture: amd64
CurrentDesktop: KDE
Date: Wed Oct 4 19:54:34 2017
EcryptfsInUse: Yes
SourcePackage: gcc-7
UpgradeStatus: Upgraded to artful on 2017-09-29 (5 days ago)

Revision history for this message
Laurent Bonnaud (laurent-bonnaud) wrote :
Revision history for this message
Hans Joachim Desserud (hjd) wrote :

Thanks for taking your time to report this issue and help making Ubuntu better.

I was not able to reproduce this issue with gcc-7 7.2.0-8ubuntu2 on Ubuntu Artful, I don't see any of the extra characters. Could you check with the latest update if it has been resolved or still happens?

Changed in gcc-7 (Ubuntu):
status: New → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for gcc-7 (Ubuntu) because there has been no activity for 60 days.]

Changed in gcc-7 (Ubuntu):
status: Incomplete → Expired
Revision history for this message
Laurent Bonnaud (laurent-bonnaud) wrote :

I tried with this gcc version in artful:

Package: gcc-7
Version: 7.2.0-8ubuntu3

and the problem is still there.

I am wondering what is different on my systems. gcc itself is not corrupted:

$ debsums -s gcc-7
[nothing]

Changed in gcc-7 (Ubuntu):
status: Expired → New
Revision history for this message
Laurent Bonnaud (laurent-bonnaud) wrote :

I found how to reproduce this:

MALLOC_PERTURB_=117 gcc -v

Revision history for this message
Laurent Bonnaud (laurent-bonnaud) wrote :
Download full text (3.4 KiB)

valgrind finds some uses of uninitialised memory:

$ valgrind gcc -v
==496== Memcheck, a memory error detector
==496== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==496== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==496== Command: gcc -v
==496==
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
==496== Conditional jump or move depends on uninitialised value(s)
==496== at 0x4C32D48: __strlen_sse2 (vg_replace_strmem.c:460)
==496== by 0x4E918C4: vfprintf (vfprintf.c:1643)
==496== by 0x4E927D5: buffered_vfprintf (vfprintf.c:2330)
==496== by 0x4E8FAA5: vfprintf (vfprintf.c:1301)
==496== by 0x4F61295: __vfprintf_chk (vfprintf_chk.c:33)
==496== by 0x428CCD: vfprintf (stdio2.h:127)
==496== by 0x428CCD: fnotice(_IO_FILE*, char const*, ...) (diagnostic.c:1427)
==496== by 0x407F06: env_manager::xput(char const*) (gcc.c:119)
==496== by 0x40A604: xputenv (gcc.c:2700)
==496== by 0x40A604: driver::maybe_putenv_OFFLOAD_TARGETS() const (gcc.c:7764)
==496== by 0x403A5C: driver::main(int, char**) (gcc.c:7295)
==496== by 0x403D53: main (gcc-main.c:46)
==496==
OFFLOAD_TARGET_DEFAULT=1
==496== Conditional jump or move depends on uninitialised value(s)
==496== at 0x4C37CE0: putenv (vg_replace_strmem.c:1996)
==496== by 0x40A604: xputenv (gcc.c:2700)
==496== by 0x40A604: driver::maybe_putenv_OFFLOAD_TARGETS() const (gcc.c:7764)
==496== by 0x403A5C: driver::main(int, char**) (gcc.c:7295)
==496== by 0x403D53: main (gcc-main.c:46)
==496==
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.2.0-8ubuntu3.1' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 7.2.0 (Ubuntu 7.2.0-8ubuntu3.1)
==496==
==496== HEAP SUMMARY:
==496== in use at exit: 180,029 bytes in 57 blocks
==496== total heap usage: 201 allocs, 144 frees, 202,427 bytes allocated
==496==
==496== LEAK SUMMARY:
==496== definitely lost: 4,272 bytes in 7 blocks
==496== indirectly lost: 0 bytes in 0 blocks
==496== possibly lost: 0 bytes in 0 blocks
==496== still reachable: 175,757 bytes in 50 blocks
==496== suppressed: 0 bytes in 0 blocks
==496== Rerun with --...

Read more...

Revision history for this message
Hans Joachim Desserud (hjd) wrote :

Thanks for digging deeper into this. When running MALLOC_PERTURB_=117 gcc -v, I am able to reproduce this issue with gcc 7.2.0-18ubuntu2 on Ubuntu bionic. (Not that I know what the environment variable do, but it does affect the output)

Changed in gcc-7 (Ubuntu):
status: New → Confirmed
summary: - gcc -v gives strange output for OFFLOAD_TARGET_DEFAULT
+ MALLOC_PERTURB_=117 gcc -v gives strange output for
+ OFFLOAD_TARGET_DEFAULT
tags: added: bionic
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gcc-7 - 7.3.0-16ubuntu2

---------------
gcc-7 (7.3.0-16ubuntu2) bionic; urgency=medium

  * Merge with Debian; remaining changes:
    - Build from upstream sources.
  * Update the gcc-foffload-default patch. LP: #1721355.

gcc-7 (7.3.0-16) unstable; urgency=medium

  * Update to SVN 20180411 (r259316) from the gcc-7-branch.
    - Fix PR target/85203 (ARM), PR target/84748 (AArch64), PR c++/85279,
      PR target/85196 (SPARC).
  * Use triplet-prefixed as and ld (Helmut Grohne). Addresses: #895251.
  * Link libasan, liblsan, libubsan always with --no-as-needed. LP: #1762683.
  * Backport r251558 from the trunk, addresses Linaro #3718. LP: #1759369.
  * Fix PR libstdc++/85222, taken from the trunk.
  * Use --push-state --as-needed and --pop-state instead of --as-needed and
    --no-as-needed for linking libgcc.

 -- Matthias Klose <email address hidden> Thu, 12 Apr 2018 00:45:22 +0200

Changed in gcc-7 (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Laurent Bonnaud (laurent-bonnaud) wrote :

Hi Matthias,

thanks for the fix!

This bug also exists in Debian. Since you also maintain gcc in Debian, do you plan to fix it there also, or should I make another bug report?

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gcc-8 - 8-20180414-1ubuntu1

---------------
gcc-8 (8-20180414-1ubuntu1) bionic; urgency=medium

  * GCC 8 snapshot, taken from the trunk 20180408 (r259224).
  * Strip the binaries for the upcoming release.

gcc-8 (8-20180414-1) unstable; urgency=medium

  * GCC 8 snapshot, taken from the trunk 20180414 (r259383).

  [ Matthias Klose ]
  * Update GDC to 20180410.
  * Don't install i586 symlinks anymore for i386 builds in sid.
  * Fix zlib-dev dependencies for the libphobos cross multilib packages.
  * Fix dependency generation for libatomic and libquadmath cross packages.
  * Use triplet-prefixed as and ld (Helmut Grohne). Closes: #895251.
  * Link libasan, liblsan, libubsan always with --no-as-needed. LP: #1762683.
  * Use --push-state --as-needed and --pop-state instead of --as-needed and
    --no-as-needed for linking libgcc.
  * Update the gcc-foffload-default patch. LP: #1721355.

  [ Svante Signell ]
  * Reintroduce libgo patches for hurd-i386. Closes: #894080.

 -- Matthias Klose <email address hidden> Sat, 14 Apr 2018 07:29:59 +0200

Changed in gcc-8 (Ubuntu):
status: New → Fix Released
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Please test proposed package

Hello Laurent, or anyone else affected,

Accepted gcc-7 into bionic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/gcc-7/7.3.0-27ubuntu1~18.04 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed.Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-bionic to verification-done-bionic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-bionic. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in gcc-7 (Ubuntu Bionic):
status: New → Fix Committed
tags: added: verification-needed verification-needed-bionic
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

This bug is already fixed in the latest version present in bionic - marking as verified.

tags: added: verification-done verification-done-bionic
removed: verification-needed verification-needed-bionic
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Update Released

The verification of the Stable Release Update for gcc-7 has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Launchpad Janitor (janitor) wrote :
Download full text (7.7 KiB)

This bug was fixed in the package gcc-7 - 7.3.0-27ubuntu1~18.04

---------------
gcc-7 (7.3.0-27ubuntu1~18.04) bionic-proposed; urgency=medium

  * SRU: LP: #1769657. Update the package to the current version in cosmic.

gcc-7 (7.3.0-27ubuntu1) cosmic; urgency=medium

  * Merge with Debian; remaining changes:
    - Build from upstream sources.

gcc-7 (7.3.0-27) unstable; urgency=medium

  * Update to SVN 20180720 (r262899) from the gcc-7-branch.
    - Fix PR target/84168 (AArch64).

  [ Nicolas Boulenguez ]
  * ada-verbose patch: Make the ada build more verbose.
  * Update the ada-gcc-name patch again. See #856274. Closes: #903694.

  [ Matthias Klose ]
  * Rewrite debian/README.cross.
  * Build using gnat-6, avoiding the broken gnat in 7.3.0-26.

gcc-7 (7.3.0-26ubuntu1) cosmic; urgency=medium

  * Merge with Debian; remaining changes:
    - Build from upstream sources.

gcc-7 (7.3.0-26) unstable; urgency=medium

  * Update to SVN 20180717 (r262814) from the gcc-7-branch.
    - Fix PR target/84829, PR fortran/83184, PR fortran/86417,
      PR fortran/83183, PR fortran/86325.

  [ Nicolas Boulenguez ]
  * Update the ada-gcc-name patch, not appending the suffix twice.
    Addresses: #856274.

gcc-7 (7.3.0-25ubuntu1) cosmic; urgency=medium

  * Merge with Debian; remaining changes:
    - Build from upstream sources.

gcc-7 (7.3.0-25) unstable; urgency=medium

  * Update to SVN 20180712 (r262577) from the gcc-7-branch.
    - Fix PR c++/86291, PR libstdc++/86272, PR libstdc++/86127,
      PR target/85904, PR libstdc++/85098, PR libstdc++/85671, PR hsa/86371,
      PR libstdc++/83982, PR libstdc++/84087, PR target/86314 (x86),
      PR c++/86378, PR c++/80290, PR c++/86291, PR fortran/82969,
      PR fortran/86242.
  * Enable decimal float support on kfreebsd-amd64. Closes: #897416.

gcc-7 (7.3.0-24ubuntu1) cosmic; urgency=medium

  * Merge with Debian; remaining changes:
    - Build from upstream sources.

gcc-7 (7.3.0-24) unstable; urgency=medium

  * Update to SVN 20180626 (r262132) from the gcc-7-branch.
    - Fix PR jit/85384, PR libstdc++/86138, PR c++/86210, PR c/85696,
      PR c++/85662, PR c/85696, PR c/84999, PR c/84853, PR target/84786 (x86),
      PR tree-optimization/85989, PR tree-optimization/86231,
      PR middle-end/85878, PR target/85945, PR c++/86025, PR c++/85659,
      PR web/85578, PR tree-optimization/85529, PR tree-optimization/85446,
      PR rtl-optimization/85431, PR target/85430 (x86),
      PR rtl-optimization/85300, PR tree-optimization/85257, PR debug/85252,
      PR rtl-optimization/85167, PR target/85095, PR inline-asm/85022,
      PR inline-asm/85034, PR inline-asm/85022, PR inline-asm/84941,
      PR sanitizer/85018, PR debug/84875, PR c/84953, PR target/84990,
      PR sanitizer/78651, PR sanitizer/78651, PR target/84899,
      PR tree-optimization/84841, PR c++/79085, PR target/84860,
      PR middle-end/84834, PR target/84827, PR target/84786, PR target/84772,
      PR c++/84767, PR tree-optimization/84739, PR target/84700,
      PR middle-end/82063, PR c++/85952, PR c/85696, PR c++/85662,
      PR c++/84463, PR c++/85210, PR c++/85208, PR inline-asm/85172,
      PR c++/85147, PR c++/85140, PR c++/84791, PR c...

Read more...

Changed in gcc-7 (Ubuntu Bionic):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.