[Bug c/43774] option -O2 generates wrong assembly code

2010-04-18 Thread dirtysalt1987 at gmail dot com
--- 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

[Bug c/43774] option -O2 generates wrong assembly code

2010-04-18 Thread pinskia at gcc dot gnu dot org
--- 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

[Bug c/43774] option -O2 generates wrong assembly code

2010-04-17 Thread dirtysalt1987 at gmail dot com
--- 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:

[Bug c/43774] option -O2 generates wrong assembly code

2010-04-17 Thread schwab at linux-m68k dot org
--- 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 -

[Bug c/43774] option -O2 generates wrong assembly code

2010-04-17 Thread dirtysalt1987 at gmail dot com
--- 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,

[Bug c/43774] option -O2 generates wrong assembly code

2010-04-17 Thread dirtysalt1987 at gmail dot com
--- 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

[Bug c/43774] option -O2 generates wrong assembly code

2010-04-16 Thread jakub at gcc dot gnu dot org
--- 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