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

IntelliSense stops working "Quick info operation failed: FE: 'Compiler exited with error - No IL available'" when an #error is hit on Linux/Mac #6114

Closed
JeanMiK opened this issue Sep 11, 2020 · 13 comments
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
Milestone

Comments

@JeanMiK
Copy link

JeanMiK commented Sep 11, 2020

Type: LanguageService

When hovering over variables, Intellisense does no longer provide correct information with v0.30.0-insiders5.

For some variables, no information is shown at all, for others, it will show incorrect information.

For example, with a local variable
int64_t foo;
it would show declarations of other variables called foo inside the workspace, e.g.

int64_t MyClass.foo;
int64_t Namespace1::Namespace2::foo;

sometimes, but not always, including the correct variable as well.

In the Output, the extension is then always printing

Quick info operation failed: FE: 'Compiler exited with error - No IL available'

Reverting back to v.0.29 corrects the issue.

I think the issue was already present with previous v0.30 insider versions.

This is on a relatively complex workspace with multiple roots, each in a distinct git repository.

Describe the bug

  • OS and Version: RedHat Enterprise 7.8
  • VS Code Version: 1.49.0 but also previous versions
  • C/C++ Extension Version: v0.30.0-insiders5
  • Other extensions you installed (and if the issue persists after disabling them): None
  • Does this issue involve using SSH remote to run the extension on a remote machine?: No

Steps to reproduce

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

Logs
sending compilation args for /source/main/cs.custody_inttests/tatoos/tests/NASA/MarketClaims/BasicTest.cc
  include: /source/main/cs.custody_inttests/tatoos/framework/include
  include: /source/main/cs.nasa/NASA/MarketClaim/include
  include: /source/main/cs.nasa/NASA/include
  include: /source/main/cs.redex/include
  include: /source/main/cs.redex/tools/include
  include: /source/main/cs.oxi/include
  include: /source/main/cs.ti/include
  include: /source/main/cs.ti/include/ta
  include: /source/main/cs.ti/include/ti
  include: /source/main/cs.ti/deps/rhel7/include
  include: /source/main/cs.ti/deps/rhel7/include/SourcePro2016
  include: /source/main/cs.ti/deps/rhel7/include/protobuf_3.6.1
  include: /opt/oracle/product/CLT_12201/rdbms/public
  include: /usr/include/c++/4.8.2
  include: /usr/include/c++/4.8.2/x86_64-redhat-linux
  include: /usr/include/c++/4.8.2/backward
  include: /usr/lib/gcc/x86_64-redhat-linux/4.8.2/include
  include: /usr/local/include
  include: /usr/include
  define: __STDC__=1
  define: __cplusplus=201103L
  define: __STDC_HOSTED__=1
  define: __GNUC__=4
  define: __GNUC_MINOR__=8
  define: __GNUC_PATCHLEVEL__=5
  define: __VERSION__="4.8.5 20150623 (Red Hat 4.8.5-39)"
 
...
  define: __STDC_IEC_559__=1
  define: __STDC_IEC_559_COMPLEX__=1
  define: __STDC_ISO_10646__=201103L
  define: __STDC_NO_THREADS__=1
  other: --g++
  other: --gnu_version=40805
Checking for syntax errors: file:///source/main/cs.custody_inttests/tatoos/tests/NASA/MarketClaims/BasicTest.cc
Queueing IntelliSense update for files in translation unit of: /source/main/cs.custody_inttests/tatoos/tests/NASA/MarketClaims/BasicTest.cc
idle loop: reparsing the active document
Checking for syntax errors: file:///source/main/cs.custody_inttests/tatoos/tests/NASA/MarketClaims/BasicTest.cc
Queueing IntelliSense update for files in translation unit of: /source/main/cs.custody_inttests/tatoos/tests/NASA/MarketClaims/BasicTest.cc
Error squiggle count: 0
terminating child process: 19038
Update IntelliSense time (sec): 5.621
Quick info operation failed: FE: 'Compiler exited with error - No IL available'
using Tag Parser for quick info

Screenshots

Additional context

@sean-mcmanus
Copy link
Contributor

Can you provide the results of C/C++: Log Diagnostics? The error means our parser hit an unrecoverable error. It's possible the project in not configured correctly. Can you check whether the results of the Log Diagnostics match what you're using to compile the code with in regards to the includePath ordering?

We've received other reports of this at #6009 .

