This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/79172] New: -Wunused-but-set-parameter gone nuts


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

            Bug ID: 79172
           Summary: -Wunused-but-set-parameter gone nuts
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: petschy at gmail dot com
  Target Milestone: ---

I made a fresh build from the gcc 7 master branch (6f0a524c). Now my code
doesn't compile:

common/src/mgsnetCRSARC4Base.cpp: In constructor
‘mgs::net::CRSARC4Base::CRSARC4Base(uint32_t, uint32_t)’:
common/src/mgsnetCRSARC4Base.cpp:46:45: error: parameter ‘msends_’ set but not
used [-Werror=unused-but-set-parameter]
 mgs::net::CRSARC4Base::CRSARC4Base(uint32_t msends_, uint32_t mrecvs_) :
                                             ^~~~~~~
common/src/mgsnetCRSARC4Base.cpp:46:63: error: parameter ‘mrecvs_’ set but not
used [-Werror=unused-but-set-parameter]
 mgs::net::CRSARC4Base::CRSARC4Base(uint32_t msends_, uint32_t mrecvs_) :
                                                               ^~~~~~~

This is a rather simple ctor:

46: mgs::net::CRSARC4Base::CRSARC4Base(uint32_t msends_, uint32_t mrecvs_) :
        CTCPIPBase(msends_, mrecvs_),
        m_rsa_padding(mgs::crypto::CRSAEngine::PADDING_8000)
{
        m_rng.Seed();
}

The two params are forwarded to the ctor of the base class, so they are
definitely used; the implementation of the base ctor is in another cpp. It does
this at -O0 and -O3, too.

An earlier version of 7.0 had no such problem (probably a few months earlier I
guess), and current 6.2.1, 6.3.1 compiles the code fine.

Tried to make a reduced test case, but simply cloning the inheritance structure
and the ctor signatures didn't trigger the warning, unfortunately. I will have
another go with this if I have a little free time.

There are lots of other ctors that forward to the base class, but only this
single instance is picked out. Could it be because of virtual inheritance? This
is the only distinguishing attribute I can think of atm.

Bisected, hope this helps:

commit 4076953ad7a3e1f54c5caf6c7c23fd8878702001
Author: nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Fri Oct 7 20:01:17 2016 +0000

        cp/
        PR c++/64433
        DR1658, DR1611
        * init.c (emit_mem_initializers): Don't construct vbases of
        abstract classes.
        (push_base_cleanups): Don't push vbase cleanups for abstract class
        when in C++14 mode.
        * method.c (synthethesized_method_walk): Don't walk vbases of
        abstract classes when in C++14 mode.

        testsuite/
        PR c++/66443
        * g++.dg/cpp0x/pr66443-cxx11.C: New.
        * g++.dg/cpp0x/pr66443-cxx11-2.C: New.
        * g++.dg/cpp1y/pr66443-cxx14.C: New
        * g++.dg/cpp1y/pr66443-cxx14-2.C: New.
        * g++.dg/cpp1y/pr66443-cxx14-3.C: New.


    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@240874
138bc75d-0d04-0410-961f-82ee72b054a4

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]