Hi, the following piece of code causes an ICE (segmentation fault) when compiled with gcc-4.7.0-RC-20120302 (no problem with gcc 4.6.3): #include <atomic> template<typename T> struct test { std::atomic<int> x; void foo() { auto cond = [this] {return x != 0;}; } }; It works if the value of x is loaded explicitly: auto cond = [this] {return x.load() != 0;};
Confirmed. We should figure out a reduced testcase not including anything (note: the internals of <atomic> are completely different in 4.7 vs 4.6)
The crash happens in lvalue_kind: an INDIRECT_REF with no TREE_TYPE.
Here is a testcase not including anything: template <typename T> struct foo { operator T() { return T(); } }; template<typename T> struct test { foo<int> x; void bar() { auto f = [this] {return x != 0;}; } }; As in the above testcase, the ICE disappears if implicit type conversion is avoided: auto f = [this] {return (int)x != 0;};
Thanks!
Probably Dup of PR54403.
Fixed by the patch which fixed PR54122. *** This bug has been marked as a duplicate of bug 54122 ***