Bug 106184 - gcc/analyzer/sm-fd.cc:545: ordering problem ?
Summary: gcc/analyzer/sm-fd.cc:545: ordering problem ?
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: analyzer (show other bugs)
Version: 12.0
: P3 normal
Target Milestone: ---
Assignee: Immad Mir
URL:
Keywords: build, diagnostic
Depends on:
Blocks: cppcheck
  Show dependency treegraph
 
Reported: 2022-07-04 13:56 UTC by David Binderman
Modified: 2022-07-07 05:58 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Binderman 2022-07-04 13:56:01 UTC
I just did a gcc trunk build with clang. It said:

gcc/analyzer/sm-fd.cc:545:7: warning: field 'm_invalid' will be initialized after field 'm_valid_read_write' [-Wreorder-ctor]

I suggest conforming with standard practice in C++.
Comment 1 David Binderman 2022-07-04 13:56:40 UTC
Adding author.
Comment 2 GCC Commits 2022-07-06 16:46:42 UTC
The master branch has been updated by Immad Mir <mir@gcc.gnu.org>:

https://gcc.gnu.org/g:3a6de2b2db500d76ac141a6ef85d336bd0f8430b

commit r13-1540-g3a6de2b2db500d76ac141a6ef85d336bd0f8430b
Author: Immad Mir <mirimmad@outlook.com>
Date:   Wed Jul 6 21:37:14 2022 +0530

    analyzer: reorder initialization of state m_invalid in sm-fd.cc [PR106184]
    
    This patch reorders the initialization of state m_invalid in sm-fd.cc
    so that the order of initializers is same as the ordering of the fields
    in the class decl.
    
    gcc/analyzer/ChangeLog:
            PR analyzer/106184
            * sm-fd.cc (fd_state_machine): Change ordering of initialization
            of state m_invalid so that the order of initializers is same as
            the ordering of the fields in the class decl.
    
    Signed-off-by: Immad Mir <mirimmad@outlook.com>
Comment 3 Immad Mir 2022-07-07 05:58:33 UTC
The issue was resolved: see the commit above.