arpack-ng icon indicating copy to clipboard operation
arpack-ng copied to clipboard

bug_1315 and icb_arpack_c initialize array size through (non-const) variables

Open dariomangoni opened this issue 3 years ago • 1 comments

Both bug_1315_single.c and bug_1315_double.c declare an array through a non-const integer variable N, at line 30:

a_int N = 1000;
...
float resid[N];
  • the C language does not allow to initialize an array size with variables at all, even if are const;
  • the C++ language it at least requires the const attribute.

Their compilation clearly triggers a lot of errors. How can this code compile? What am I missing?

BTW, also the icb_arpack_c.c code is affected by the same problem.

Where/how to reproduce the problem

  • arpack-ng: db55a7ff4180bb440a980d618e302eded0db52f3
  • OS: Win10
  • compiler: MSVC
  • environment: set through Intel oneApi for x64
  • configure: cmake -DBLA_VENDOR=Intel10_64lp
  • input data: none

Steps to reproduce the problem

  • run bug_1315_single or bug_1315_double

Error message

error C2057: expected constant expression

dariomangoni avatar Jan 11 '23 13:01 dariomangoni

Feel free to propose a PR.

fghoussen avatar Jan 11 '23 19:01 fghoussen