Thread overview
[dmd-internals] segv regression found by dmd test suite
Dec 08, 2010
Brad Roberts
Dec 08, 2010
Brad Roberts
Dec 08, 2010
Brad Roberts
Dec 08, 2010
Jason House
Dec 08, 2010
Brad Roberts
December 07, 2010
It looks like dmd change 777 introduced a change that causes one of the failure test cases to segv.  Yeah, the auto-tester has been failing on linux for a rather long time.  Just got around to looking at it.

http://www.dsource.org/projects/dmd/changeset/777

$ gdb --args ../src/dmd -v -Ifail_compilation   -odtest_results/fail_compilation
-oftest_results/fail_compilation/fail278_0.o -c fail_compilation/fail278.d
(gdb) run
binary    /home/braddr/sandbox/d/source/trunk/dmd/src/dmd
version   v2.051
config    /home/braddr/sandbox/d/source/trunk/dmd/src/dmd.conf
parse     fail278
importall fail278
import    object        (~/sandbox/d/source/trunk/druntime/import/object.di)
semantic  fail278

Program received signal SIGSEGV, Segmentation fault.
0x0812baf9 in TemplateInstance::mangle (this=0x82496f8) at mangle.c:225
225         Dsymbol *par = isnested || isTemplateMixin() ? parent :
tempdecl->parent;

(gdb) print tempdecl
$1 = (TemplateDeclaration *) 0x0

(gdb) bt
#0  0x0812baf9 in TemplateInstance::mangle (this=0x82496f8) at mangle.c:225
#1  0x08186925 in TemplateInstance::genIdent (this=0x8249650) at template.c:4684
#2  0x08187b58 in TemplateMixin::semantic (this=0x8249650, sc=0x8249838) at
template.c:5190
#3  0x0818537c in TemplateInstance::semantic (this=0x8249460, sc=0x82493d0,
fargs=0x0) at template.c:4016
#4  0x08184a94 in TemplateInstance::semantic (this=0x8249460, sc=0x82493d0) at
template.c:3687
#5  0x080db0f3 in ScopeExp::semantic (this=0x8249500, sc=0x82493d0) at
expression.c:3587
#6  0x080b2f4c in VarDeclaration::semantic (this=0x8248ef0, sc=0x82493d0) at
declaration.c:1243
#7  0x0804b1ee in AttribDeclaration::semanticNewSc (this=0x8244538,
sc=0x8249170, stc=4, linkage=LINKd, protection=PROTpublic, explicitProtection=0,
structalign=8) at attrib.c:126
#8  0x0804bd14 in StorageClassDeclaration::semantic (this=0x8244538,
sc=0x8249170) at attrib.c:414
#9  0x0818537c in TemplateInstance::semantic (this=0x8213ef8, sc=0x82141f0,
fargs=0x0) at template.c:4016
#10 0x08184a94 in TemplateInstance::semantic (this=0x8213ef8, sc=0x82141f0) at
template.c:3687
#11 0x0813f569 in TypeInstance::resolve (this=0x8214030, loc=..., sc=0x82141f0,
pe=0xffffcfa8, pt=0xffffcfac, ps=0xffffcfa4) at mtype.c:5902
#12 0x0813f7d8 in TypeInstance::toDsymbol (this=0x8214030, sc=0x82141f0) at
mtype.c:5968
#13 0x080b026d in AliasDeclaration::semantic (this=0x82140a8, sc=0x82141f0) at
declaration.c:463
#14 0x08130b29 in Module::semantic (this=0x8213208) at module.c:787
#15 0x0812e0d9 in main (argc=13, argv=0x8209520) at mars.c:1171

December 07, 2010
This patch fixes the one error.  Still running the test suite to see if anything dislikes it:

===================================================================
--- mangle.c    (revision 792)
+++ mangle.c    (working copy)
@@ -222,15 +222,18 @@
     printf("\n");
 #endif
     id = ident ? ident->toChars() : toChars();
-    Dsymbol *par = isnested || isTemplateMixin() ? parent : tempdecl->parent;
     if (!tempdecl)
         error("is not defined");
