[mercury-users] segmentation violation with wrong syntax sources

Paul Bone pbone at csse.unimelb.edu.au
Tue Jun 29 10:57:56 AEST 2010


On Mon, Jun 28, 2010 at 04:47:54PM +0200, Jean-Marc Vanel 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
> 

This doesn't segfault for me.  I get:

pbone at taura:/tmp$ mmc --make crypt
** Error making `Mercury/int3s/crypt.int3'.
crypt.m:027: Syntax error: Illegal character 0xE2 (226) in input.

pbone at taura:/tmp$ mmc --version
Mercury Compiler, version rotd-2010-06-28, configured for x86_64-unknown-linux-gnu
Copyright (C) 1993-2010 The University of Melbourne
pbone at taura:/tmp$ gcc --version
gcc (Ubuntu 4.4.1-4ubuntu9) 4.4.1
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

This system is Ubuntu 9.10 (karmic), I picked this system because it is similar
to yours.

The problem is likely to be a compatibility issue between gcc and Mercury.  We
test Mercury regularly on gcc-3.4, 4.1, 4,2, 4,3, 4.4 Of these gcc-3.4 has been
stable for a long time, but it's being phased out.  gcc-4.2 has a minor issue.

> It is hard to learn Mercury if the compiler does not flag syntax errors
> correctly !

Sadly this is largly a volenteer project; no-one is paid to improve Mercury.
It's also difficult to keep up with the moving target of gcc.

The error reported above, (not the segfault), was caused by a non-ascii
charicter.  Try to use a non-unicode/utf-8 environment when editing Mercury
files.

> I put my version of crypt.m that looks good but however makes a segmentation
> violation here :
> http://jmvanel.free.fr/tmp/crypt.m
> 
> I'm running Ubuntu 10.4 .
> uname -a
> Linux jmv-desktop 2.6.32-22-generic #33-Ubuntu SMP Wed Apr 28 13:28:05 UTC
> 2010 x86_64 GNU/Linux
> 
> with either
> mercury-compiler-10.04-beta-2010-06-24
> or
> mercury-rotd-2010-06-23
> 

Thanks for these details, they're very helpful.  could you also let us know
which C compiler you're using?

$ gcc --version

> Note that I couldn't install the stable version  13.1.

That's to be expected.  0.13.1 isn't compatible with gcc-4.x in its default
configuration.

Once I have time to setup an Ubuntu 10.4 system I'll re-test this problem.  In
the meantime, try following the advice under the first item on this page:
http://www.mercury.csse.unimelb.edu.au/information/doc-latest/mercury_faq/Installing.html#Installing

Thanks.

-------------- 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/a82711d0/attachment.sig>


More information about the users mailing list