Thread overview
[Bug 231] Some template mixins symbols get defined in output object files, although they shouldn't
Jan 25
dan
Jan 25
dan
Jan 25
dan
July 26
http://bugzilla.gdcproject.org/show_bug.cgi?id=231

Johannes Pfau <johannespfau@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ibuclaw@gdcproject.org,
                   |                            |johannespfau@gmail.com

--- Comment #1 from Johannes Pfau <johannespfau@gmail.com> ---
I've tracked this down:

widget.d
--------------------------------------
interface ImplementorIF
{
    void* getImplementorStruct();
    void* getStruct();
}
template ImplementorT()
{
    void* getImplementorStruct()
    {
        return null;
    }
}
class Widget : ImplementorIF
{
    mixin ImplementorT;
    void* getStruct()
    {
        return null;
    }
}
--------------------------------------

range.d
--------------------------------------
import Widget;
class Range : Widget
{
    void* getStruct()
    {
        return null;
    }
}
void main() {}
--------------------------------------
gdc range.d widget.d


The problem is our thunk emission. We call toObjfile in FuncDeclaration::toThunkSymbol, DMD does not. This code was initially added in cbd6d919559697bba6bb210acc2761ae43dbaf8a to fix issue 27. Back then we had a output_declaration_p check in toObjfile that prevented emitting getImplementorStruct. 9766ddee234a3db05b24d071bd15987373d962f5 changed the output_declaration_p check into a simple gcc_attribute_p(this) check which caused this regression.

I wonder how dmd handles issue 27 without calling toObjfile and whether we should do the same thing. If we have to keep calling toObjfile I think we need to re-add this code to toObjfile:

--------------------------------------
FuncDeclaration *fd = dsym->isFuncDeclaration();
if (fd != NULL)
  {
    for (FuncDeclaration *fdp = fd; fdp != NULL;)
      {
        if (!fdp->isInstantiated() && fdp->inNonRoot())
          return false;

        if (!fdp->isNested())
          break;

        fdp = fdp->toParent2()->isFuncDeclaration();
      }
  }

  if (!flag_emit_templates)
    return !D_DECL_IS_TEMPLATE (dsym->toSymbol()->Stree);
--------------------------------------

What do you think, Iain?

-- 
You are receiving this mail because:
You are watching all bug changes.
September 26
http://bugzilla.gdcproject.org/show_bug.cgi?id=231

--- Comment #2 from Johannes Pfau <johannespfau@gmail.com> ---
https://github.com/D-Programming-GDC/GDC/pull/245

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

Johannes Pfau <johannespfau@gmail.com> changed:

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

--- Comment #3 from Johannes Pfau <johannespfau@gmail.com> ---
https://github.com/D-Programming-GDC/GDC/commit/ef3141dcf92fc10e5f18eceff9207e39b75035b6

-- 
You are receiving this mail because:
You are watching all bug changes.
January 25
On Saturday, 1 October 2016 at 09:35:22 UTC, Johannes Pfau wrote:
> http://bugzilla.gdcproject.org/show_bug.cgi?id=231
>
> Johannes Pfau <johannespfau@gmail.com> changed:
>
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>          Resolution|---                         |FIXED
>              Status|NEW                         |RESOLVED
>
> --- Comment #3 from Johannes Pfau <johannespfau@gmail.com> ---
> https://github.com/D-Programming-GDC/GDC/commit/ef3141dcf92fc10e5f18eceff9207e39b75035b6

Hi Johannes,

This bug does not seem to be fixed for me, but maybe i'm not reading the fine print correctly (or maybe i'm just doing something wrong somewhere along the line).

My setup is xubuntu 16.10, and i'm using the packaged gdc there.

If you do 'gdc -v -c empty_file.d' where empty_file.d is some empty file, then it reveals the version of gdc to be v2.068.2.

That version was apparently released Christmas 2016, according to
https://github.com/D-Programming-GDC/GDC/releases
so it should have the fix picked up, i think.

Nevertheless, when i type 'make' to gtkd version 3.3.0, when it tries to link it has these multiple definition errors.

This is on a fresh vm so hopefully there's no way any old versions of gdc i have on the host could leak in.

Thanks for your work on this issue!!

