On Tue, Jun 3, 2025 at 10:45 AM Martin Uecker <uec...@tugraz.at> wrote: > > > This version only contains the fix for -Wc++-compat.
Note this was recorded as PR 120078. I didn't notice the typo when I filed the bug report; otherwise I would have fixed it. Note I think the typo fix is obvious and should be backported to the open branches too as it was working with GCC 4.7.0 and was only broken with r0-116778-gf2bc201f53e2b8 which introduced the typo. Thanks, Andrew Pinski > > Bootstrapped and regression tested for x86_64. > > Martin > > > c: Enable -Wjump-misses-init for -Wc++-compat > > Fix a typo that prevented the warning from being activated with > -Wc++compat. > > gcc/c-family/ChangeLog: > * c.opts (Wjump-misses-init): Fix typo. > > gcc/testsuite/ChangeLog: > * gcc.dg/Wjump-misses-init-3.c: New test. > > diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt > index 75b6531860e..50ba856fedb 100644 > --- a/gcc/c-family/c.opt > +++ b/gcc/c-family/c.opt > @@ -938,7 +938,7 @@ C ObjC C++ ObjC++ CPP(cpp_warn_invalid_utf8) > CppReason(CPP_W_INVALID_UTF8) Var(w > Warn about invalid UTF-8 characters. > > Wjump-misses-init > -C ObjC Var(warn_jump_misses_init) Warning LangEnabledby(C ObjC,Wc++-compat) > +C ObjC Var(warn_jump_misses_init) Warning LangEnabledBy(C ObjC,Wc++-compat) > Warn when a jump misses a variable initialization. > > Enum > diff --git a/gcc/testsuite/gcc.dg/Wjump-misses-init-3.c > b/gcc/testsuite/gcc.dg/Wjump-misses-init-3.c > new file mode 100644 > index 00000000000..36ebd371cb6 > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/Wjump-misses-init-3.c > @@ -0,0 +1,10 @@ > +/* { dg-do compile } */ > +/* { dg-options "-Wc++-compat" } */ > + > +void f() > +{ > + goto skip; /* { dg-warning "jump skips variable initialization" > } */ > + int i = 1; > +skip: > +} > + >