public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/38945] New: No warning when using unset variable
@ 2009-01-23 14:36 fredrik at hederstierna dot com
2009-01-24 16:05 ` [Bug c/38945] No warning when using uninitialized variable manu at gcc dot gnu dot org
2009-01-26 19:27 ` pinskia at gcc dot gnu dot org
0 siblings, 2 replies; 3+ messages in thread
From: fredrik at hederstierna dot com @ 2009-01-23 14:36 UTC (permalink / raw)
To: gcc-bugs
The 4.x compilers does not warn when using unset variables.
The 3.x compilers did warn on this:
Example:
int use_unset_variable(int y)
{
int x;
switch(y) {
case 0:
x = 0;
break;
default:
break;
}
x++;
return x;
}
Variable x could be unset when returning.
I use all warnings possible:
-Wall -W -Wextra
Best Regards
Fredrik
--
Summary: No warning when using unset variable
Product: gcc
Version: 4.3.2
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: fredrik at hederstierna dot com
GCC build triplet: arm-elf-gcc
GCC host triplet: x86-intel
GCC target triplet: arm-elf-gcc
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38945
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c/38945] No warning when using uninitialized variable
2009-01-23 14:36 [Bug c/38945] New: No warning when using unset variable fredrik at hederstierna dot com
@ 2009-01-24 16:05 ` manu at gcc dot gnu dot org
2009-01-26 19:27 ` pinskia at gcc dot gnu dot org
1 sibling, 0 replies; 3+ messages in thread
From: manu at gcc dot gnu dot org @ 2009-01-24 16:05 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from manu at gcc dot gnu dot org 2009-01-24 16:05 -------
I am almost sure that this is CCP again assuming that the undefined value is
the same as the constant assigned, hence x++ is converted to 0++. This can be
checked using -fdump-tree-all-all-lineno.
If so, a duplicate of bug 18501.
--
manu at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |manu at gcc dot gnu dot org
OtherBugsDependingO| |24639
nThis| |
Summary|No warning when using unset |No warning when using
|variable |uninitialized variable
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38945
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c/38945] No warning when using uninitialized variable
2009-01-23 14:36 [Bug c/38945] New: No warning when using unset variable fredrik at hederstierna dot com
2009-01-24 16:05 ` [Bug c/38945] No warning when using uninitialized variable manu at gcc dot gnu dot org
@ 2009-01-26 19:27 ` pinskia at gcc dot gnu dot org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-01-26 19:27 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pinskia at gcc dot gnu dot org 2009-01-26 19:27 -------
Yes this is a dup of bug 18501.
*** This bug has been marked as a duplicate of 18501 ***
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38945
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-01-26 19:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-23 14:36 [Bug c/38945] New: No warning when using unset variable fredrik at hederstierna dot com
2009-01-24 16:05 ` [Bug c/38945] No warning when using uninitialized variable manu at gcc dot gnu dot org
2009-01-26 19:27 ` pinskia at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).