Bug creation and email sending has been disabled, file new bugs at gcc.gnu.org/bugzilla
Bug 298 - dub 1.10 compilation bug
Summary: dub 1.10 compilation bug
Status: ASSIGNED
Alias: None
Product: GDC
Classification: Unclassified
Component: gdc (show other bugs)
Version: development
Hardware: All All
: --- major
Assignee: Iain Buclaw
URL:
Depends on:
Blocks:
 
Reported: 2018-07-14 19:07 CEST by Eugene Wissner
Modified: 2018-07-14 20:21 CEST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eugene Wissner 2018-07-14 19:07:02 CEST
module dub.generators.generator;

struct Package
{
    @property string name() const
    {
        return null;
    }
}

void ProjectGenerator()
{
    string[string] targets;

    void collectDependencies(ref string)
    {
    }

    collectDependencies(targets[Package.init.name]);
}

gives:

    source/dub/generators/generator.d: In function ‘ProjectGenerator’:
    source/dub/generators/generator.d:19:24: internal compiler error: in add_expr, at tree.c:7454
    collectDependencies(targets[Package.init.name]);
    ^
    0x6f7308 ???
    ../sysdeps/x86_64/start.S:118
Comment 1 Iain Buclaw 2018-07-14 20:03:18 CEST
Full traceback.
---
bug298.d: In function ‘ProjectGenerator’:
bug298.d:19:24: internal compiler error: in add_expr, at tree.c:7454
     collectDependencies(targets[Package.init.name]);
                        ^
0x71dab3 inchash::add_expr(tree_node const*, inchash::hash&, unsigned int)
	../../dev/gcc/tree.c:7454
0x104250c inchash::add_expr(tree_node const*, inchash::hash&, unsigned int)
	../../dev/gcc/tree.c:7528
0x1042245 inchash::add_expr(tree_node const*, inchash::hash&, unsigned int)
	../../dev/gcc/tree.c:7528
0x104250c inchash::add_expr(tree_node const*, inchash::hash&, unsigned int)
	../../dev/gcc/tree.c:7528
0x1042245 inchash::add_expr(tree_node const*, inchash::hash&, unsigned int)
	../../dev/gcc/tree.c:7528
0xaa6466 operand_equal_p(tree_node const*, tree_node const*, unsigned int)
	../../dev/gcc/fold-const.c:2930
0xaa8b06 operand_equal_for_comparison_p
	../../dev/gcc/fold-const.c:3537
0xab4ddd fold_ternary_loc(unsigned int, tree_code, tree_node*, tree_node*, tree_node*, tree_node*)
	../../dev/gcc/fold-const.c:11425
0xab5f4d fold_build3_loc(unsigned int, tree_code, tree_node*, tree_node*, tree_node*, tree_node*)
	../../dev/gcc/fold-const.c:12384
0xac0987 fold_unary_loc(unsigned int, tree_code, tree_node*, tree_node*)
	../../dev/gcc/fold-const.c:7800
0xac2ad9 fold_build1_loc(unsigned int, tree_code, tree_node*, tree_node*)
	../../dev/gcc/fold-const.c:12278
0x8f14e5 convert(tree_node*, tree_node*)
	../../dev/gcc/d/d-convert.cc:283
0x8ee2fb d_build_call(TypeFunction*, tree_node*, tree_node*, Array<Expression*>*)
	../../dev/gcc/d/d-codegen.cc:1980
0x9057eb ExprVisitor::visit(CallExp*)
	../../dev/gcc/d/expr.cc:1847
0x903114 build_expr(Expression*, bool)
	../../dev/gcc/d/expr.cc:3091
0x9031d1 build_expr_dtor(Expression*)
	../../dev/gcc/d/expr.cc:3113
0x911e21 IRVisitor::visit(ExpStatement*)
	../../dev/gcc/d/toir.cc:1013
0x911b5c IRVisitor::build_stmt(Statement*)
	../../dev/gcc/d/toir.cc:254
0x911b5c IRVisitor::visit(CompoundStatement*)
	../../dev/gcc/d/toir.cc:1030
0x911b5c IRVisitor::build_stmt(Statement*)
	../../dev/gcc/d/toir.cc:254
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Comment 2 Iain Buclaw 2018-07-14 20:21:45 CEST
The ICE occurs as we generate the following code:

   _aaGetRvalueX (targets, &_D12TypeInfo_Aya6__initZ, 16, &name (&{}))

The last parameter is a function call, and we erroneously attempt to use it as an lvalue.

ICE in question specifically does not like the double `&` when generating a hash for the expression `&name (&{})`