GCC and "-fsanitize=memory" ?
Petrillo, Neale A (Contractor) via gcc-help
gcc-help@gcc.gnu.org
Thu Mar 28 14:26:00 GMT 2019
Hi Gordon,
There are quire a few sanitize options in later GCC versions. If you take a look over here, you can get a full list:
https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html
I think you'll be most interested in:
-fsanitize=address
You'll also want to take a look at the warning options related to using uninitialized variables:
-Wuninitialized
-Wmaybe-uninitialized
Hope it helps!
________________________________
From: gcc-help-owner@gcc.gnu.org <gcc-help-owner@gcc.gnu.org> on behalf of Gordon McConnell <gordon.mcconnell@synopsys.com>
Sent: Thursday, March 28, 2019 9:55:07 AM
To: gcc-help@gcc.gnu.org
Subject: GCC and "-fsanitize=memory" ?
Hi all,
I've previously used Purify / Valgrind for catching various code defects ; I would love to instead just use one or more of the sanitizers which are available from GCC. Address Sanitizer does a great job for detecting many of the defect types, but it's not catching 'UMR' (Uninitialized Memory Reads)
I notice that clang has a separate "-fsanitize=memory" option, which does catch these UMR defects, but GCC (even up to the latest 8.3 version) does not support this - it just reports : unrecognized command line option '-fsanitize=memory'
Is this functionality perhaps provided in GCC but available via some other flag / option, or is it definitely not implemented for GCC ? If the latter, is there a plan to make it available anytime soon ?
Thanks in advance for any info you can share on this.
Regards,
Gordon
More information about the Gcc-help
mailing list