lfortran icon indicating copy to clipboard operation
lfortran copied to clipboard

ICE for character function result length mismatch in len call

Open opixdown opened this issue 5 months ago • 5 comments

MRE

character(8) function text()
  text = "abcdefgh"
end function text

program mismatch
  character(4) :: text

  print *, len(text())
end program mismatch

output

(base) opixdown@Unknown_ee:a0:8d:2a:05:f5 lfortran % lfortran t.f90

Segfault: Signal SIGSEGV (segmentation fault) received

gfortran behavior

(base) opixdown@Unknown_ee:a0:8d:2a:05:f5 lfortran % gfortran t.f90

Error: Interface mismatch in global procedure 'text' at (1): Character length mismatch in function result

opixdown avatar Jun 24 '26 07:06 opixdown

Thanks for the bug @opixdown I am on it.

Jatinagarwal24 avatar Jun 24 '26 08:06 Jatinagarwal24

Hi @opixdown can you check the standard once and tell me that should i throw this error by default or when using implicit-interface flag.Currently i can see that using --implicit-interface this mre compiles and gives output as 4.

Jatinagarwal24 avatar Jun 24 '26 20:06 Jatinagarwal24

@Jatinagarwal24 It should throw error without the tag and compile with implicit-interface

opixdown avatar Jun 25 '26 06:06 opixdown

Hi @opixdown I am pusing the pr but i was getting some issue in adding the test in continue_compilation_1.f90 . Can you help me with that.

Jatinagarwal24 avatar Jun 25 '26 10:06 Jatinagarwal24

Hi @opixdown I solved the issue of adding the test in continue_compilation_1.f90. Thanks.

Jatinagarwal24 avatar Jun 25 '26 11:06 Jatinagarwal24