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

[SOL][BPF] Adjust BPF tests #6

Conversation

dmakarov
Copy link
Collaborator

No description provided.

@dmakarov dmakarov force-pushed the solana-rustc/11.0-2021-01-05 branch 2 times, most recently from 0dd7189 to b73fdbf Compare March 24, 2021 13:55
@dmakarov
Copy link
Collaborator Author

Fixes solana-labs/solana#13290

@dmakarov dmakarov force-pushed the solana-rustc/11.0-2021-01-05 branch from 5d9ac76 to 4732b08 Compare March 24, 2021 18:49
@dmakarov dmakarov force-pushed the solana-rustc/11.0-2021-01-05 branch from 4732b08 to bb2c596 Compare March 25, 2021 08:55
- issue only one warning for each function
- report the function location if debug information is available
@dmakarov dmakarov merged commit 72ec6b3 into anza-xyz:solana-rustc/11.0-2021-01-05 Mar 25, 2021
dmakarov added a commit to dmakarov/llvm-project that referenced this pull request May 16, 2021
* [SOL][BPF] Adjust BPF tests

* [SOL][BPF] Improve reporting of stack size is too large

- issue only one warning for each function
- report the function location if debug information is available
dmakarov pushed a commit to dmakarov/llvm-project that referenced this pull request Mar 17, 2023
For the following program,
  $ cat t.c
  struct t {
   int (__attribute__((btf_type_tag("rcu"))) *f)();
   int a;
  };
  int foo(struct t *arg) {
    return arg->a;
  }
Compiling with 'clang -g -O2 -S t.c' will cause a failure like below:
  clang: /home/yhs/work/llvm-project/clang/lib/Sema/SemaType.cpp:6391: void {anonymous}::DeclaratorLocFiller::VisitParenTypeLoc(clang::ParenTypeLoc):
         Assertion `Chunk.Kind == DeclaratorChunk::Paren' failed.
  PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
  Stack dump:
  ......
  anza-xyz#5 0x00007f89e4280ea5 abort (/lib64/libc.so.6+0x21ea5)
  anza-xyz#6 0x00007f89e4280d79 _nl_load_domain.cold.0 (/lib64/libc.so.6+0x21d79)
  anza-xyz#7 0x00007f89e42a6456 (/lib64/libc.so.6+0x47456)
  anza-xyz#8 0x00000000045c2596 GetTypeSourceInfoForDeclarator((anonymous namespace)::TypeProcessingState&, clang::QualType, clang::TypeSourceInfo*) SemaType.cpp:0:0
  anza-xyz#9 0x00000000045ccfa5 GetFullTypeForDeclarator((anonymous namespace)::TypeProcessingState&, clang::QualType, clang::TypeSourceInfo*) SemaType.cpp:0:0
  ......

The reason of the failure is due to the mismatch of TypeLoc and D.getTypeObject().Kind. For example,
the TypeLoc is
  BTFTagAttributedType 0x88614e0 'int  btf_type_tag(rcu)()' sugar
  |-ParenType 0x8861480 'int ()' sugar
  | `-FunctionNoProtoType 0x8861450 'int ()' cdecl
  |   `-BuiltinType 0x87fd500 'int'
while corresponding D.getTypeObject().Kind points to DeclaratorChunk::Paren, and
this will cause later assertion.

To fix the issue, similar to AttributedTypeLoc, let us skip BTFTagAttributedTypeLoc in
GetTypeSourceInfoForDeclarator().

Differential Revision: https://reviews.llvm.org/D136807
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant