Bug 67244 - [5/6 Regression] internal compiler error: in gimplify_var_or_parm_decl, at gimplify.c:1801
Summary: [5/6 Regression] internal compiler error: in gimplify_var_or_parm_decl, at gi...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 5.2.0
: P3 normal
Target Milestone: 5.3
Assignee: Jason Merrill
URL:
Keywords:
Depends on: 62272
Blocks:
  Show dependency treegraph
 
Reported: 2015-08-17 05:58 UTC by Emil Eriksson
Modified: 2024-01-26 00:43 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.9.3
Known to fail: 5.1.1, 6.0
Last reconfirmed: 2015-08-17 00:00:00


Attachments
The preprocessed source (336.14 KB, application/x-gzip)
2015-08-17 05:58 UTC, Emil Eriksson
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Emil Eriksson 2015-08-17 05:58:59 UTC
Created attachment 36192 [details]
The preprocessed source

Internal compiler error with GCC 5.2.0 when building the attached preprocessed source on OS X 10.10.2:

build_gcc❯ g++-5 -std=c++11 Unique.pp.cpp -o test                                                                                                                                                                                                           rapidcheck/git/dev 
../test/gen/ContainerTests/Unique.cpp: In lambda function:
../test/gen/ContainerTests/Unique.cpp:59:37: internal compiler error: in gimplify_var_or_parm_decl, at gimplify.c:1801
                 return std::count_if(begin(elements),
                                     ^

../test/gen/ContainerTests/Unique.cpp:59:37: internal compiler error: Abort trap: 6
g++-5: internal compiler error: Abort trap: 6 (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://github.com/Homebrew/homebrew/issues> for instructions.
Comment 1 Markus Trippelsdorf 2015-08-17 06:25:13 UTC
dup.

*** This bug has been marked as a duplicate of bug 62272 ***
Comment 2 Emil Eriksson 2015-08-17 07:09:51 UTC
Are you absolutely sure this is a duplicate? The alleged duplicate involes a member function call while this one does not. Also, this code works on 4.9 while the code in the duplicate is verified on 4.9. Unless I'm missing some knowledge of the internals, these two seem like different bugs to me.
Comment 3 Markus Trippelsdorf 2015-08-17 10:24:45 UTC
Creduce came up with:

markus@x4 tmp % cat Uni.ii
class A {
public:
  int operator*();
};
template <typename T, typename Predicate>
void searchGen(int, int, T, Predicate p4) {
  p4(0);
}
template <typename...> struct B;
template <typename MetaFunction, typename Type, typename... Types>
struct B<MetaFunction, Type, Types...> {
  static void exec() { MetaFunction::template exec<Type>; }
};
template <typename MetaFunction, typename... Types> void forEachType() {
  B<MetaFunction, Types...>::exec;
}
namespace {
struct C {
  template <typename T> void exec() {
    A __trans_tmp_1;
    const auto target = *__trans_tmp_1;
    searchGen(0, 0, 0, [=](T) { [=] { target; }; });
  }
};
}
void ____C_A_T_C_H____T_E_S_T____75() { forEachType<C, int>; }

markus@x4 tmp % /usr/x86_64-pc-linux-gnu/gcc-bin/4.9.3/g++ -std=c++11 -c Uni.ii
markus@x4 tmp % g++ -c Uni.ii
Uni.ii: In lambda function:
Uni.ii:22:33: internal compiler error: in gimplify_var_or_parm_decl, at gimplify.c:1776
     searchGen(0, 0, 0, [=](T) { [=] { target; }; });
                                 ^
0xa653e1 gimplify_var_or_parm_decl
        ../../gcc/gcc/gimplify.c:1776
0xa6c827 gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_base**, bool (*)(tree_node*), int)
        ../../gcc/gcc/gimplify.c:8500
0xa794f6 gimplify_modify_expr
        ../../gcc/gcc/gimplify.c:4625
0xa6cd94 gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_base**, bool (*)(tree_node*), int)
        ../../gcc/gcc/gimplify.c:8069
0xa70ec6 gimplify_stmt(tree_node**, gimple_statement_base**)
        ../../gcc/gcc/gimplify.c:5525
0xa710ac gimplify_and_add(tree_node*, gimple_statement_base**)
        ../../gcc/gcc/gimplify.c:398
0xa710ac gimplify_init_ctor_eval
        ../../gcc/gcc/gimplify.c:3637
0xa78156 gimplify_init_constructor
        ../../gcc/gcc/gimplify.c:3997
0xa78f97 gimplify_modify_expr_rhs
        ../../gcc/gcc/gimplify.c:4254
0xa7936d gimplify_modify_expr
        ../../gcc/gcc/gimplify.c:4584
0xa6cd94 gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_base**, bool (*)(tree_node*), int)
        ../../gcc/gcc/gimplify.c:8069
0xa6cebd gimplify_target_expr
        ../../gcc/gcc/gimplify.c:5456
0xa6cebd gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_base**, bool (*)(tree_node*), int)
        ../../gcc/gcc/gimplify.c:8436
0xa70ec6 gimplify_stmt(tree_node**, gimple_statement_base**)
        ../../gcc/gcc/gimplify.c:5525
0xa6d1b3 gimplify_cleanup_point_expr
        ../../gcc/gcc/gimplify.c:5301
0xa6d1b3 gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_base**, bool (*)(tree_node*), int)
        ../../gcc/gcc/gimplify.c:8432
0xa70ec6 gimplify_stmt(tree_node**, gimple_statement_base**)
        ../../gcc/gcc/gimplify.c:5525
0xa727bd gimplify_bind_expr
        ../../gcc/gcc/gimplify.c:1111
0xa6d0ec gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_base**, bool (*)(tree_node*), int)
        ../../gcc/gcc/gimplify.c:8266
0xa70ec6 gimplify_stmt(tree_node**, gimple_statement_base**)
        ../../gcc/gcc/gimplify.c:5525
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
Comment 4 Jason Merrill 2015-08-17 18:42:41 UTC
Author: jason
Date: Mon Aug 17 18:42:09 2015
New Revision: 226950

URL: https://gcc.gnu.org/viewcvs?rev=226950&root=gcc&view=rev
Log:
	PR c++/67244
	* pt.c (tsubst_copy_and_build): Call insert_pending_capture_proxies.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested5.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/pt.c
Comment 5 Jason Merrill 2015-08-17 18:42:58 UTC
Author: jason
Date: Mon Aug 17 18:42:26 2015
New Revision: 226951

URL: https://gcc.gnu.org/viewcvs?rev=226951&root=gcc&view=rev
Log:
	PR c++/67244
	* pt.c (tsubst_copy_and_build): Call insert_pending_capture_proxies.

Added:
    branches/gcc-5-branch/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested5.C
Modified:
    branches/gcc-5-branch/gcc/cp/ChangeLog
    branches/gcc-5-branch/gcc/cp/pt.c
Comment 6 Jason Merrill 2015-08-17 18:43:13 UTC
Fixed for 5.3/6.
Comment 7 Markus Trippelsdorf 2015-08-17 19:18:54 UTC
*** Bug 58907 has been marked as a duplicate of this bug. ***