-    else if (par)
+    else
     {
-        char *p = par->mangle();
-        if (p[0] == '_' && p[1] == 'D')
-            p += 2;
-        buf.writestring(p);
+        Dsymbol *par = isnested || isTemplateMixin() ? parent : tempdecl->parent;
+        if (par)
+        {
+            char *p = par->mangle();
+            if (p[0] == '_' && p[1] == 'D')
+                p += 2;
+            buf.writestring(p);
+        }
     }
     buf.printf("%zu%s", strlen(id), id);
     id = buf.toChars();

On 12/7/2010 8:30 PM, Brad Roberts wrote:
> It looks like dmd change 777 introduced a change that causes one of the failure test cases to segv.  Yeah, the auto-tester has been failing on linux for a rather long time.  Just got around to looking at it.
> 
> http://www.dsource.org/projects/dmd/changeset/777
> 
> $ gdb --args ../src/dmd -v -Ifail_compilation   -odtest_results/fail_compilation
> -oftest_results/fail_compilation/fail278_0.o -c fail_compilation/fail278.d
> (gdb) run
> binary    /home/braddr/sandbox/d/source/trunk/dmd/src/dmd
> version   v2.051
> config    /home/braddr/sandbox/d/source/trunk/dmd/src/dmd.conf
> parse     fail278
> importall fail278
> import    object        (~/sandbox/d/source/trunk/druntime/import/object.di)
> semantic  fail278
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x0812baf9 in TemplateInstance::mangle (this=0x82496f8) at mangle.c:225
> 225         Dsymbol *par = isnested || isTemplateMixin() ? parent :
> tempdecl->parent;
> 
> (gdb) print tempdecl
> $1 = (TemplateDeclaration *) 0x0
> 
> (gdb) bt
> #0  0x0812baf9 in TemplateInstance::mangle (this=0x82496f8) at mangle.c:225
> #1  0x08186925 in TemplateInstance::genIdent (this=0x8249650) at template.c:4684
> #2  0x08187b58 in TemplateMixin::semantic (this=0x8249650, sc=0x8249838) at
> template.c:5190
> #3  0x0818537c in TemplateInstance::semantic (this=0x8249460, sc=0x82493d0,
> fargs=0x0) at template.c:4016
> #4  0x08184a94 in TemplateInstance::semantic (this=0x8249460, sc=0x82493d0) at
> template.c:3687
> #5  0x080db0f3 in ScopeExp::semantic (this=0x8249500, sc=0x82493d0) at
> expression.c:3587
> #6  0x080b2f4c in VarDeclaration::semantic (this=0x8248ef0, sc=0x82493d0) at
> declaration.c:1243
> #7  0x0804b1ee in AttribDeclaration::semanticNewSc (this=0x8244538,
> sc=0x8249170, stc=4, linkage=LINKd, protection=PROTpublic, explicitProtection=0,
> structalign=8) at attrib.c:126
> #8  0x0804bd14 in StorageClassDeclaration::semantic (this=0x8244538,
> sc=0x8249170) at attrib.c:414
> #9  0x0818537c in TemplateInstance::semantic (this=0x8213ef8, sc=0x82141f0,
> fargs=0x0) at template.c:4016
> #10 0x08184a94 in TemplateInstance::semantic (this=0x8213ef8, sc=0x82141f0) at
> template.c:3687
> #11 0x0813f569 in TypeInstance::resolve (this=0x8214030, loc=..., sc=0x82141f0,
> pe=0xffffcfa8, pt=0xffffcfac, ps=0xffffcfa4) at mtype.c:5902
> #12 0x0813f7d8 in TypeInstance::toDsymbol (this=0x8214030, sc=0x82141f0) at
> mtype.c:5968
> #13 0x080b026d in AliasDeclaration::semantic (this=0x82140a8, sc=0x82141f0) at
> declaration.c:463
> #14 0x08130b29 in Module::semantic (this=0x8213208) at module.c:787
> #15 0x0812e0d9 in main (argc=13, argv=0x8209520) at mars.c:1171
> 
> _______________________________________________
> dmd-internals mailing list
> dmd-internals at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-internals

December 07, 2010
Is it possible to generate an email after n failures?

Sent from my iPhone

On Dec 7, 2010, at 11:30 PM, Brad Roberts <braddr at puremagic.com> wrote:

