[Bug c++/62196] New: running time segment fault with valarray
pangbw at gmail dot com
gcc-bugzilla@gcc.gnu.org
Wed Aug 20 00:28:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62196
Bug ID: 62196
Summary: running time segment fault with valarray
Product: gcc
Version: 4.9.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: pangbw at gmail dot com
The code would segment fault at running time, I see the same result with G++
4.6.3(which comes with Ubuntu 12.04) and 4.9.1:
#include <iostream>
#include <valarray>
int main(int argc, char *argv[])
{
const char vl[] = {"abcdefghijklmnopqrstuvwxyz"};
const char vu[] = {"ABCDEFGHIJKLMNOPQRSTUVWXYZ"};
const std::valarray<char> v0(vl, 27), vm6(vu, 6);
const bool vb[] = {false, false, true, true, false, true};
const std::valarray<bool> vmask(vb, 6);
std::valarray<char> x = v0;
for(int i = 0; i < x.size(); i++)
std::cout << x[i];
std::cout << std::endl;
x[vmask] = vm6;
for(int i = 0; i < x.size(); i++)
std::cout << x[i];
std::cout << std::endl;
return 0;
}
The command line is just simply as:
g++ -std=c++0x x.cpp
More information about the Gcc-bugs
mailing list