Version: 4.2.4
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jellegeerts at gmail dot com
GCC host triplet: i486-slackware-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38961
--- Comment #2 from jellegeerts at gmail dot com 2009-01-24 18:15 ---
Yes, I know, but it is still a bug that the if () block is false and the
variable is still assigned the "lxsession-logout" value but the printf is not
executed. Shouldn't be possible I figure
--- Comment #4 from jellegeerts at gmail dot com 2009-01-24 18:44 ---
That is certainly true, but shouldn't GCC (instead of optionally warning)
report an error?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38961
--- Comment #6 from jellegeerts at gmail dot com 2009-01-24 22:24 ---
Seems reasonable, though I'd vote for -Wall to include -Winit-self.
I actually discovered this because of a bug I found in lxpanel. Now of course
it's the fault of those developers not to use -Winit-self
--- Comment #8 from jellegeerts at gmail dot com 2009-01-25 01:50 ---
So actually initializing the variable by itself is a hack which results in
undefined behavior because folks wanted to disable the warning, and still
everybody thinks this is the way to go?
--
http://gcc.gnu.org
--- Comment #9 from jellegeerts at gmail dot com 2009-01-25 01:54 ---
Never mind my last message, misunderstood something.
Andrew, you say -Winit-self was added because initing a var by itself was a way
to disable the -Wuninitialized warning, but shouldn't -Wuninitialized itself
--- Comment #2 from jellegeerts at gmail dot com 2008-08-18 18:14 ---
Created an attachment (id=16086)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16086&action=view)
output of G++ with the `-v -save-temps' flags
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36814
--- Comment #3 from jellegeerts at gmail dot com 2008-08-18 18:15 ---
Created an attachment (id=16087)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16087&action=view)
the `.ii' file that G++ created
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36814
--- Comment #4 from jellegeerts at gmail dot com 2008-08-18 18:16 ---
Please see the attachments I created for more information.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36814
rrectly.
Thanks, Jelle
--
Summary: gcc won't warn about an uninitialized value
Product: gcc
Version: 4.5.1
Status: UNCONFIRMED
Severity: critical
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jellegeerts at gmail dot com
GCC host triplet: mingw32
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45467
--- Comment #1 from jellegeerts at gmail dot com 2010-08-31 20:02 ---
Created an attachment (id=21619)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21619&action=view)
output of `gcc -v -save-temps -std=c99 -O -g -Wall gcctest.c -o gcctest'
--
http://gcc.gnu.
--- Comment #2 from jellegeerts at gmail dot com 2010-08-31 20:03 ---
Created an attachment (id=21620)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21620&action=view)
output of `gcc -v -save-temps -std=c99 -O -g -Wall gcctest.c -o gcctest'
--
http://gcc.gnu.
--- Comment #3 from jellegeerts at gmail dot com 2010-08-31 20:03 ---
Created an attachment (id=21621)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21621&action=view)
the `.i' file that GCC created
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45467
--- Comment #4 from jellegeerts at gmail dot com 2010-08-31 20:04 ---
Created an attachment (id=21622)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21622&action=view)
`.i' file that GCC created
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45467
--- Comment #6 from jellegeerts at gmail dot com 2010-08-31 20:14 ---
It also happens in functions that do have side-effects. I can give you an
example if you want?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45467
dTo: unassigned at gcc dot gnu dot org
ReportedBy: jellegeerts at gmail dot com
GCC host triplet: mingw32
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45468
--- Comment #2 from jellegeerts at gmail dot com 2010-08-31 20:23 ---
I already reasoned that that might have been the case, but it seems false,
because if I compile the following snippet with GCC 4.5.1 with the command `gcc
newtest.c -std=c99 -Wall', I get no warning abou
--- Comment #3 from jellegeerts at gmail dot com 2010-08-31 20:24 ---
Reopening bug.
--
jellegeerts at gmail dot com changed:
What|Removed |Added
Status
--- Comment #7 from jellegeerts at gmail dot com 2010-08-31 20:32 ---
Updated code snippet, GCC doesn't warn here either if we leave `#if 0' as-is,
even though the function foo() may have side-effects.
<<<<<<<<<<<<<<<
#include
--- Comment #5 from jellegeerts at gmail dot com 2010-08-31 20:36 ---
With `gcc -std=c99 -Wuninitialized -O0' I get no warning for the following code
snippet (I do with `-O1' though), so it still seems GCC 4.5.1 should warn about
`-O' not being specified.
<<<<
--- Comment #7 from jellegeerts at gmail dot com 2010-08-31 20:39 ---
I am pointing out a case where it does not warn (and it seems to me that it
should); what is your point?
--
jellegeerts at gmail dot com changed:
What|Removed |Added
--- Comment #9 from jellegeerts at gmail dot com 2010-08-31 20:45 ---
I get that point, and I might open another bug report for that case, sure.
Though, GCC does not warn about a missing `-O' (or `-Oxxx') flag, which was the
point of this bug report. That the `-O0' flag
--- Comment #9 from jellegeerts at gmail dot com 2010-08-31 20:47 ---
Okay. :)
Though, why does GCC warn when we have `#if 1', and not if we have `#if 0'?
Just curiosity...
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45467
--- Comment #10 from jellegeerts at gmail dot com 2010-08-31 20:49 ---
Also, it seems a bit questionable to not warn when it is clearly(?) not the
developers intent to use an uninitialized variable. What is the rationale
behind this? Is it a pragmatic thing?
--
http://gcc.gnu.org
--- Comment #12 from jellegeerts at gmail dot com 2010-08-31 20:54 ---
Thanks. :)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45467
--- Comment #12 from jellegeerts at gmail dot com 2010-08-31 20:59 ---
Sorry Andrew, misinterpreted some things you said. I understand now that you
meant that normally everything should work as expected.
@Manuel,
So, perhaps then this bug report is at least sort of valid? It seems that
--- Comment #14 from jellegeerts at gmail dot com 2010-08-31 21:16 ---
(In reply to comment #13)
> (In reply to comment #12)
> > @Manuel,
> > So, perhaps then this bug report is at least sort of valid? It seems that to
> > get `-Wuninitialized' to *fully* wor
--- Comment #16 from jellegeerts at gmail dot com 2010-08-31 21:38 ---
Thanks for the explanation.
I understand it's a hard thing to fix. It's a bit of a sad situation, and has
been for quite a while, unfortunately. :(
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45468
sed to warn about this, is that correct?
Thanks, Jelle
--
Summary: G++ won't warn about an uninitialized value
Product: gcc
Version: 4.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassign
29 matches
Mail list logo