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: [PATCH] Put all constants last in tree_swap_operands_p, remove odd -Os check


On Fri, 15 Aug 2014, Manuel López-Ibáñez wrote:

> On 15 August 2014 11:07, Richard Biener <rguenther@suse.de> wrote:
> > -  if (TREE_CODE (arg1) == INTEGER_CST)
> > +  if (CONSTANT_CLASS_P (arg1) == INTEGER_CST)
> 
> Huh?

Eh ;)

> /* Nonzero if NODE represents a constant.  */
> 
> #define CONSTANT_CLASS_P(NODE)\
>     (TREE_CODE_CLASS (TREE_CODE (NODE)) == tcc_constant)
> 
> Sadly, we don't have a warning for this, but clang++ has one:
> 
> test.c:4:16: warning: comparison of constant 2 with expression of type
> 'bool' is always false [-Wtautological-constant-out-of-range-compare]
>   if ((a == 1) == 2) {
>       ~~~~~~~~ ^  ~
> 
> I'll open a PR

Thx.
Richard.

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