[Fwd: Re: [m-dev.] Mercury's non-local gotos and gcc 4]

Peter Hawkins peter at hawkins.emu.id.au
Mon Aug 29 09:58:12 AEST 2005


Can someone please apply these patches? They appear to have become lost 
in the mailing list.

The extra bug described in the message below is actually a gcc 4 
optimizer bug, which you can work around by using -O0 for the files 
which it affects.


-------- Original Message --------
Subject: 	Re: [m-dev.] Mercury's non-local gotos and gcc 4
Date: 	Fri, 08 Jul 2005 15:56:27 +1000
From: 	Peter Hawkins <peter at hawkins.emu.id.au>
Reply-To: 	mercury-developers at cs.mu.OZ.AU
To: 	mercury-developers at cs.mu.OZ.AU
References: 	<42CDF12C.6090707 at hawkins.emu.id.au>

Peter Hawkins wrote:

> Any suggestions as to how to convince gcc not to do this?

I've attached 2 patches that seem to convince gcc to do the right thing. 
With these I'm able to build and run a few example programs with mercury 
and gcc 4. They add the line:
__asm__ __volatile__(""::: "memory");
after each non-local entry point, which stops gcc from assuming things 
about the contents of memory.

I can't build the compiler itself with gcc 4. It dies with this error:
../scripts/mgnuc --grade asm_fast.gc      --no-mercury-stdlib-dir 
--c-debug --no-ansi   --       -c mercury_deep_copy.c -o mercury_deep_copy.o
mercury_deep_copy_body.h: In function 'MR_deep_copy_typeclass_info':
mercury_deep_copy_body.h:1000: error: unable to find a register to spill 
in class 'GENERAL_REGS'
mercury_deep_copy_body.h:1000: error: this is the insn:
(insn:HI 93 92 94 8 mercury_deep_copy_body.h:979 (set (reg:SI 0 ax)
        (mem:SI (reg:SI 64 [ ivtmp.113 ]) [0 S4 A32])) 41 {*movsi_1} (nil)
mercury_deep_copy_body.h:1000: confused by earlier errors, bailing out

I'll take a look at this next.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: configure.patch
Type: text/x-patch
Size: 781 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/developers/attachments/20050829/e1ebdf88/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcc4-fix.patch
Type: text/x-patch
Size: 615 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/developers/attachments/20050829/e1ebdf88/attachment-0001.bin>

More information about the developers mailing list