@sean-mcmanus sean-mcmanus added Language Service more info needed The issue report is not actionable in its current state regression A bug that didn't exist in a previous release labels Sep 11, 2020
@sean-mcmanus
Copy link
Contributor

sean-mcmanus commented Sep 12, 2020

In particular, the error is most likely occurring in a header file, which may have been "recoverable" in 0.29.0, but then due to undefined behavior in regards to how error handling is done, it could cause it to fail in 0.30.0-insiders, because the parser might be in a state where it can't continue to give additional errors due to previous errors (in the headers, not shown in the opened source file that his hovered over). If we implemented #3873 , then the errors in the header files would most likely make the issue easier to diagnose.

@JeanMiK
Copy link
Author

JeanMiK commented Sep 14, 2020

OK, back at work, could launch the C++ diagnostics.

Yes, it complains about potentially duplicate headers, but it is (only) in the system headers, don't know what / how I could change to remove these:

C++ diagnostics
-------- Diagnostics - 9/14/2020, 9:58:23 AM
Version: 0.30.0-insiders5
Current Configuration:
{
    "name": "Linux",
    "includePath": [
        "${workspaceFolder}/tatoos/framework/include",
        "${workspaceFolder}/../cs.nasa/NASA/include/**",
        "${workspaceFolder}/../cs.nasa/NASA/MarketClaim/include",
        "${workspaceFolder}/../cs.nasa/NASA/include",
        "${workspaceFolder}/../cs.redex/include",
        "${workspaceFolder}/../cs.redex/tools/include",
        "${workspaceFolder}/../cs.oxi/include",
        "${workspaceFolder}/../cs.ti/include",
        "${workspaceFolder}/../cs.ti/include/ta",
        "${workspaceFolder}/../cs.ti/include/ti",
        "${workspaceFolder}/../cs.ti/deps/rhel7/include",
        "${workspaceFolder}/../cs.ti/deps/rhel7/include/SourcePro2016",
        "/usr/include/**",
        "${workspaceFolder}/../cs.ti/deps/rhel7/include/protobuf_3.6.1",
        "/opt/oracle/product/CLT_12201/rdbms/public"
    ],
    "defines": [],
    "compilerPath": "/bin/gcc",
    "cStandard": "c11",
    "cppStandard": "c++11",
    "intelliSenseMode": "gcc-x64",
    "browse": {
        "path": [
            "${workspaceFolder}",
            "${workspaceFolder}/../cs.redex/tools/include",
            "${workspaceFolder}/../cs.ti"
        ],
        "limitSymbolsToIncludedHeaders": true
    },
    "compilerArgs": []
}
Translation Unit Mappings:
[ /source/main/cs.custody_inttests/tatoos/tests/NASA/MarketClaims/BasicTest.cc ]:
    /source/main/cs.custody_inttests/tatoos/tests/NASA/MarketClaims/BasicTest.cc
Translation Unit Configurations:
[ /source/main/cs.custody_inttests/tatoos/tests/NASA/MarketClaims/BasicTest.cc ]:
    Process ID: 14361
    Memory Usage: 219 MB
    Compiler Path: /bin/gcc
    Includes:
        /source/main/cs.custody_inttests/tatoos/framework/include
        /source/main/cs.nasa/NASA/MarketClaim/include
        /source/main/cs.nasa/NASA/include
        /source/main/cs.redex/include
        /source/main/cs.redex/tools/include
        /source/main/cs.oxi/include
        /source/main/cs.ti/include
        /source/main/cs.ti/include/ta
        /source/main/cs.ti/include/ti
        /source/main/cs.ti/deps/rhel7/include
        /source/main/cs.ti/deps/rhel7/include/SourcePro2016
        /source/main/cs.ti/deps/rhel7/include/protobuf_3.6.1
        /opt/oracle/product/CLT_12201/rdbms/public
        /usr/include/c++/4.8.2
        /usr/include/c++/4.8.2/x86_64-redhat-linux
        /usr/include/c++/4.8.2/backward
        /usr/lib/gcc/x86_64-redhat-linux/4.8.2/include
        /usr/local/include
        /usr/include
    Standard Version: c++11
    IntelliSense Mode: gcc-x64
    Other Flags:
        --g++
        --gnu_version=40805
Total Memory Usage: 219 MB

------- Workspace parsing diagnostics -------
Number of folders and files enumerated: 185900
Number of files discovered (not excluded): 163694

