This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/29239] New: -fno-strict-aliasing disables restrict
- From: "acahalan at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 26 Sep 2006 19:23:24 -0000
- Subject: [Bug middle-end/29239] New: -fno-strict-aliasing disables restrict
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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