expected iteration declaration/initialization before 'g_371'

General OpenMP discussion

expected iteration declaration/initialization before 'g_371'

Postby sameeran » Sun Mar 17, 2019 2:50 am

For the following code:
struct S1 {
int8_t f0;
};
global variable:
static struct S1 g_371 = {0x54L};

void main ( ){
#pragma omp parallel for
for (g_371.f2 = (-3); (g_371.f2 >= (-27)) ; g_371.f2 = safe_sub_func_int32_t_s_s(g_371.f2, 2))
{/* block id: 210 */
structured block
}
}
I have following 3 questions in regards to usage of openmp.

1.Can't I use a '(test)' a 'bracket' for a 'test' expression?
error:invalid controlling predicate
If I try removing the brackets the program works fine.


2.Can't I use a struct field variable for initialization?:

Whereas the 5.0 specification states:
var operator lb
var := variable of signed or unsigned type | variable of pointer type
which obeys the specification rules.

error:expected iteration declaration/initialization before 'g_371'


3.Consider a case where I need to increment the variable:

I have a situation where, in increment expression I need to use function safe_sub_func_int32_t_s_s(g_371.f2, 2)
the function decrements the variable(same as g_371.f2 = g_371.f2-1 ) but it does some checks for the bounds, which are essential for my program to check for some specific conditions.

but openmp compiler gives following error:
error: invalid increment expression

How do I overcome this case?

Regarding learning openmp.
Where can I find the resources for converting a sequential program into parallel, I have a done basic OpenMP course :?: ?

Thanks.
sameeran
 
Posts: 1
Joined: Wed Mar 13, 2019 6:32 am

Return to Using OpenMP

Who is online

Users browsing this forum: Google [Bot] and 3 guests