diff options
author | AtariDreams <83477269+AtariDreams@users.noreply.github.com> | 2024-01-23 14:13:55 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-23 11:13:55 -0800 |
commit | 3c20e25b0c51c67e35d028ba0d1d5f1dd5e206bb (patch) | |
tree | 1fc61dcecbbbacf68641d582f14440b2cca999df /compiler-rt | |
parent | f05dd29ceea29080d18ec31414a7ae2edf86c39d (diff) | |
download | llvm-3c20e25b0c51c67e35d028ba0d1d5f1dd5e206bb.zip llvm-3c20e25b0c51c67e35d028ba0d1d5f1dd5e206bb.tar.gz llvm-3c20e25b0c51c67e35d028ba0d1d5f1dd5e206bb.tar.bz2 |
[NFC] Size and element numbers are often swapped when calling calloc (#79081)
gcc-14 will now throw a warning if size and elements are swapped.
Diffstat (limited to 'compiler-rt')
-rw-r--r-- | compiler-rt/lib/profile/InstrProfilingFile.c | 4 | ||||
-rw-r--r-- | compiler-rt/test/tsan/java_finalizer2.cpp | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/compiler-rt/lib/profile/InstrProfilingFile.c b/compiler-rt/lib/profile/InstrProfilingFile.c index e72a2ba..867ae73 100644 --- a/compiler-rt/lib/profile/InstrProfilingFile.c +++ b/compiler-rt/lib/profile/InstrProfilingFile.c @@ -335,10 +335,10 @@ static void initFileWriter(ProfDataWriter *This, FILE *File) { COMPILER_RT_VISIBILITY ProfBufferIO * lprofCreateBufferIOInternal(void *File, uint32_t BufferSz) { FreeHook = &free; - DynamicBufferIOBuffer = (uint8_t *)calloc(BufferSz, 1); + DynamicBufferIOBuffer = (uint8_t *)calloc(1, BufferSz); VPBufferSize = BufferSz; ProfDataWriter *fileWriter = - (ProfDataWriter *)calloc(sizeof(ProfDataWriter), 1); + (ProfDataWriter *)calloc(1, sizeof(ProfDataWriter)); initFileWriter(fileWriter, File); ProfBufferIO *IO = lprofCreateBufferIO(fileWriter); IO->OwnFileWriter = 1; diff --git a/compiler-rt/test/tsan/java_finalizer2.cpp b/compiler-rt/test/tsan/java_finalizer2.cpp index 8752890..0d677be 100644 --- a/compiler-rt/test/tsan/java_finalizer2.cpp +++ b/compiler-rt/test/tsan/java_finalizer2.cpp @@ -51,7 +51,7 @@ void *Ballast(void *p) { } int main() { - Heap* heap = (Heap*)calloc(sizeof(Heap), 2) + 1; + Heap *heap = (Heap *)calloc(2, sizeof(Heap)) + 1; __tsan_java_init((jptr)heap, sizeof(*heap)); __tsan_java_alloc((jptr)heap, sizeof(*heap)); // Ballast threads merely make the bug a bit easier to trigger. |