Skip to content

acc_testsuite.h and acc_testsuite_declare.h define the same things, and are included in multiple TUs; also missing 'scalar' declaration #105

@erichkeane

Description

@erichkeane

Compiling declare_copyin.c/cpp gets:

In file included from declare_copyin.c:5:
./acc_testsuite.h:27:9: warning: 'ARRAYSIZE' macro redefined [-Wmacro-redefined]
   27 | #define ARRAYSIZE   100
      |         ^
./acc_testsuite_declare.h:28:9: note: previous definition is here
   28 | #define ARRAYSIZE   250
      |         ^
In file included from declare_copyin.c:5:
./acc_testsuite.h:28:11: error: redefinition of 'n'
   28 | long long n = ARRAYSIZE;
      |           ^
./acc_testsuite_declare.h:29:11: note: previous definition is here
   29 | long long n = ARRAYSIZE;
      |           ^
In file included from declare_copyin.c:5:
./acc_testsuite.h:56:9: warning: 'ARRAYSIZE_NEW' macro redefined [-Wmacro-redefined]
   56 | #define ARRAYSIZE_NEW 256
      |         ^
./acc_testsuite_declare.h:117:9: note: previous definition is here
  117 | #define ARRAYSIZE_NEW 1024
      |         ^
In file included from declare_copyin.c:5:
./acc_testsuite.h:60:9: warning: 'LOOPCOUNT' macro redefined [-Wmacro-redefined]
   60 | #define LOOPCOUNT 100
      |         ^
./acc_testsuite_declare.h:121:9: note: previous definition is here
  121 | #define LOOPCOUNT 1000
      |         ^
In file included from declare_copyin.c:5:
./acc_testsuite.h:68:3: error: typedef redefinition with different types ('struct dcomplex' vs 'struct dcomplex')
   68 | } dcomplex;
      |   ^
./acc_testsuite_declare.h:129:3: note: previous definition is here
  129 | } dcomplex;
      |   ^
declare_copyin.c:8:28: error: use of undeclared identifier 'scalar'
    8 | #pragma acc declare copyin(scalar)
      |                            ^~~~~~
declare_copyin.c:68:61: error: use of undeclared identifier 'scalar'
   68 |     #pragma acc data copyin(a[0:n]) copyout(b[0:n]) present(scalar)
      |                                                             ^~~~~~
declare_copyin.c:74:31: error: use of undeclared identifier 'scalar'
   74 |                 b[x] = a[x] + scalar;
      |                               ^~~~~~
declare_copyin.c:80:33: error: use of undeclared identifier 'scalar'
   80 |         if (fabs(b[x] - (a[x] + scalar)) > PRECISION){
      |                                 ^~~~~~
3 warnings and 6 errors generated.

It appears that the two headers are either not designed to BOTH be included, or need to have a common interface extracted (also note that the macro values are different for each!).

ADDITIONALLY, the variable 'scalar' doesn't exist, but quite a few of the declare tests refer to them. This probably is intended to be defined/declared inside of one of the headers.

I'm not sure how to fix these, as I don't know the intent of the tests, but if you give guidance, I'll prepare a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions