Summary: | Code with memory leak does not get triggered when I run the executable | ||
---|---|---|---|
Product: | gcc | Reporter: | stefanos <ssofroni> |
Component: | sanitizer | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | UNCONFIRMED --- | ||
Severity: | normal | CC: | dodji, dvyukov, jakub, kcc, marxin |
Priority: | P3 | ||
Version: | 12.2.0 | ||
Target Milestone: | --- | ||
Host: | Target: | ||
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: |
Description
stefanos
2022-12-13 14:07:08 UTC
I forgot to mention that if I try *directly* the following command g++ -Wall -Wextra -Werror -Wpedantic -std=c++20 -g -g0 -fsanitize=address,undefined -D_GLIBCXX_DEBUG -fno-strict-aliasing -fwrapv -lm -o tmp src/tmp.cpp in place of Makefile, it triggers the memory leak. (In reply to stefanos from comment #0) > With my Makefile, I generate an executable with the following steps: > > ccache g++ -Wall -Wextra -Werror -Wpedantic -std=c++20 -g -Og > -D_GLIBCXX_DEBUG -I src -c src/tmp.cpp -o obj/tmp.o You're not compiling with sanitizers, only linking: > ccache g++ obj/tmp.o -o bin/tmp -fno-strict-aliasing -fwrapv -lfmt -lm > -fsanitize=address,undefined Your makefile is incorrect. (In reply to Jonathan Wakely from comment #2) > (In reply to stefanos from comment #0) > > With my Makefile, I generate an executable with the following steps: > > > > ccache g++ -Wall -Wextra -Werror -Wpedantic -std=c++20 -g -Og > > -D_GLIBCXX_DEBUG -I src -c src/tmp.cpp -o obj/tmp.o > > You're not compiling with sanitizers, only linking: > > > ccache g++ obj/tmp.o -o bin/tmp -fno-strict-aliasing -fwrapv -lfmt -lm > > -fsanitize=address,undefined > > Your makefile is incorrect. Even if I do so, it does not trigger the memory leak...unless I misunderstood you. stefanos@debian:~/code/cpp/tmp $ make ccache g++ -Wall -Wextra -Werror -Wpedantic -std=c++20 -g -Og -D_GLIBCXX_DEBUG -fsanitize=address,undefined -I src -c src/tmp.cpp -o obj/tmp.o ccache g++ obj/tmp.o -o bin/tmp -fno-strict-aliasing -fwrapv -lfmt -lm -fsanitize=address,undefined make -j4 --jobserver-auth=3,4 got executed in debug mode... stefanos@debian:~/code/cpp/tmp $ bin/tmp histefanos@debian:~/code/cpp/tmp $ |