void f(int a, int *b) { *b = a; } void g(void) { int a = 5; f(++a, &a); }
with -Wall reports t.c:1: warning: operation on `a' may be undefined. This is with the following gcc versions: [I realize they are all Red Hat versions, not official releases, but I think that this happening on three different release branches provides sufficient argument that this is very likely an upstream bug.] Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.3.3/specs Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --disable-libunwind-exceptions --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux Thread model: posix gcc version 3.3.3 20040412 (Red Hat Linux 3.3.3-7) and Reading specs from /usr/lib/gcc/i386-redhat-linux/3.4.1/specs Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-java-awt=gtk --host=i386-redhat-linux Thread model: posix gcc version 3.4.1 20040831 (Red Hat 3.4.1-10) and Reading specs from /usr/lib/gcc/i386-redhat-linux/3.5.0/specs Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --with-gxx-include-dir=/usr/include/c++/3.4.1 --enable-languages=c,c++,f99 --disable-libgcj --host=i386-redhat-linux Thread model: posix gcc version 3.5.0 20040818 (Red Hat 3.5.0-0.9) -- Summary: -Wsequence-point reports false positives Product: gcc Version: 3.3.3 Status: UNCONFIRMED Severity: minor Priority: P2 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: mitr at volny dot cz CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18050