__FUNCTION__ causes g++ internal compiler error in constexpr functions

Bug #1593608 reported by cub
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gcc-5 (Ubuntu)
Fix Released
Undecided
Unassigned
Xenial
Fix Released
Undecided
Unassigned

Bug Description

// bug.cpp
// g++ -std=c++14 bug.cpp -DCAUSE_GCC_INTERNAL_COMPILER_ERROR
inline constexpr bool bug() noexcept {
#ifdef CAUSE_GCC_INTERNAL_COMPILER_ERROR
  auto tmp = __FUNCTION__; // same for __PRETTY_FUNCTION__
#else
  auto tmp = "bug";
#endif
  return true;
}
static_assert(bug(), "g++ 5.3.1 bug");
int main(int, const char *[]) { return 0; }

$ g++ -std=c++14 bug.cpp

$ g++ -std=c++14 bug.cpp -DCAUSE_GCC_INTERNAL_COMPILER_ERROR
bug.cpp:11:18: in constexpr expansion of ‘bug()’
bug.cpp:11:38: internal compiler error: Segmentation fault
 static_assert(bug(), "g++ 5.3.1 bug");
                                      ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-5/README.Bugs> for instructions.

$ gcc --version
gcc (Ubuntu 5.3.1-14ubuntu2.1) 5.3.1 20160413
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04 LTS"

Revision history for this message
Matthias Klose (doko) wrote :

fixed in yakkety and in ppa:ubuntu-toolchain-r/ppa (which is supposed to go to xenial-updates)

Changed in gcc-5 (Ubuntu):
status: New → In Progress
Matthias Klose (doko)
Changed in gcc-5 (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
Martin Pitt (pitti) wrote : Please test proposed package

Hello Curtis, or anyone else affected,

Accepted gcc-5 into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/gcc-5/5.4.0-6ubuntu1~16.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 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 to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

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

Changed in gcc-5 (Ubuntu Xenial):
status: New → Fix Committed
tags: added: verification-needed
Revision history for this message
Matthias Klose (doko) wrote :

works with the version in xenial-proposed

tags: added: verification-done
removed: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :
Download full text (8.1 KiB)

This bug was fixed in the package gcc-5 - 5.4.0-6ubuntu1~16.04.1

---------------
gcc-5 (5.4.0-6ubuntu1~16.04.1) xenial-proposed; urgency=medium

  * SRU: LP: #1586673. Backport GCC 5.4 to 16.04 LTS.
  * Revert a libstdc++ header reorg done after the 5.3.0 release.
  * Add AArch64 Vulcan cpu support, backport from trunk. LP: #1594452.
  * Revert a libstdc++ header reorg done after the 5.3.0 release (only for
    OS releases including a GCC 5 at release time).
  * Fixes C++ ICE. LP: #1593608.

gcc-5 (5.4.0-6ubuntu1) yakkety; urgency=medium

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

gcc-5 (5.4.0-6) unstable; urgency=medium

  * Fix gdc cross build.
  * Disable the AArch64 Vulcan cpu support for FSF builds, needs a proper
    back port.

gcc-5 (5.4.0-5ubuntu1) yakkety; urgency=medium

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

gcc-5 (5.4.0-5) unstable; urgency=medium

  [ Matthias Klose ]
  * Add AArch64 Vulcan cpu support, backport from trunk. LP: #1594452.
  * Revert a libstdc++ header reorg done after the 5.3.0 release (only for
    OS releases including a GCC 5 at release time).
  * Enforce build using binutils 2.26.1 for unstable/development series.
  * Mark cross compilers as M-A: foreign. Addresses: #827136.
  * Remove the MIPS r6 support again, dak doesn't like unknown architectures.

  [ Aurelien Jarno ]
  * Drop support for loongson 2f (YunQiang Su). Closes: #827554.
  * Apply proposed patch from Matthew Fortune to fix libjava on mips64el.

gcc-5 (5.4.0-4ubuntu1) yakkety; urgency=medium

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

gcc-5 (5.4.0-4) unstable; urgency=medium

  * gdc: Fix linking the runtime library. Closes: #826645.
  * gdc: Fix updates from 5.3.x. Closes: #826583.
  * Update the Linaro support to the 5-2016.06 snapshot.
  * Add MIPS r6 support and bump mipsn32(el) ISA to r2 (YunQiang Su).
    Closes: #824986.
  * Avoid storing -fdebug-prefix-map in DW_AT_producer (for better
    reproducibility). Taken from the trunk (Daniel Kahn Gillmor).
    Closes: #819176.

gcc-5 (5.4.0-3ubuntu1) yakkety; urgency=medium

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

gcc-5 (5.4.0-3) unstable; urgency=medium

  * Update Ada patch for KFreeBSD (Steven Chamberlain). Closes: #826332.

gcc-5 (5.4.0-2) unstable; urgency=medium

  * Fix gdc packaging for architectures without libphobos support.

gcc-5 (5.4.0-1) unstable; urgency=medium

  * GCC 5.4.0 release.
    - Fix PR target/68696 (AArch64), PR fortran/70350.
  * Update embedded timestamp setting patch, backported from the trunk.
  * Update the Linaro support to the 5-2016.05 snapshot.
  * Update gdc to the gcc-5 branch 20160603.

gcc-5 (5.3.1-21ubuntu11) yakkety; urgency=medium

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

gcc-5 (5.3.1-21) unstable; urgency=medium

  * GCC 5.4.0 release candidate 1.
  * Update to SVN 20160528 (r236840, 5.3.1) from the gcc-5-branch.
    - Fix PR libstdc++/69703, PR libstdc++/71038, PR libstdc++/71036,
      PR libstdc++/71037, PR libstdc++/71005, PR libstdc++/71004,
      PR libstdc++/70...

Read more...

Changed in gcc-5 (Ubuntu Xenial):
status: Fix Committed → Fix Released
Revision history for this message
Martin Pitt (pitti) wrote : Update Released

The verification of the Stable Release Update for gcc-5 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.

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.