https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65284
Bug ID: 65284 Summary: [5 Regression] ICE (segfault) on arm-linux-gnueabihf Product: gcc Version: 5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: doko at gcc dot gnu.org r221115 on arm-linux-gnueabihf $ g++ -std=c++11 -c -O2 schema-parser.ii schema-parser.ii: In member function 'Maybe<ParsedSchema> ParsedSchema::findNested() const': schema-parser.ii:45:21: internal compiler error: Segmentation fault Maybe<ParsedSchema> ParsedSchema::findNested() const { ^ Please submit a full bug report, with preprocessed source if appropriate. $ gdb --args /usr/lib/gcc/arm-linux-gnueabihf/5/cc1plus -fpreprocessed schema-parser.ii -quiet -dumpbase schema-parser.ii -march=armv7-a -mfloat-abi=hard -mfpu=vfpv3-d16 -mthumb -mtls-dialect=gnu -auxbase schema-parser -O2 -std=c++11 -version -fstack-protector-strong -Wformat -Wformat-security -o /tmp/ccABpp5w.s (gdb) bt #0 0x00346d52 in maybe_canonicalize_mem_ref_addr(tree_node**) () #1 0x0034ee4c in fold_stmt_1(gimple_stmt_iterator*, bool, tree_node* (*)(tree_node*)) () #2 0x0053bb56 in (anonymous namespace)::pass_forwprop::execute(function*) () #3 0x00434e5e in execute_one_pass(opt_pass*) () #4 0x00435148 in execute_pass_list_1(opt_pass*) [clone .constprop.59] () #5 0x00435152 in execute_pass_list_1(opt_pass*) [clone .constprop.59] () #6 0x00435180 in execute_pass_list(function*, opt_pass*) () #7 0x00298eb6 in cgraph_node::expand() () #8 0x0029a93c in symbol_table::compile() [clone .part.42] () #9 0x0029ab78 in symbol_table::finalize_compilation_unit() () #10 0x001a34e4 in cp_write_global_declarations() () #11 0x004aa082 in compile_file() () #12 0x001571a6 in toplev::main(int, char**) () #13 0x00157bf4 in main () $ cat schema-parser.ii namespace _ { template <typename T> class NullableValue { public: T operator*(); NullableValue(T); }; } template <typename T> class Maybe { public: Maybe(T t) : ptr(t) {} template <typename Func> auto map(Func f) -> Maybe<decltype(f(T()))> { return f(*ptr); } _::NullableValue<T> ptr; }; template <typename T> class A { public: T *operator->(); }; typedef int uint64_t; class B { public: long getId(); }; class C { struct D; A<D> impl; friend class ParsedSchema; }; class ParsedSchema { Maybe<ParsedSchema> findNested() const; ParsedSchema(ParsedSchema, C); C *parser; B getProto() const; int raw; }; class F { public: Maybe<uint64_t> lookup(uint64_t, int); ParsedSchema get(uint64_t); }; struct C::D { F compiler; }; Maybe<ParsedSchema> ParsedSchema::findNested() const { int name; parser->impl->compiler.lookup(getProto().getId(), name) .map([this](uint64_t childId) { return ParsedSchema(parser->impl->compiler.get(childId), *parser); }); }