[mercury-users] segmentation violation with wrong syntax sources

Peter Wang novalazy at gmail.com
Tue Jun 29 11:03:13 AEST 2010


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).

Peter
--------------------------------------------------------------------------
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