This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/31893] Please provide an "inout" attribute for function parameters.
- From: "madcoder at debian dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 10 May 2007 10:12:50 -0000
- Subject: [Bug c/31893] Please provide an "inout" attribute for function parameters.
- References: <bug-31893-13675@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #1 from madcoder at debian dot org 2007-05-10 11:12 -------
It seems that even if the argument is declared const foo_t * gcc assumes the
function will initialize the data, which is rather ... erm... strange. Here is
the testcase:
======================================================
struct foo { int toto; };
void do_bar(const struct foo *);
int main(void) {
struct foo foo;
do_bar(&foo);
return 0;
}
======================================================
gcc -Wall -Wextra -O2 -Wuninitialized -c -o foo.o foo.c
gives no warning while I'd expect to have one as do_bar takes a const foo_t *
hence should not initialize it.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31893