Re: system_error(cannot_catch_throw(error(existence_error(procedure, (>)/2), findall/3)))
"Gustavo Brown - INCO" <[email protected]> Mon, 14 Sep 2015 13:41:03 -0300
| Newsgroups | gmane.comp.gnu.prolog.bugs |
|---|---|
| Message-ID | <F939160EC87B4A5E978439B7FC321686@VirtualXP99969> |
This is a multi-part message in MIME format. --===============3795242390146642787== Content-Type: multipart/alternative; boundary="----=_NextPart_000_020B_01D0EEF2.FF92A000" This is a multi-part message in MIME format. ------=_NextPart_000_020B_01D0EEF2.FF92A000 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable 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 ?=20 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 -----=20 From: Daniel Diaz=20 To: Gustavo Brown - INCO ; [email protected]=20 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,...)=20 b.. explicitely call member/2 (eg. adding a dummy clause: dummy :- = member(_,_).)=20 c.. use a directive called ensure_linked(member/2).=20 Daniel Le 14/07/2015 16:34, Gustavo Brown - INCO a =E9crit : I am getting the following error when compiling a simple snippet=20 = system_error(cannot_catch_throw(error(existence_error(procedure,(>)/2),fi= ndall/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, !. =20 findall_bug1(Parms, Att):- member( Att, Parms),=20 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:=20 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),fi= ndall/3))) = system_error(cannot_catch_throw(error(existence_error(procedure,(>)/2),fi= ndall/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 --=20 Ce message a =E9t=E9 v=E9rifi=E9 par MailScanner pour des virus ou = des polluriels et rien de suspect n'a =E9t=E9 trouv=E9.=20 =20 _______________________________________________ Bug-prolog mailing list [email protected] https://lists.gnu.org/mailman/listinfo/bug-prolog --=20 Ce message a =E9t=E9 v=E9rifi=E9 par MailScanner pour des virus ou des = polluriels et rien de suspect n'a =E9t=E9 trouv=E9. ------=_NextPart_000_020B_01D0EEF2.FF92A000 Content-Type: text/html; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META content=3D"text/html; charset=3Dwindows-1252" = http-equiv=3DContent-Type> <META name=3DGENERATOR content=3D"MSHTML 8.00.6001.23588"></HEAD> <BODY bgColor=3D#ffffff text=3D#000000> <DIV><FONT size=3D2 face=3DArial>Daniel,</FONT></DIV> <DIV><FONT size=3D2 face=3DArial> The problema was not with = member/2 but with=20 (>)/2 (in my example, member/2 did get linked because it is used in=20 findall_bug1, however >/2 did not even though it is also used in=20 findall_bug1). Maybe there are two versions of the arithmetic comparison = ?=20 </FONT></DIV> <DIV><FONT size=3D2 face=3DArial></FONT> </DIV> <DIV><FONT size=3D2 face=3DArial>Adding = <STRONG>:-ensure_linked((>)/2)</STRONG>.=20 did the trick, so I guess when using VC as the linker i should add=20 :-ensure_linked for all the artihmetic operators.</FONT></DIV> <DIV><FONT size=3D2 face=3DArial></FONT> </DIV> <DIV><FONT size=3D2 face=3DArial>Regards,</FONT></DIV> <DIV><FONT size=3D2 face=3DArial> Gustavo</FONT></DIV> <BLOCKQUOTE=20 style=3D"BORDER-LEFT: #000000 2px solid; PADDING-LEFT: 5px; = PADDING-RIGHT: 0px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px"> <DIV style=3D"FONT: 10pt arial">----- Original Message ----- </DIV> <DIV=20 style=3D"FONT: 10pt arial; BACKGROUND: #e4e4e4; font-color: = black"><B>From:</B>=20 <A [email protected]=20 href=3D"mailto:[email protected]">Daniel Diaz</A> </DIV> <DIV style=3D"FONT: 10pt arial"><B>To:</B> <A = [email protected]=20 href=3D"mailto:[email protected]">Gustavo Brown - INCO</A> ; <A=20 [email protected]=20 href=3D"mailto:[email protected]">[email protected]</A> </DIV> <DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Monday, September 14, = 2015 4:01=20 AM</DIV> <DIV style=3D"FONT: 10pt arial"><B>Subject:</B> Re:=20 system_error(cannot_catch_throw(error(existence_error(procedure, = (>)/2),=20 findall/3)))</DIV> <DIV><BR></DIV> <DIV class=3Dmoz-cite-prefix>Hi,<BR><BR>Sorry for the late = reply<BR><BR>this is=20 not a bug. With --min-pl-bips only statically referenced predicates = are part=20 of the executable (member/2 is dynamically called).<BR>To avoid this = you=20 can:<BR> <UL> <LI>avoid the use of --min-pl-bips and friends (e.g. min-bips,...)=20 <LI>explicitely call member/2 (eg. adding a dummy clause: dummy :-=20 member(_,_).)=20 <LI>use a directive called ensure_linked(member/2). </LI></UL> <P>Daniel<BR></P><BR><BR>Le 14/07/2015 16:34, Gustavo Brown - INCO a=20 =E9crit :<BR></DIV> <BLOCKQUOTE cite=3Dmid:759DF669DCA94C99A66F2D37B24EE28B@VirtualXP99969 = type=3D"cite"> <META name=3DGENERATOR content=3D"MSHTML 8.00.6001.23588"> <STYLE></STYLE> <DIV><FONT size=3D2 face=3DArial>I am getting the following error = when compiling=20 a simple snippet </FONT></DIV> <DIV> </DIV> <DIV><FONT size=3D2=20 face=3D"Courier = New"><STRONG>system_error(cannot_catch_throw(error(existence_error(proced= ure,(>)/2),findall/3)))</STRONG></FONT></DIV> <DIV> </DIV> <DIV><FONT size=3D2 face=3DArial>To reproduce, create a file = (test.pl) with this=20 code:</FONT></DIV> <DIV> </DIV> <DIV><FONT size=3D2=20 face=3D"Courier New">:-initialization(findall_bug).</FONT></DIV> <DIV> </DIV> <DIV><FONT size=3D2 face=3D"Courier New">findall_bug:-<BR> =20 write(findall_bug),nl,<BR> findall(Att, (member(Att, [6, 0]), = Att >=20 0), XParmAs),<BR> write(XParmAs),nl,<BR> findall(Att,=20 findall_bug1([6,0], Att), ParmAs),<BR> = write(ParmAs),nl,<BR> =20 write(done),nl,<BR> !. </FONT></DIV> <DIV> </DIV> <DIV><FONT size=3D2 face=3D"Courier New">findall_bug1(Parms,=20 Att):-<BR> member( Att, Parms), <BR> Att > = 0.</FONT></DIV> <DIV> </DIV> <DIV><FONT size=3D2 face=3DArial>I usually compile the generated = assembly file=20 with this two steps:</FONT></DIV> <DIV><FONT size=3D2 face=3D"Courier New"> gplc -S test.pl -o=20 test.s</FONT></DIV> <DIV><FONT size=3D2 face=3D"Courier New"> mingw-as - o = test.obj --32=20 test.s</FONT></DIV> <DIV><FONT size=3D2 face=3DArial>and link with MSVC = linker.</FONT></DIV> <DIV> </DIV> <DIV><FONT size=3D2 face=3DArial>However, I can reproduce this using = only gplc:=20 </FONT></DIV> <DIV> </DIV> <DIV><FONT size=3D2 face=3D"Courier New"><STRONG>gplc --no-top-level = --min-pl-bips -o test.exe test.pl</STRONG></FONT></DIV> <DIV> </DIV> <DIV><FONT size=3D2 face=3DArial>Output of execution = is:</FONT></DIV> <DIV> </DIV> <DIV><FONT size=3D2 face=3D"Courier New">findall_bug</FONT></DIV> <DIV> </DIV> <DIV><FONT size=3D2=20 face=3D"Courier = New">system_error(cannot_catch_throw(error(existence_error(procedure,(>= ;)/2),findall/3)))</FONT></DIV> <DIV> </DIV> <DIV><FONT size=3D2=20 face=3D"Courier = New">system_error(cannot_catch_throw(error(existence_error(procedure,(>= ;)/2),findall/3)))<BR>[]<BR>[6]<BR>done</FONT></DIV> <DIV> </DIV> <DIV><FONT size=3D2 face=3DArial>If you compile without <FONT=20 face=3D"Courier New">--min-pl-bips</FONT>, the output is = right</FONT></DIV> <DIV><FONT size=3D2 face=3DArial>It seems that the compiler treats = differently=20 the arithmetic comparison inside findall, and does not include some = library=20 code when using --min-pl-bips (and also linking directly with=20 MSVC)</FONT></DIV> <DIV> </DIV> <DIV><FONT size=3D2 face=3DArial>Using GNU Prolog 1.4.4</FONT></DIV> <DIV> </DIV> <DIV><FONT size=3D2 face=3DArial>Regards,</FONT></DIV> <DIV><FONT size=3D2 face=3DArial> Gustavo</FONT></DIV> <DIV> </DIV> <DIV> </DIV><BR>-- <BR>Ce message a =E9t=E9 v=E9rifi=E9 par <A=20 href=3D"http://www.mailscanner.info/" = moz-do-not-send=3D"true">MailScanner</A>=20 pour des virus ou des polluriels et rien de suspect n'a =E9t=E9 = trouv=E9. <BR> <FIELDSET class=3DmimeAttachmentHeader></FIELDSET> <BR><PRE = wrap=3D"">_______________________________________________ Bug-prolog mailing list <A class=3Dmoz-txt-link-abbreviated = href=3D"mailto:[email protected]">[email protected]</A> <A class=3Dmoz-txt-link-freetext = href=3D"https://lists.gnu.org/mailman/listinfo/bug-prolog">https://lists.= gnu.org/mailman/listinfo/bug-prolog</A> </PRE></BLOCKQUOTE><BR><BR>-- <BR>Ce message a =E9t=E9 v=E9rifi=E9 par = <A=20 href=3D"http://www.mailscanner.info/">MailScanner</A> pour des virus = ou des=20 polluriels et rien de suspect n'a =E9t=E9 trouv=E9. = </BLOCKQUOTE></BODY></HTML> ------=_NextPart_000_020B_01D0EEF2.FF92A000-- --===============3795242390146642787== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Bug-prolog mailing list [email protected] https://lists.gnu.org/mailman/listinfo/bug-prolog --===============3795242390146642787==--