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

[ffi] missing type argument in @Native crashes the compiler #51913

Closed
dcharkes opened this issue Mar 31, 2023 · 2 comments
Closed

[ffi] missing type argument in @Native crashes the compiler #51913

dcharkes opened this issue Mar 31, 2023 · 2 comments
Assignees
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. crash Process exits with SIGSEGV, SIGABRT, etc. An unhandled exception is not a crash. library-ffi

Comments

@dcharkes
Copy link
Contributor

@Native() // should have been @Native<Void Function()>
external void foo();

crashes the compiler

type 'DynamicType' is not a subtype of type 'FunctionType' in type cast

#0      FfiNativeTransformer.visitProcedure (package:vm/transformations/ffi/native.dart:671:58)
#1      Procedure.accept (package:kernel/ast.dart:3590:40)
#2      Transformer.transform (package:kernel/visitor.dart:1801:21)
#3      Transformer.transformList (package:kernel/visitor.dart:1836:18)
#4      Library.transformChildren (package:kernel/ast.dart:614:7)
#5      Transformer.defaultTreeNode (package:kernel/visitor.dart:1858:10)
#6      TreeVisitor.visitLibrary (package:kernel/visitor.dart:513:35)
#7      FfiTransformer.visitLibrary (package:vm/transformations/ffi/common.dart:530:26)
#8      FfiNativeTransformer.visitLibrary (package:vm/transformations/ffi/native.dart:95:26)
#9      List.forEach (dart:core-patch/growable_array.dart:416:8)
#10     transformLibraries (package:vm/transformations/ffi/native.dart:41:13)
#11     VmTarget.performModularTransformationsOnLibraries (package:vm/target/vm.dart:179:26)
#12     KernelTarget.runBuildTransformations (package:front_end/src/fasta/kernel/kernel_target.dart:1568:19)
#13     KernelTarget.buildComponent.<anonymous closure> (package:front_end/src/fasta/kernel/kernel_target.dart:638:7)
<asynchronous suspension>
#14     withCrashReporting (package:front_end/src/fasta/crash.dart:136:12)
<asynchronous suspension>
#15     IncrementalCompiler.computeDelta.<anonymous closure> (package:front_end/src/fasta/incremental_compiler.dart:413:23)
<asynchronous suspension>
#16     computeKernel (package:frontend_server/compute_kernel.dart:434:9)
<asynchronous suspension>
#17     main (file:///b/s/w/ir/x/w/sdk/utils/bazel/kernel_worker.dart:32:18)
<asynchronous suspension>
Target //experimental/users/iinozemtsev/flutter_ffi/java/com/google/android/apps/flutterffi:flutterffi failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 4.323s, Forge stats: 0/1 actions cached, 0.8s CPU used, 0.0s queue time, 0.0 MB ObjFS output (novel bytes: 0.0 MB), 0.0 MB local output, Critical Path: 2.07s, Remote (0.00% of the time): [queue: 0.00%, setup: 0.00%, process: 0.00%]
ERROR: Build did NOT complete successfully
INFO: Streaming build results to: [http://sponge2/61bf32f9-abf1-4f5c-ac21-ffc11828d43b](https://sponge2.corp.google.com/61bf32f9-abf1-4f5c-ac21-ffc11828d43b)
iblaze ERROR 12:35:48 blaze build failed: exit status 1
@dcharkes dcharkes added area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. crash Process exits with SIGSEGV, SIGABRT, etc. An unhandled exception is not a crash. library-ffi labels Mar 31, 2023
@dcharkes dcharkes self-assigned this Mar 31, 2023
@faizan003
Copy link

i want to work on this

@dart-lang dart-lang deleted a comment from faizan003 Apr 2, 2023
@mraleph
Copy link
Member

mraleph commented Apr 2, 2023

@faizan003 be warned that next time you will go across the repo posting meaningless ChatGPT (or similar) generated answers you will get banned from organization.

copybara-service bot pushed a commit that referenced this issue Apr 5, 2023
TEST=tests/ffi/regress_51913_test.dart

Bug: #51913
Change-Id: I79746f3b3852f34d7e31b32260ce5abcb2d6801a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/293602
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. crash Process exits with SIGSEGV, SIGABRT, etc. An unhandled exception is not a crash. library-ffi
Projects
None yet
Development

No branches or pull requests

3 participants