------- Potential include path issues --------
Some headers exist in multiple locations. If IntelliSense is behaving incorrectly,
try adding one of the alternate paths to the "includePath" in your configuration in
c_cpp_properties.json to override the automatic path discovery for that header.

Using: /usr/include/c++/4.8.2/algorithm
    Alternative: "/usr/include/c++/4.8.2/ext"
    Alternative: "/usr/include/c++/4.8.2/parallel"
Using: /usr/include/c++/4.8.2/array
    Alternative: "/usr/include/c++/4.8.2/debug"
    Alternative: "/usr/include/c++/4.8.2/profile"
    Alternative: "/usr/include/c++/4.8.2/tr1"
Using: /usr/include/c++/4.8.2/x86_64-redhat-linux/bits/atomic_word.h
    Alternative: "/usr/include/c++/4.8.2/x86_64-redhat-linux/32"
Using: /usr/include/dirent.h
    Alternative: "/usr/include/bits"
Using: /usr/include/errno.h
    Alternative: "/usr/include/asm-generic"
    Alternative: "/usr/include/asm"
    Alternative: "/usr/include/linux"
    Alternative: "/usr/include/sys"
Using: /usr/include/netdb.h
    Alternative: "/usr/include/gssrpc"
    Alternative: "/usr/include/rpc"
Using: /usr/include/c++/4.8.2/ratio
    Alternative: "/usr/include/c++/4.8.2/tr2"
Using: /usr/include/regex.h
    Alternative: "/usr/include/c++/4.8.2/bits"

