goplus / llgo

A Go compiler based on LLVM in order to better integrate Go with the C ecosystem including Python
Apache License 2.0
362 stars 26 forks source link

log:unexpect nil pointer dereference on linux #843

Open luoliwoshang opened 1 month ago

luoliwoshang commented 1 month ago
package main

import (
    "log"
)

func main() {
    log.Println("hello")
}

want get log output bug get panic

root@be00d9b1c2c9:~/llgo/chore/_xtool/llcppsymg/bb# go run .
2024/10/23 03:27:47 hello
root@be00d9b1c2c9:~/llgo/chore/_xtool/llcppsymg/bb# llgo run .
panic: runtime error: invalid memory address or nil pointer dereference

on mac is normally

chore/_xtool/bb on  llcppsigfetch/refine [$!?] via 🐹 v1.20.4 took 7s 
❯ go run .  
2024/10/23 11:30:07 hello
(base) 
chore/_xtool/bb on  llcppsigfetch/refine [$!?] via 🐹 v1.20.4 
❯ llgo run .
2024/10/23 11:30:17 hello

env

root@be00d9b1c2c9:~/llgo/chore/_xtool/llcppsymg/bb# uname -a
Linux be00d9b1c2c9 6.6.26-linuxkit #1 SMP Sat Apr 27 04:13:19 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux
cpunion commented 2 days ago

Fixed by https://github.com/goplus/llgo/pull/879