fuzion icon indicating copy to clipboard operation
fuzion copied to clipboard

C backend creates non-functions that do not return a result

Open fridis opened this issue 2 years ago • 2 comments

This small example

b := (String.type.from_marray ((marray Any).type.new 1 nil))
_ := type_of b

provokes this error in the code created for a type parameter (which is probably not needed anyway):

 > ../../bin/fz -c  t.fz
universe.c:7086:1: error: non-void function does not return a value [-Werror,-Wreturn-type]
}
^
1 error generated.

error 1: C backend: C compiler failed
C compiler call 'clang -Wall -Werror -Wno-gnu-empty-struct -Wno-unused-variable -Wno-unused-label -Wno-unused-function -Wno-infinite-recursion -Wno-unused-but-set-variable -O3 -lm -lpthread -o universe universe.c' failed with exit code '1'

one error.

fridis avatar Aug 17 '23 12:08 fridis

now:


error 1: java.lang.Error: require-condition4 failed: dev.flang.ast.AbstractFeature:typeFeature:700
        at dev.flang.util.ANY.require(ANY.java:135)
        at dev.flang.ast.AbstractFeature.typeFeature(AbstractFeature.java:700)
        at dev.flang.ast.Call.lambda$resolveTypes$18(Call.java:2259)
        at dev.flang.ast.AbstractType.applyToGenericsAndOuter(AbstractType.java:1465)
        at dev.flang.ast.Call.resolveTypes(Call.java:2252)
        at dev.flang.ast.Feature$ResolveTypes.action(Feature.java:1280)
        at dev.flang.ast.Feature$ResolveTypes.action(Feature.java:1272)
        at dev.flang.ast.Call.visit(Call.java:1153)
        at dev.flang.ast.Feature.visit(Feature.java:1926)
        at dev.flang.ast.Block.visit(Block.java:228)
        at dev.flang.ast.Block.visit(Block.java:41)
        at dev.flang.ast.Impl.visit(Impl.java:314)
        at dev.flang.ast.Feature.visit(Feature.java:1038)
        at dev.flang.ast.Feature.internalResolveTypes(Feature.java:1330)
        at dev.flang.ast.Resolution.resolveOne(Resolution.java:371)
        at dev.flang.ast.Resolution.resolve(Resolution.java:338)
        at dev.flang.fe.SourceModule.createASTandResolve(SourceModule.java:254)
        at dev.flang.fe.FrontEnd.<init>(FrontEnd.java:183)
        at dev.flang.tools.Fuzion.lambda$parseArgsForBackend$3(Fuzion.java:906)
        at dev.flang.tools.Tool.lambda$run$0(Tool.java:145)
        at dev.flang.util.Errors.runAndExit(Errors.java:790)
        at dev.flang.tools.Tool.run(Tool.java:145)
        at dev.flang.tools.Fuzion.main(Fuzion.java:557)


*** fatal errors encountered, stopping.

michaellilltokiwa avatar Oct 25 '23 08:10 michaellilltokiwa

update:

mi : mutate is
mi.go ()->
  b := (String.type.from_mutable_array ((mutate.array Any).type.new mi 1 false))
  _ := type_of b

michaellilltokiwa avatar Feb 19 '24 11:02 michaellilltokiwa