[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: gcc 4.5 built-in memcpy() does not handle unaligned int
2012/8/20 Martin Husemann <martin%duskware.de@localhost>:
> On Mon, Aug 20, 2012 at 02:41:23PM +0900, Hikaru Abe wrote:
>> I have found this problem on upstream:
>> Bug 46483 - [4.5 regression] built-in memcpy() does not handle unaligned int
>> -current and netbsd-6 are affected?
> Can you reproduce it? I can't (code for set_by_assignement is identical
> to set_by_memcpy for me).
I have tried on DreamPlug, the code died in alignment fault.
# uname -a
NetBSD 6.0_RC1 NetBSD 6.0_RC1 (SHEEVAPLUG) #0: Mon Aug 20 23:10:07
# gcc -O2 -g -o align align.c
data_abort_handler: data_aborts fsr=0x1 far=0xbfffedcb
pid 58 (align), uid 0: exited on signal 10 (core dumped)
 Bus error (core dumped) ./align
# gdb align align.core
GNU gdb (GDB) 7.3.1
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "arm--netbsdelf".
For bug reporting instructions, please see:
Reading symbols from /align...done.
[New process 1]
Core was generated by `align'.
Program terminated with signal 10, Bus error.
#0 copy_x_into_struct (buf=0xbfffedc8 "\377\377\377\377\300\062\025 ",
x=<optimized out>) at align.c:30
30 memcpy((void*)&(testp->number), &x, sizeof(unsigned int));
# gcc -O2 -g -fno-builtin-memcpy -o align align.c
BUILT-IN MEMCPY TO bfffedc7: ff ff ff 78 56 34 12
USER-DEF MEMCPY TO bfffedc7: ff ff ff 78 56 34 12
Main Index |
Thread Index |