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: PR 40752: -Wconversion generates false warnings for operands not larger than target type


Hi,

On 05/09/2012 02:54 PM, Manuel López-Ibáñez wrote:
On 7 May 2012 16:52, Paolo Carlini<paolo.carlini@oracle.com> wrote:
Hi,


On 06/11/2010 10:23 PM, Manuel López-Ibáñez wrote:
On 11 August 2009 02:01, Joseph S. Myers<joseph@codesourcery.com> wrote:
On Tue, 11 Aug 2009, Manuel López-Ibáñez wrote:

Modified the patch to make use of the new c-c++-common testsuite.
Bootstrapped and regression tested on x86_64-linux-gnu.

OK for trunk?
I still think the warnings for these cases are mostly correct (there are
cases where you may be able to make deductions about the range of
possible
values of the expression being converted) and appropriate, and if
disabled
should be disabled under some separate -Wno-conversion-whatever option.
-Wno-conversion-after-promotion ?

I am not sure what would be a good name, but I think it is worth to
allow silencing these warnings, so suggestions are welcome.
it looks like this PR is still open today, and I think resolving it one way
or the other isn't much work... Thus I'm asking: shall we actually have a
new -Wno-conversion-after-promotion? Or, alternately - the issue came up
quite often in recent times, because other widespread compilers don't warn -
suppress the warning only in case of conditional expressions:

char
foo(bool haveBar, char bar_)
{
  return haveBar ? bar_ : 0;
};

What do you think?
I think Joseph has said before that if the range can be deduced to
stay within limits of the target type, then we should never warn, no
new option needed. This is exactly the case if you recurse only on
conditional expression operands and casts, and it will fix the warning
above. The other cases should be deal separately.
Good, I even have a patch essentially ready for that, but can you point me to that detailed feedback? I couldn't find it when I looked for it.

Thanks
Paolo.


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