This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
c++/7981: -Wsequence-point broken for C++
- From: austern at apple dot com
- To: gcc-gnats at gcc dot gnu dot org
- Date: 19 Sep 2002 23:13:12 -0000
- Subject: c++/7981: -Wsequence-point broken for C++
- Reply-to: austern at apple dot com
>Number: 7981
>Category: c++
>Synopsis: -Wsequence-point broken for C++
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Sep 19 16:16:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: austern@apple.com
>Release: 3.1, 3.2, and TOT
>Organization:
>Environment:
Linux, OS X
>Description:
The documentation doesn't list -Wsequence-point as a C-only option. However, it turns out that this warning doesn't work for C++. In 3.1 and 3.2 the option fails silently; in TOT we get a warning saying (in contradiction to the documentation) that this option isn't available for C++.
Either the compiler or the documentation should be fixed.
>How-To-Repeat:
bash-2.05$ cat > foo.c
int main() {
int a = 0;
a = a++;
return a;
}
bash-2.05$ /usr/local/gcc-3.1/bin/gcc -Wsequence-point foo.c
foo.c: In function `main':
foo.c:3: warning: operation on `a' may be undefined
bash-2.05$ /usr/local/gcc-3.1/bin/g++ -Wsequence-point foo.c
bash-2.05$ /usr/local/gcc-3.2/bin/g++ -Wsequence-point foo.c
bash-2.05$ ~/root/bin/g++ -Wsequence-point foo.c
cc1plus: warning: "-Wsequence-point" is valid for C/ObjC but not for C++
bash-2.05$
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: