[Bug c/87038] diagnostics: Please add warning for jumping over initializers with switch/case in C mode

2018-10-22 Thread harald at gigawatt dot nl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87038 --- Comment #21 from Harald van Dijk --- (In reply to Segher Boessenkool from comment #20) > That is still not what I said, so don't pretend I did please. > > Those are also not false positives: in all these cases, the program does > in fact

[Bug c/87038] diagnostics: Please add warning for jumping over initializers with switch/case in C mode

2018-10-22 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87038 --- Comment #20 from Segher Boessenkool --- That is still not what I said, so don't pretend I did please. Those are also not false positives: in all these cases, the program does in fact skip some initialisation. But, it seems

[Bug c/87038] diagnostics: Please add warning for jumping over initializers with switch/case in C mode

2018-10-21 Thread harald at gigawatt dot nl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87038 --- Comment #19 from Harald van Dijk --- (In reply to Segher Boessenkool from comment #18) > (In reply to Harald van Dijk from comment #15) > > (In reply to Segher Boessenkool from comment #10) > > > The initialisation (the call to f1) could

[Bug c/87038] diagnostics: Please add warning for jumping over initializers with switch/case in C mode

2018-10-21 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87038 --- Comment #18 from Segher Boessenkool --- (In reply to Harald van Dijk from comment #15) > (In reply to Segher Boessenkool from comment #10) > > The initialisation (the call to f1) could have a side effect, but the > > a==1 case skips that.

[Bug c/87038] diagnostics: Please add warning for jumping over initializers with switch/case in C mode

2018-10-21 Thread harald at gigawatt dot nl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87038 --- Comment #17 from Harald van Dijk --- (In reply to Steinar H. Gunderson from comment #16) > Since you're asking (presumably rhethorically): I would certainly recommend > that this code be changed, yes, and I don't find the author's intent

[Bug c/87038] diagnostics: Please add warning for jumping over initializers with switch/case in C mode

2018-10-21 Thread steinar+gcc at gunderson dot no
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87038 --- Comment #16 from Steinar H. Gunderson --- Since you're asking (presumably rhethorically): I would certainly recommend that this code be changed, yes, and I don't find the author's intent obvious at all. The fix that comes to mind is to scope

[Bug c/87038] diagnostics: Please add warning for jumping over initializers with switch/case in C mode

2018-10-21 Thread harald at gigawatt dot nl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87038 --- Comment #15 from Harald van Dijk --- (In reply to Segher Boessenkool from comment #10) > The initialisation (the call to f1) could have a side effect, but the > a==1 case skips that. GCC is right to warn here in my opinion. With an

[Bug c/87038] diagnostics: Please add warning for jumping over initializers with switch/case in C mode

2018-10-21 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87038 --- Comment #14 from Segher Boessenkool --- I am saying that no warning should warn for things that are valid C but invalid C++, except with -Wc++-compat; not for that reason, anyway. -Wjump-misses-init should warn here: the jump does miss the

[Bug c/87038] diagnostics: Please add warning for jumping over initializers with switch/case in C mode

2018-10-21 Thread steinar+gcc at gunderson dot no
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87038 --- Comment #13 from Steinar H. Gunderson --- That could be (I disagree, but that's another debate), but the question was whether allowing this case would improve the warning or not. If you change it to allowing such a case, you also make

[Bug c/87038] diagnostics: Please add warning for jumping over initializers with switch/case in C mode

2018-10-21 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87038 --- Comment #12 from Segher Boessenkool --- That is not a reason to have the warning in C, not without some "-Wc++-compat" or similar; and in C++ it should be an error you say, not a warning at all.

[Bug c/87038] diagnostics: Please add warning for jumping over initializers with switch/case in C mode

2018-10-21 Thread steinar+gcc at gunderson dot no
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87038 --- Comment #11 from Steinar H. Gunderson --- It is also not legal (side effects or not) when compiling as C++, which is one of the reasons for having this warning.

[Bug c/87038] diagnostics: Please add warning for jumping over initializers with switch/case in C mode

2018-10-21 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87038 --- Comment #10 from Segher Boessenkool --- The initialisation (the call to f1) could have a side effect, but the a==1 case skips that. GCC is right to warn here in my opinion.

[Bug c/87038] diagnostics: Please add warning for jumping over initializers with switch/case in C mode

2018-10-21 Thread harald at gigawatt dot nl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87038 Harald van Dijk changed: What|Removed |Added CC||harald at gigawatt dot nl --- Comment

[Bug c/87038] diagnostics: Please add warning for jumping over initializers with switch/case in C mode

2018-10-20 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87038 Segher Boessenkool changed: What|Removed |Added CC||segher at gcc dot gnu.org ---

[Bug c/87038] diagnostics: Please add warning for jumping over initializers with switch/case in C mode

2018-10-19 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87038 Eric Gallager changed: What|Removed |Added Blocks||87656 --- Comment #7 from Eric Gallager

[Bug c/87038] diagnostics: Please add warning for jumping over initializers with switch/case in C mode

2018-08-22 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87038 Eric Gallager changed: What|Removed |Added CC||egallager at gcc dot gnu.org ---

[Bug c/87038] diagnostics: Please add warning for jumping over initializers with switch/case in C mode

2018-08-22 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87038 --- Comment #5 from Richard Biener --- I think even -Wall makes sense.

[Bug c/87038] diagnostics: Please add warning for jumping over initializers with switch/case in C mode

2018-08-21 Thread steinar+gcc at gunderson dot no
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87038 --- Comment #4 from Steinar H. Gunderson --- Oh, it exists? Yes, if so, please count this as a request for enabling on -Wextra.

[Bug c/87038] diagnostics: Please add warning for jumping over initializers with switch/case in C mode

2018-08-21 Thread joseph at codesourcery dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87038 --- Comment #3 from joseph at codesourcery dot com --- This is Wjump-misses-init. Is this a request to make some other option such as -Wall or -Wextra enable that option (rather than just -Wc++-compat as at present)?

[Bug c/87038] diagnostics: Please add warning for jumping over initializers with switch/case in C mode

2018-08-21 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87038 --- Comment #2 from Jonathan Wakely --- And for the goto case Clang says: 87038.c:2:13: warning: variable 'foo' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] if (x == 0) goto lbl; ^~

[Bug c/87038] diagnostics: Please add warning for jumping over initializers with switch/case in C mode

2018-08-21 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87038 Jonathan Wakely changed: What|Removed |Added Keywords||diagnostic