Daniel,
  The problema was not with member/2 but with (>)/2 (in my example, member/2 
did get linked because it is used in findall_bug1, however >/2 did not even 
though it is also used in findall_bug1). Maybe there are two versions of the 
arithmetic comparison ? 

Adding :-ensure_linked((>)/2). did the trick, so I guess when using VC as the 
linker i should add :-ensure_linked for all the artihmetic operators.

Regards,
  Gustavo
  ----- Original Message ----- 
  From: Daniel Diaz 
  To: Gustavo Brown - INCO ; bug-prolog@gnu.org 
  Sent: Monday, September 14, 2015 4:01 AM
  Subject: Re: system_error(cannot_catch_throw(error(existence_error(procedure, 
(>)/2), findall/3)))


  Hi,

  Sorry for the late reply

  this is not a bug. With --min-pl-bips only statically referenced predicates 
are part of the executable (member/2 is dynamically called).
  To avoid this you can:

    a.. avoid the use of --min-pl-bips and friends (e.g. min-bips,...) 
    b.. explicitely call member/2 (eg. adding a dummy clause: dummy :- 
member(_,_).) 
    c.. use a directive called ensure_linked(member/2). 
  Daniel




  Le 14/07/2015 16:34, Gustavo Brown - INCO a écrit :

    I am getting the following error when compiling a simple snippet 

    
system_error(cannot_catch_throw(error(existence_error(procedure,(>)/2),findall/3)))

    To reproduce, create a file (test.pl) with this code:

    :-initialization(findall_bug).

    findall_bug:-
      write(findall_bug),nl,
      findall(Att, (member(Att, [6, 0]), Att > 0), XParmAs),
      write(XParmAs),nl,
      findall(Att, findall_bug1([6,0], Att), ParmAs),
      write(ParmAs),nl,
      write(done),nl,
      !.  

    findall_bug1(Parms, Att):-
     member( Att, Parms), 
     Att > 0.

    I usually compile the generated assembly file with this two steps:
      gplc -S test.pl -o test.s
      mingw-as - o test.obj --32 test.s
    and link with MSVC linker.

    However, I can reproduce this using only gplc: 

    gplc --no-top-level --min-pl-bips -o test.exe test.pl

    Output of execution is:

    findall_bug

    
system_error(cannot_catch_throw(error(existence_error(procedure,(>)/2),findall/3)))

    
system_error(cannot_catch_throw(error(existence_error(procedure,(>)/2),findall/3)))
    []
    [6]
    done

    If you compile without --min-pl-bips, the output is right
    It seems that the compiler treats differently the arithmetic comparison 
inside findall, and does not include some library code when using --min-pl-bips 
(and also linking directly with MSVC)

    Using GNU Prolog 1.4.4

    Regards,
      Gustavo



    -- 
    Ce message a été vérifié par MailScanner pour des virus ou des polluriels 
et rien de suspect n'a été trouvé. 
     

_______________________________________________
Bug-prolog mailing list
Bug-prolog@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-prolog


  -- 
  Ce message a été vérifié par MailScanner pour des virus ou des polluriels et 
rien de suspect n'a été trouvé. 
_______________________________________________
Bug-prolog mailing list
Bug-prolog@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-prolog

Reply via email to