[Bug c++/59255] New: Segmentation fault with std::function and -fprofile-use

2013-11-22 Thread stepik-777 at mail dot ru
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59255

Bug ID: 59255
   Summary: Segmentation fault with std::function and
-fprofile-use
   Product: gcc
   Version: 4.8.2
Status: UNCONFIRMED
  Severity: critical
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: stepik-777 at mail dot ru

Consider the following simple program:
#include 

int main(int argc, char *argv[])
{
std::function f = []{ return 0; };
return 0;
}

I'm compiling it with these commands:
g++ -std=c++11 -fprofile-generate -c test.cpp -o test.o
g++ -std=c++11 -fprofile-generate -o test test.o
./test # execute to generate profiling data
g++ -std=c++11 -fprofile-use -c test.cpp -o test.o
#g++ -std=c++11 -fprofile-use -o test test.o

This causes segfault when compiling with -fprofile-use:
test.cpp: In destructor 'std::_Function_base::~_Function_base()':
test.cpp:7:1: internal compiler error: Segmentation fault
 }
 ^

Tested with these two gcc versions:
g++ (Ubuntu/Linaro 4.8.1-10ubuntu8) 4.8.1
g++.exe (rev0, Built by MinGW-W64 project) 4.8.2


[Bug c++/54403] [C++11] operator! applied to a member of a templated class in a lambda expression that captures 'this' pointer crashes compiler

2012-11-24 Thread stepik-777 at mail dot ru


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54403



stepik-777 at mail dot ru changed:



   What|Removed |Added



 CC||stepik-777 at mail dot ru



--- Comment #4 from stepik-777 at mail dot ru 2012-11-24 10:03:55 UTC ---

You can use !this->m_barbar intead of !m_barbar as a workaround.



This bug is still present in 4.7.2.



template

struct Struct

{

int member;



Struct()

{

[=]{ !this->member; }; // this works

[=]{ !member; }; // internal compiler error: Segmentation fault

}

};