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

(C) VLA recognized as a bug in v1.8.0-insiders2 #8581

Closed
patrykkozuch opened this issue Dec 17, 2021 · 3 comments
Closed

(C) VLA recognized as a bug in v1.8.0-insiders2 #8581

patrykkozuch opened this issue Dec 17, 2021 · 3 comments
Assignees
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service regression A bug that didn't exist in a previous release

Comments

@patrykkozuch
Copy link

Bug type: Language Service - Intellisens recognizes VLA as a bug

Describe the bug

  • OS and Version: Windows 11
  • VS Code Version: 1.63.2
  • C/C++ Extension Version: v1.8.0-insiders2

Steps to reproduce
After creating VLA in C (C89 standard) IntelliSense marks every use of Variable Length Arrays as an error.

Code sample and logs

#include <stdlib.h>
#include <stdio.h>

void bubblesort(int k, int n, char p1[][k]); /* Line marked as "a parameter is not allowed" */

int main(void)
{
    int n, l;
    scanf(" %d", &n);
    scanf(" %d", &l);

    char tab[n][l]; /*This line is marked as "expression must have constant value" */
    return 0;
}
  • Configurations in c_cpp_properties.json: none

Additional context
It works well with v1.7.1, but after switching to Insiders channel IntelliSense shows errors.

@Colengms
Copy link
Collaborator

Hi @rico305 . Are you using a GCC compiler/IntelliSenseMode? I'm able to repro the issue if I use GCC on Windows. In my case, the issue appears to be related to -fms-extensions (which should be enabled by default for Cygwin and MinGW). We had 'fixed' this in v1.8.0-insider2, but it exposed some other issues. If this is what you are encountering, you should be able to work around it by adding a compilerArg of -fno-ms-extensions. We plan to disable -fms-extensions for MinGW and Cygwin in the next insiders/release, until we can address the immediate issues. Re-enabling it is then tracked by: #8353 I've opened a bug internally against VS related to -fms-extensions breaking VLAs. (The C/C++ extension shares the IntelliSense implementation with VS).

@Colengms Colengms self-assigned this Dec 17, 2021
@Colengms Colengms added Language Service more info needed The issue report is not actionable in its current state labels Dec 17, 2021
@patrykkozuch
Copy link
Author

patrykkozuch commented Dec 18, 2021

Yes, I use GCC compiler - MinGW under Windows. You're right - adding -fno-ms-extensions to compilerArgs works. Thank's for your attention!

@sean-mcmanus sean-mcmanus pinned this issue Jan 3, 2022
@bobbrow bobbrow added this to the 1.8.0-insiders3 milestone Jan 5, 2022
@bobbrow bobbrow added bug fixed Check the Milestone for the release in which the fix is or will be available. and removed more info needed The issue report is not actionable in its current state labels Jan 5, 2022
@sean-mcmanus sean-mcmanus mentioned this issue Jan 18, 2022
@sean-mcmanus
Copy link
Collaborator

Fixed with https://github.com/microsoft/vscode-cpptools/releases/tag/1.8.0-insiders3 or 1.8.0 (via using VS Code's "Pre-Release Version" UI or https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools&ssr=false#version-history ).

Unless you're explicitly adding -fms-extensions, in which case that bug fix is still pending (#8353 ).

@Colengms Colengms unpinned this issue Jan 24, 2022
@sean-mcmanus sean-mcmanus added the regression A bug that didn't exist in a previous release label Jan 28, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Feb 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service regression A bug that didn't exist in a previous release
Projects
None yet
Development

No branches or pull requests

4 participants