[mercury-users] segmentation violation with wrong syntax sources

Julien Fischer juliensf at csse.unimelb.edu.au
Tue Jun 29 11:53:40 AEST 2010


On Tue, 29 Jun 2010, Paul Bone wrote:

> On Tue, Jun 29, 2010 at 11:03:13AM +1000, Peter Wang wrote:
>> On 2010-06-28, Jean-Marc Vanel <jeanmarc.vanel at gmail.com> wrote:
>>> Hi
>>>
>>> I tried to run the pasted and corrected version of the cryptarithm example
>>> from the tutorial (cf my preceding post) .
>>> Alas, I couln't, as I met a segmentation violation.
>>> So I tried to write a small example showing the same problem. Here it is :
>>>
>>> :- module crypt_crash3.
>>> :- interface.
>>> :- pred main is det.
>>> :- implementation.
>>>
>>> main :-
>>>   CAT = 100 * C % segmentation violation <<<<<<<<<<<<
>>>   % CAT = C  % OK ! warning: unresolved polymorphism.  The variables with
>>> unbound types were: C: V_1 CAT: V_1
>>> .
>>>
>>> Here is the result of compiling this :
>>>
>>> /usr/local/mercury-10.04-beta-2010-06-24/bin/mmc --make crypt_crash3
>>>
>>> *** Mercury runtime: caught segmentation violation ***
>>> cause: address not mapped to object
>>> address involved: 0x9994f80
>>> This may have been caused by a stack overflow, due to unbounded recursion.
>>> exiting from signal handler
>>> zsh: segmentation fault  /usr/local/mercury-10.04-beta-2010-06-24/bin/mmc
>>> --make crypt_crash3
>>>
>>> It is hard to learn Mercury if the compiler does not flag syntax errors
>>> correctly !
>>>
>>> I put my version of crypt.m that looks good but however makes a segmentation
>>> violation here :
>>> http://jmvanel.free.fr/tmp/crypt.m
>>
>> Here is the error message you should have seen:
>>
>> % mmc crypt.m
>> crypt.m:004: Error: no clauses for predicate `main'/2.
>> crypt.m:027: Syntax error: Illegal character 0xE2 (226) in input.
>>
>> The asterisk (*) characters are UTF-8 encoded U+2217 characters, not
>> ASCII U+002A.
>>
>> Of course, the compiler should not crash anyway.  This is a known
>> problem when installing from the precompiled sources on a x86-64 machine
>> (bug #115).
>
> I'm not sure that that's the problem.  Why would it segfault for Jean-Marc but
> report an error for us?

Read Peter's note in the entry for bug #115, it's likely the mmc you
are using wasn't built from the pre-generated .c files in the source
distribution -- the problem only appears with them.

Julien.
--------------------------------------------------------------------------
mercury-users mailing list
Post messages to:       mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions:          mercury-users-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the users mailing list