> It looks like dmd change 777 introduced a change that causes one of the failure test cases to segv.  Yeah, the auto-tester has been failing on linux for a rather long time.  Just got around to looking at it.
> 
> http://www.dsource.org/projects/dmd/changeset/777
> 
> $ gdb --args ../src/dmd -v -Ifail_compilation   -odtest_results/fail_compilation
> -oftest_results/fail_compilation/fail278_0.o -c fail_compilation/fail278.d
> (gdb) run
> binary    /home/braddr/sandbox/d/source/trunk/dmd/src/dmd
> version   v2.051
> config    /home/braddr/sandbox/d/source/trunk/dmd/src/dmd.conf
> parse     fail278
> importall fail278
> import    object        (~/sandbox/d/source/trunk/druntime/import/object.di)
> semantic  fail278
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x0812baf9 in TemplateInstance::mangle (this=0x82496f8) at mangle.c:225
> 225         Dsymbol *par = isnested || isTemplateMixin() ? parent :
> tempdecl->parent;
> 
> (gdb) print tempdecl
> $1 = (TemplateDeclaration *) 0x0
> 
> (gdb) bt
> #0  0x0812baf9 in TemplateInstance::mangle (this=0x82496f8) at mangle.c:225
> #1  0x08186925 in TemplateInstance::genIdent (this=0x8249650) at template.c:4684
> #2  0x08187b58 in TemplateMixin::semantic (this=0x8249650, sc=0x8249838) at
> template.c:5190
> #3  0x0818537c in TemplateInstance::semantic (this=0x8249460, sc=0x82493d0,
> fargs=0x0) at template.c:4016
> #4  0x08184a94 in TemplateInstance::semantic (this=0x8249460, sc=0x82493d0) at
> template.c:3687
> #5  0x080db0f3 in ScopeExp::semantic (this=0x8249500, sc=0x82493d0) at
> expression.c:3587
> #6  0x080b2f4c in VarDeclaration::semantic (this=0x8248ef0, sc=0x82493d0) at
> declaration.c:1243
> #7  0x0804b1ee in AttribDeclaration::semanticNewSc (this=0x8244538,
> sc=0x8249170, stc=4, linkage=LINKd, protection=PROTpublic, explicitProtection=0,
> structalign=8) at attrib.c:126
> #8  0x0804bd14 in StorageClassDeclaration::semantic (this=0x8244538,
> sc=0x8249170) at attrib.c:414
> #9  0x0818537c in TemplateInstance::semantic (this=0x8213ef8, sc=0x82141f0,
> fargs=0x0) at template.c:4016
> #10 0x08184a94 in TemplateInstance::semantic (this=0x8213ef8, sc=0x82141f0) at
> template.c:3687
> #11 0x0813f569 in TypeInstance::resolve (this=0x8214030, loc=..., sc=0x82141f0,
> pe=0xffffcfa8, pt=0xffffcfac, ps=0xffffcfa4) at mtype.c:5902
> #12 0x0813f7d8 in TypeInstance::toDsymbol (this=0x8214030, sc=0x82141f0) at
> mtype.c:5968
> #13 0x080b026d in AliasDeclaration::semantic (this=0x82140a8, sc=0x82141f0) at
> declaration.c:463
> #14 0x08130b29 in Module::semantic (this=0x8213208) at module.c:787
> #15 0x0812e0d9 in main (argc=13, argv=0x8209520) at mars.c:1171
> 
> _______________________________________________
> dmd-internals mailing list
> dmd-internals at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-internals
December 07, 2010
It's on my todo list to send mail on each failure.  They're rare enough that showing 'fix me' 'fix me' 'fix me' until it's fixed isn't that bad.  I just haven't gotten that one to the top of my priority list.  Maybe I should bump it up a little.

That said, it's not _that_ hard to glance at a web page every once in a while...

