www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - problem while updating to 2.052

reply =?ISO-8859-1?Q?Christian_K=F6stlin?= <christian.koestlin gmail.com> writes:
hi .. i have a small library for combinatorial parsing.
when i updated to version 2.052 of dmd (tested on os x) i got an 
exception from variant.d:279 (target must be non-null).
i fixed the problem with the following diff:
      ParseResult!(T) parse(T[] s) {
-      auto results = appender!(Variant[])();
+      Variant[] results;
        auto rest = s;
        while (true) {
          auto res = fToRepeat.parse(rest);
          if (res.success) {
            rest = res.rest;
-          results.put(res.results);
+          results = results ~ res.results;
          } else {
            break;
          }
        }
-      return transform(ParseResult!(T).ok(rest, results.data));
+      return transform(ParseResult!(T).ok(rest, results));
      }

what did i do wrong and why could it work with an older version of dmd2?

thanks in advance

christian koestlin
Feb 19 2011
parent reply bearophile <bearophileHUGS lycos.com> writes:
Christian K.:

 hi .. i have a small library for combinatorial parsing.
 when i updated to version 2.052 of dmd (tested on os x) i got an 
 exception from variant.d:279 (target must be non-null).

It may be a bug. Are you able to create a minimal test program that later will be fit for bugzilla? Bye, bearophile
Feb 19 2011
parent reply =?ISO-8859-1?Q?Christian_K=F6stlin?= <christian.koestlin gmail.com> writes:
On 2/19/11 22:06 , bearophile wrote:
 Christian K.:

 hi .. i have a small library for combinatorial parsing.
 when i updated to version 2.052 of dmd (tested on os x) i got an
 exception from variant.d:279 (target must be non-null).

It may be a bug. Are you able to create a minimal test program that later will be fit for bugzilla? Bye, bearophile

unfortunately not ... I looked several minutes at the stacktrace (would it help if I send you the whole project), and could not figure out what the problem was. then I tried to change the program (see the diff) and it worked. this is the stacktrace of the exception if it helps: core.exception.AssertError /Users/gizmo/.homebrew/Cellar/dmdtwo/2.052/src/phobos std/variant.d(279): target must be non-null ---------------- 5 compiler 0x000340b5 onAssertErrorMsg + 73 6 compiler 0x0003dfb2 _d_assert_msg + 26 7 compiler 0x0000ea76 int std.variant.VariantN!(32).VariantN.handler!(astelements.MessageInfo).handler(std.variant.VariantN (32).VariantN.OpID, ubyte[32]*, void*).bool tryPutting(astelements.MessageInfo*, TypeInfo, void*) + 130 8 compiler 0x0000e75c int std.variant.VariantN!(32).VariantN.handler!(astelements.MessageInfo).handler(std.variant.VariantN (32).VariantN.OpID, ubyte[32]*, void*) + 200 9 compiler 0x000152a2 std.variant.VariantN!(32).VariantN std.variant.VariantN!(32).VariantN.opAssign!(std.variant.VariantN!(32).VariantN).opAssign(std.variant.Var antN!(32).VariantN) + 78 10 compiler 0x0001613a void std.array.Appender!(std.variant.VariantN!(32).VariantN[]).Appender.put!(std.variant.VariantN!(32).VariantN).put(std.variant.Var antN!(32).VariantN) + 134 11 compiler 0x000161cb void std.array.Appender!(std.variant.VariantN!(32).VariantN[]).Appender.put!(std.variant.VariantN!(32).VariantN[]).put(std.variant.Varia tN!(32).VariantN[]) + 115 12 compiler 0x0000aa8a pc.parser.ParseResult!(immutable(char)).ParseResult pc.parser.Parser!(immutable(char)).Parser.Repetition.parse(immutable(char)[]) + 422 13 compiler 0x0000a369 pc.parser.ParseResult!(immutable(char)).ParseResult pc.parser.Parser!(immutable(char)).Parser.parseAll(immutable(char)[]) + 41 14 compiler 0x000026b6 _Dmain + 446 15 compiler 0x0003e343 extern (C) int rt.dmain2.main(int, char**).void runMain() + 23 16 compiler 0x0003e2ca extern (C) int rt.dmain2.main(int, char**).void tryExec(scope void delegate()) + 38 17 compiler 0x0003e38b extern (C) int rt.dmain2.main(int, char**).void runAll() + 59 18 compiler 0x0003e2ca extern (C) int rt.dmain2.main(int, char**).void tryExec(scope void delegate()) + 38 19 compiler 0x0003e25b main + 179 20 compiler 0x000024ed start + 53 21 ??? 0x00000003 0x0 + 3 regarding types: my debugoutput at the exception showed me, that the appender already has one element of type astelements.PackageInfo and now an array with one element of type astelements.MessageInfo is to be put into the appender. perhaps this can lead to a problem? messageinfo is a struct declared like: struct MessageInfo { string name; FieldInfo[] fieldInfos; EnumDefinition[] enums; MessageInfo[] messages; string thePackage = ""; ... } , packageinfo is even simpler: class PackageInfo { string fName; this(string name) { fName = name; } } thanks in advance christian
Feb 19 2011
next sibling parent reply novice2 <sorry noem.ail> writes:
Christian Köstlin Wrote:

 unfortunately not ... I looked several minutes at the stacktrace (would 

i am sorry for offtopic, but how you produce stacktrace? sometime i very want to see it...
Feb 20 2011
parent novice2 <sorry noem.ail> writes:
Jonathan M Davis, thank you for explanation,
but i am on windows :(
Feb 20 2011
prev sibling parent Jonathan M Davis <jmdavisProg gmx.com> writes:
On Sunday 20 February 2011 22:11:13 novice2 wrote:
 Christian K=F6stlin Wrote:
 unfortunately not ... I looked several minutes at the stacktrace (would

i am sorry for offtopic, but how you produce stacktrace? sometime i very want to see it...

1. It doesn't work on Windows yet, I don't believe. So, for now, you're out= of=20 luck. I don't know about Mac OS X. 2. On Linux, any Throwable (be it an Exception or an Error) which escapes m= ain=20 will print a stack trace. IIRC, you also get a stack trace when you conver= t an=20 Exception to a string. Regardless, you need to have linked with -L--export- dynamic to get the function names to work, but that's in the dmd.conf, so y= ou=20 should always be building with it. =2D Jonathan M Davis
Feb 20 2011