This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c++/7981: -Wsequence-point broken for C++

>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
>Release:        3.1, 3.2, and TOT
Linux, OS X
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.

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++


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]