diff options
author | Marek Polacek <polacek@redhat.com> | 2014-11-19 14:32:02 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2014-11-19 14:32:02 +0000 |
commit | c71a55f88d2d4fc29f9009aea2d833ac340ea38b (patch) | |
tree | cb18d477dddc969d4782f2d7ef4c4f046aef8e81 /gcc/ubsan.c | |
parent | 3b5b776210dc2819638d48595a0e97578d7adbcb (diff) | |
download | gcc-c71a55f88d2d4fc29f9009aea2d833ac340ea38b.zip gcc-c71a55f88d2d4fc29f9009aea2d833ac340ea38b.tar.gz gcc-c71a55f88d2d4fc29f9009aea2d833ac340ea38b.tar.bz2 |
re PR sanitizer/63690 (ICE: tree check: expected class 'expression', have 'constant' (string_cst) with -fsanitize=undefined)
PR sanitizer/63690
* ubsan.c (instrument_object_size): Check for MEM_REF.
* gcc.dg/ubsan/pr63690.c: New test.
From-SVN: r217778
Diffstat (limited to 'gcc/ubsan.c')
-rw-r--r-- | gcc/ubsan.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/ubsan.c b/gcc/ubsan.c index 7d1e341..ad5665f 100644 --- a/gcc/ubsan.c +++ b/gcc/ubsan.c @@ -1539,7 +1539,13 @@ instrument_object_size (gimple_stmt_iterator *gsi, bool is_lhs) return; bool decl_p = DECL_P (inner); - tree base = decl_p ? inner : TREE_OPERAND (inner, 0); + tree base; + if (decl_p) + base = inner; + else if (TREE_CODE (inner) == MEM_REF) + base = TREE_OPERAND (inner, 0); + else + return; tree ptr = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (t)), t); while (TREE_CODE (base) == SSA_NAME) |