Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail to resolve array size #8967

Closed
drhaozhong opened this issue Apr 6, 2023 · 3 comments
Closed

Fail to resolve array size #8967

drhaozhong opened this issue Apr 6, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@drhaozhong
Copy link

The code is as follows:

int n = 0, p[n * 0 + 1];

The error message is:

error: variable length array declaration not allowed at file scope
int n = 0, p[n * 0 + 1];
^ ~~~~~~~~~
1 error generated.

The size of p can be calculated, since n is zero.
GCC accepts the above code.

@drhaozhong drhaozhong added the bug Something isn't working label Apr 6, 2023
@dm-vodopyanov
Copy link
Contributor

dm-vodopyanov commented Apr 6, 2023

@drhaozhong, thanks for the report. It turned out it is not a DPC++-specific error because it is reproduced on mainline LLVM, the reproducer is: https://godbolt.org/z/dYhq8En39.
You may consider to take a look on the possible solution: https://stackoverflow.com/a/13646058.
If you believe this is an error, you can submit your issue to the mainline LLVM bug tracker: https://github.com/llvm/llvm-project/issues.
Closing the issue, If you have some concerns, you can re-open it. Hope the links provided above will help.

@dm-vodopyanov
Copy link
Contributor

@drhaozhong other issues are also not DPC++-related. We address here only DPC++-specific issues because we develop DPC++ compiler in this fork.
To get the quick feedback on your reports, can you please submit them to the mainline LLVM bug tracker? (https://github.com/llvm/llvm-project/issues)

@jinz2014
Copy link
Contributor

jinz2014 commented May 9, 2023

@drhaozhong may hope that DPC++ could solve these issues when the mainline LLVM won't.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants