bug-prolog
[Top][All Lists]
Advanced

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

read_integer causing "user directive failed" in 1.3.0 on x86_64 (Linux)


From: Scott L. Burson
Subject: read_integer causing "user directive failed" in 1.3.0 on x86_64 (Linux)
Date: Thu, 11 Jan 2007 15:57:41 -0800
User-agent: Mozilla Thunderbird 1.0.7 (X11/20050923)

Hi,

I have a simple program that reads an input file containing one integer and one atom on each line. I have two builds of GNU Prolog 1.3.0, one on a 32-bit Linux (SuSE 9.3) and the other on a 64-bit Linux (SuSE Linux Enterprise Desktop 10). The program behaves differently in the two environments. The difference seems to come down to what happens when I call `read_integer' when the input stream pointer is immediately before the newline which is the last character in the file. On the 32-bit machine, the `read_integer' simply fails; on the 64-bit machine, I get "warning: ... user directive failed" and the program exits.

I can work around the problem by consuming the newline and testing for end_of_file before invoking `read_integer', so I don't need this fixed urgently.

I run the test case by doing

 % gplc --no-debugger --no-top-level example.pl
 % example <input.dat

Code and sample input is below.

-- Scott

-------- example.pl
:- initialization(main).

main :-
   read_pairs(Ps),
   print(Ps),
   nl.

read_pairs([P | Ps]) :-
   catch(read_pair(P), _, fail),
   read_pairs(Ps).

read_pairs([]) :-
   at_end_of_stream.

read_pair(pair(I, A)) :-
   peek_char(C),
   read_integer(I),
   read_atom(A).

-------- input.dat
0 a
1 b





reply via email to

[Prev in Thread] Current Thread [Next in Thread]