Skip to content

Commit

Permalink
detect -Wcast-align violations
Browse files Browse the repository at this point in the history
on an armv5 system
  • Loading branch information
Reini Urban committed Feb 6, 2015
1 parent d5b6385 commit cfdb73e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/packfile/api.c
Expand Up @@ -341,10 +341,11 @@ PackFile *
Parrot_pf_deserialize(PARROT_INTERP, ARGIN(STRING *str))
{
ASSERT_ARGS(Parrot_pf_deserialize)
PackFile * const pf = Parrot_pf_new(interp, 0);
const opcode_t * const ptr =
(const opcode_t *)Parrot_str_cstring(interp, str);
const int length = Parrot_str_byte_length(interp, str);
PackFile * const pf = Parrot_pf_new(interp, 0);
const char * const cstr = Parrot_str_cstring(interp, str);
/* XXX -Wcast-align Need to check alignment for RISC, or memcpy */
const opcode_t * const ptr = (const opcode_t *)cstr;
const int length = Parrot_str_byte_length(interp, str);

if (!Parrot_pf_unpack(interp, pf, ptr, length)) {
Parrot_pf_destroy(interp, pf);
Expand Down Expand Up @@ -2687,6 +2688,7 @@ read_pbc_file_packfile_handle(PARROT_INTERP, ARGIN(STRING * const fullname),
PackFile * const pf = Parrot_pf_new(interp, 0);
pf->options = 0;

/* XXX -Wcast-align Need to check alignment for RISC, or memcpy */
if (!Parrot_pf_unpack(interp, pf, (opcode_t *)program_code, (size_t)program_size))
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
"Can't unpack packfile %Ss", fullname);
Expand Down Expand Up @@ -2796,6 +2798,7 @@ read_pbc_file_packfile(PARROT_INTERP, ARGIN(STRING * const fullname),
pf = Parrot_pf_new(interp, is_mapped);
pf->options = 0;

/* XXX -Wcast-align Need to check alignment for RISC, or memcpy */
if (!Parrot_pf_unpack(interp, pf, (opcode_t *)program_code, (size_t)program_size))
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
"Can't unpack packfile %Ss", fullname);
Expand Down
1 change: 1 addition & 0 deletions src/packfile/pf_items.c
Expand Up @@ -1085,6 +1085,7 @@ PF_fetch_opcode(ARGIN_NULLOK(const PackFile *pf), ARGMOD(const opcode_t **stream
const unsigned char *ucstream = *(const unsigned char **)stream;
opcode_t o = (pf->fetch_op)(ucstream);
ucstream += pf->header->wordsize;
/* XXX -Wcast-align Need to check alignment for RISC, or memcpy */
*stream = (const opcode_t *)ucstream;
return o;
}
Expand Down

0 comments on commit cfdb73e

Please sign in to comment.