https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78204

            Bug ID: 78204
           Summary: ‘no_sanitize’ attribute directive ignored
                    [-Wattributes]
           Product: gcc
           Version: 6.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: sanitizer
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jan.kratochvil at redhat dot com
                CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
                    jakub at gcc dot gnu.org, kcc at gcc dot gnu.org
  Target Milestone: ---

g++ -o 44 44.C -Wall -g -fsanitize=bool -fsanitize=float-divide-by-zero;./44
-----------------------------------------------------------------------------
int intzero(0);
//__attribute__((no_sanitize_undefined))
__attribute__((no_sanitize("float-divide-by-zero")))
int main() {
  union { char c; bool b; } u={42};
  double d(double(10)/intzero);
  return u.b + d;
}
-----------------------------------------------------------------------------
gcc-6.2.1-2.fc24.x86_64
clang 1:3.8-34 Ubuntu x86_64
 - Fedora clang does not support ubsan
-----------------------------------------------------------------------------
//__attribute__((no_sanitize_undefined))
__attribute__((no_sanitize("float-divide-by-zero")))
FAIL gcc: I want to suppress the "division by zero" message.
44.C:4:10: warning: ‘no_sanitize’ attribute directive ignored [-Wattributes]
 int main() {
44.C:6:22: runtime error: division by zero
44.C:7:12: runtime error: load of value 42, which is not a valid value for type
'bool'
PASS clang++:
44.C:7:12: runtime error: load of value 42, which is not a valid value for type
'bool'
-----------------------------------------------------------------------------
__attribute__((no_sanitize_undefined))
//__attribute__((no_sanitize("float-divide-by-zero")))
FAIL gcc: Missing "load of value 42, which is not a valid value for type
'bool'"
-----------------------------------------------------------------------------

Reply via email to