public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/99674] New: gcc/config/i386/i386-features.c: 2143: 2 * member variable not inited in ctor ?
@ 2021-03-19 21:04 dcb314 at hotmail dot com
  2021-03-19 21:16 ` [Bug target/99674] " dcb314 at hotmail dot com
  2022-01-10 20:09 ` dcb314 at hotmail dot com
  0 siblings, 2 replies; 3+ messages in thread
From: dcb314 at hotmail dot com @ 2021-03-19 21:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99674

            Bug ID: 99674
           Summary: gcc/config/i386/i386-features.c: 2143: 2 * member
                    variable not inited in ctor ?
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

cppcheck says

trunk.git/gcc/config/i386/i386-features.c:2143:3: warning: Member variable
'pass_insert_endbr_and_patchable_area::need_endbr' is not initialized in the
constructor. [uninitMemberVar]
trunk.git/gcc/config/i386/i386-features.c:2143:3: warning: Member variable
'pass_insert_endbr_and_patchable_area::patchable_area_size' is not initialized
in the constructor. [uninitMemberVar]

Source code is

  pass_insert_endbr_and_patchable_area (gcc::context *ctxt)
    : rtl_opt_pass (pass_data_insert_endbr_and_patchable_area, ctxt)
  {}

There might be some value in making sure these two member variables
are initialised to something sensible.

Looking at

private:
  bool need_endbr;
  unsigned int patchable_area_size;

then maybe false and 0 would be good.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug target/99674] gcc/config/i386/i386-features.c: 2143: 2 * member variable not inited in ctor ?
  2021-03-19 21:04 [Bug target/99674] New: gcc/config/i386/i386-features.c: 2143: 2 * member variable not inited in ctor ? dcb314 at hotmail dot com
@ 2021-03-19 21:16 ` dcb314 at hotmail dot com
  2022-01-10 20:09 ` dcb314 at hotmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: dcb314 at hotmail dot com @ 2021-03-19 21:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99674

--- Comment #1 from David Binderman <dcb314 at hotmail dot com> ---

A straightforward generalisation of this bug report would
be for gcc to warn on code like this:

struct S
{
        int a, b, c;
        S();
};

S::S() : a( 0), c( 2)
{
};

cppcheck finds the problem but gcc and clang don't.

mar19g.cc:11:4: warning: Member variable 'S::b' is not initialized in the
constructor. [uninitMemberVar]

Interestingly, there are about 125 cases of this in the gcc source code,
so this warning would be of immediate use for gcc itself.

List available on request.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug target/99674] gcc/config/i386/i386-features.c: 2143: 2 * member variable not inited in ctor ?
  2021-03-19 21:04 [Bug target/99674] New: gcc/config/i386/i386-features.c: 2143: 2 * member variable not inited in ctor ? dcb314 at hotmail dot com
  2021-03-19 21:16 ` [Bug target/99674] " dcb314 at hotmail dot com
@ 2022-01-10 20:09 ` dcb314 at hotmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: dcb314 at hotmail dot com @ 2022-01-10 20:09 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99674

--- Comment #2 from David Binderman <dcb314 at hotmail dot com> ---
(In reply to David Binderman from comment #1)
> Interestingly, there are about 125 cases of this in the gcc source code,
> so this warning would be of immediate use for gcc itself.

Now up to 161 cases.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-01-10 20:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-19 21:04 [Bug target/99674] New: gcc/config/i386/i386-features.c: 2143: 2 * member variable not inited in ctor ? dcb314 at hotmail dot com
2021-03-19 21:16 ` [Bug target/99674] " dcb314 at hotmail dot com
2022-01-10 20:09 ` dcb314 at hotmail dot com

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).