Thread overview
"Previous Definition different" when -inline switch is set
Jul 17, 2013
Baz
Jul 17, 2013
Jonathan M Davis
Jul 17, 2013
Baz
Jul 17, 2013
John Colvin
Jul 17, 2013
Ali Çehreli
July 17, 2013
Hello, is there any particular reason why dmd would tell me that the "Previous Definition different" when compiling a program with -inline while not when compiling it without the switch ?

more information:
- the message appears two times and it's about two methods used in a lib.
- the message doesn't appear when I compile the lib but when I compile a program using this lib.
- the two methods involved are private, used in another public method,
- the two methods involved are used recursively (but..., see above)
- the two methods involved are used via a single delegate (itself set according to the context.)

So the problem is clearly caused by the compiler optimizations performed when using the -inline switch. Unfortunately I cannot reproduce the issue in a simple example.

Would there be a method to avoid these two methods to be inlined ? (so far I've tried to put their parameters as ref, but without success).

Is the bug described a "well known" issue with a "well known" workaround ?
(so far, I haven't found anything which is related, even with some serious forum/newsgroup investigation...)

Any idea ?
July 17, 2013
On Wednesday, July 17, 2013 16:01:23 Baz wrote:
> Is the bug described a "well known" issue with a "well known"
> workaround ?
> (so far, I haven't found anything which is related, even with
> some serious forum/newsgroup investigation...)

I don't know if this particular issue with -inline is in bugzilla or not (IIRC, there's at least one on how combining -inline and -O causes things to go wrong), but in general, the workaround for problems with flags like -inline or -O is to just not use them.

- Jonathan M Davis
July 17, 2013
On Wednesday, 17 July 2013 at 18:00:47 UTC, Jonathan M Davis wrote:
> On Wednesday, July 17, 2013 16:01:23 Baz wrote:
>> Is the bug described a "well known" issue with a "well known"
>> workaround ?
>> (so far, I haven't found anything which is related, even with
>> some serious forum/newsgroup investigation...)
>
> I don't know if this particular issue with -inline is in bugzilla or not
> (IIRC, there's at least one on how combining -inline and -O causes things to
> go wrong), but in general, the workaround for problems with flags like -inline
> or -O is to just not use them.
>
> - Jonathan M Davis
No the issue is not yet in bugzilla...but trust me, once I'll find the way to reproduce it...people at digital mars WILL have to deal with it...
July 17, 2013
On Wednesday, 17 July 2013 at 20:58:41 UTC, Baz wrote:
> On Wednesday, 17 July 2013 at 18:00:47 UTC, Jonathan M Davis wrote:
>> On Wednesday, July 17, 2013 16:01:23 Baz wrote:
>>> Is the bug described a "well known" issue with a "well known"
>>> workaround ?
>>> (so far, I haven't found anything which is related, even with
>>> some serious forum/newsgroup investigation...)
>>
>> I don't know if this particular issue with -inline is in bugzilla or not
>> (IIRC, there's at least one on how combining -inline and -O causes things to
>> go wrong), but in general, the workaround for problems with flags like -inline
>> or -O is to just not use them.
>>
>> - Jonathan M Davis
> No the issue is not yet in bugzilla...but trust me, once I'll find the way to reproduce it...people at digital mars WILL have to deal with it...

AFAIK:

struct DigitalMars
{
    immutable BadassCompilerDev WalterBright;
    alias WalterBright this;
}

However, there are a decent number of people who work on the compiler, so hopefully someone will put in some of their free time and get it fixed.
July 17, 2013
On 07/17/2013 07:01 AM, Baz wrote:

> Hello, is there any particular reason why dmd would tell me that the
> "Previous Definition different" when compiling a program with -inline
> while not when compiling it without the switch ?

I could not find that phrase in the dmd, dlang, or phobos sources. Apparently, it is a linker message. Here is another thread about the same issue, which links to yet another one:

  http://forum.dlang.org/thread/zkbrvrlvujmnnjqqpwep@forum.dlang.org

Ali