[Bug target/59379] gomp_init_num_threads is compiled into an infinite loop with --with-arch=corei7 --with-cpu=slm
hjl.tools at gmail dot com
gcc-bugzilla@gcc.gnu.org
Wed Dec 4 00:41:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59379
--- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> ---
Created attachment 31372
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31372&action=edit
A testcase
The outputs from stage 2 and stage 3 cc1 are different:
[hjl@gnu-mic-2 pr59379]$ make
/export/build/gnu/gcc-lto-fdo/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/gcc-lto-fdo/build-x86_64-linux/gcc/
-ftls-model=initial-exec -fPIC -O2 -S test.c
/export/build/gnu/gcc-lto-fdo/build-x86_64-linux/prev-gcc/xgcc
-B/export/build/gnu/gcc-lto-fdo/build-x86_64-linux/prev-gcc/
-ftls-model=initial-exec -fPIC -O2 -S -o good.s test.c
diff -up test.s good.s
--- test.s 2013-12-03 16:38:50.413067359 -0800
+++ good.s 2013-12-03 16:38:50.473066316 -0800
@@ -27,7 +27,7 @@ gomp_init_num_threads:
movq %rdi, gomp_cpuset_size(%rip)
call gomp_malloc@PLT
.p2align 4,,15
-.L24:
+.L27:
movq %rax, gomp_cpusetp(%rip)
movq %rax, %rbx
.L2:
@@ -40,9 +40,9 @@ gomp_init_num_threads:
xorl %eax, %eax
call pthread_getaffinity_np@PLT
testl %eax, %eax
- je .L27
+ je .L30
cmpl $22, %eax
- jne .L25
+ jne .L28
movq gomp_cpuset_size(%rip), %rsi
cmpq $127, %rsi
ja .L10
@@ -64,8 +64,8 @@ gomp_init_num_threads:
movq gomp_cpusetp(%rip), %rdi
call realloc@PLT
testq %rax, %rax
- jne .L24
-.L25:
+ jne .L27
+.L28:
movq gomp_global_icv@GOTPCREL(%rip), %rbx
.L4:
movq gomp_cpusetp(%rip), %rdi
@@ -88,7 +88,7 @@ gomp_init_num_threads:
ret
.p2align 4,,7
.p2align 3
-.L27:
+.L30:
.cfi_restore_state
movq gomp_cpusetp(%rip), %rsi
movq gomp_cpuset_size(%rip), %rdi
@@ -98,35 +98,31 @@ gomp_init_num_threads:
testq %rax, %rax
movq %rax, (%rbx)
je .L4
- movq gomp_cpuset_size(%rip), %rdi
- movq %rdi, gomp_get_cpuset_size(%rip)
- salq $3, %rdi
+ movq gomp_cpuset_size(%rip), %rsi
+ movq %rsi, gomp_get_cpuset_size(%rip)
+ salq $3, %rsi
je .L14
- movq %rdi, %r8
- movq %rdi, %rsi
- movq gomp_cpusetp(%rip), %r9
- negq %r8
- salq $32, %r8
- jmp .L6
+ movq gomp_cpusetp(%rip), %rdi
+ movq %rsi, %rdx
+ jmp .L8
.p2align 4,,7
.p2align 3
-.L8:
- testq %rdx, %rdx
- je .L5
.L7:
- movq %rcx, %rsi
+ testq %rcx, %rcx
+ je .L5
.L6:
- leaq -1(%rsi), %rcx
- leaq (%rcx,%r8), %rdx
- cmpq %rdx, %rdi
- jbe .L7
+ movq %rcx, %rdx
+.L8:
+ leaq -1(%rdx), %rcx
+ cmpq %rcx, %rsi
+ jbe .L6
movq %rcx, %rax
shrq $6, %rax
- movq (%r9,%rax,8), %rax
+ movq (%rdi,%rax,8), %rax
shrq %cl, %rax
andl $1, %eax
- je .L8
- leaq 63(%rsi), %rax
+ je .L7
+ leaq 63(%rdx), %rax
shrq $6, %rax
salq $3, %rax
.L5:
make: *** [all] Error 1
More information about the Gcc-bugs
mailing list