unfortunately, chromatic's memcpy patch still generated the compiler
error, perhaps because gcc is optimizing it back to the original code it
was replacing.
using memmove fixes this issue. it performs the copy, but it's not
optimized in the same way because it deals with potentially overlapping
memory. it's part of C89, so it should be fine to use. patch is
attached.
t/op/copy.t passes with this patch. can others try it out?
-jeff
On Mon, 17 Dec 2007, James Keenan via RT wrote:
No, at least not on Ubuntu. (Will have to check later on other OSes.)
Here's the last part of the 'make' output:
src/string.c
src/ops/core_ops.c
src/ops/debug.ops: In function ‘Parrot_debug_break’:
src/ops/debug.ops:103: warning: null argument where non-null required
(argument 2)
src/ops/debug.ops:113: warning: null argument where non-null required
(argument 2)
src/ops/core_ops_switch.c
src/ops/debug.ops: In function ‘switch_core’:
src/ops/debug.ops:103: warning: null argument where non-null required
(argument 2)
src/ops/debug.ops:113: warning: null argument where non-null required
(argument 2)
src/atomic/gcc_x86.c
src/builtin.c
src/byteorder.c
src/charset.c
src/core_pmcs.c
src/cpu_dep.c
src/datatypes.c
src/debug.c
src/dynext.c
src/embed.c
src/encoding.c
src/events.c
src/exceptions.c
src/exit.c
src/extend.c
src/extend_vtable.c
src/gc/dod.c
src/gc/gc_gms.c
src/gc/gc_ims.c
src/gc/memory.c
src/gc/register.c
src/gc/smallobject.c
src/global.c
src/global_setup.c
src/hash.c
src/hash.c: In function ‘hash_thaw’:
src/hash.c:361: warning: null argument where non-null required (argument 4)
src/hash.c:367: warning: null argument where non-null required (argument 4)
src/headers.c
src/hll.c
src/inter_call.c
src/inter_cb.c
src/inter_create.c
src/inter_misc.c
src/interpreter.c
src/inter_run.c
src/intlist.c
src/key.c
src/library.c
src/list.c
src/longopt.c
src/misc.c
src/mmd.c
/usr/local/bin/perl tools/build/nativecall.pl src/call_list.txt
src/nci.c
src/oo.c
src/objects.c
src/objects.c: In function ‘Parrot_find_method_with_cache’:
src/objects.c:1627: warning: passing argument 3 of
‘Parrot_find_method_direct’ discards qualifiers from pointer target type
src/objects.c:1668: warning: passing argument 3 of
‘Parrot_find_method_direct’ discards qualifiers from pointer target type
src/packfile.c
src/packout.c
src/pic_jit.c
src/pic.c
src/platform.c
src/pmc_freeze.c
src/pmc.c
/usr/local/bin/perl -Ilib tools/build/revision_c.pl > src/revision.c
src/revision.c
src/runops_cores.c
src/scheduler.c
src/spf_render.c
src/spf_vtable.c
src/stack_common.c
src/stacks.c
src/stm/backend.c
src/stm/waitlist.c
src/string_primitives.c
src/sub.c
src/thread.c
src/trace.c
src/tsq.c
src/utils.c
src/vtables.c
src/warnings.c
src/packfile/pf_items.c
src/ops/core_ops_cg.c
src/ops/debug.ops: In function ‘cg_core’:
src/ops/debug.ops:103: warning: null argument where non-null required
(argument 2)
src/ops/debug.ops:113: warning: null argument where non-null required
(argument 2)
src/ops/experimental.ops:535: error: unable to find a register to spill
in class ‘SIREG’
src/ops/experimental.ops:535: error: this is the insn:
(insn 72206 72205 72207 2345 src/ops/set.ops:557 (parallel [
(set (reg:SI 2 cx [65672])
(const_int 0 [0x0]))
(set (reg:SI 5 di [orig:65669 D.58595 ] [65669])
(plus:SI (ashift:SI (reg:SI 2 cx [65672])
(const_int 2 [0x2]))
(reg:SI 5 di [orig:65669 D.58595 ] [65669])))
(set (reg/f:SI 1 dx [orig:65670 clone ] [65670])
(plus:SI (ashift:SI (reg:SI 2 cx [65672])
(const_int 2 [0x2]))
(reg/f:SI 1 dx [orig:65670 clone ] [65670])))
(set (mem/s:BLK (reg:SI 5 di [orig:65669 D.58595 ] [65669])
[0 S24 A32])
(mem/s:BLK (reg/f:SI 1 dx [orig:65670 clone ] [65670])
[0 S24 A32]))
(use (reg:SI 2 cx [65672]))
(use (reg:SI 19 dirflag))
]) 628 {*rep_movsi} (nil)
(expr_list:REG_UNUSED (reg/f:SI 1 dx [orig:65670 clone ] [65670])
(expr_list:REG_UNUSED (reg:SI 5 di [orig:65669 D.58595 ] [65669])
(expr_list:REG_UNUSED (reg:SI 2 cx [65672])
(expr_list:REG_DEAD (reg:SI 19 dirflag)
(expr_list:REG_UNUSED (reg/f:SI 1 dx [orig:65670
clone ] [65670])
(expr_list:REG_UNUSED (reg:SI 5 di [orig:65669
D.58595 ] [65669])
(expr_list:REG_UNUSED (reg:SI 2 cx [65672])
(nil)))))))))
src/ops/experimental.ops:535: confused by earlier errors, bailing out
make: *** [src/ops/core_ops_cg.o] Error 1
Index: src/ops/set.ops
===================================================================
--- src/ops/set.ops (revision 24016)
+++ src/ops/set.ops (working copy)
@@ -554,7 +554,7 @@
/* the source PMC knows how to clone itself, but we must reuse the
destination header */
- STRUCT_COPY($1, clone);
+ memmove($1, clone, sizeof (PMC) );
/* don't let the clone's destruction destroy the destination's data */
PObj_active_destroy_CLEAR(clone);