[Bug c/55397] [asan] -faddress-sanitizer should define a CPP macro

2012-11-21 Thread hjl at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55397



--- Comment #6 from hjl at gcc dot gnu.org hjl at gcc dot gnu.org 2012-11-21 
20:21:02 UTC ---

Author: hjl

Date: Wed Nov 21 20:20:42 2012

New Revision: 193704



URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=193704

Log:

Define __SANITIZE_ADDRESS__ for -fsanitize=address



PR c/55397

* cppbuiltin.c (define_builtin_macros_for_compilation_flags):

Define __SANITIZE_ADDRESS__ for flag_asan.



Modified:

trunk/gcc/ChangeLog

trunk/gcc/cppbuiltin.c


[Bug c/55397] [asan] -faddress-sanitizer should define a CPP macro

2012-11-21 Thread hjl.tools at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55397



H.J. Lu hjl.tools at gmail dot com changed:



   What|Removed |Added



 Status|UNCONFIRMED |RESOLVED

 Resolution||FIXED

   Target Milestone|--- |4.8.0



--- Comment #7 from H.J. Lu hjl.tools at gmail dot com 2012-11-21 20:28:52 
UTC ---

Fixed.


[Bug c/55397] [asan] -faddress-sanitizer should define a CPP macro

2012-11-19 Thread konstantin.s.serebryany at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55397



Konstantin Serebryany konstantin.s.serebryany at gmail dot com changed:



   What|Removed |Added



 CC||konstantin.s.serebryany at

   ||gmail dot com



--- Comment #1 from Konstantin Serebryany konstantin.s.serebryany at gmail dot 
com 2012-11-20 05:13:27 UTC ---

Note that this will be incompatible with what clang uses

(http://clang.llvm.org/docs/AddressSanitizer.html#has_feature)

Clang will never use a CPP macro (I've lost this battle a year ago). 



Just FYI. I don't know how much compatibility we want and can achieve.


[Bug c/55397] [asan] -faddress-sanitizer should define a CPP macro

2012-11-19 Thread pinskia at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55397



--- Comment #2 from Andrew Pinski pinskia at gcc dot gnu.org 2012-11-20 
05:23:29 UTC ---

(In reply to comment #1)

 Note that this will be incompatible with what clang uses

 (http://clang.llvm.org/docs/AddressSanitizer.html#has_feature)

 Clang will never use a CPP macro (I've lost this battle a year ago). 

 

 Just FYI. I don't know how much compatibility we want and can achieve.



has feature will most likely not be implemented in GCC so CPP macro is correct

for GCC.  If clang wants to have a non-standard way of doing CPP macro for

features, that is up to them.


[Bug c/55397] [asan] -faddress-sanitizer should define a CPP macro

2012-11-19 Thread konstantin.s.serebryany at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55397



Konstantin Serebryany konstantin.s.serebryany at gmail dot com changed:



   What|Removed |Added



 CC||dnovillo at google dot com



--- Comment #3 from Konstantin Serebryany konstantin.s.serebryany at gmail dot 
com 2012-11-20 05:30:59 UTC ---

FTR: my conversation with clang on this topic. 

http://comments.gmane.org/gmane.comp.compilers.clang.scm/42610



From Diego: 

I don't know of any current effort in this area for GCC.  If 

__has_feature() is desirable, patches documenting and implementing it 

would be welcome.  The GCC pre-processor is jointly maintained by all 

the FE maintainers.  I would start there.





If we end up implementing a macro, may I ask it to be named ADDRESS_SANITIZER? 

This name is already used in a few places (Chromium, WebKit, etc).


[Bug c/55397] [asan] -faddress-sanitizer should define a CPP macro

2012-11-19 Thread hjl.tools at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55397



--- Comment #4 from H.J. Lu hjl.tools at gmail dot com 2012-11-20 05:37:18 
UTC ---

(In reply to comment #3)

 

 If we end up implementing a macro, may I ask it to be named 
 ADDRESS_SANITIZER? 

 This name is already used in a few places (Chromium, WebKit, etc).



It should have `_' prefix.


[Bug c/55397] [asan] -faddress-sanitizer should define a CPP macro

2012-11-19 Thread konstantin.s.serebryany at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55397



--- Comment #5 from Konstantin Serebryany konstantin.s.serebryany at gmail dot 
com 2012-11-20 05:46:06 UTC ---

Then it should probably *not* be named _ADDRESS_SANITIZER 

(imagine a user trying to understand why ADDRESS_SANITIZER works for him 

with clang, where he added -DADDRESS_SANITIZER=1 manually, and dpoes not work

with gcc where he saw the documentation saying about _ADDRESS_SANITIZER)



Maybe something with GCC in the name?  _GCC_ADDRESS_SANITIZER?