This is the mail archive of the gcc@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: warning: conversion from ‘int’ to ‘char’ may change value


On 2018-09-20 11:13:59 -0400, Jason Merrill wrote:
> Indeed, whether this sort of warning is a false positive depends on
> values, which the optimizers can always do better with.  We could
> build some logic into the front end, e.g. recognize that a &
> expression will always fit in the smallest of its operand types, but

This is not true with int & signed char, where the signed char
is negative.

> on the other hand that duplicates things that other parts of the
> compiler already deal with, so there's a question of how to share
> these rules between front and middle end, like we're doing more of
> with constant folding.  Perhaps we could use the folder somehow.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


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