Wiki Roadmap Timeline Tickets New Ticket Source Search Help / Guide About Trac Login

Ticket #334 (new defect)

Opened 1 year ago

Last modified 1 year ago

concatenation fails in typeinfo

Reported by: fawzi Assigned to: ChristianK
Priority: major Milestone:
Component: unspecified Version: hg tip
Keywords: Cc: fawzi@gmx.ch

Description

The mini test typeinfo13 (and 5) fail on mac with the current tango.

The following changes to the runtime

--- lib/compiler/ldc/object_.d	(revision 4749)
+++ lib/compiler/ldc/object_.d	(working copy)
@@ -48,6 +48,7 @@
     import rt.util.hash;
     import rt.aaA;
     debug(PRINTF) import rt.cImports: printf;
+    import rt.cImports: printf; //pippo
     import rt.cInterface: _d_allocclass;
 }
 
@@ -542,6 +543,8 @@
 {
     override char[] toString()
     {
+        char[] s1=next.toString(),s2=key.toString();
+        printf("pippoToString2 %p %*s %*s\n",this,s1.length,s1.ptr,s2.length,s2.ptr);
         return next.toString() ~ "[" ~ key.toString() ~ "]";
     }
 

print (for mini/typeinfo13.d)

pippoToString2 0x2a0d0 float long

but then the whole string is

?????]

I don't know why. I tried to track it down better, and the 0.99.8 runtime does not have the problem, but I don't understand it, as the same concatenation compiled with the same flags works in the main function.... ?????]

Change History

07/02/09 12:55:19 changed by fawzi

I just found out that this depends on the optimization flags:

-release -O3 -inline -output-bc -w

has probems, whereas

-inline -release -O2

does not

07/21/09 09:34:52 changed by d0k

simpler testcase

import tango.util.Convert;
import tango.stdc.stdio;

void main() {
	char[] y = to!(char[])(42);
	char[] x = y ~ "~" ~ y;
	printf("%*s\n", x.length, x.ptr);
}

works as expected with -O2, produces garbage with -O3.

Copyright © 2008, LDC Development Team.