Closed Rydial closed 2 years ago
Can you try the dev branch? I know I fixed an issue with C++ and MA_DEBUG_OUTPUT
, but I can't remember when I did it. I may not have released it yet.
The dev
branch fixed the MA_DEBUG_OUTPUT
problem, but the runtime error still remains.
I know that removing the compile flag -fsanitize=undefined
gets rid of the error, but I'd like to eliminate any runtime errors without needing to remove any compile flags if possible.
Thanks for checking the dev branch. Those sanitization errors should definitely be addressed. Do you have updated line numbers for those errors from the dev branch?
No. The errors and line numbers from the dev
branch are exactly the same as the ones previously shown above:
lib/miniaudio/miniaudio.h:69031:5: runtime error: null pointer passed as argument 1, which is declared to never be null
lib/miniaudio/miniaudio.h:64082:24: runtime error: load of misaligned address 0x7ffcf8f89306 for type 'const ma_uint32', which requires 4 byte alignment
0x7ffcf8f89306: note: pointer points here
65 78 65 00 72 65 73 2f 50 61 63 6d 61 6e 5f 43 4c 2f 61 75 64 69 6f 2f 67 61 6d 65 5f 73 74 61
^
[EDIT] Apologies, the errors remain the same but the line numbers have been updated.
lib/miniaudio/miniaudio.h:69631:5: runtime error: null pointer passed as argument 1, which is declared to never be null
lib/miniaudio/miniaudio.h:64682:24: runtime error: load of misaligned address 0x7ffe22241306 for type 'const ma_uint32', which requires 4 byte alignment
0x7ffe22241306: note: pointer points here
65 78 65 00 72 65 73 2f 50 61 63 6d 61 6e 5f 43 4c 2f 61 75 64 69 6f 2f 67 61 6d 65 5f 73 74 61
^
Thanks. I think those sanitization errors should now be fixed. Are you able to try the dev branch again?
The first one was not an error that would have resulted in a crash in practice, but still good to get that cleaned up regardless. The other was from MurmurHash3 and would be fine for x86/64, but for other architectures where unaligned access is a problem, this would have resulting in issues so good to get that one cleaned up as well.
Thanks for reporting these.
The sanitization errors have now been fixed with the dev
branch.
Thank you for spending the time to fix this!
Currently using GCC 11.1.0, Ubuntu 20.04 LTS. I've taken the high-level api example from https://github.com/mackron/miniaudio and tried compiling and running it as a .cpp file, with the addition of defining the MA_DEBUG_OUTPUT macro before the include statement.
When I use the following compile command, there are no error outputs, and the MA_DEBUG_OUTPUT macro works when I run the program.
g++ -Ilib/miniaudio test.cpp -ldl -lpthread -lm -o test.exe 2> test.log
MA_DEBUG_OUTPUT:
When I add the compile flag
-std=c++20
, there are no error outputs, but the MA_DEBUG_OUTPUT macro stops working when I run the program.g++ -std=c++20 -Ilib/miniaudio test.cpp -ldl -lpthread -lm -o test.exe 2> test.log
When I add the compile flag
-fsanitize=undefined
, the following runtime error is outputted when the program is run:g++ -fsanitize=undefined -Ilib/miniaudio test.cpp -ldl -lpthread -lm -o test.exe 2> test.log
Is there a way to get rid of the errors without having to remove the compile flags?