This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/10032: -pedantic gives a warning when goto jumps over an initalization, but then dies
- From: mvl at exedo dot nl
- To: gcc-gnats at gcc dot gnu dot org
- Date: 11 Mar 2003 21:04:23 -0000
- Subject: c++/10032: -pedantic gives a warning when goto jumps over an initalization, but then dies
- Reply-to: mvl at exedo dot nl
>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: