This might be an XY Problem <https://xyproblem.info/>, or your question
simply needs more context. Your sample program is an example of infinite
recursion. How that is detected is platform specific. It might be done via
a special signal. Or it might be done by a syscall to grow the stack
returning an error. So my question is, why are you asking how infinite
recursion is handled?

On Wed, Jun 23, 2021 at 7:33 PM Kavindu Gimhan Zoysa <kavindu...@gmail.com>
wrote:

> Hi all,
>
> *package main*
>
> *func main() {*
> * foo()*
> *}*
>
> *func foo() {*
> * a := 5*
> * _ = a*
> * foo()*
> *}*
>
> I have generated the below llvm ir using the command `./bin/llvm-goc -S
> test.go -dump-ir`. I expected there are some llvm intrinsics that have been
> used to handle stack overflow. But it is not there. How does gollvm handle
> stackoverflow?
>
> *define void @main.main(i8* nest %nest.0) #0 !dbg !14 {*
> *entry:*
> *  call void @main.foo(i8* nest undef), !dbg !15*
> *  ret void*
> *}*
>
> *define void @main.foo(i8* nest %nest.1) #0 !dbg !16 {*
> *entry:*
> *  %a = alloca i64, align 8*
> *  %0 = bitcast i64* %a to i8**
> *  call void @llvm.lifetime.start.p0i8(i64 8, i8* %0)*
> *  store i64 5, i64* %a, align 8*
> *  call void @llvm.dbg.declare(metadata i64* %a, metadata !17, metadata
> !DIExpression()), !dbg !20*
> *  %a.ld.0 = load i64, i64* %a, align 8, !dbg !21*
> *  call void @main.foo(i8* nest undef), !dbg !22*
> *  %1 = bitcast i64* %a to i8**
> *  call void @llvm.lifetime.end.p0i8(i64 8, i8* %1)*
> *  ret void*
> *}*
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/0bbb1347-5ceb-4ed2-9622-cb695d29bc6dn%40googlegroups.com
> <https://groups.google.com/d/msgid/golang-nuts/0bbb1347-5ceb-4ed2-9622-cb695d29bc6dn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CABx2%3DD8z%2BDqbos7GvGUcRXPN1Hyr%3DPsKw%2BtLy_9otBc%2BO6R%3DcA%40mail.gmail.com.

Reply via email to