--- Comment #8 from joerg at netbsd dot org 2006-09-25 16:57 ---
> Second this is just a memcpy issue, short testcase:
> #include
>
> char buf[21];
>
> int main(void)
> {
> int a = 0x;
> memcpy(buf, &a, 4);
This creates two movl, one for a and one to buf. When
--- Comment #5 from joerg at netbsd dot org 2006-09-25 16:48 ---
It is not violating aliasing rules (since a character string can alias with
everything, 6.5p7) nor does it affect this problem.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29215
--- Comment #4 from pinskia at gcc dot gnu dot org 2006-09-25 16:43 ---
Second this is just a memcpy issue, short testcase:
#include
char buf[21];
int main(void)
{
int a = 0x;
memcpy(buf, &a, 4);
buf[4] = '\0';
puts(buf);
return 0;
}
-
--- Comment #3 from pinskia at gcc dot gnu dot org 2006-09-25 16:37 ---
First not you are violating C aliasing rules:
*(int *)"abcd"
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29215
--- Comment #2 from joerg at netbsd dot org 2006-09-25 14:46 ---
Created an attachment (id=12323)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12323&action=view)
Assembly output
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29215
--- Comment #1 from joerg at netbsd dot org 2006-09-25 14:46 ---
Created an attachment (id=12322)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12322&action=view)
C source to compile with -O2
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29215