[Bug c++/53137] [4.7/4.8 Regression] g++ segfault

valery.bickov+gcc at gmail dot com gcc-bugzilla@gcc.gnu.org
Wed Sep 26 11:12:00 GMT 2012


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

valery.bickov+gcc at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |

--- Comment #8 from Jason Merrill <jason at gcc dot gnu.org> 2012-06-20 07:22:00 UTC ---
Author: jason
Date: Wed Jun 20 07:21:55 2012
New Revision: 188810

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=188810
Log:
    Reapply:
    PR c++/53137
    * pt.c (instantiate_class_template_1): Set LAMBDA_EXPR_THIS_CAPTURE.
    (instantiate_decl): Don't push_to_top_level for local class methods.
    (instantiate_class_template_1): Or for local classes.

Added:
   
branches/gcc-4_7-branch/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template5.C
Modified:
    branches/gcc-4_7-branch/gcc/cp/ChangeLog
    branches/gcc-4_7-branch/gcc/cp/pt.c
    branches/gcc-4_7-branch/gcc/testsuite/ChangeLog

--- Comment #9 from valery.bickov+gcc at gmail dot com 2012-09-26 11:12:24 UTC ---
Slightly modified example still crashes on 4.7.2:

template <typename STORE>
void getParent(STORE& tStore)
{
}

struct  Store
{
    template <typename CheckParentFunc>
    void updateChildCommon(CheckParentFunc c)
    {
        c();
    }

    template <typename T>
    int& getStore();

    template <typename T>
    void updateChild(const T& obj)
    {
        updateChildCommon([this] () { getParent(getStore<T>()); });
    }

    void update(int obj);
};

void Store::update(int obj)
{
    updateChild(obj);
}

$ /usr/local/gcc-4.7.2/bin/g++ -c gcc-4.7.2-crash.cpp -std=c++11
gcc-4.7.2-crash.cpp: In lambda function:
gcc-4.7.2-crash.cpp:29:1: internal compiler error: in get_expr_operands, at
tree-ssa-operands.c:1035
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

$ /usr/local/gcc-4.7.2/bin/g++ -v
Using built-in specs.
COLLECT_GCC=/usr/local/gcc-4.7.2/bin/g++
COLLECT_LTO_WRAPPER=/usr/local/gcc-4.7.2/libexec/gcc/x86_64-unknown-linux-gnu/4.7.2/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ./configure --prefix=/usr/local/gcc-4.7.2 --enable-lto
--disable-multilib --enable-languages=c,c++
Thread model: posix
gcc version 4.7.2 (GCC) 

It compiles ok if I remove c() call or move update(int) definition body into
class.

g++-4.6.3 works with it.

I changed status to reopened excuse me if I shouldn't do it.



More information about the Gcc-bugs mailing list