This is the mail archive of the gcc-patches@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]

Re: [PATCH] Fix a recent warning in reorg.c


On 04/26/2016 05:41 PM, Jakub Jelinek wrote:
On Tue, Apr 26, 2016 at 03:13:32PM +0200, Bernd Schmidt wrote:
On 04/26/2016 03:08 PM, Jakub Jelinek wrote:
        ^
../../gcc/reorg.c:1413:25: warning:   matches this âiâ under old rules
        for (unsigned int i = len - 1; i < len; i--)
                          ^

Oh, and also - I flagged this while reviewing other parts of Trevor's
changes, this pattern is too ugly to live, that should be a
FOR_EACH_VEC_ELT_....

That would be FOR_EACH_VEC_ELT_REVERSE, but unfortunately that doesn't
really work.

The iterate template does:

template<typename T, typename A>
inline bool
vec<T, A, vl_embed>::iterate (unsigned ix, T *ptr) const
{
   if (ix < m_vecpfx.m_num)
     {
       *ptr = m_vecdata[ix];
       return true;
     }
   else
     {
       *ptr = 0;
       return false;
     }
}

and the element in this case is std::pair <rtx_insn *, bool>, for which
*ptr = 0; doesn't work (maybe *ptr = T (); would work in there instead,
dunno).

So is the following ok if it passes bootstrap/regtest, or shall I do
something about vec.h?

Your patch is fine, and I think we should also work on vec.h separately.


Bernd


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