diff options
author | Ben Elliston <bje@au.ibm.com> | 2009-05-19 13:24:30 +0000 |
---|---|---|
committer | Ben Elliston <bje@gcc.gnu.org> | 2009-05-19 23:24:30 +1000 |
commit | ce883f549b88a97eef2b32da03cc712692f8f2c6 (patch) | |
tree | 06979689177456962b1acb14a9b126a630187866 /gcc | |
parent | 377f099ab80623a6d0dacfd4447d45042c385b98 (diff) | |
download | gcc-ce883f549b88a97eef2b32da03cc712692f8f2c6.zip gcc-ce883f549b88a97eef2b32da03cc712692f8f2c6.tar.gz gcc-ce883f549b88a97eef2b32da03cc712692f8f2c6.tar.bz2 |
unwind-dw2-fde.c (fde_unencoded_compare): Replace type punning assignments with memcpy calls.
* unwind-dw2-fde.c (fde_unencoded_compare): Replace type punning
assignments with memcpy calls.
(add_fdes): Likewise.
(binary_search_unencoded_fdes): Likewise.
(linear_search_fdes): Eliminate type puns.
From-SVN: r147705
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/unwind-dw2-fde.c | 20 |
2 files changed, 21 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1b3b0fc..07d2c8e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2009-05-19 Ben Elliston <bje@au.ibm.com> + + * unwind-dw2-fde.c (fde_unencoded_compare): Replace type punning + assignments with memcpy calls. + (add_fdes): Likewise. + (binary_search_unencoded_fdes): Likewise. + (linear_search_fdes): Eliminate type puns. + 2009-05-19 Richard Guenther <rguenther@suse.de> * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Do diff --git a/gcc/unwind-dw2-fde.c b/gcc/unwind-dw2-fde.c index fcac25f..4aa9d82 100644 --- a/gcc/unwind-dw2-fde.c +++ b/gcc/unwind-dw2-fde.c @@ -318,8 +318,9 @@ static int fde_unencoded_compare (struct object *ob __attribute__((unused)), const fde *x, const fde *y) { - const _Unwind_Ptr x_ptr = *(const _Unwind_Ptr *) x->pc_begin; - const _Unwind_Ptr y_ptr = *(const _Unwind_Ptr *) y->pc_begin; + _Unwind_Ptr x_ptr, y_ptr; + memcpy (&x_ptr, x->pc_begin, sizeof (_Unwind_Ptr)); + memcpy (&y_ptr, y->pc_begin, sizeof (_Unwind_Ptr)); if (x_ptr > y_ptr) return 1; @@ -674,7 +675,9 @@ add_fdes (struct object *ob, struct fde_accumulator *accu, const fde *this_fde) if (encoding == DW_EH_PE_absptr) { - if (*(const _Unwind_Ptr *) this_fde->pc_begin == 0) + _Unwind_Ptr ptr; + memcpy (&ptr, this_fde->pc_begin, sizeof (_Unwind_Ptr)); + if (ptr == 0) continue; } else @@ -792,8 +795,9 @@ linear_search_fdes (struct object *ob, const fde *this_fde, void *pc) if (encoding == DW_EH_PE_absptr) { - pc_begin = ((const _Unwind_Ptr *) this_fde->pc_begin)[0]; - pc_range = ((const _Unwind_Ptr *) this_fde->pc_begin)[1]; + const _Unwind_Ptr *pc_array = (const _Unwind_Ptr *) this_fde->pc_begin; + pc_begin = pc_array[0]; + pc_range = pc_array[1]; if (pc_begin == 0) continue; } @@ -840,8 +844,10 @@ binary_search_unencoded_fdes (struct object *ob, void *pc) { size_t i = (lo + hi) / 2; const fde *const f = vec->array[i]; - const void *pc_begin = ((const void *const*) f->pc_begin)[0]; - const uaddr pc_range = ((const uaddr *) f->pc_begin)[1]; + void *pc_begin; + uaddr pc_range; + memcpy (&pc_begin, (const void * const *) f->pc_begin, sizeof (void *)); + memcpy (&pc_range, (const uaddr *) f->pc_begin + 1, sizeof (uaddr)); if (pc < pc_begin) hi = i; |