On 12/7/2010 8:49 PM, Jason House wrote:
> Is it possible to generate an email after n failures?
> 
> Sent from my iPhone
> 
> On Dec 7, 2010, at 11:30 PM, Brad Roberts <braddr at puremagic.com> wrote:
> 
>> It looks like dmd change 777 introduced a change that causes one of the failure test cases to segv.  Yeah, the auto-tester has been failing on linux for a rather long time.  Just got around to looking at it.
>>
>> http://www.dsource.org/projects/dmd/changeset/777
>>
>> $ gdb --args ../src/dmd -v -Ifail_compilation   -odtest_results/fail_compilation
>> -oftest_results/fail_compilation/fail278_0.o -c fail_compilation/fail278.d
>> (gdb) run
>> binary    /home/braddr/sandbox/d/source/trunk/dmd/src/dmd
>> version   v2.051
>> config    /home/braddr/sandbox/d/source/trunk/dmd/src/dmd.conf
>> parse     fail278
>> importall fail278
>> import    object        (~/sandbox/d/source/trunk/druntime/import/object.di)
>> semantic  fail278
>>
>> Program received signal SIGSEGV, Segmentation fault.
>> 0x0812baf9 in TemplateInstance::mangle (this=0x82496f8) at mangle.c:225
>> 225         Dsymbol *par = isnested || isTemplateMixin() ? parent :
>> tempdecl->parent;
>>
>> (gdb) print tempdecl
>> $1 = (TemplateDeclaration *) 0x0
>>
>> (gdb) bt
>> #0  0x0812baf9 in TemplateInstance::mangle (this=0x82496f8) at mangle.c:225
>> #1  0x08186925 in TemplateInstance::genIdent (this=0x8249650) at template.c:4684
>> #2  0x08187b58 in TemplateMixin::semantic (this=0x8249650, sc=0x8249838) at
>> template.c:5190
>> #3  0x0818537c in TemplateInstance::semantic (this=0x8249460, sc=0x82493d0,
>> fargs=0x0) at template.c:4016
>> #4  0x08184a94 in TemplateInstance::semantic (this=0x8249460, sc=0x82493d0) at
>> template.c:3687
>> #5  0x080db0f3 in ScopeExp::semantic (this=0x8249500, sc=0x82493d0) at
>> expression.c:3587
>> #6  0x080b2f4c in VarDeclaration::semantic (this=0x8248ef0, sc=0x82493d0) at
>> declaration.c:1243
>> #7  0x0804b1ee in AttribDeclaration::semanticNewSc (this=0x8244538,
>> sc=0x8249170, stc=4, linkage=LINKd, protection=PROTpublic, explicitProtection=0,
>> structalign=8) at attrib.c:126
>> #8  0x0804bd14 in StorageClassDeclaration::semantic (this=0x8244538,
>> sc=0x8249170) at attrib.c:414
>> #9  0x0818537c in TemplateInstance::semantic (this=0x8213ef8, sc=0x82141f0,
>> fargs=0x0) at template.c:4016
>> #10 0x08184a94 in TemplateInstance::semantic (this=0x8213ef8, sc=0x82141f0) at
>> template.c:3687
>> #11 0x0813f569 in TypeInstance::resolve (this=0x8214030, loc=..., sc=0x82141f0,
>> pe=0xffffcfa8, pt=0xffffcfac, ps=0xffffcfa4) at mtype.c:5902
>> #12 0x0813f7d8 in TypeInstance::toDsymbol (this=0x8214030, sc=0x82141f0) at
>> mtype.c:5968
>> #13 0x080b026d in AliasDeclaration::semantic (this=0x82140a8, sc=0x82141f0) at
>> declaration.c:463
>> #14 0x08130b29 in Module::semantic (this=0x8213208) at module.c:787
>> #15 0x0812e0d9 in main (argc=13, argv=0x8209520) at mars.c:1171
>>
>> _______________________________________________
>> dmd-internals mailing list
>> dmd-internals at puremagic.com
>> http://lists.puremagic.com/mailman/listinfo/dmd-internals
> _______________________________________________
> dmd-internals mailing list
> dmd-internals at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-internals

December 07, 2010
Passes the full dmd test suite just fine.

