printf with asm
Manfred Hansen
m.hansen at kielnet.net
Wed Nov 7 11:29:32 PST 2007
Manfred Hansen wrote:
>
> void main()
> {
> int myint = 1234;
> const(char*) mystring = "This number -> %d <- should be 1234\n";
>
> asm
> {
> push dword ptr myint ; // pointer to the integer
> variable
> declared in D
> push dword ptr mystring ; // pointer into the C-style
> string
> declared in D
> call printf ; // call the printf function
> }
> }
>
> This programm run with dmd 2.007 but not with gdc based on version 2.005 .
> My Compiler is gcc.4.1.2 under linux.
>
> The output:
> manni at manni-lx:~/dd/ass$ ./asm
> This number -> 1234 <- should be 1234
> Speicherzugriffsfehler (core dumped)
>
> I believe the core dump has to with the line
> const(char*) mystring ...
>
> manni
Hello,
i make my programm a little bit smaller to get a
segmentation fault.
void main()
{
int myint = 1234;
asm
{
push dword ptr myint;
}
}
I have tested the programm under Debian/Sidux and Kubuntu feisty.
Can someone reproduce the error, maybe the problem is not the
gdc compiler, it's my operating system ?
manni
More information about the D.gnu
mailing list