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: [C/C++ Patch] PR 51294


On 12 May 2012 19:34, Paolo Carlini <paolo.carlini@oracle.com> wrote:
> Hi,
>
> the below is my (very conservative, I think) interpretation of what we
> recently summarized we want to do wrt these -Wconversion warnings in the
> conditional expressions context. Of course many details could be different,
> please let me know... This is booted and tested on x86_64-linux.
>
> Thanks,
> Paolo.

It seems very conservative also to me. I think the code should just
unconditionally recurse on the operands of COND_EXPR. The recursion
should then take care of the casts. So then  c = b ? c : i; will warn
about 'i', not about the whole conditional expression.

Did you find any issues with doing:

+  STRIP_USELESS_TYPE_CONVERSION (expr);
+  /* Don't warn about unsigned char y = 0xff, x = (int) y;  */
+  expr = get_unwidened (expr, 0);
+  expr_type = TREE_TYPE (expr);

just before the switch?  (and deleting the get_unwidened quite a few
lines below)

Cheers,

Manuel.


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