From: jakub Date: Tue, 13 Aug 2013 16:58:46 +0000 (+0000) Subject: PR sanitizer/56417 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e4849b471267489d708ef58942099e070a6467cb;p=thirdparty%2Fgcc.git PR sanitizer/56417 * asan.c (instrument_strlen_call): Fix typo in comment. Use char * type even for the lhs of POINTER_PLUS_EXPR. * gcc.dg/asan/pr56417.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@201696 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2cf949bae191..682328effbd9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2013-08-13 Jakub Jelinek + + PR sanitizer/56417 + * asan.c (instrument_strlen_call): Fix typo in comment. + Use char * type even for the lhs of POINTER_PLUS_EXPR. + 2013-08-13 Steve Ellcey * config/mips/mips.md (prefetch): Use lw instead of ld on diff --git a/gcc/asan.c b/gcc/asan.c index 78321b0ed39c..1756b07805fd 100644 --- a/gcc/asan.c +++ b/gcc/asan.c @@ -1635,7 +1635,7 @@ instrument_mem_region_access (tree base, tree len, access to the last byte of the argument; it uses the result of the call to deduce the offset of that last byte. - Upon completion, iff the call has actullay been instrumented, this + Upon completion, iff the call has actually been instrumented, this function returns TRUE and *ITER points to the statement logically following the built-in strlen function call *ITER was initially pointing to. Otherwise, the function returns FALSE and *ITER @@ -1666,10 +1666,10 @@ instrument_strlen_call (gimple_stmt_iterator *iter) /* Instrument the access to the first byte of str_arg. i.e: _1 = str_arg; instrument (_1); */ + tree cptr_type = build_pointer_type (char_type_node); gimple str_arg_ssa = gimple_build_assign_with_ops (NOP_EXPR, - make_ssa_name (build_pointer_type - (char_type_node), NULL), + make_ssa_name (cptr_type, NULL), str_arg, NULL); gimple_set_location (str_arg_ssa, loc); gimple_stmt_iterator gsi = *iter; @@ -1688,8 +1688,7 @@ instrument_strlen_call (gimple_stmt_iterator *iter) pointer_plus expr: (_1 + len). */ gimple stmt = gimple_build_assign_with_ops (POINTER_PLUS_EXPR, - make_ssa_name (TREE_TYPE (str_arg), - NULL), + make_ssa_name (cptr_type, NULL), gimple_assign_lhs (str_arg_ssa), len); gimple_set_location (stmt, loc); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c264264592a3..6e1b6309e7e8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-08-13 Jakub Jelinek + + PR sanitizer/56417 + * gcc.dg/asan/pr56417.c: New test. + 2013-08-13 Eric Botcazou * gnat.dg/loop_optimization16.adb: New test. diff --git a/gcc/testsuite/gcc.dg/asan/pr56417.c b/gcc/testsuite/gcc.dg/asan/pr56417.c new file mode 100644 index 000000000000..b7eabf125aa9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/asan/pr56417.c @@ -0,0 +1,9 @@ +/* PR sanitizer/56417 */ +/* { dg-do compile } */ +/* { dg-options "-w" } */ + +int +foo (void) +{ + return __builtin_strlen (&foo); +}