[Openmp-dev] Regression in clang-9 for external declare target variable

Joachim Protze via Openmp-dev openmp-dev at lists.llvm.org
Thu Dec 19 08:32:22 PST 2019


I tested with trunk and with release/9.x.
The code compiles with trunk, with release/9.x I get the same error as 
with the clang/9 built from the release tarball.

I'm currently running bisect to identify the commit with the fix.


Hans: I assume it's too late to include the bugfix to the clang 9.0.1 
release?


Best
Joachim

On 12/18/19 7:31 PM, Alexey Bataev wrote:
> Hi Joahim, could you check if it works with trunk? It must be fixed 
> already in trunk.
> 
> -------------
> Best regards,
> Alexey Bataev
> 
> 18.12.2019 1:29 PM, Joachim Protze via Openmp-dev пишет:
>> Hi all,
>>
>> we think, we found a regression in clang/9:
>>
>>
>> #pragma omp declare target
>> int counter = 0;
>> #pragma omp end declare target
>>
>> int main(){
>>     #pragma omp target
>>     counter++;
>>     return 0;
>> }
>>
>>
>> The code compiles with clang/7 and clang/8, but fails with clang/9:
>>
>>
>> clang -fopenmp -fopenmp-targets=x86_64 declare-var.c
>> /usr/bin/ld: /tmp/declare-var-28ddc5.o: relocation R_X86_64_PC32 
>> against symbol `counter' can not be used when making a shared object; 
>> recompile with -fPIC
>> /usr/bin/ld: final link failed: Bad value
>> collect2: error: ld returned 1 exit status
>> /usr/bin/ld: cannot find /tmp/declare-var-e0fa25.out
>> /usr/bin/ld: cannot find /tmp/declare-var-e0fa25.out
>>
>>
>> Is this intended behavior?
>> The error goes away, when making counter static.
>>
>> Best
>> Joachim
>> _______________________________________________
>> Openmp-dev mailing list
>> Openmp-dev at lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev



More information about the Openmp-dev mailing list