Re: Bug when instantiating long list of compounds from consulted file

STREBELLE Alain <[email protected]> Mon, 18 Aug 2014 08:21:28 +0000
Newsgroups gmane.comp.gnu.prolog.bugs
Message-ID <D0178381.2ECEC%[email protected]>
Daniel,

Many thanks for your help. I am already using a similar workaround.

Best regards,

Alain Strebelle

From: Daniel Diaz <[email protected] >

Date: Wednesday, 13 August 2014 09:22

To: Alain Strebelle <[email protected] >

Cc: "[email protected] " <[email protected] >

Subject: Re: Bug when instantiating long list of compounds from consulted file

Hi,

thank you for the bug report. This occurs when a lot of compound terms are nested. I’m working on a fix.

A possible workaround for you case is to split the big list into several chunks. Here is an example with chunks of size 16.

a(L) :-

L = [b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c)|L1],

L1 =[b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c)|L2 ],

L2 =[b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c)|L3 ],

L3 =[b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c)|L4 ],

L4 =[b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c)|L5 ],

L5 =[b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c)|L6 ],

L6 =[b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c)|L7 ],

L7 =[b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c)|L8 ],

L8 =[b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c)|L9 ],

L9 =[b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c)|L10],

L10=[b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c)|L11],

L11=[b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c)|L12],

L12=[b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c)|L13],

L13=[b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c)|L14],

L14=[b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c)|L15],

L15=[b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c)|L16],

L16=[b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c)].

Daniel

Le 3 juin 2014 à 18:04, STREBELLE Alain <[email protected] > a écrit :

Hello everyone,

I just came to this bug.

Assume that I have a prolog file "fatal_error.pl", which contains

a(

[

b(c),

b(c),

b(c),

…

b(c)

]

).

If I consult the file

| ?- [fatal_error].

compiling /Dvlpt/trfmodels/fatal_error.pl for byte code...

/Dvlpt/trfmodels/fatal_error.pl compiled, 261 lines read - 26473 bytes written, 761 ms

(3 ms) yes

If there were less than 257 b(c) compound statements, I have no problem retrieving the knowledge:

| ?- a(R).

R = [b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c),b(c)]

Yes

If there are 257 b(c) compound statements or more, gprolog crashes:

GNU Prolog 1.4.4 (64 bits)

Compiled Jun 3 2014, 17:40:55 with gcc

By Daniel Diaz

Copyright (C) 1999-2013 Daniel Diaz

| ?- [fatal_error].

compiling /Dvlpt/trfmodels/fatal_error.pl for byte code...

/Dvlpt/trfmodels/fatal_error.pl compiled, 261 lines read - 26473 bytes written, 761 ms

(3 ms) yes

| ?- a(R).

cannot display cyclic term for R

(1 ms) yes

Fatal Error: Segmentation Violation (bad address: 0x803)

The same happens in 1.4.0, in 1.4.4 and the latest unstable version from 20140207.

Thank for looking at this, and thank you for an otherwise very good product that saves my life every day.

Alain Strebelle

Swift

Some details on my environment :

Hardware Overview:

Model Name: MacBook Pro

Model Identifier:
MacBookPro6,2

Processor Name:
Intel Core i5

Processor Speed:
2.53 GHz

Number Of Processors:1

Total Number Of Cores:2

L2 Cache (per core):
256 KB

L3 Cache: 3 MB

Memory: 4 GB

Processor Interconnect Speed:4.8 GT/s

Boot ROM Version:
MBP61.0057.B0C

SMC Version (system):1.58f17

Serial Number (system):-------------

Hardware UUID:
------------------------------------

Sudden Motion Sensor:

State: Enabled

System Software Overview:

System Version:
Mac OS X 10.6.8 (10K549)

Kernel Version:
Darwin 10.8.0

Boot Volume: MBPI5HD

Boot Mode: Normal

Computer Name:
-----

User Name: ----------------------------

Secure Virtual Memory:Enabled

64-bit Kernel and Extensions:No

Time since boot:
7:55

--

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

[email protected]

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
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-prolog