<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/120854>120854</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[OpenMP][IR] OMP: Error #132: Thread identifier invalid.
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
wesuRage
</td>
</tr>
</table>
<pre>
I'm trying to make parallel loops with different scheduling policies. My generated LLVM looks like this:
```llvm
; ModuleID = 'GalaxyJIT'
source_filename = "GalaxyJIT"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
@omp_ident = private constant { i32, i32, i32, i32, ptr } { i32 0, i32 514, i32 0, i32 22, ptr null }
define i32 @main() {
entry:
br label %preloop
preloop: ; preds = %entry
%i = alloca i32, align 4
store i32 0, ptr %i, align 4
%i1 = alloca i32, align 4
store i32 0, ptr %i1, align 4
br label %cond
cond: ; preds = %update, %preloop
%i2 = load i32, ptr %i1, align 4
%loopcond = icmp slt i32 %i2, 10
br i1 %loopcond, label %body, label %endloop
body: ; preds = %cond
call void @__kmpc_for_static_init_4(ptr @omp_ident, i32 0, i32 33, ptr %i1, i32 10, ptr null, ptr null, i32 1, i32 1)
%updatedLoopVar = add i32 %i2, 1
store i32 %updatedLoopVar, ptr %i1, align 4
br label %update
update: ; preds = %body
br label %cond
endloop: ; preds = %cond
ret i32 0
}
declare void @__kmpc_for_static_init_4(ptr, i32, i32, ptr, i32, ptr, ptr, i32, i32)
```
Then i compile the generated object file with:
```bash
clang -fopenmp -L/usr/lib/llvm-19/lib/ output.o -o executable
```
And when I run it...
```
OMP: Error #132: Thread identifier invalid.
Assertion failure at kmp_runtime.cpp(6993): __kmp_registration_flag != 0.
OMP: Error #13: Assertion failure at kmp_runtime.cpp(6993).
OMP: Hint Please submit a bug report with this message, compile and run commands used, and machine configuration info including native compiler and operating system versions. Faster response will be obtained by including all program sources. For information on submitting this issue, please see https://github.com/llvm/llvm-project/issues/.
```
If more information is needed, like how my source code looks like, let me know and I will send it.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJycVt1u4zoOfhrlhkhgy3biXOTC3W53u2gxg9nB3AayRTs6lSVBP2nz9geSkzRtcoDpFIGrH5IiP36iyJwTg0LckOqOVPczFvxO280ruvCDDThrNT9sHgldjeDtQagBvIaRvSAYZpmUKEFqbRy8Cr8DLvoeLSoPrtshDzIqGC1FJ9At4PkAAyq0zCOHp6dfz1H3xYEULwh-JxwpGpKl3zKbflLuxzgv7uBZ8yDx8R5IcQ-Erv7DJHs7_O_xJ6ErkjVOB9vhthcSFRvxKEUvpCjJGs_sgB4480yygw7-JIfzkRQNzg1dZaRoCpo-cZp_nMbRskyfuTgPclqToslpPe_r7DhSaWl5Ul-W8_9HsUs_vBVGnn19q5fbZTkP6kXpVzWXQoW3-aDCpBJ_ZaZHsxU8QhyVjBV75hE6rZxncXF1B6KghP7r9j_jLZDV_UkOsuMeVHl5Gp7X6FlFBSmj3uQGx14oTCKkzEYmFIlxraNVkjWovD1MqQRoLUjWogRCK2MxkmUycpoUDcTsGovcHYGoJgtRndBKpFUmpe7YKQwmxaCgTCLOa4vvjqcIaSU-i8W1_M9M5Z_lLoPqtOJTRGl0K5xgOPMYjXwAYfKJJimpGf-Qo1vHElpF1XhOUhLdaMBJP2Ui2ooaeXbyMcb7rhL3zl7He_1hARV_z03aLRr4yt9V1EdgADomJey14JEt2-3LaLptr-3WeeZFtxVK-G1JaJ3ivmD4FR-L4gqeuJxnlzT9PE4SF4P1CcopK_xJa_OL2YkZnH_C8hMtrtR-myZHDiR4j-MvAXwFb8rRP5PxlM9bfDxnxqI_Ipw1F7e7k8zib2bsZom5nt2QXF_W-enonztUIKDToxEyPgl48WDo9i_sPMQCn16b68eiZW4X76FkaoB5rw2q0cD8idCH4CyhD1K08Sv34zx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