On 12/7/2010 8:37 PM, Brad Roberts wrote:
> This patch fixes the one error.  Still running the test suite to see if anything dislikes it:
> 
> ===================================================================
> --- mangle.c    (revision 792)
> +++ mangle.c    (working copy)
> @@ -222,15 +222,18 @@
>      printf("\n");
>  #endif
>      id = ident ? ident->toChars() : toChars();
> -    Dsymbol *par = isnested || isTemplateMixin() ? parent : tempdecl->parent;
>      if (!tempdecl)
>          error("is not defined");
> -    else if (par)
> +    else
>      {
> -        char *p = par->mangle();
> -        if (p[0] == '_' && p[1] == 'D')
> -            p += 2;
> -        buf.writestring(p);
> +        Dsymbol *par = isnested || isTemplateMixin() ? parent : tempdecl->parent;
> +        if (par)
> +        {
> +            char *p = par->mangle();
> +            if (p[0] == '_' && p[1] == 'D')
> +                p += 2;
> +            buf.writestring(p);
> +        }
>      }
>      buf.printf("%zu%s", strlen(id), id);
>      id = buf.toChars();
> 
> On 12/7/2010 8:30 PM, Brad Roberts wrote:
>> It looks like dmd change 777 introduced a change that causes one of the failure test cases to segv.  Yeah, the auto-tester has been failing on linux for a rather long time.  Just got around to looking at it.
>>
>> http://www.dsource.org/projects/dmd/changeset/777
>>
>> $ gdb --args ../src/dmd -v -Ifail_compilation   -odtest_results/fail_compilation
>> -oftest_results/fail_compilation/fail278_0.o -c fail_compilation/fail278.d
>> (gdb) run
>> binary    /home/braddr/sandbox/d/source/trunk/dmd/src/dmd
>> version   v2.051
>> config    /home/braddr/sandbox/d/source/trunk/dmd/src/dmd.conf
>> parse     fail278
>> importall fail278
>> import    object        (~/sandbox/d/source/trunk/druntime/import/object.di)
>> semantic  fail278
>>
>> Program received signal SIGSEGV, Segmentation fault.
>> 0x0812baf9 in TemplateInstance::mangle (this=0x82496f8) at mangle.c:225
>> 225         Dsymbol *par = isnested || isTemplateMixin() ? parent :
>> tempdecl->parent;
>>
>> (gdb) print tempdecl
>> $1 = (TemplateDeclaration *) 0x0
>>
>> (gdb) bt
>> #0  0x0812baf9 in TemplateInstance::mangle (this=0x82496f8) at mangle.c:225
>> #1  0x08186925 in TemplateInstance::genIdent (this=0x8249650) at template.c:4684
>> #2  0x08187b58 in TemplateMixin::semantic (this=0x8249650, sc=0x8249838) at
>> template.c:5190
>> #3  0x0818537c in TemplateInstance::semantic (this=0x8249460, sc=0x82493d0,
>> fargs=0x0) at template.c:4016
>> #4  0x08184a94 in TemplateInstance::semantic (this=0x8249460, sc=0x82493d0) at
>> template.c:3687
>> #5  0x080db0f3 in ScopeExp::semantic (this=0x8249500, sc=0x82493d0) at
>> expression.c:3587
>> #6  0x080b2f4c in VarDeclaration::semantic (this=0x8248ef0, sc=0x82493d0) at
>> declaration.c:1243
>> #7  0x0804b1ee in AttribDeclaration::semanticNewSc (this=0x8244538,
>> sc=0x8249170, stc=4, linkage=LINKd, protection=PROTpublic, explicitProtection=0,
>> structalign=8) at attrib.c:126
>> #8  0x0804bd14 in StorageClassDeclaration::semantic (this=0x8244538,
>> sc=0x8249170) at attrib.c:414
>> #9  0x0818537c in TemplateInstance::semantic (this=0x8213ef8, sc=0x82141f0,
>> fargs=0x0) at template.c:4016
>> #10 0x08184a94 in TemplateInstance::semantic (this=0x8213ef8, sc=0x82141f0) at
>> template.c:3687
>> #11 0x0813f569 in TypeInstance::resolve (this=0x8214030, loc=..., sc=0x82141f0,
>> pe=0xffffcfa8, pt=0xffffcfac, ps=0xffffcfa4) at mtype.c:5902
>> #12 0x0813f7d8 in TypeInstance::toDsymbol (this=0x8214030, sc=0x82141f0) at
>> mtype.c:5968
>> #13 0x080b026d in AliasDeclaration::semantic (this=0x82140a8, sc=0x82141f0) at
>> declaration.c:463
>> #14 0x08130b29 in Module::semantic (this=0x8213208) at module.c:787
>> #15 0x0812e0d9 in main (argc=13, argv=0x8209520) at mars.c:1171
>>
>> _______________________________________________
>> dmd-internals mailing list
>> dmd-internals at puremagic.com
>> http://lists.puremagic.com/mailman/listinfo/dmd-internals
> 
> _______________________________________________
> dmd-internals mailing list
> dmd-internals at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-internals