Thread overview
[Issue 19548] [REG 2.080] Missing reference to _D6object__T14__switch_errorZQrFNaNbNiNfAyamZv
Jan 06, 2019
Nicholas Wilson
Jan 06, 2019
Seb
Jan 06, 2019
Seb
Jan 06, 2019
Seb
Jul 16, 2019
Ali Ak
Nov 12, 2019
Carsten Schlote
Nov 12, 2019
Carsten Schlote
Feb 25, 2021
RazvanN
January 06, 2019
https://issues.dlang.org/show_bug.cgi?id=19548

Nicholas Wilson <iamthewilsonator@hotmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |iamthewilsonator@hotmail.co
                   |                            |m

--- Comment #1 from Nicholas Wilson <iamthewilsonator@hotmail.com> ---
Reduced a bit further

import std.stdio, std.bitmanip;

void main() {
        final switch (0) { }
        writef("");
}

--
January 06, 2019
https://issues.dlang.org/show_bug.cgi?id=19548

Seb <greeenify@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |greeenify@gmail.com

--- Comment #2 from Seb <greeenify@gmail.com> ---
The linker error is different for me if I add -debug to the mix when compiling :D

---
foo.o:foo.d:_D76TypeInfo_S3std3uni__T13InversionListTSQBcQBb8GcPolicyZQBh__T9IntervalsTAkZQo6__initZ:
error: undefined reference to '_D6object__T10RTInfoImplVAmA2i32i8Z4datayG2m'
foo.o:foo.d:_D48TypeInfo_S3std3uni__T8CowArrayTSQwQu8GcPolicyZQz6__initZ:
error: undefined reference to '_D6object__T10RTInfoImplVAmA2i16i2Z4datayG2m'
---

Also as the behavior is different for `-checkaction=C`, I presume it runs into this:

https://github.com/dlang/dmd/blob/92408ea7b43f9636a5e5b0426d7c6ffd73576ca2/src/dmd/statementsem.d#L2596

Specifically CallExp needs to be a DotTemplateInstanceExp.

So this should be a good start:

---
diff --git a/src/dmd/statementsem.d b/src/dmd/statementsem.d index cd7ac9aca..3cb3f01c4 100644
--- a/src/dmd/statementsem.d
+++ b/src/dmd/statementsem.d
@@ -2602,16 +2602,16 @@ else
                 }
                 else
                 {
-                    Expression sl = new IdentifierExp(ss.loc, Id.empty);
-                    sl = new DotIdExp(ss.loc, sl, Id.object);
-                    sl = new DotIdExp(ss.loc, sl, Id.__switch_error);
+                    Expression objectId = new IdentifierExp(ss.loc,
Id.object);

                     Expressions* args = new Expressions();
                     args.push(new StringExp(ss.loc, cast(char*)
ss.loc.filename));
                     args.push(new IntegerExp(ss.loc.linnum));

-                    sl = new CallExp(ss.loc, sl, args);
-                    sl.expressionSemantic(sc);
+                    auto tiargs = new Objects();
+                    auto dt = new DotTemplateInstanceExp(ss.loc, objectId,
Id.__switch_error, tiargs);
+                    Expression sl = new CallExp(ss.loc, dt, args);
+                    sl = sl.expressionSemantic(sc);

                     s = new SwitchErrorStatement(ss.loc, sl);
                 }

---

However, it still doesn't trigger the instantiation.

--
January 06, 2019
https://issues.dlang.org/show_bug.cgi?id=19548

--- Comment #3 from Seb <greeenify@gmail.com> ---
PR: https://github.com/dlang/dmd/pull/9211

--
January 06, 2019
https://issues.dlang.org/show_bug.cgi?id=19548

--- Comment #4 from Seb <greeenify@gmail.com> ---
(In reply to Seb from comment #3)
> PR: https://github.com/dlang/dmd/pull/9211

Please ignore this PR. While I think it's on a good track, it still doesn't fix the instantiation problem and the test wasn't testing the linking.

--
July 16, 2019
https://issues.dlang.org/show_bug.cgi?id=19548

Ali Ak <ali.akhtarzada@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ali.akhtarzada@gmail.com

--- Comment #5 from Ali Ak <ali.akhtarzada@gmail.com> ---
Shouldn't this be marked as critical or something? You hit this issue quite randomly depending on which part of std you use. Can you mark something as a regression AND critical?

--
November 12, 2019
https://issues.dlang.org/show_bug.cgi?id=19548

Carsten Schlote <schlote@vahanus.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schlote@vahanus.net

--- Comment #6 from Carsten Schlote <schlote@vahanus.net> ---
I triggered this bug today some code. Works in -release mode for DMD  and LDC2 only. GDC is fine.

The created object files for DMD and LDC2 do NOT directly link against the symbol '_D6object__T14__switch_errorZQrFNaNbNiNfAyamZv'.

So the missing symbol must be referenced by some of the libraries linked against the object.

--
November 12, 2019
https://issues.dlang.org/show_bug.cgi?id=19548

--- Comment #7 from Carsten Schlote <schlote@vahanus.net> ---
I triggered this bug today some code. Works in -release mode for DMD  and LDC2 only. GDC is fine.

The created object files for DMD and LDC2 do NOT directly link against the symbol '_D6object__T14__switch_errorZQrFNaNbNiNfAyamZv'.

So the missing symbol must be referenced by some of the libraries linked against the object.

--
June 13, 2020
https://issues.dlang.org/show_bug.cgi?id=19548

hsteoh@quickfur.ath.cx changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hsteoh@quickfur.ath.cx

--
July 24, 2020
https://issues.dlang.org/show_bug.cgi?id=19548

Vaptistis Anogeianakis <nomad@cornercase.gr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://issues.dlang.org/sh
                   |                            |ow_bug.cgi?id=21071

--
February 25, 2021
https://issues.dlang.org/show_bug.cgi?id=19548

RazvanN <razvan.nitu1305@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |razvan.nitu1305@gmail.com
         Resolution|---                         |WORKSFORME

--- Comment #8 from RazvanN <razvan.nitu1305@gmail.com> ---
I cannot reproduce this. The filed code snippet compiles successfully for both -release and -debug. Closing as WORKSFORME. Please reopen if the issue is not fixed.

--