Skip to content

Commit 88034e3

Browse files
authored
[SWDEV-548614] Fix compiler-rt code-ql errors. (llvm#3575)
2 parents c926c8c + 14aa2bf commit 88034e3

File tree

1 file changed

+22
-18
lines changed

1 file changed

+22
-18
lines changed

compiler-rt/lib/asan/asan_errors.cpp

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -691,11 +691,11 @@ void ErrorNonSelfGeneric::Print() {
691691
Decorator d;
692692
Printf("%s", d.Error());
693693
Report("ERROR: AddressSanitizer: %s on address %p at pc %p\n", bug_descr,
694-
(void *)addresses[0], callstack[0]);
694+
(void *)addresses[0], (void *)callstack[0]);
695695

696696
Printf("%s%s of size %zu at %p thread id %zu\n", d.Access(),
697697
access_size ? (is_write ? "WRITE" : "READ") : "ACCESS", access_size,
698-
(void *)addresses[0], thread_id[0]);
698+
(void *)addresses[0], (usize)thread_id[0]);
699699

700700
// todo: perform symbolization for the given callstack
701701
// can be done by creating in-memory object file or by writing
@@ -733,7 +733,7 @@ ErrorNonSelfAMDGPU::ErrorNonSelfAMDGPU(uptr *dev_callstack, u32 n_callstack,
733733

734734
void ErrorNonSelfAMDGPU::PrintStack() {
735735
InternalScopedString source_location;
736-
source_location.AppendF(" #0 %p", callstack[0]);
736+
source_location.AppendF(" #0 %p", (void *)callstack[0]);
737737
#if SANITIZER_AMDGPU
738738
source_location.Append(" in ");
739739
__sanitizer::AMDGPUCodeObjectSymbolizer symbolizer;
@@ -754,7 +754,8 @@ void ErrorNonSelfAMDGPU::PrintThreadsAndAddresses() {
754754
str.Append("\n");
755755
per_row_count = 0;
756756
}
757-
str.AppendF("%02d : %p ", workitem_ids[idx], device_address[idx]);
757+
str.AppendF("%02d : %p ", (int)workitem_ids[idx],
758+
(void *)device_address[idx]);
758759
per_row_count++;
759760
}
760761
str.Append("\n");
@@ -797,11 +798,12 @@ void ErrorNonSelfAMDGPU::PrintMallocStack() {
797798
uptr plo = ScanForMagicDown(start, lo, magic, lo);
798799
if (plo) {
799800
callstack[0] = ((uptr*)plo)[2];
800-
Printf("%s%p is %u bytes above an address from a %sdevice malloc "
801-
"(or free) call of size %u from%s\n",
802-
d.Location(), device_address[0],
803-
(int)(device_address[0] - (plo+offset)),
804-
d.Allocation(), ((int*)plo)[7], d.Default());
801+
Printf(
802+
"%s%p is %u bytes above an address from a %sdevice malloc "
803+
"(or free) call of size %u from%s\n",
804+
d.Location(), (void *)device_address[0],
805+
(u32)(device_address[0] - (plo + offset)), d.Allocation(),
806+
((u32*)plo)[7], d.Default());
805807
// TODO: The code object with the malloc call may not be the same
806808
// code object trying the illegal access. A mechanism is needed
807809
// to obtain the former.
@@ -811,12 +813,13 @@ void ErrorNonSelfAMDGPU::PrintMallocStack() {
811813
uptr phi = ScanForMagicUp(start, hi, magic, lo);
812814
if (phi) {
813815
callstack[0] = ((uptr*)phi)[2];
814-
Printf("%s%p is %u bytes below an address from a %sdevice malloc "
815-
"(or free) call of size %u from%s\n",
816-
d.Location(), device_address[0],
817-
(int)((phi+offset) - device_address[0]),
816+
Printf(
817+
"%s%p is %u bytes below an address from a %sdevice malloc "
818+
"(or free) call of size %u from%s\n",
819+
d.Location(), (void *)device_address[0],
820+
(u32)((phi + offset) - device_address[0]),
818821

819-
d.Allocation(), ((int*)phi)[7], d.Default());
822+
d.Allocation(), ((u32*)phi)[7], d.Default());
820823
PrintStack();
821824
}
822825
}
@@ -825,10 +828,11 @@ void ErrorNonSelfAMDGPU::PrintMallocStack() {
825828
void ErrorNonSelfAMDGPU::Print() {
826829
Decorator d;
827830
Printf("%s", d.Error());
828-
Report("ERROR: AddressSanitizer: %s on amdgpu device %zu at pc %p\n",
829-
bug_descr, device_id, callstack[0]);
830-
Printf("%s%s of size %zu in workgroup id (%zu,%zu,%zu)\n", d.Access(),
831-
(is_write ? "WRITE" : "READ"), access_size, wg.idx, wg.idy, wg.idz);
831+
Report("ERROR: AddressSanitizer: %s on amdgpu device %d at pc %p\n",
832+
bug_descr, device_id, (void *)callstack[0]);
833+
Printf("%s%s of size %zu in workgroup id (%llu,%llu,%llu)\n", d.Access(),
834+
(is_write ? "WRITE" : "READ"), access_size, wg.idx,
835+
wg.idy, wg.idz);
832836
Printf("%s", d.Default());
833837
PrintStack();
834838
Printf("%s", d.Location());

0 commit comments

Comments
 (0)