This is the mail archive of the gcc-bugs@gcc.gnu.org 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++/10032: -pedantic gives a warning when goto jumps over an initalization, but then dies


>Number:         10032
>Category:       c++
>Synopsis:       -pedantic gives a warning when goto jumps over an initalization, but then dies
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Mar 11 21:06:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     mvl at exedo dot nl
>Release:        3.2.2 20030109 (Debian prerelease)
>Organization:
>Environment:
Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,proto,pascal,objc,ada --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.2 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --enable-java-gc=boehm --enable-objc-gc i386-linux
Thread model: posix
gcc version 3.2.2 20030109 (Debian prerelease)
>Description:
pedantic gives a warning when a jump jumps over the initialization of a var, but then dies. Without pedantic, is gives an error. The error is ok, but the warning is confusing. It should be an error too.

[michiel at epsilon temp]$ cat goto.cpp 
int main() {
  goto label;
  
  int temp = 1;
  
  label:
    return 1;
}
[michiel at epsilon temp]$ g++ -pedantic goto.cpp && echo ok
goto.cpp: In function `int main()':
goto.cpp:6: warning: jump to label `label'
goto.cpp:2: warning:   from here
goto.cpp:4:   crosses initialization of `int temp'

[michiel at epsilon temp]$ g++ goto.cpp && echo ok
goto.cpp: In function `int main()':
goto.cpp:6: jump to label `label'
goto.cpp:2:   from here
goto.cpp:4:   crosses initialization of `int temp'

[michiel at epsilon temp]$ 

(expected: echo "ok" when only warnings are given)
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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