www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15525] New: SEGV running semantic analysis on non-root decl

https://issues.dlang.org/show_bug.cgi?id=15525

          Issue ID: 15525
           Summary: SEGV running semantic analysis on non-root decl that
                    has errors.
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ibuclaw gdcproject.org

One such example.

bug.d:
---
struct CrashMe
{
  import typecons;
  Tuple!() crash;
}


typecons.d
---
template Tuple{ static if }


command: dmd bug.d
typecons.d(1): Error: parenthesized TemplateParameterList expected following
TemplateIdentifier
typecons.d(1): Error: (expression) expected following static if
typecons.d(1): Error: declaration expected, not '}'
Segmentation fault


stacktrace:
---
Program received signal SIGSEGV, Segmentation fault.
0x00000000004e49ca in StaticIfCondition::syntaxCopy() (this=0x7ffff6bfb950) at
cond.d:345
(gdb) bt
#0  0x00000000004e49ca in StaticIfCondition::syntaxCopy() (this=0x7ffff6bfb950)
at cond.d:345
#1  0x00000000004dd0b6 in StaticIfDeclaration::syntaxCopy(Dsymbol*)
(this=0x7ffff6bfb9a0, s=0x0) at attrib.d:1132
#2  0x0000000000532b83 in Dsymbol::arraySyntaxCopy(Array<Dsymbol*>*)
(a=0x7ffff6bfb930) at dsymbol.d:467
#3  0x000000000054391f in TemplateInstance::semantic(Scope*,
Array<Expression*>*) (this=0x7ffff7ed3ee0, sc=0x7ffff6bfbf50, fargs=0x0) at
dtem
plate.d:5725
#4  0x000000000054435c in TemplateInstance::semantic(Scope*)
(this=0x7ffff7ed3ee0, sc=0x7ffff6bfbf50) at dtemplate.d:6009
#5  0x00000000005bd892 in TypeInstance::resolve(Loc, Scope*, Expression**,
Type**, Dsymbol**, bool) (this=0x7ffff7ed4040, loc=..., sc=0x7ffff
6bfbf50, pe=0x7fffffffc9f0, pt=0x7fffffffc9e8, ps=0x7fffffffc9f8,
intypeid=false) at mtype.d:7392
#6  0x00000000005bd96a in TypeInstance::semantic(Loc, Scope*)
(this=0x7ffff7ed4040, loc=..., sc=0x7ffff6bfbf50) at mtype.d:7413
#7  0x00000000005065b5 in VarDeclaration::semantic(Scope*)
(this=0x7ffff7ed4120, sc=0x7ffff6bfaf80) at declaration.d:1153
#8  0x0000000000530af9 in StructDeclaration::semantic(Scope*)
(this=0x7ffff7ed3ad0, sc=0x7ffff7ed4410) at dstruct.d:378
#9  0x00000000005276c5 in Module::semantic() (this=0x7ffff7ed3840) at
dmodule.d:987
#10 0x00000000005ac759 in tryMain(unsigned long, char const**) (argc=2,
argv=0x7fffffffde38) at mars.d:1488
#11 0x00000000005ad267 in D main () at mars.d:1698
---

--
Jan 07