This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Put all constants last in tree_swap_operands_p, remove odd -Os check
- From: Richard Biener <rguenther at suse dot de>
- To: Manuel López-Ibáñez <lopezibanez at gmail dot com>
- Cc: Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 15 Aug 2014 11:34:00 +0200 (CEST)
- Subject: Re: [PATCH] Put all constants last in tree_swap_operands_p, remove odd -Os check
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot LSU dot 2 dot 11 dot 1408151100410 dot 20733 at zhemvz dot fhfr dot qr> <CAESRpQACEmAoqH49hL9-PmG6t=kRpnvfWoKxCuK=oQ7p431Bhw at mail dot gmail dot com>
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.