[m-dev.] Looks like a GCC problem

Fergus Henderson fjh at cs.mu.OZ.AU
Mon Feb 17 15:00:18 AEDT 2003

On 17-Feb-2003, Ralph Becket <rafe at cs.mu.OZ.AU> wrote:
> I just tried building an unedited, up-to-date version of the main branch
> on ceres and got this:
> ...
> ../scripts/mgnuc --grade asm_fast.gc      --no-mercury-stdlib-dir
> --c-debug --no-ansi   --  -I../boehm_gc -I../boehm_gc/include
> mercury_deconstruct.c -o mercury_deconstruct.o
> In file included from mercury_deconstruct.c:28:
> mercury_ml_expand_body.h: In function `MR_expand_functor_args':
> mercury_ml_expand_body.h:1174: fixed or forbidden register 5 (di) was spilled
> for class DIREG.

I couldn't reproduce this one.

Which version of gcc are you using?
Can you add "EXTRA_MGNUCFLAGS=--verbose" to Mmake.params,
so that it prints out the exact gcc invocation?

In general, these result from the use of memcpy(), memcmp(), 
bzero(), or structure assignment.  The work-around is to use
MR_memcpy(), MR_assign_struct(), etc. -- see
runtime/mercury_reg_workarounds.h.  Unfortunately GCC
won't give you the exact line number, just the name of the
function which is affected.  Look for recent changes to
that function, or try splitting it up, commenting out
parts, etc. until you figure out which part of the function
is causing the problem.

The good news is that this bug in GCC is *finally* fixed in GCC CVS;
the fix will be included in GCC 3.4 and maybe 3.3.  However, it will
be a very long time before all our users have upgraded to GCC 3.4, so we'll
probably still have to maintain work-arounds for this bug for years to come.

Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au

More information about the developers mailing list