Thread overview
[Bug 242] [ICE] (const_hash_1) varasm.c:2912: Segmentation fault
Oct 02, 2016
Iain Buclaw
Oct 02, 2016
Iain Buclaw
Oct 03, 2016
Iain Buclaw
October 02, 2016
http://bugzilla.gdcproject.org/show_bug.cgi?id=242

--- Comment #1 from Iain Buclaw <ibuclaw@gdcproject.org> ---
In the bad code, the frontend gives us a CallExp for:

   Instance.iter()

In the good code, the frontend gives us a CallExp for:

   Thing().iter()

Regardless of this slight difference between what should be identical code, the ICE in the deep backend is because DECL_INITIAL was never generated where one was expected.

There is a comment relating to debug emission in VarDeclaration::toObjFile.

   CONST_DECL was initially intended for enumerals and may be used for scalars
in general but not for aggregates.

This is still true as far as debugging is concerned, although for simple aggregates (without pointers) they are represented just fine in gdb as of 7.11, but we should probably generate an initializer anyway on the basis that it might be used.

-- 
You are receiving this mail because:
You are watching all bug changes.
October 02, 2016
http://bugzilla.gdcproject.org/show_bug.cgi?id=242

--- Comment #2 from Iain Buclaw <ibuclaw@gdcproject.org> ---
There is a second consideration.

---
struct Thing
{
    enum Instance = Thing();
    int a = 42;

    void iter()
    {
        this.a = 24;
    }
}

auto test()
{
    return Thing.Instance.iter;
}
---

This should not try to overwrite read-only data.  If taking the address of a CONST_DECL, it should either be that DECL_INITIAL is used directly, or internally rewrite the decl as a normal VAR_DECL.

-- 
You are receiving this mail because:
You are watching all bug changes.
October 03, 2016
http://bugzilla.gdcproject.org/show_bug.cgi?id=242

Iain Buclaw <ibuclaw@gdcproject.org> changed:

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

--- Comment #3 from Iain Buclaw <ibuclaw@gdcproject.org> ---
https://github.com/D-Programming-GDC/GDC/commit/1cca26581e4bb391edbbada66b0c80327f5123e4

-- 
You are receiving this mail because:
You are watching all bug changes.