Hi,
I am using the D compiler on Mac OS X 10.4 ("gdc-0.24-mac-10.4.dmg" from sourceforge.net).
The following code crashes my gdc:
long atol (string str)
{
extern (C) long atoll(char *nptr);
return atoll(cast(char *)(str));
}
When running gdc, it says:
crash.d: In function ‘atol’:
crash.d:5: internal compiler error: Bus error
Please submit a full bug report ...
If I put the "extern (C)" declaration out of the function, the bus error goes away.
Comment #1 by u.singer — 2007-09-04T13:41:41Z
As an issue tracker newbie, I first got the "Component" & "Version" fields wrong. Meantime, I corrected the "Version" to 1.020 following the output of the "gdc -v" command:
Using built-in specs.
Target: powerpc-apple-darwin8
Configured with: /usr/local/staging/r24rc1/gcc-5363/build/obj/src/configure --disable-checking -enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,c++,d --program-transform-name=/^[cg][^.-]*$/s/$/-4.0/ --with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/lib --build=i686-apple-darwin8 --program-prefix= --host=powerpc-apple-darwin8 --target=powerpc-apple-darwin8
Thread model: posix
gcc version 4.0.1 (Apple Computer, Inc. build 5363) (gdc 0.24, using dmd 1.020)
Also, I gained the impression that the actual failing component is the gcc backend, not gdc itself. Nevertheless, the builders of gdc / dmd will be far better capable than myself of determining the cause of the crash...
Comment #2 by braddr — 2007-09-04T14:02:02Z
Reassigning to the right product, dgcc aka gdc
Comment #3 by manuel.montezelo — 2011-10-11T08:29:01Z
Created attachment 1038
Adding Ulrich Singer's testcase as file
Adding Ulrich Singer's testcase as file
Comment #4 by manuel.montezelo — 2011-10-11T08:32:28Z
When using the extern outside the function, it works for me, otherwise it fails with a compilation error:
issue-1470.d:13: Error: function m.atol.atoll nested function missing body
So maybe it was a wrong syntax which now is disallowed, but previously was not properly handled, causing the ICE? Anyway, this is additional info.
Details of my system:
--------------------------------------------------------------------------------
$ dpkg -l gdc-4.6 | grep ii
ii gdc-4.6 0.29.1-4.6.1-14 GNU D compiler, based on the GCC backend
$ uname -a
Linux mafm-laptop 3.0.0-2-amd64 #1 SMP Fri Oct 7 20:48:45 UTC 2011 x86_64 GNU/Linux --------------------------------------------------------------------------------