This is the mail archive of the 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: [RFC] PR 51712 -Wtype-limits should not trigger for enum constants

On Mon, 14 May 2012, Manuel López-Ibáñez wrote:


The general idea of checking this information in shorten_compare seems 
reasonable.  (shorten_compare's optimization function is one that really 
ought to be done in generic code, but the warning function is reasonable 

> And on a general note, what is the opinion of the C/C++ maintainers
> about tracking the original source code more faithfully than currently
> done?

I consider it a good idea to do so - moving more to an explicit lowering 
step / conversion from front-end to middle-end internal representation.

There are some places where c_fully_fold is called to avoid false positive 
warnings.  A first approach for eliminating those would be to make the 
internal representation contain relevant information such as "this is an 
implicit conversion" so that the warnings can be generated later in 
c_fully_fold when it has the extra information from folding operands.  
Another possibility would be to have IR that says "give this warning, if 
this condition can occur", and options to evaluate the condition early 
(with predictability but false positives) or late (fewer false positives, 
less predictability).  Or you could lower as needed but carry around both 
lowered and unlowered versions of an expression (so front-end IR would 
include a pointer to lowered IR if lowering has taken place on-demand).

Joseph S. Myers

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