[mercury-users] segmentation violation with wrong syntax sources
Paul Bone
pbone at csse.unimelb.edu.au
Tue Jun 29 11:19:29 AEST 2010
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? Is his version not catching the syntax error and
crashing at some later stage?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 489 bytes
Desc: Digital signature
URL: <http://lists.mercurylang.org/archives/users/attachments/20100629/21c8304a/attachment.sig>
More information about the users
mailing list