Summary: | no warning for "int a = a + 1" statements | ||
---|---|---|---|
Product: | gcc | Reporter: | invi |
Component: | c++ | Assignee: | Andrew Pinski <pinskia> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | andersk, bangerth, erickt, gcc-bugs, peter.barth |
Priority: | P3 | Keywords: | diagnostic |
Version: | 3.2 | ||
Target Milestone: | 3.4.0 | ||
Host: | Target: | ||
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: | 2003-08-03 15:08:50 | |
Bug Depends on: | |||
Bug Blocks: | 24639 |
Description
Wolfgang Bangerth
2003-04-29 09:30:29 UTC
From: Wolfgang Bangerth <bangerth@ices.utexas.edu> To: Remo Inverardi <invi@your.toilet.ch> Cc: gcc-gnats@gcc.gnu.org Subject: Re: c++/10538: gcc 3.2.3 does not issue a warning for "int a = a + 1" statements Date: Tue, 29 Apr 2003 09:32:28 -0500 (CDT) > I just gave the current GCC documentation a second look, but I was not > able to identify the extension your referring to (?) ... Maybe you're right. I tried to locate it in the manual some time ago and couldn't find it either, after it had been discussed on the mailing lists for the umpteenth time. It's documented in the mailing list archives, but that is not a very good place... > what's more, I > just tried compiling the same code with -ansi, -pedantic, and -Wall > options, neither of which gave me a warning ... That's why I didn't close the report. W. ------------------------------------------------------------------------- Wolfgang Bangerth email: bangerth@ices.utexas.edu www: http://www.ices.utexas.edu/~bangerth/ The following code compiles without any warnings: void foo() { int xxx = xxx + 1; } I think some warning like "xxx was accessed without being initialized" would be appropriate. Release: gcc-3.2.3 Environment: Debian SID How-To-Repeat: See description. State-Changed-From-To: open->analyzed State-Changed-Why: You actually use a documented gcc extension to _suppress_ the warning. I don't think I have an opinion about the usefulness of this extension, so leave it to others to decide what to do with the report. In any case, I can confirm the behavior with present mainline (3.4). W. I am working on a patch. I submitted a patch to fix this: <http://gcc.gnu.org/ml/gcc-patches/2003-08/ msg00952.html>. *** Bug 5284 has been marked as a duplicate of this bug. *** Subject: Bug 10538 CVSROOT: /cvs/gcc Module name: gcc Changes by: pinskia@gcc.gnu.org 2003-08-19 20:29:01 Modified files: gcc : c-common.h c.opt c-opts.c c-lang.c function.c gcc/objc : objc-lang.c gcc/doc : invoke.texi gcc/cp : cp-lang.c Log message: PR c++/10538, PR c/5582 ChangeLog: * langhooks-def.h (lhd_decl_uninit): Declare. (LANG_HOOKS_DECL_UNINIT): New macro. (LANG_HOOKS_INITIALIZER): Adjust. * langhooks.h (struct lang_hooks): Add new field decl_uninit. * langhooks.c (lhd_decl_uninit): Define. * c-common.c (c_decl_uninit_1): New function. (c_decl_uninit): New function. (warn_init_self): Define. * c-common.h (c_decl_uninit): Declare. (warn_init_self): Declare. * c.opt: Introduce -Winit-self. * c-opts.c (c_common_handle_options): Set warn_init_self. * c-lang.c (LANG_HOOKS_DECL_UNINIT): Define. * objc/objc-lang.c (LANG_HOOKS_DECL_UNINIT): Define. * function.c (uninitialized_vars_warning): Call the language hook. * doc/invoke.texi: Document -Winit-self. cp/ChangeLog: * cp/cp-lang.c (LANG_HOOKS_DECL_UNINIT): Define. testsuite: * gcc.dg/uninit-D.c: New Test. * gcc.dg/uninit-E.c: New Test. * gcc.dg/uninit-F.c: New Test. * gcc.dg/uninit-G.c: New Test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-common.h.diff?cvsroot=gcc&r1=1.202&r2=1.203 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c.opt.diff?cvsroot=gcc&r1=1.14&r2=1.15 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-opts.c.diff?cvsroot=gcc&r1=1.87&r2=1.88 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-lang.c.diff?cvsroot=gcc&r1=1.114&r2=1.115 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/function.c.diff?cvsroot=gcc&r1=1.449&r2=1.450 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/objc/objc-lang.c.diff?cvsroot=gcc&r1=1.37&r2=1.38 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/doc/invoke.texi.diff?cvsroot=gcc&r1=1.328&r2=1.329 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-lang.c.diff?cvsroot=gcc&r1=1.61&r2=1.62 Fixed on the mainline for 3.4. *** Bug 12651 has been marked as a duplicate of this bug. *** *** Bug 14739 has been marked as a duplicate of this bug. *** |