[mercury-users] segmentation fault

Julien Fischer juliensf at csse.unimelb.edu.au
Tue Jan 20 23:19:36 AEDT 2009

On Tue, 20 Jan 2009, Jörg Schuster wrote:

>> Some questions:
>> * Which version of gcc is this?
> gcc version 4.3.1 20080507 (prerelease) [gcc-4_3-branch revision
> 135036] (SUSE Linux)
>> * Which version of Mercury is this?
> Mercury Compiler, version 0.13.1, configured for x86_64-unknown-linux-gnu
>> * What grade is the program being compiled in?
> I don't know so much about grades. I compiled it with mmc -m.

The default grade is hlc.gc based on the way configure was invoked

> It might have to do with the way I installed Mercury according to your
> instructions. You wrote:
>> I've tried installing Mercury 0.13.1 on OpenSUSE 11 using gcc 4.3
>> and the following works:
>> (1) Unpack the source distribution from the tarball
>> (2) Create the file Mmake.params at the root of the source tree and
>>    put the following line in it:
>>  GRADE=none.gc
>> (3) Invoke configure as follows:
> > ./configure --with-llds-base-grade=none \
> >    --with-default-grade=hlc.gc

The problem is that gcc cannot handle the amount of C code
that Mercury compiler is generating.  With large tables of facts,
such as we have here, the Mercury compiler should ideally generate
some sort of static lookup table, rather than actual code, (large
amounts of the latter are almost certainly what is killing gcc here.)

Recent versions of the compiler do perform this optimization
(in some compilation grades), but it is not happening here
for a couple of reasons:

(1) this was only implemented in recent versions of the Mercury
     compiler.  It wasn't in version 0.13.X.

(2) this particular optimization is not implemented for the compiler's
     high-level C backend, i.e. the one use by the hlc.gc grade.

(Some of the details are discussed in the following paper, 
which is available from our papers page:

Dealing with large predicates: exo-compilation in the WAM and in Mercury 
Bart Demoen, Phuong-Lan Nguyen, Vitor Santos Costa and Zoltan Somogyi,
Proceedings of the Seventh International Colloquim on Implementation of
Constraint and Logic Programming Systems, Porto, Portugal, September


More information about the users mailing list