[Bug c/38961] if () block not true but a command in it is still in effect

2009-01-25 Thread rguenth at gcc dot gnu dot org
--- Comment #10 from rguenth at gcc dot gnu dot org 2009-01-25 11:15 --- The self-init is of course for the case where the -Wuninitialized warning is bogus (which happens). It simply has no effect on whatever undefinedness is in your code - it was added to be a "cheaper" way instead of

[Bug c/38961] if () block not true but a command in it is still in effect

2009-01-24 Thread jellegeerts at gmail dot com
--- 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 warn ab

[Bug c/38961] if () block not true but a command in it is still in effect

2009-01-24 Thread jellegeerts at gmail dot com
--- 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/bu

[Bug c/38961] if () block not true but a command in it is still in effect

2009-01-24 Thread pinskia at gmail dot com
--- Comment #7 from pinskia at gmail dot com 2009-01-24 22:33 --- Subject: Re: if () block not true but a command in it is still in effect Sent from my iPhone On Jan 24, 2009, at 2:24 PM, "jellegeerts at gmail dot com" wrote: > > > --- Comment #6 from jellegeerts at gmail dot

Re: [Bug c/38961] if () block not true but a command in it is still in effect

2009-01-24 Thread Andrew Thomas Pinski
Sent from my iPhone On Jan 24, 2009, at 2:24 PM, "jellegeerts at gmail dot com" > wrote: --- 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 foun

[Bug c/38961] if () block not true but a command in it is still in effect

2009-01-24 Thread jellegeerts at gmail dot com
--- 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, but seen the

[Bug c/38961] if () block not true but a command in it is still in effect

2009-01-24 Thread rguenth at gcc dot gnu dot org
--- Comment #5 from rguenth at gcc dot gnu dot org 2009-01-24 19:37 --- The program is only undefined at runtime, we may not reject the program at compile-time. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38961

[Bug c/38961] if () block not true but a command in it is still in effect

2009-01-24 Thread jellegeerts at gmail dot com
--- 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

[Bug c/38961] if () block not true but a command in it is still in effect

2009-01-24 Thread rguenth at gcc dot gnu dot org
--- Comment #3 from rguenth at gcc dot gnu dot org 2009-01-24 18:19 --- You are invoking undefined behavior so anything can happen. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38961

[Bug c/38961] if () block not true but a command in it is still in effect

2009-01-24 Thread jellegeerts at gmail dot com
--- 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 figured? -- http://gcc.gnu.o

[Bug c/38961] if () block not true but a command in it is still in effect

2009-01-24 Thread falk at debian dot org
--- Comment #1 from falk at debian dot org 2009-01-24 17:48 --- const char *logout_cmd = logout_cmd; actually initializes the variable with its own (uninitialized) value. You can get a warning about this with "-Winit-self". -- falk at debian dot org changed: What|Re