If I remember right, not adding /usr/include/** to the includePAth was giving (at least in some previous version) errors on the system includes...

I now checked what happens if I remove it from the c_cpp_properties.json:

C++ diagnostics with reduced includePath
-------- Diagnostics - 9/14/2020, 10:28:14 AM
Version: 0.30.0-insiders5
Current Configuration:
{
    "name": "Linux",
    "includePath": [
        "${workspaceFolder}/tatoos/framework/include",
        "${workspaceFolder}/../cs.nasa/NASA/include/**",
        "${workspaceFolder}/../cs.nasa/NASA/MarketClaim/include",
        "${workspaceFolder}/../cs.nasa/NASA/include",
        "${workspaceFolder}/../cs.redex/include",
        "${workspaceFolder}/../cs.redex/tools/include",
        "${workspaceFolder}/../cs.oxi/include",
        "${workspaceFolder}/../cs.ti/include",
        "${workspaceFolder}/../cs.ti/include/ta",
        "${workspaceFolder}/../cs.ti/include/ti",
        "${workspaceFolder}/../cs.ti/deps/rhel7/include",
        "${workspaceFolder}/../cs.ti/deps/rhel7/include/SourcePro2016",
        "${workspaceFolder}/../cs.ti/deps/rhel7/include/protobuf_3.6.1",
        "/opt/oracle/product/CLT_12201/rdbms/public"
    ],
    "defines": [],
    "compilerPath": "/bin/gcc",
    "cStandard": "c11",
    "cppStandard": "c++11",
    "intelliSenseMode": "gcc-x64",
    "browse": {
        "path": [
            "${workspaceFolder}",
            "${workspaceFolder}/../cs.redex/tools/include",
            "${workspaceFolder}/../cs.ti"
        ],
        "limitSymbolsToIncludedHeaders": true
    },
    "compilerArgs": []
}
Translation Unit Mappings:
[ /source/main/cs.custody_inttests/tatoos/tests/NASA/MarketClaims/BasicTest.cc ]:
    /source/main/cs.custody_inttests/tatoos/tests/NASA/MarketClaims/BasicTest.cc
Translation Unit Configurations:
[ /source/main/cs.custody_inttests/tatoos/tests/NASA/MarketClaims/BasicTest.cc ]:
    Process ID: 19682
    Memory Usage: 219 MB
    Compiler Path: /bin/gcc
    Includes:
        /source/main/cs.custody_inttests/tatoos/framework/include
        /source/main/cs.nasa/NASA/MarketClaim/include
        /source/main/cs.nasa/NASA/include
        /source/main/cs.redex/include
        /source/main/cs.redex/tools/include
        /source/main/cs.oxi/include
        /source/main/cs.ti/include
        /source/main/cs.ti/include/ta
        /source/main/cs.ti/include/ti
        /source/main/cs.ti/deps/rhel7/include
        /source/main/cs.ti/deps/rhel7/include/SourcePro2016
        /source/main/cs.ti/deps/rhel7/include/protobuf_3.6.1
        /opt/oracle/product/CLT_12201/rdbms/public
        /usr/include/c++/4.8.2
        /usr/include/c++/4.8.2/x86_64-redhat-linux
        /usr/include/c++/4.8.2/backward
        /usr/lib/gcc/x86_64-redhat-linux/4.8.2/include
        /usr/local/include
        /usr/include
    Standard Version: c++11
    IntelliSense Mode: gcc-x64
    Other Flags:
        --g++
        --gnu_version=40805
Total Memory Usage: 219 MB

------- Workspace parsing diagnostics -------
Number of folders and files enumerated: 185900
Number of files discovered (not excluded): 163694

As you can see, the 'Potential include path issues' disappeared, but the

Quick info operation failed: FE: 'Compiler exited with error - No IL available'

error remains, as well (of course) as the incorrect and/or missing IntelliSense information...

@sean-mcmanus
Copy link
Contributor

You definitely don't want to use "/usr/include/**" because system includes are order dependent, so you'll get a random order which is likely to not work.

Can you check if the includePath ordering you're using matches what you compile with? i.e. does running the following compile without errors?

/bin/gcc -std=c++11 -I /source/main/cs.custody_inttests/tatoos/framework/include -I /source/main/cs.nasa/NASA/MarketClaim/include -I /source/main/cs.nasa/NASA/include -I /source/main/cs.redex/include -I /source/main/cs.redex/tools/include -I /source/main/cs.oxi/include -I /source/main/cs.ti/include -I /source/main/cs.ti/include/ta -I /source/main/cs.ti/include/ti -I /source/main/cs.ti/deps/rhel7/include -I /source/main/cs.ti/deps/rhel7/include/SourcePro2016 -I /source/main/cs.ti/deps/rhel7/include/protobuf_3.6.1 -I /opt/oracle/product/CLT_12201/rdbms/public -I /usr/include/c++/4.8.2 -I /usr/include/c++/4.8.2/x86_64-redhat-linux -I /usr/include/c++/4.8.2/backward -I /usr/lib/gcc/x86_64-redhat-linux/4.8.2/include -I /usr/local/include -I /usr/include /source/main/cs.custody_inttests/tatoos/tests/NASA/MarketClaims/BasicTest.cc

If so, do you get IntelliSense errors when you run the command below and open BasicTest.out.cc

/bin/gcc -std=c++11 -E -I /source/main/cs.custody_inttests/tatoos/framework/include -I /source/main/cs.nasa/NASA/MarketClaim/include -I /source/main/cs.nasa/NASA/include -I /source/main/cs.redex/include -I /source/main/cs.redex/tools/include -I /source/main/cs.oxi/include -I /source/main/cs.ti/include -I /source/main/cs.ti/include/ta -I /source/main/cs.ti/include/ti -I /source/main/cs.ti/deps/rhel7/include -I /source/main/cs.ti/deps/rhel7/include/SourcePro2016 -I /source/main/cs.ti/deps/rhel7/include/protobuf_3.6.1 -I /opt/oracle/product/CLT_12201/rdbms/public -I /usr/include/c++/4.8.2 -I /usr/include/c++/4.8.2/x86_64-redhat-linux -I /usr/include/c++/4.8.2/backward -I /usr/lib/gcc/x86_64-redhat-linux/4.8.2/include -I /usr/local/include -I /usr/include /source/main/cs.custody_inttests/tatoos/tests/NASA/MarketClaims/BasicTest.cc > /source/main/cs.custody_inttests/tatoos/tests/NASA/MarketClaims/BasicTest.out.cc

Or if you build system include other changes you could modify those commands to get it to build.

@JeanMiK
Copy link
Author

JeanMiK commented Sep 15, 2020

The first compilation does in fact fail, but not because of include file ordering, but because of a missing -D_RWCONFIG=m for the RogueWave class library.

Once I add it to the workspace's "defines", IntelliSense is working again. also with the Insiders version (now at 1.0.0).

So at least in my case, I can confirm that the underlying error was in the configuration itself, which previous versions seems to have handled more gracefully.

In the meantime, I had also figured out how to have CMake generate a compile_commands.json, using which also solved the issue. That was actually so easy that I am really wondering why I had not done so from the beginning. Maybe it would be a good idea to further stress the advantages of using the compile_commands.json and to include a link on how to generate it.

For myself, the issue can be closed, but if you want to dig deeper to find out what exactly has become 'unrecoverable' in the 0.30 release, I am ready to try out more stuff.

@alexclewontin
Copy link

As an additional data point, I am getting the issue in the 0.30 insiders releases AND the 1.0.0 releases, but not 0.29. I am assuming it is some issue in the underlying config for myself as well, and will dig into it, but I am happy to provide info and test. I can also confirm it is not an include file ordering issue.

@bobbrow
Copy link
Member

bobbrow commented Sep 15, 2020

@alexclewontin can you try following what @sean-mcmanus and @JeanMiK did to compile the source file in the terminal to see if your configuration is correct?

For example:

  1. Run the "Log Diagnostics" command to get the IntelliSense configuration for your source file from cpptools
  2. Craft a compile command using the information in step 1 (assuming you're using a gcc-based compiler)
    1. use -std=<Standard Version>
    2. use -I <Include Path> for each path in "Includes"
    3. use -D <Define> for each define in "Defines"
    4. use -include <Forced Include> for each file in "Forced Includes"
    5. Add the source file name as the last argument.
  3. Run the command in the terminal window

If the command fails, then there's something wrong with the configuration.

I do think it would be helpful if someone could help us get a small repro of the case so we can make sure our parser doesn't fail so dramatically. This is most certainly a change in behavior for the parser and we'd like to get a fix for it.

@sean-mcmanus
Copy link
Contributor

sean-mcmanus commented Sep 15, 2020

@bobbrow We have a repro with /linux/kernel/time/alarmtimer.c with ${workspaceFolder}/**. In that case, it ends up hitting an #error line (such as in /linux/include/asm-generic/div64.h), so an easy repro is...

test.h

#error foo

test.h

#include "test.h"

int main()
{
	return 0;
}

If we showed the errors in test.h, the user would see it and make it more obvious that a compile failure occurred.

I'm not sure yet why the behavior is different in 0.29.0 though...and it doesn't seem to repro with VS.

@alexclewontin
Copy link

alexclewontin commented Sep 15, 2020

@bobbrow Okay so in my case. a preprocessor #if !defined(...) check was failing, and an #error ... directive was tripping. With that fixed, IntelliSense works properly.

Previously when hitting an #error, I'd get red squiggles, which was useful behavior.

EDIT: Ah, I see Sean beat me to it with a nearly identical case.

@bobbrow
Copy link
Member

bobbrow commented Sep 15, 2020

@sean-mcmanus we should talk with the VS team to get that change reverted. IntelliSense shouldn't die because of an #error directive.

@sean-mcmanus sean-mcmanus added bug and removed more info needed The issue report is not actionable in its current state labels Sep 15, 2020
@sean-mcmanus sean-mcmanus self-assigned this Sep 15, 2020
@sean-mcmanus sean-mcmanus pinned this issue Sep 15, 2020
@sean-mcmanus sean-mcmanus added this to the 1.1.0 milestone Sep 15, 2020
@sean-mcmanus sean-mcmanus changed the title Intellisense not working "Quick info operation failed: FE: 'Compiler exited with error - No IL available'" with v0.30.0-insiders5 IntelliSense stops working "Quick info operation failed: FE: 'Compiler exited with error - No IL available'" when an #error is hit on Linux/Mac Sep 15, 2020
@sean-mcmanus sean-mcmanus added the fixed Check the Milestone for the release in which the fix is or will be available. label Sep 16, 2020
@bobbrow
Copy link
Member

bobbrow commented Sep 17, 2020

We published an insiders release with the fix for this. Please try it out and let us know if you continue to have issues.
https://github.com/microsoft/vscode-cpptools/releases/tag/1.0.1-insiders

@alexclewontin
Copy link

Appreciate you getting it fixed so quickly. Test driving it now

@sean-mcmanus sean-mcmanus modified the milestones: 1.1.0, 1.0.1 Sep 21, 2020
@sean-mcmanus
Copy link
Contributor

Fixed with https://github.com/microsoft/vscode-cpptools/releases/tag/1.0.1 . Let us know if you encounter other "No IL" issues. We know of at least one other regression we're still working on: #6166 .

@sean-mcmanus sean-mcmanus unpinned this issue Sep 25, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Oct 8, 2020
@sean-mcmanus sean-mcmanus removed their assignment Oct 30, 2020
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