[Bug middle-end/29239] New: -fno-strict-aliasing disables restrict
acahalan at gmail dot com
gcc-bugzilla@gcc.gnu.org
Tue Sep 26 19:23:00 GMT 2006
This really shouldn't happen. Rather than disabling the whole
analysis, -fno-strict-aliasing should should simply cause gcc
to use the (char*) rules for everything.
It can be useful to add "restrict", even if it is not
practical to find and fix all aliasing-related problems.
$ cat restrict.c
void foo(int *restrict a, int *restrict b, int *restrict c){
*a = *b;
*c = *b;
}
$ gcc -m32 -std=gnu99 -mregparm=3 -fomit-frame-pointer -Os -S restrict.c
$ cat restrict.s
.file "restrict.c"
.text
.globl foo
.type foo, @function
foo:
movl (%edx), %edx
movl %edx, (%eax)
movl %edx, (%ecx)
ret
.size foo, .-foo
.ident "GCC: (GNU) 4.1.1 20060828 (Red Hat 4.1.1-20)"
.section .note.GNU-stack,"",@progbits
$ gcc -m32 -std=gnu99 -mregparm=3 -fomit-frame-pointer -Os -fno-strict-aliasing
-S restrict.c
$ cat restrict.s
.file "restrict.c"
.text
.globl foo
.type foo, @function
foo:
pushl %ebx
movl (%edx), %ebx
movl %ebx, (%eax)
movl (%edx), %eax
popl %ebx
movl %eax, (%ecx)
ret
.size foo, .-foo
.ident "GCC: (GNU) 4.1.1 20060828 (Red Hat 4.1.1-20)"
.section .note.GNU-stack,"",@progbits
$
BTW, this is probably related to the problem of -fno-strict-aliasing
silently disabling the -Wstrict-aliasing=2 warning option.
--
Summary: -fno-strict-aliasing disables restrict
Product: gcc
Version: 4.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: acahalan at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29239
More information about the Gcc-bugs
mailing list