clang++ regex_replace always segfaults with -O3
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
llvm-defaults (Ubuntu) |
Won't Fix
|
Undecided
|
Unassigned |
Bug Description
Calling regex_replace with -O3 will crash no matter the input. This seems to have started occurring after an apt-get upgrade, but I cannot say for sure exactly what package update might have caused it. We were able to run similar code in previous builds of 16.04.
If you compile without -O3, it runs.
clang++ --std=c++14 -O3 test.cpp
test.cpp:
#include <regex>
#include <string>
#include <iostream>
int main() {
const std::string& output = regex_replace("", std::regex(""), "");
std::cout << output << "\n";
return 0;
}
Description: Ubuntu 16.04.3 LTS
Release: 16.04
clang:
Installed: 1:3.8-33ubuntu3.1
Candidate: 1:3.8-33ubuntu3.1
Version table:
*** 1:3.8-33ubuntu3.1 500
500 http://
100 /var/lib/
1:
500 http://
ProblemType: Bug
DistroRelease: Ubuntu 16.04
Package: clang 1:3.8-33ubuntu3.1
ProcVersionSign
Uname: Linux 4.13.0-32-generic x86_64
NonfreeKernelMo
ApportVersion: 2.20.1-0ubuntu2.15
Architecture: amd64
CurrentDesktop: Unity
Date: Thu Feb 8 20:23:48 2018
InstallationDate: Installed on 2017-08-17 (175 days ago)
InstallationMedia: Ubuntu 16.04.3 LTS "Xenial Xerus" - Release amd64 (20170801)
ProcEnviron:
LANGUAGE=en_US
PATH=(custom, no user)
XDG_RUNTIME_
LANG=en_US.UTF-8
SHELL=/bin/bash
SourcePackage: llvm-defaults
UpgradeStatus: No upgrade log present (probably fresh install)
libstdc++-5-dev: 16.04.6 16.04.6 16.04.6 500 us.archive. ubuntu. com/ubuntu xenial-updates/main amd64 Packages dpkg/status 4.0-6ubuntu1~ 16.04.4 500 security. ubuntu. com/ubuntu xenial- security/ main amd64 Packages 3.1-14ubuntu2 500 us.archive. ubuntu. com/ubuntu xenial/main amd64 Packages
Installed: 5.4.0-6ubuntu1~
Candidate: 5.4.0-6ubuntu1~
Version table:
*** 5.4.0-6ubuntu1~
500 http://
100 /var/lib/
5.
500 http://
5.
500 http://