r50 gdc crash on 4.0.3, mingw32

David Friedman dvdfrdmn at users.ess-eff.net
Wed Dec 6 19:25:39 PST 2006


Downs wrote:
> Downs wrote:
> 
>> Trying to compile the file html.d
>> ( http://paste.dprogramming.com/dpba895x.php )
>> with a recently compiled r50 of gdc on gcc 4.0.3 on mingw32,
>> I encountered the following error:
>>  > html.d: In member function 'apply':
>>  > html.d:211: internal compiler error: Arithmetic exception
>>  > (that's actually an assert, I just made it an arithmetic
>>  > exception so's I could get the stacktrace .. the original line was
>>  > Assertion failed: func_type!=NULL, file 
>> ../../gcc-4.0.3/gcc/d/d-codegen.cc, line 854
>>  > Please submit a full bug report yada yada.
>>
>> The stack trace at the time of the crash is:
>> E:\code\dmono>gdb c:\gdc\libexec\gcc\i686-pc-mingw32\4.0.3\cc1d.exe
>> GNU gdb 5.2.1
>> Copyright 2002 Free Software Foundation, Inc.
>> GDB is free software, covered by the GNU General Public License, and 
>> you are
>> welcome to change it and/or distribute copies of it under certain 
>> conditions.
>> Type "show copying" to see the conditions.
>> There is absolutely no warranty for GDB.  Type "show warranty" for 
>> details.
>> This GDB was configured as "i686-pc-mingw32"...
>> (gdb) r html.d -dumpbase html.d -auxbase-strip obj/html.o 
>> -fversion=Windows -ipr
>> efix C:/gdc/lib/gcc/i686-pc-mingw32/4.0.3 -IC:/gdc/include/d/4.0.3 -o 
>> test.s
>> Starting program: c:\gdc\libexec\gcc\i686-pc-mingw32\4.0.3\cc1d.exe 
>> html.d -dump
>> base html.d -auxbase-strip obj/html.o -fversion=Windows -iprefix 
>> C:/gdc/lib/gcc/
>> i686-pc-mingw32/4.0.3 -IC:/gdc/include/d/4.0.3 -o test.s
>>
>> Program received signal SIGFPE, Arithmetic exception.
>> 0x004ba10f in IRState::call(TypeFunction*, tree_node*, tree_node*, 
>> Array*) (
>>     this=0x203cb70, func_type=0x0, callable=0x20737e0, object=0x20737c0,
>>     arguments=0x15afd60) at ../../gcc-4.0.3/gcc/d/d-codegen.cc:854
>> 854         if (func_type==NULL) { int a=0; a=0/a; }
>> Current language:  auto; currently c++
>> (gdb) bt
>> #0  0x004ba10f in IRState::call(TypeFunction*, tree_node*, tree_node*, 
>> Array*)
>>     (this=0x203cb70, func_type=0x0, callable=0x20737e0, object=0x20737c0,
>>     arguments=0x15afd60) at ../../gcc-4.0.3/gcc/d/d-codegen.cc:854
>> #1  0x004ba783 in IRState::call(Expression*, Array*) (this=0x203cb70,
>>     expr=0x15afd28, arguments=0x15afd60)
>>     at ../../gcc-4.0.3/gcc/d/d-codegen.cc:824
>> #2  0x004c4e39 in CallExp::toElem(IRState*) (this=0x15afd88, 
>> irs=0x203cb70)
>>     at ../../gcc-4.0.3/gcc/d/d-glue.cc:1491
>> #3  0x004b9e1e in IRState::convertTo(Expression*, Type*) (this=0x203cb70,
>>     exp=0x15afd88, target_type=0x15841b0)
>>     at ../../gcc-4.0.3/gcc/d/d-codegen.cc:239
>> #4  0x004bf12f in CastExp::toElem(IRState*) (this=0x1eaafa8, 
>> irs=0x203cb70)
>>     at ../../gcc-4.0.3/gcc/d/d-glue.cc:1318
>> #5  0x004b9dc1 in IRState::convertForAssignment(Expression*, Type*) (
>>     this=0x203cb70, exp=0x1eaafa8, target_type=0x15841b0)
>>     at ../../gcc-4.0.3/gcc/d/d-codegen.cc:549
>> #6  0x004c75c9 in AssignExp::toElem(IRState*) (this=0x1eaae70, 
>> irs=0x203cb70)
>>     at ../../gcc-4.0.3/gcc/d/d-glue.cc:1130
>> #7  0x004be23f in CommaExp::toElem(IRState*) (this=0x1eaaea8, 
>> irs=0x203cb70)
>>     at ../../gcc-4.0.3/gcc/d/d-glue.cc:1200
>> #8  0x004be21b in CommaExp::toElem(IRState*) (this=0x1eaaf18, 
>> irs=0x203cb70)
>>     at ../../gcc-4.0.3/gcc/d/d-glue.cc:1199
>> #9  0x004b9e1e in IRState::convertTo(Expression*, Type*) (this=0x203cb70,
>> ---Type <return> to continue, or q <return> to quit---
>>     exp=0x1eaaf18, target_type=0x1e6d8f0)
>>     at ../../gcc-4.0.3/gcc/d/d-codegen.cc:239
>> #10 0x004bf12f in CastExp::toElem(IRState*) (this=0x1eaafe0, 
>> irs=0x203cb70)
>>     at ../../gcc-4.0.3/gcc/d/d-glue.cc:1318
>> #11 0x004ba080 in IRState::convertForArgument(Expression*, Argument*) (
>>     this=0x203cb70, exp=0x1eaafe0, arg=0x15a4f00)
>>     at ../../gcc-4.0.3/gcc/d/d-codegen.cc:490
>> #12 0x004ba330 in IRState::call(TypeFunction*, tree_node*, tree_node*, 
>> Array*)
>>     (this=0x203cb70, func_type=0x1e6e2a8, callable=0x2066dc0,
>>     object=0x2072140, arguments=0x15af258)
>>     at ../../gcc-4.0.3/gcc/d/d-codegen.cc:907
>> #13 0x004ba542 in IRState::call(FuncDeclaration*, tree_node*, Array*) (
>>     this=0x203cb70, func_decl=0x15a4f30, object=0x2072140, 
>> args=0x15af258)
>>     at ../../gcc-4.0.3/gcc/d/d-codegen.cc:838
>> #14 0x004c335e in NewExp::toElem(IRState*) (this=0x15afdc0, 
>> irs=0x203cb70)
>>     at ../../gcc-4.0.3/gcc/d/d-glue.cc:1975
>> #15 0x004b9e1e in IRState::convertTo(Expression*, Type*) (this=0x203cb70,
>>     exp=0x15afdc0, target_type=0x15841b0)
>>     at ../../gcc-4.0.3/gcc/d/d-codegen.cc:239
>> #16 0x004bf12f in CastExp::toElem(IRState*) (this=0x1eab018, 
>> irs=0x203cb70)
>>     at ../../gcc-4.0.3/gcc/d/d-glue.cc:1318
>> #17 0x004c63c2 in CatAssignExp::toElem(IRState*) (this=0x15afe10,
>>     irs=0x203cb70) at ../../gcc-4.0.3/gcc/d/d-glue.cc:883
>> ---Type <return> to continue, or q <return> to quit---
>> #18 0x004bdd31 in ExpStatement::toIR(IRState*) (this=0x15afe48, 
>> irs=0x203cb70)
>>     at ../../gcc-4.0.3/gcc/d/d-glue.cc:3949
>> #19 0x004bd9ff in CompoundStatement::toIR(IRState*) (this=0x15b0318,
>>     irs=0x203cb70) at ../../gcc-4.0.3/gcc/d/d-glue.cc:3917
>> #20 0x004bd9ff in CompoundStatement::toIR(IRState*) (this=0x1eab768,
>>     irs=0x203cb70) at ../../gcc-4.0.3/gcc/d/d-glue.cc:3917
>> #21 0x004c2079 in FuncDeclaration::toObjFile() (this=0x15ae330)
>>     at ../../gcc-4.0.3/gcc/d/d-glue.cc:2636
>> #22 0x004aacd3 in _ZN16ClassDeclaration9toObjFileEv (this=0x15ad8f8)
>>     at ../../gcc-4.0.3/gcc/d/dmd/toobj.c:310
>> #23 0x004c0d6a in Module::genobjfile() (this=0x1583d30)
>>     at ../../gcc-4.0.3/gcc/d/d-glue.cc:2779
>> #24 0x004b1aed in d_parse_file(int) () at 
>> ../../gcc-4.0.3/gcc/d/d-lang.cc:1017
>> #25 0x00527df3 in compile_file () at ../../gcc-4.0.3/gcc/toplev.c:1010
>> #26 0x005298d0 in do_compile () at ../../gcc-4.0.3/gcc/toplev.c:2125
>> #27 0x00529935 in toplev_main (argc=12, argv=0x3e2710)
>>     at ../../gcc-4.0.3/gcc/toplev.c:2157
>> #28 0x004e9bda in main (argc=2293684, argv=0x4011a0)
>>     at ../../gcc-4.0.3/gcc/main.c:35
>> (gdb)
>>
>>
>> Greetings, thanks and good luck! :D
>> --downs
> 
> 
> The problem also appears for me with the following vastly simplified 
> program:
> int main() { return delegate int() { return 0; }(); }
> In this case, I get the vastly simplified stack trace:
> 
> GNU gdb 5.2.1
> Copyright 2002 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and you 
> are
> welcome to change it and/or distribute copies of it under certain 
> conditions.
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB.  Type "show warranty" for details.
> This GDB was configured as "i686-pc-mingw32"...
> (gdb) r test.d -IC:/gdc/include/d/4.0.3
> Starting program: c:\gdc\libexec\gcc\i686-pc-mingw32\4.0.3\cc1d.exe 
> test.d -IC:/
> gdc/include/d/4.0.3
> 
> Program received signal SIGFPE, Arithmetic exception.
> 0x004ba10f in IRState::call(TypeFunction*, tree_node*, tree_node*, 
> Array*) (
>     this=0x15a5360, func_type=0x0, callable=0x1530fe0, object=0x1530fc0,
>     arguments=0x15a04d0) at ../../gcc-4.0.3/gcc/d/d-codegen.cc:854
> 854         if (func_type==NULL) { int a=0; a=0/a; }
> Current language:  auto; currently c++
> (gdb) bt
> #0  0x004ba10f in IRState::call(TypeFunction*, tree_node*, tree_node*, 
> Array*)
>     (this=0x15a5360, func_type=0x0, callable=0x1530fe0, object=0x1530fc0,
>     arguments=0x15a04d0) at ../../gcc-4.0.3/gcc/d/d-codegen.cc:854
> #1  0x004ba783 in IRState::call(Expression*, Array*) (this=0x15a5360,
>     expr=0x15a0498, arguments=0x15a04d0)
>     at ../../gcc-4.0.3/gcc/d/d-codegen.cc:824
> #2  0x004c4e39 in CallExp::toElem(IRState*) (this=0x15a04f8, irs=0x15a5360)
>     at ../../gcc-4.0.3/gcc/d/d-glue.cc:1491
> #3  0x004b9dc1 in IRState::convertForAssignment(Expression*, Type*) (
>     this=0x15a5360, exp=0x15a04f8, target_type=0x14b9018)
>     at ../../gcc-4.0.3/gcc/d/d-codegen.cc:549
> #4  0x004bf07a in ReturnStatement::toIR(IRState*) (this=0x15a0530,
>     irs=0x15a5360) at ../../gcc-4.0.3/gcc/d/d-glue.cc:3607
> #5  0x004bd9ff in CompoundStatement::toIR(IRState*) (this=0x15a40f8,
>     irs=0x15a5360) at ../../gcc-4.0.3/gcc/d/d-glue.cc:3917
> #6  0x004c2079 in FuncDeclaration::toObjFile() (this=0x15a0118)
>     at ../../gcc-4.0.3/gcc/d/d-glue.cc:2636
> #7  0x004c0d6a in Module::genobjfile() (this=0x1583c08)
>     at ../../gcc-4.0.3/gcc/d/d-glue.cc:2779
> #8  0x004b1aed in d_parse_file(int) () at 
> ../../gcc-4.0.3/gcc/d/d-lang.cc:1017
> #9  0x00527df3 in compile_file () at ../../gcc-4.0.3/gcc/toplev.c:1010
> #10 0x005298d0 in do_compile () at ../../gcc-4.0.3/gcc/toplev.c:2125
> #11 0x00529935 in toplev_main (argc=3, argv=0x3e2550)
>     at ../../gcc-4.0.3/gcc/toplev.c:2157
> #12 0x004e9bda in main (argc=2293684, argv=0x4011a0)
>     at ../../gcc-4.0.3/gcc/main.c:35
> (gdb) q
> 
> Again, good luck!

Thanks for the reduced test case!  The fix is in svn.

David



More information about the D.gnu mailing list