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: Fix C++ testsuite failures.


Paolo Bonzini wrote:
> 
>>> Sure, but the address needs to be passed (at least until inlining) as
>>> the "this" pointer of C::operator int ().  The wording is misleading,
>>> but at least at -O0 a warning is correct.
>>>     
>> I think the warning is appropriate at all optimization levels.  The
>> warning is telling the user that they are (implicitly) trying to take
>> the address of a register variable.
> Wholly agreed.  My comment about -O0 is because the address-of can be
> optimized out at higher optimization levels.

I understand.

But, as you probably know from my previous postings/rants, I don't think
optimization levels ought to affect warnings. :-)  I think that's
definitely the case in this situation; one reason for warnings is to
inform users of problems that might occur in other environments.  So,
even if GCC were to be able to keep the variable in a register at some
optimization level, it would make sense to warn, as the same thing might
not happen at other optimization levels or with other compilers.

The good news is that nobody uses "register" with C++, or, for that
matter, remotely modern C.  So, exactly what we do won't affect many
users. :-)

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713


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