diff mbox

Fix LOOP_REQUIRES_VERSIONING_* macros (PR c/61271)

Message ID 20140825130237.GK15033@redhat.com
State New
Headers show

Commit Message

Marek Polacek Aug. 25, 2014, 1:02 p.m. UTC
Another issue found by -Wlogical-not-parentheses.
tree-vect-data-refs.c contains
if (!LOOP_REQUIRES_VERSIONING_FOR_ALIGNMENT (loop_vinfo))
but since the definition of LOOP_REQUIRES_VERSIONING_FOR_ALIGNMENT
is lacking parens, this expands to !X > 0 and we warn.
Similarly for LOOP_REQUIRES_VERSIONING_FOR_ALIAS.

Bootstrapped/regtested on x86_64-linux, ok for trunk?

2014-08-25  Marek Polacek  <polacek@redhat.com>

	PR c/61271
	* tree-vectorizer.h (LOOP_REQUIRES_VERSIONING_FOR_ALIGNMENT,
	LOOP_REQUIRES_VERSIONING_FOR_ALIAS): Wrap in parens.


	Marek

Comments

Richard Biener Aug. 26, 2014, 8:42 a.m. UTC | #1
On Mon, Aug 25, 2014 at 3:02 PM, Marek Polacek <polacek@redhat.com> wrote:
> Another issue found by -Wlogical-not-parentheses.
> tree-vect-data-refs.c contains
> if (!LOOP_REQUIRES_VERSIONING_FOR_ALIGNMENT (loop_vinfo))
> but since the definition of LOOP_REQUIRES_VERSIONING_FOR_ALIGNMENT
> is lacking parens, this expands to !X > 0 and we warn.
> Similarly for LOOP_REQUIRES_VERSIONING_FOR_ALIAS.
>
> Bootstrapped/regtested on x86_64-linux, ok for trunk?

Ok for trunk (and affected branches).

Thanks,
Richard.

> 2014-08-25  Marek Polacek  <polacek@redhat.com>
>
>         PR c/61271
>         * tree-vectorizer.h (LOOP_REQUIRES_VERSIONING_FOR_ALIGNMENT,
>         LOOP_REQUIRES_VERSIONING_FOR_ALIAS): Wrap in parens.
>
> diff --git gcc/tree-vectorizer.h gcc/tree-vectorizer.h
> index a38443e..95209bc 100644
> --- gcc/tree-vectorizer.h
> +++ gcc/tree-vectorizer.h
> @@ -414,9 +414,9 @@ typedef struct _loop_vec_info {
>  #define LOOP_VINFO_SCALAR_LOOP(L)         (L)->scalar_loop
>
>  #define LOOP_REQUIRES_VERSIONING_FOR_ALIGNMENT(L) \
> -  (L)->may_misalign_stmts.length () > 0
> +  ((L)->may_misalign_stmts.length () > 0)
>  #define LOOP_REQUIRES_VERSIONING_FOR_ALIAS(L)     \
> -  (L)->may_alias_ddrs.length () > 0
> +  ((L)->may_alias_ddrs.length () > 0)
>
>  #define LOOP_VINFO_NITERS_KNOWN_P(L)          \
>    (tree_fits_shwi_p ((L)->num_iters) && tree_to_shwi ((L)->num_iters) > 0)
>
>         Marek
diff mbox

Patch

diff --git gcc/tree-vectorizer.h gcc/tree-vectorizer.h
index a38443e..95209bc 100644
--- gcc/tree-vectorizer.h
+++ gcc/tree-vectorizer.h
@@ -414,9 +414,9 @@  typedef struct _loop_vec_info {
 #define LOOP_VINFO_SCALAR_LOOP(L)	   (L)->scalar_loop
 
 #define LOOP_REQUIRES_VERSIONING_FOR_ALIGNMENT(L) \
-  (L)->may_misalign_stmts.length () > 0
+  ((L)->may_misalign_stmts.length () > 0)
 #define LOOP_REQUIRES_VERSIONING_FOR_ALIAS(L)     \
-  (L)->may_alias_ddrs.length () > 0
+  ((L)->may_alias_ddrs.length () > 0)
 
 #define LOOP_VINFO_NITERS_KNOWN_P(L)          \
   (tree_fits_shwi_p ((L)->num_iters) && tree_to_shwi ((L)->num_iters) > 0)