--- Comment #7 from dirtysalt1987 at gmail dot com 2010-04-19 02:25 ---
(In reply to comment #6)
> Just a littke more: alignof (struct _x_t) is 4 therefor so is the alignof(_x_t
> ::data).
>
3ku very much,with your explanation I think I can understand it..3ku very much.
--
http://g
--- Comment #6 from pinskia at gcc dot gnu dot org 2010-04-19 01:08 ---
Just a littke more: alignof (struct _x_t) is 4 therefor so is the alignof(_x_t
::data).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43774
--- Comment #5 from dirtysalt1987 at gmail dot com 2010-04-17 10:28 ---
(In reply to comment #1)
> You should make the struct packed, because otherwise you are accessing it
> unaligned.
>
3ku for your reply.Your reply is much more useful than Axxx's reply.3ku very
much:).
--
http:
--- Comment #4 from schwab at linux-m68k dot org 2010-04-17 09:49 ---
The compiler can assume that *x is correctly aligned, so this is not a bug.
--
schwab at linux-m68k dot org changed:
What|Removed |Added
-
--- Comment #3 from dirtysalt1987 at gmail dot com 2010-04-17 09:45 ---
(In reply to comment #1)
> You should make the struct packed, because otherwise you are accessing it
> unaligned.
>
If I recompile it with -O0, the assembly code call 'strlen' function.And I use
Valgrind to run it,
--- Comment #2 from dirtysalt1987 at gmail dot com 2010-04-17 08:11 ---
(In reply to comment #1)
> You should make the struct packed, because otherwise you are accessing it
> unaligned.
>
I think the main problem coming from that GCC replace the 'strlen' function
with the following code
--- Comment #1 from jakub at gcc dot gnu dot org 2010-04-17 06:55 ---
You should make the struct packed, because otherwise you are accessing it
unaligned.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43774