[Bug 1593608] [NEW] __FUNCTION__ causes g++ internal compiler error in constexpr functions

Curtis Brown 1593608 at bugs.launchpad.net
Fri Jun 17 07:43:13 UTC 2016


Public bug reported:

// 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"

** Affects: gcc-5 (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to gcc-5 in Ubuntu.
https://bugs.launchpad.net/bugs/1593608

Title:
  __FUNCTION__ causes g++ internal compiler error in constexpr functions

Status in gcc-5 package in Ubuntu:
  New

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"

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1593608/+subscriptions



More information about the foundations-bugs mailing list