And thanks for any clarification (like maybe somehow the fix didn't make it into the release?).

dan
January 25
On Wednesday, 25 January 2017 at 04:10:49 UTC, dan wrote:
> On Saturday, 1 October 2016 at 09:35:22 UTC, Johannes Pfau wrote:
>> http://bugzilla.gdcproject.org/show_bug.cgi?id=231
>>
>> Johannes Pfau <johannespfau@gmail.com> changed:
>>
>>            What    |Removed                     |Added
>> ----------------------------------------------------------------------------
>>          Resolution|---                         |FIXED
>>              Status|NEW                         |RESOLVED
>>
>> --- Comment #3 from Johannes Pfau <johannespfau@gmail.com> ---
>> https://github.com/D-Programming-GDC/GDC/commit/ef3141dcf92fc10e5f18eceff9207e39b75035b6
>
> Hi Johannes,
>
> This bug does not seem to be fixed for me, but maybe i'm not reading the fine print correctly (or maybe i'm just doing something wrong somewhere along the line).
>
> My setup is xubuntu 16.10, and i'm using the packaged gdc there.
>
> If you do 'gdc -v -c empty_file.d' where empty_file.d is some empty file, then it reveals the version of gdc to be v2.068.2.
>
> That version was apparently released Christmas 2016, according to
> https://github.com/D-Programming-GDC/GDC/releases
> so it should have the fix picked up, i think.
>
> Nevertheless, when i type 'make' to gtkd version 3.3.0, when it tries to link it has these multiple definition errors.
>
> This is on a fresh vm so hopefully there's no way any old versions of gdc i have on the host could leak in.
>
> Thanks for your work on this issue!!
>
> And thanks for any clarification (like maybe somehow the fix didn't make it into the release?).
>
> dan

Hi,
I just tried again, and I confirm I'm able to successfully compile GtkD with gdc.
I used to get those multiply defined template symbols, but the issue is now fixed, at least for me.
I'm using latest Debian Testing gdc (6.2.1 20161124, v2.68.2) + current GtkD from git.

However, please note that I had to manually specify "-no-pie" to link the examples (but it's a totally separate issue).

January 25
Am Wed, 25 Jan 2017 04:10:49 +0000
schrieb dan <dan.hitt@gmail.com>:

> On Saturday, 1 October 2016 at 09:35:22 UTC, Johannes Pfau wrote:
> > http://bugzilla.gdcproject.org/show_bug.cgi?id=231
> >
> > Johannes Pfau <johannespfau@gmail.com> changed:
> >
> >            What    |Removed                     |Added
> > ----------------------------------------------------------------------------
> >          Resolution|---                         |FIXED
> >              Status|NEW                         |RESOLVED
> >
> > --- Comment #3 from Johannes Pfau <johannespfau@gmail.com> ---
> > https://github.com/D-Programming-GDC/GDC/commit/ef3141dcf92fc10e5f18eceff9207e39b75035b6
> 
> Hi Johannes,
> 
> This bug does not seem to be fixed for me, but maybe i'm not reading the fine print correctly (or maybe i'm just doing something wrong somewhere along the line).
> 
> My setup is xubuntu 16.10, and i'm using the packaged gdc there.
> 
> If you do 'gdc -v -c empty_file.d' where empty_file.d is some empty file, then it reveals the version of gdc to be v2.068.2.
> 
> That version was apparently released Christmas 2016, according to
> https://github.com/D-Programming-GDC/GDC/releases
> so it should have the fix picked up, i think.
> 
> Nevertheless, when i type 'make' to gtkd version 3.3.0, when it tries to link it has these multiple definition errors.
> 
> This is on a fresh vm so hopefully there's no way any old versions of gdc i have on the host could leak in.
> 
> Thanks for your work on this issue!!
> 
> And thanks for any clarification (like maybe somehow the fix didn't make it into the release?).
> 
> dan

It is somewhat difficult to find the exact GDC version used by the debian/ubuntu packages but http://packages.ubuntu.com/yakkety/all/gcc-6-source/filelist suggests a source version from 20160822. This version does not yet include the fix for the GTK bug.

-- Johannes

January 25
On Wednesday, 25 January 2017 at 09:30:18 UTC, Johannes Pfau wrote:
> Am Wed, 25 Jan 2017 04:10:49 +0000
> schrieb dan <dan.hitt@gmail.com>:
>
>> On Saturday, 1 October 2016 at 09:35:22 UTC, Johannes Pfau wrote:

>
> It is somewhat difficult to find the exact GDC version used by the debian/ubuntu packages but http://packages.ubuntu.com/yakkety/all/gcc-6-source/filelist suggests a source version from 20160822. This version does not yet include the fix for the GTK bug.
>
> -- Johannes

Ah, great, thanks Johannes.

And thanks also Sebastien for testing as well.

So i'll need to sit tight for yet a while longer, or maybe switch to debian, or figure out something else to do.

However, at least one important piece of information is that i'm determining version incorrectly.  (I would like a command to give to gdc to determine the version, but nearly as much as i want to be able to compile gtkd!!! :) :) )

Thanks everybody for your help and for moving gdc forward.

dan
January 25
and that should have been, NOT nearly as much as i want to be able to compile gtkd!! :)

i long for the day when gtkd is just a package that i can install, although hopefully it will not lag too far behind the real thing.

Thanks again Johannes and Sebastien.

dan
January 25
Am Wed, 25 Jan 2017 16:32:53 +0000
schrieb dan <dan.hitt@gmail.com>:

> i long for the day when gtkd is just a package that i can install

The future is already here - it's just not very evenly distributed. ;-) https://packages.debian.org/stretch/libgtkd-3-0 https://packages.debian.org/stretch/libgtkd-3-dev

LDC only for now though.

-- Johannes