[ubsan] Fix ICE 79/136679/7 accepted/tizen/base/20170901.225743 submit/tizen_base/20170823.100418
authorDenis Khalikov <d.khalikov@partner.samsung.com>
Sun, 2 Jul 2017 15:47:03 +0000 (18:47 +0300)
committerDongkyun Son <dongkyun.s@samsung.com>
Wed, 23 Aug 2017 09:53:08 +0000 (09:53 +0000)
commit2b27620bd5b5972827fe5c12cea7fec6f15d96a5
tree8a0e82a4b842e05ef60fbcd8faa96a9b9c784004
parent70089127dfa3e734f542831a0d45d15e14cfd0c2
[ubsan] Fix ICE

   While we have a current_function_decl in this case,
   still create_tmp_var's called gimple_add_tmp_var and
   mark_addressable don't work too well when the current
   function is a C++ ctor or dtor that the FE then duplicates

   2017-06-27  Jakub Jelinek  <jakub@redhat.com>

   PR sanitizer/81209
   * ubsan.c (ubsan_encode_value): Initialize DECL_CONTEXT on var.
   * g++.dg/ubsan/pr81209.C: New test.

   2017-06-20  Jakub Jelinek  <jakub@redhat.com>

   PR sanitizer/81125
   * ubsan.h (ubsan_encode_value): Workaround buggy clang++ parser
   by removing enum keyword.
   (ubsan_type_descriptor): Likewise.  Formatting fix.

   2017-06-19  Jakub Jelinek  <jakub@redhat.com>

   PR sanitizer/81125
   * ubsan.h (enum ubsan_encode_value_phase): New.
   (ubsan_encode_value): Change second argument to
   enum ubsan_encode_value_phase with default value of
   UBSAN_ENCODE_VALUE_GENERIC.
   * ubsan.c (ubsan_encode_value): Change second argument to
   enum ubsan_encode_value_phase PHASE from bool IN_EXPAND_P,
   adjust uses, for UBSAN_ENCODE_VALUE_GENERIC use just
   create_tmp_var_raw instead of create_tmp_var and use a
   TARGET_EXPR.
   (ubsan_expand_bounds_ifn, ubsan_build_overflow_builtin,
   instrument_bool_enum_load, ubsan_instrument_float_cast): Adjust
   ubsan_encode_value callers.

   PR sanitizer/81111
   * ubsan.c (ubsan_encode_value): If current_function_decl is NULL,
   use create_tmp_var_raw instead of create_tmp_var, mark it addressable
   just by setting TREE_ADDRESSABLE on the result and use a TARGET_EXPR.

   PR sanitizer/81125
   * g++.dg/ubsan/pr81125.C: New test.

   PR sanitizer/81111
   * g++.dg/ubsan/pr81111.C: New test.

   git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@249480 138bc75d-0d04-0410-961f-82ee72b054a4

Change-Id: I3b7816b4f9b1bb5916adf3684dcbcc5284e50954
gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ubsan/pr81111.C [new file with mode: 0644]
gcc/testsuite/g++.dg/ubsan/pr81125.C [new file with mode: 0644]
gcc/testsuite/g++.dg/ubsan/pr81209.C [new file with mode: 0644]
gcc/ubsan.c
gcc/ubsan.h