*nudge*
I know Dan's obviously got more important things to worry about and
Simon's also busy elsewhere, but did anyone else have any thoughts?
I include my query of last week below.
---------- Forwarded message ----------
Date: Tue, 15 Jan 2002 16:36:41 -0500 (EST)
From: Andy Dougherty <[EMAIL PROTECTED]>
To: Perl6 Internals <[EMAIL PROTECTED]>
Subject: [possible PATCH] More gcc warnings: -Wcast-align
On SPARC, gcc -Wcast-align gives 70+ warnings of the form
interpreter.c:69: warning: cast increases required alignment of target type
For about half the warnings, the code in question is something of the
form:
code_start = (opcode_t *)interpreter->code->byte_code;
where interpreter->code->byte_code is (char *), and code_start is
(opcode_t *).
The following patch silences those warnings and passes all the tests (with
opcode_t = INTVAL = long, the only combination I have time to test today),
but I'd appreciate another set of eyes looking at it. Is it really the
case that all accesses of interpreter->code->byte_code will be looking for
opcode-size chunks? Or is there occasion to address byte_code with a
finer granularity? Or is the warning irrelevant since the larger structure of
the code guarantees correct alignment anyway?
diff -r -u parrot/include/parrot/packfile.h parrot-andy/include/parrot/packfile.h
--- parrot/include/parrot/packfile.h Mon Jan 7 17:09:15 2002
+++ parrot-andy/include/parrot/packfile.h Tue Jan 15 16:16:17 2002
@@ -44,7 +44,7 @@
struct PackFile_FixupTable * fixup_table;
struct PackFile_ConstTable * const_table;
size_t byte_code_size;
- char * byte_code;
+ opcode_t * byte_code;
};
Along similar lines, packfile.c (which I haven't touched) contains
things like
char * cursor;
opcode_t * op_ptr;
cursor = packed;
/* . . . */
op_ptr = (opcode_t *)cursor;
cursor += sizeof(opcode_t);
Again, the (opcode_t *) cast raises alignment warnings. packfile.c
walks through byte_code with a char * pointer and makes size
calculations using sizeof(opcode_t). We could probably silence the
warnings by just using an opcode_t * cursor, but there might be a good
reason for doing it the way it is done now.
--
Andy Dougherty [EMAIL PROTECTED]
Dept. of Physics
Lafayette College, Easton PA 18042