Closed dopelsunce closed 4 years ago
It looks like a bug in the compiler. Compiling the above code with clang from the BigRefactor branch gives the same error:
test.c:2:25: error: initializing '_Nt_array_ptr<char>' with an expression of incompatible type 'char *'
_Nt_array_ptr<char> b = a;
^ ~
1 error generated.
But the code compiles under clang from microsoft:master branch. So I guess this was fixed upstream?
Did you try this with the mainline Checked C clang
? The code you typed in at the top is straight Checked C, so the porting tool shouldn't do anythnig.
Yes, the mainline checked-c clang
compiles it without any error. The clang
from plum-umd/BigRefactor branch emits the above error.
Not familiar with the porting tool. It seems it invoked clang
in the conversion process.
@Machiry Can we update our clang
to match Microsoft's ?
@mwhicks1 Will try to do by this weekend. Meanwhile, @dopelsunce Can you try to use: BigRefactor_Merging
, it has all the changes from Microsoft's clang.
@Machiry I tried the latest Bigfactor_Merging
and still got this error.
@dopelsunce It might be that you have not properly re-built clang in this branch. I had the problem that when I switched to it and rebuilt, CLion did not properly rebuild clang. I had to clear all my previous work and build everything from scratch.
@dopelsunce Can you please check with BigRefactor_master
. The BigRefactor_Merging
had issues which are now fixed. Also, as Mike suggested, please rebuild clang
along with the tool.
Btw for faster Checked C builds, while building try to use ninja and restrict the targets (to X86) to build, specifically,
cmake -G Ninja -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_ENABLE_RTTI=ON -DCMAKE_BUILD_TYPE=Debug -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra" <llvm_folder>
I tried BigRefactor_master
and I did not observe this error. Thanks!
Given
test.c
which is already converted:Output:
I expect no errors because
test.c
is valid Checked C code.Here is the full output with
--dump-intermediate
option:I noticed the tool runs without errors if I replace nt_array_ptr with array_ptr: