October 07, 2015
http://bugzilla.gdcproject.org/show_bug.cgi?id=196

--- Comment #11 from Iain Buclaw <ibuclaw@gdcproject.org> ---
I can confirm that this shows on Linux, however unlike OSX, GNU assembles without error.

---
        .align 32
        .type   .3531, @object
        .size   .3531, 80
.3531:
        .quad   _D3bug11ThreadError6__vtblZ
        .quad   0
        .zero   16
        .zero   16
        .quad   0
        .zero   8
        .zero   8
        .zero   8

---


I'm reading this as, there is a global symbol being emitted with no name, so gcc gives it a unique identifier.

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


October 07, 2015
http://bugzilla.gdcproject.org/show_bug.cgi?id=196

--- Comment #12 from Johannes Pfau <johannespfau@gmail.com> ---
Smaller test case:
----------------------------------------
class ThreadError {}
void foo()
{
    __gshared error = new ThreadError();
}
----------------------------------------

Only happens for classes, not for structs. AFAICS this code creates two things:
* A variable in the data segment, properly named
  _D4test3fooFZ5errorC4test11ThreadError
  (A pointer, as classes are reference types)
* The result of ThreadError() interpreted in CTFE
  the data pointed to by D4test3fooFZ11ThreadErrorC4test11ThreadError, unnamed.


BTW: The unnamed variable is also in rodata instead of data, which is wrong:
----------------------------------------
class ThreadError
{
    int a;
}

void main()
{
    __gshared error = new ThreadError();
    error.a = 1;
}
----------------------------------------
segmentation fault (core dumped)  ./a.out
(works with dmd 2.068, haven't tested 2.066)

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


October 07, 2015
http://bugzilla.gdcproject.org/show_bug.cgi?id=196

--- Comment #13 from Iain Buclaw <ibuclaw@gdcproject.org> ---
(In reply to Johannes Pfau from comment #12)
> Smaller test case:
> ----------------------------------------
> class ThreadError {}
> void foo()
> {
>     __gshared error = new ThreadError();
> }

It took me a while to put two and two together, but the unnamed data would be created by ClassReferenceExp.  Can certainly give it a proper anonymous name and unset the readonly flag on it.

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


October 07, 2015
http://bugzilla.gdcproject.org/show_bug.cgi?id=196

--- Comment #14 from Iain Buclaw <ibuclaw@gdcproject.org> ---
This should also happen for StructLiteralExp written to data too, but won't try too hard to find the trigger for it.

https://github.com/D-Programming-GDC/GDC/pull/144

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


October 10, 2015
http://bugzilla.gdcproject.org/show_bug.cgi?id=196

--- Comment #15 from Johannes Pfau <johannespfau@gmail.com> ---
@John Colvin the bug fix has been pushed to all gdc branches. If this fix works for you, I'll close this bug report.

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


October 10, 2015
http://bugzilla.gdcproject.org/show_bug.cgi?id=196

John Colvin <john.loughran.colvin@gmail.com> changed:

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

--- Comment #16 from John Colvin <john.loughran.colvin@gmail.com> ---
Yep, works for me now.

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


1 2
Next ›   Last »