forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Labels
Description
Checklist
- Checked the issue tracker for similar issues to ensure this is not a duplicate
- Read the documentation to confirm the issue is not addressed there and your configuration is set correctly
- Tested with the latest version to ensure the issue hasn't been fixed
How often does this bug occurs?
always
Expected behavior
correct compile
Actual behavior (suspected bug)
compile follow ir to .o file , got the <unknown>:0: error: Undefined temporary symbol .L
error,and will same compile command will got different code .L��@
,.L*6
,.L
❯ ./clang-test/esp-clang/bin/clang-19 --target=xtensa-esp-elf -mcpu=esp32 -Wno-override-module -Qunused-arguments -Wno-unused-command-line-argument -Werror -fshort-enums -Wno-macro-redefined -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -ffunction-sections -fdata-sections -o test.o ./test.ll
<unknown>:0: error: Undefined temporary symbol .L
`
error: cannot compile inline asm
1 error generated.
(base)
lib/test on emb/esp [!?]
❯ ./clang-test/esp-clang/bin/clang-19 --target=xtensa-esp-elf -mcpu=esp32 -Wno-override-module -Qunused-arguments -Wno-unused-command-line-argument -Werror -fshort-enums -Wno-macro-redefined -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -ffunction-sections -fdata-sections -o test.o ./test.ll
<unknown>:0: error: Undefined temporary symbol .L*6
error: cannot compile inline asm
1 error generated.
(base)
lib/test on emb/esp [!?]
❯ ./clang-test/esp-clang/bin/clang-19 --target=xtensa-esp-elf -mcpu=esp32 -Wno-override-module -Qunused-arguments -Wno-unused-command-line-argument -Werror -fshort-enums -Wno-macro-redefined -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -ffunction-sections -fdata-sections -o test.o ./test.ll
<unknown>:0: error: Undefined temporary symbol .L��@
error: cannot compile inline asm
1 error generated.
; ModuleID = 'github.com/goplus/lib/demo/checkoverflow'
source_filename = "github.com/goplus/lib/demo/checkoverflow"
%"github.com/goplus/llgo/runtime/internal/runtime.eface" = type { ptr, ptr }
%"github.com/goplus/llgo/runtime/internal/runtime.String" = type { ptr, i32 }
%"github.com/goplus/llgo/runtime/internal/runtime.Slice" = type { ptr, i32, i32 }
@"github.com/goplus/lib/demo/checkoverflow.init$guard" = global i1 false, align 1
@_llgo_uint8 = linkonce global ptr null, align 4
@"[]_llgo_uint8" = linkonce global ptr null, align 4
@_llgo_int8 = linkonce global ptr null, align 4
@"[1024]_llgo_int8" = linkonce global ptr null, align 4
@0 = private unnamed_addr constant [12 x i8] c"invalid type", align 1
@_llgo_string = linkonce global ptr null, align 4
define void @"github.com/goplus/lib/demo/checkoverflow.init"() {
_llgo_0:
%0 = load i1, ptr @"github.com/goplus/lib/demo/checkoverflow.init$guard", align 1
br i1 %0, label %_llgo_2, label %_llgo_1
_llgo_1: ; preds = %_llgo_0
store i1 true, ptr @"github.com/goplus/lib/demo/checkoverflow.init$guard", align 1
call void @"github.com/goplus/lib/demo/checkoverflow.init$after"()
br label %_llgo_2
_llgo_2: ; preds = %_llgo_1, %_llgo_0
ret void
}
define void @"github.com/goplus/lib/demo/checkoverflow.main"() {
_llgo_0:
ret void
}
define void @"github.com/goplus/lib/demo/checkoverflow.init$after"() {
_llgo_0:
%0 = load ptr, ptr @_llgo_uint8, align 8
%1 = icmp eq ptr %0, null
br i1 %1, label %_llgo_1, label %_llgo_2
_llgo_1: ; preds = %_llgo_0
%2 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i32 40)
store ptr %2, ptr @_llgo_uint8, align 8
br label %_llgo_2
_llgo_2: ; preds = %_llgo_1, %_llgo_0
%3 = load ptr, ptr @"[]_llgo_uint8", align 8
%4 = icmp eq ptr %3, null
br i1 %4, label %_llgo_3, label %_llgo_4
_llgo_3: ; preds = %_llgo_2
%5 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i32 40)
%6 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.SliceOf"(ptr %5)
store ptr %6, ptr @"[]_llgo_uint8", align 8
br label %_llgo_4
_llgo_4: ; preds = %_llgo_3, %_llgo_2
%7 = load ptr, ptr @_llgo_int8, align 8
%8 = icmp eq ptr %7, null
br i1 %8, label %_llgo_5, label %_llgo_6
_llgo_5: ; preds = %_llgo_4
%9 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i32 35)
store ptr %9, ptr @_llgo_int8, align 8
br label %_llgo_6
_llgo_6: ; preds = %_llgo_5, %_llgo_4
%10 = load ptr, ptr @"[1024]_llgo_int8", align 8
%11 = icmp eq ptr %10, null
br i1 %11, label %_llgo_7, label %_llgo_8
_llgo_7: ; preds = %_llgo_6
%12 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i32 35)
%13 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.ArrayOf"(i32 1024, ptr %12)
store ptr %13, ptr @"[1024]_llgo_int8", align 8
br label %_llgo_8
_llgo_8: ; preds = %_llgo_7, %_llgo_6
%14 = load ptr, ptr @_llgo_string, align 8
%15 = icmp eq ptr %14, null
br i1 %15, label %_llgo_9, label %_llgo_10
_llgo_9: ; preds = %_llgo_8
%16 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i32 24)
store ptr %16, ptr @_llgo_string, align 8
br label %_llgo_10
_llgo_10: ; preds = %_llgo_9, %_llgo_8
ret void
}
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i32)
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.SliceOf"(ptr)
declare void @"github.com/goplus/llgo/runtime/internal/runtime.AssertIndexRange"(i1)
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.ArrayOf"(i32, ptr)
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i32)
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i32)
define ptr @"github.com/goplus/lib/demo/checkoverflow.direntNamePtr"([2 x i32] %0) {
_llgo_0:
%1 = alloca [2 x i32], align 4
store [2 x i32] %0, ptr %1, align 4
%2 = load %"github.com/goplus/llgo/runtime/internal/runtime.eface", ptr %1, align 8
%3 = alloca %"github.com/goplus/llgo/runtime/internal/runtime.eface", align 8
%4 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %2, 0
%5 = load ptr, ptr @_llgo_uint8, align 8
%6 = load ptr, ptr @"[]_llgo_uint8", align 8
%7 = icmp eq ptr %4, %6
br i1 %7, label %_llgo_5, label %_llgo_6
_llgo_1: ; preds = %_llgo_7
%8 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %28, 0
%9 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %28, 1
%10 = icmp sge i32 0, %9
call void @"github.com/goplus/llgo/runtime/internal/runtime.AssertIndexRange"(i1 %10)
%11 = getelementptr inbounds i8, ptr %8, i32 0
ret ptr %11
_llgo_2: ; preds = %_llgo_7
%12 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %2, 0
%13 = load ptr, ptr @_llgo_int8, align 8
%14 = load ptr, ptr @"[1024]_llgo_int8", align 8
%15 = icmp eq ptr %12, %14
br i1 %15, label %_llgo_8, label %_llgo_9
_llgo_3: ; preds = %_llgo_10
%16 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i32 1024)
store [1024 x i8] %35, ptr %16, align 1
%17 = getelementptr inbounds i8, ptr %16, i32 0
ret ptr %17
_llgo_4: ; preds = %_llgo_10
%18 = load ptr, ptr @_llgo_string, align 8
%19 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i32 8)
store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i32 12 }, ptr %19, align 8
%20 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %18, 0
%21 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %20, ptr %19, 1
store %"github.com/goplus/llgo/runtime/internal/runtime.eface" %21, ptr %3, align 8
%22 = load [2 x i32], ptr %3, align 4
call void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"([2 x i32] %22)
unreachable
_llgo_5: ; preds = %_llgo_0
%23 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %2, 1
%24 = load %"github.com/goplus/llgo/runtime/internal/runtime.Slice", ptr %23, align 8
%25 = insertvalue { %"github.com/goplus/llgo/runtime/internal/runtime.Slice", i1 } undef, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %24, 0
%26 = insertvalue { %"github.com/goplus/llgo/runtime/internal/runtime.Slice", i1 } %25, i1 true, 1
br label %_llgo_7
_llgo_6: ; preds = %_llgo_0
br label %_llgo_7
_llgo_7: ; preds = %_llgo_6, %_llgo_5
%27 = phi { %"github.com/goplus/llgo/runtime/internal/runtime.Slice", i1 } [ %26, %_llgo_5 ], [ zeroinitializer, %_llgo_6 ]
%28 = extractvalue { %"github.com/goplus/llgo/runtime/internal/runtime.Slice", i1 } %27, 0
%29 = extractvalue { %"github.com/goplus/llgo/runtime/internal/runtime.Slice", i1 } %27, 1
br i1 %29, label %_llgo_1, label %_llgo_2
_llgo_8: ; preds = %_llgo_2
%30 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %2, 1
%31 = load [1024 x i8], ptr %30, align 1
%32 = insertvalue { [1024 x i8], i1 } undef, [1024 x i8] %31, 0
%33 = insertvalue { [1024 x i8], i1 } %32, i1 true, 1
br label %_llgo_10
_llgo_9: ; preds = %_llgo_2
br label %_llgo_10
_llgo_10: ; preds = %_llgo_9, %_llgo_8
%34 = phi { [1024 x i8], i1 } [ %33, %_llgo_8 ], [ zeroinitializer, %_llgo_9 ]
%35 = extractvalue { [1024 x i8], i1 } %34, 0
%36 = extractvalue { [1024 x i8], i1 } %34, 1
br i1 %36, label %_llgo_3, label %_llgo_4
}
declare void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"([2 x i32])
Error logs or terminal output
Steps to reproduce the behavior
- wget https://github.com/espressif/llvm-project/releases/download/esp-19.1.2_20250312/clang-esp-19.1.2_20250312-aarch64-apple-darwin.tar.xz
- tar -xzf ./clang-esp-19.1.2_20250312-aarch64-apple-darwin.tar.xz -C clang-test
lib/test on emb/esp [!?] took 3s
❯ ./clang-test/esp-clang/bin/clang-19 -v
Espressif clang version 19.1.2 (https://github.com/espressif/llvm-project.git esp-19.1.2_20250312)
Target: riscv32-esp-unknown-elf
Thread model: posix
InstalledDir: /Users/zhangzhiyang/Documents/Code/goplus/lib/test/clang-test/esp-clang/bin
try to compile
./clang-test/esp-clang/bin/clang-19 --target=xtensa-esp-elf -mcpu=esp32 -Wno-override-module -Qunused-arguments -Wno-unused-command-line-argument -Werror -fshort-enums -Wno-macro-redefined -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -ffunction-sections -fdata-sections -o test.o ./test.ll
<unknown>:0: error: Undefined temporary symbol .L
error: cannot compile inline asm
1 error generated.
Project release version
System architecture
ARM 64-bit (Apple M1/M2, Raspberry Pi 4/5)
Operating system
MacOS
Operating system version
macos 15.5 (24F74)
Shell
ZSH
Additional context
but with the clang-20 got correct output
lib/test on emb/esp [!?]
❯ ./clang-20-test/esp-clang/bin/clang-20 --target=xtensa-esp-elf -mcpu=esp32 -Wno-override-module -Qunused-arguments -Wno-unused-command-line-argument -Werror -fshort-enums -Wno-macro-redefined -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -ffunction-sections -fdata-sections -c -o test.o ./test.ll
(base)
lib/test on emb/esp [!?]
❯ ./clang-20-test/esp-clang/bin/clang-20 -v
Espressif clang version 20.1.1 (https://github.com/espressif/llvm-project.git esp-20.1.1_20250829)
Target: riscv32-esp-unknown-elf
Thread model: posix
InstalledDir: /Users/zhangzhiyang/Documents/Code/goplus/lib/test/clang-20-test/esp-clang/bin