ASan: add AddressSanitizer g++ option: -fsanitize=address v_0
authorFrantišek Kučera <franta-hg@frantovo.cz>
Sat, 28 Jul 2018 15:42:33 +0200
branchv_0
changeset 19 98b901d7bb95
parent 18 90efe2db1ca8
child 20 bef6648e79b1
ASan: add AddressSanitizer g++ option: -fsanitize=address
nbproject/Makefile-Debug.mk
nbproject/configurations.xml
src/DataTypeWriterBase.h
--- a/nbproject/Makefile-Debug.mk	Wed Jul 25 01:33:57 2018 +0200
+++ b/nbproject/Makefile-Debug.mk	Sat Jul 28 15:42:33 2018 +0200
@@ -42,8 +42,8 @@
 CFLAGS=
 
 # CC Compiler Flags
-CCFLAGS=
-CXXFLAGS=
+CCFLAGS=-fsanitize=address
+CXXFLAGS=-fsanitize=address
 
 # Fortran Compiler Flags
 FFLAGS=
--- a/nbproject/configurations.xml	Wed Jul 25 01:33:57 2018 +0200
+++ b/nbproject/configurations.xml	Sat Jul 28 15:42:33 2018 +0200
@@ -47,6 +47,9 @@
         <rebuildPropChanged>false</rebuildPropChanged>
       </toolsSet>
       <compileType>
+        <ccTool>
+          <commandLine>-fsanitize=address</commandLine>
+        </ccTool>
       </compileType>
       <item path="include/Factory.h" ex="false" tool="3" flavor2="0">
       </item>
--- a/src/DataTypeWriterBase.h	Wed Jul 25 01:33:57 2018 +0200
+++ b/src/DataTypeWriterBase.h	Sat Jul 28 15:42:33 2018 +0200
@@ -37,6 +37,8 @@
 	 * @param type used as a safety mechanism to avoid wrong pointer interpretation;
 	 * should be called in this way: writeRaw(output, &value, typeid(value));
 	 * if the type does not match, the RelpipeWriterException is thrown
+	 * 
+	 * TODO: typeid() / type_info seems working but consider also sizeof() / size_t and teplates
 	 */
 	virtual void writeRaw(std::ostream& output, const void * value, const std::type_info& type) = 0;