[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Calling curl_easy_setopt crashes on 64-bit Debian stable

On Tue, Jun 22, 2010 at 09:12:09AM +0300, Tero Koskinen wrote:
> Hi,
> I am trying to create bindings for libcurl and noticed that calling
> curl_easy_setopt from Ada crashes on 64-bit (x86_64) Debian 5.0.4.

Here is a minimal test case without curl dependency:
-- http://koti.kapsi.fi/tkoskine/printf.adb
-- printf.adb
-- gnatmake -save-temps printf.adb
pragma No_Run_Time;
with Interfaces.C;

procedure Printf is
   procedure printf (S : Interfaces.C.char_array; I : Interfaces.C.Int);
   pragma Import (C, printf, "printf");

   use type Interfaces.C.char_array;

   Str_Val : Interfaces.C.char_array (1..3) :=
     "%d" & Interfaces.C.Nul;
   Int_Val : Interfaces.C.Int := 99999;
   printf(Str_Val, Int_Val);
end Printf;

The problem is that GNAT generates code which uses %eax and %esi
registers on amd64/x86_64 system when correct registers would be %rax
and %rsi.

Tero Koskinen - http://iki.fi/tero.koskinen/

Reply to: