On Tue, Mar 26, 2019 at 01:30:28PM +0530, sameeran joshi wrote: > > I'd need to see an example of what you are talking about. > > int i; > #pragma omp parallel for > for (i = (0) ; (i< (20)) ; i++) { > printf ("\ntest expression fails due to brackets"); > printf ("\n i< (20) works "); > printf ("\n (i< (20)) fails "); > } > > commands: ~$ gcc fail_for.c -Wall -Wextra -fopenmp > > fail_for.c: In function ‘main’: > fail_for.c:5:17: error: invalid controlling predicate > for (i = (0) ; (i< (20)) ; i++) { > ^
That is a correct diagnostics. See Canonical loop form. test-expr One of the following: var relational-op b b relational-op var ( var relational-op b ) is neither of those. > struct s{ > int f0; > }; > void main (){ > int i; > struct s var1 ; > #pragma omp parallel for > for (var1.f0 = 0 ; var1.f0< (20); var1.f0++) { > > } > } > > swamimauli@swamimauli:~$ gcc fail_struct.c -Wall -Wextra -fopenmp > fail_struct.c: In function ‘main’: > fail_struct.c:9:14: error: expected iteration declaration or > initialization before ‘var1’ > for (var1.f0 = 0 ; var1.f0< (20); var1.f0++) { > ^~~~ Yeah, as I said, I believe the intent is that this is not valid, otherwise the iterator var1.f0 could not be predetermined private, you can't write private(var1.f0) and all the compilers I've tried agree with me. Jakub