Bug creation and email sending has been disabled, file new bugs at gcc.gnu.org/bugzilla
Bug 251 - ICE: in dwarf2out_imported_module_or_decl_1, at dwarf2out.c:23802
Summary: ICE: in dwarf2out_imported_module_or_decl_1, at dwarf2out.c:23802
Status: RESOLVED FIXED
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: 2017-01-24 21:53 CET by Matthias Klumpp
Modified: 2017-04-30 08:42 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 Matthias Klumpp 2017-01-24 21:53:50 CET
Hi!

When compiling AppStream-Generator on Travis with GDC, the compilation terminates with:
```
FAILED: asgen_test@exe/src_asgen_result.d.o 

gdc  '-Iasgen_test@exe' '-fdiagnostics-color=always' '-I.' '-I..' '-I../src/' '-I../src/girepo/' '-I/usr/include/d/mustache-d' '-Wall' '-Wdeprecated' '-Wl,--push-state,-no-as-needed -lcurl -Wl,--pop-state' '-no-pie' '-funittest' '-g' '-O0' '-I/usr/include/glib-2.0' '-I/usr/lib/x86_64-linux-gnu/glib-2.0/include' '-pthread' '-I/usr/include/AppStream' '-I/usr/include/cairo' '-I/usr/include/pixman-1' '-I/usr/include/freetype2' '-I/usr/include/libpng16' '-pthread' '-I/usr/include/gdk-pixbuf-2.0' '-pthread' '-I/usr/include/librsvg-2.0' '-I/usr/include/pango-1.0'  -o 'asgen_test@exe/src_asgen_result.d.o' -c ../src/asgen/result.d

../src/asgen/result.d:31:8: internal compiler error: in dwarf2out_imported_module_or_decl_1, at dwarf2out.c:23802

 import asgen.backends.interfaces;
        ^
```

Unfortunately I don't have time to produce a minimized testcase (too much work prior to the Debian freeze), but at least I can give you the commit which started this and the build output :-)
(That's what a CI is for)

Commit that started this: https://github.com/ximion/appstream-generator/commit/a28b844e0a446e29859a6f970d4c01dedb55efbf

CI Log: https://travis-ci.org/ximion/appstream-generator/jobs/193238117

Thanks!
  --- Matthias
Comment 1 Iain Buclaw 2017-01-24 21:56:43 CET
My guess is that it would be this addition:

---
import asgen.config : Config;
---

As nothing else would touch dwarf2out_imported_module_or_decl.

Which leads to the question, what is Config?
Comment 2 Matthias Klumpp 2017-01-24 22:01:54 CET
Config is a class (and a global singleton ).
https://github.com/ximion/appstream-generator/blob/master/src/asgen/config.d#L88
Comment 3 Iain Buclaw 2017-01-24 22:06:53 CET
By the way, incase you've never encountered this project.

https://github.com/CyberShadow/DustMite
Comment 4 Iain Buclaw 2017-01-24 22:14:29 CET
Backtrace:
---
#0  internal_error (gmsgid=gmsgid@entry=0x20d46a4 "in %s, at %s:%d") at ../../dev/gcc/diagnostic.c:1377
#1  0x0000000001b3bd66 in fancy_abort (file=<optimised out>, line=25370, function=0x1c977c0 <dwarf2out_imported_module_or_decl_1(tree_node*, tree_node*, tree_node*, die_struct*)::__FUNCTION__> "dwarf2out_imported
_module_or_decl_1") at ../../dev/gcc/diagnostic.c:1447
#2  0x0000000000ad946e in dwarf2out_imported_module_or_decl_1 (decl=0x0, name=0x0, lexical_block=0x7ffff679b098, lexical_block_die=0x7ffff6715050) at ../../dev/gcc/dwarf2out.c:25370
#3  0x0000000000ad9a54 in dwarf2out_imported_module_or_decl (decl=0x7ffff67a6000, name=0x0, context=0x7ffff679b098, child=false) at ../../dev/gcc/dwarf2out.c:25485
#4  0x0000000000933ee8 in Dsymbol::toObjFile (this=0x7ffff7ed8370) at ../../dev/gcc/d/d-objfile.cc:131
#5  0x000000000093789a in Module::genobjfile (this=0x7ffff7ed7380) at ../../dev/gcc/d/d-objfile.cc:1125
#6  0x000000000090c132 in d_parse_file () at ../../dev/gcc/d/d-lang.cc:1226
#7  0x0000000000fb4e04 in compile_file () at ../../dev/gcc/toplev.c:463
#8  0x0000000000fb7da8 in do_compile () at ../../dev/gcc/toplev.c:1983
#9  0x0000000000fb8107 in toplev::main (this=0x7fffffffd840, argc=53, argv=0x7fffffffd948) at ../../dev/gcc/toplev.c:2117
#10 0x0000000001b23edd in main (argc=53, argv=0x7fffffffd948) at ../../dev/gcc/main.c:39
---

Pretty debug:
---
decl = <<< Unknown tree: imported_decl >>>
name = 0x0
context = asgen.result
---

Verbose debug:
---
decl =  <imported_decl 0x7ffff67a6000 D.5904
    type <void_type 0x7ffff6948000 void asm_written VOID
        align 8 symtab 0 alias set -1 canonical type 0x7ffff6948000
        pointer_to_this <pointer_type 0x7ffff6948150>>
    VOID file ../src/asgen/result.d line 32 col 8
    align 1>

context =  <namespace_decl 0x7ffff679b098 asgen.result
    type <void_type 0x7ffff6948000 void asm_written VOID
        align 8 symtab 0 alias set -1 canonical type 0x7ffff6948000
        pointer_to_this <pointer_type 0x7ffff6948150>>
    public VOID file ../src/asgen/result.d line 20 col 1
    align 1>
---

AST debug:
---
print() = "__anonymous"
kind() = "import"
---


An anonymous import? The frontend used to throw some wacky stuff at gdc in the past, but I think that is a new first for me.

Dustmiting this down...
Comment 5 Iain Buclaw 2017-01-24 22:14:53 CET
Reproducible in master.
Comment 6 Iain Buclaw 2017-01-24 22:17:14 CET
Note to self: IMPORTED_DECL_ASSOCIATED_DECL is not set.
Comment 7 Iain Buclaw 2017-01-24 22:23:48 CET
And the reason why it is not set, is because Config is a class.  And the debug type information is set on the underlying aggregate type, not the reference, duh.
Comment 8 Iain Buclaw 2017-01-24 22:28:43 CET
Got a fix ready, just waiting for the reduced test-case.
Comment 9 Matthias Klumpp 2017-01-24 22:39:11 CET
That was an insanely quick debug, thanks!
I know about Dustmite, I used it far too often already (so much so that I packaged it for Debian, but it has been stuck in NEW for more than a month now)
Comment 10 Iain Buclaw 2017-01-25 20:10:40 CET
> That was an insanely quick debug, thanks!

Not being the one who is too modest or knocks themselves down - but to be fair the file that generates debug info for symbol imports is around 60 lines of code, and only has a handful of states that affect it's output. ;-)
Comment 11 Iain Buclaw 2017-04-30 08:42:41 CEST
I seem to have forgotten to close this: https://github.com/D-Programming-GDC/GDC/pull/373