diff options
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr111818.c | 11 | ||||
-rw-r--r-- | gcc/tree-ssa.cc | 17 |
2 files changed, 22 insertions, 6 deletions
diff --git a/gcc/testsuite/gcc.dg/torture/pr111818.c b/gcc/testsuite/gcc.dg/torture/pr111818.c new file mode 100644 index 0000000..a7a9111 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr111818.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ + +static void foo(const volatile unsigned int x, void *p) +{ + __builtin_memcpy(p, (void *)&x, sizeof x); +} + +void bar(void *number) +{ + foo(0, number); +} diff --git a/gcc/tree-ssa.cc b/gcc/tree-ssa.cc index ebba02b..2f3210f 100644 --- a/gcc/tree-ssa.cc +++ b/gcc/tree-ssa.cc @@ -1788,15 +1788,20 @@ maybe_optimize_var (tree var, bitmap addresses_taken, bitmap not_reg_needs, maybe_reg = true; DECL_NOT_GIMPLE_REG_P (var) = 0; } - if (maybe_reg && is_gimple_reg (var)) + if (maybe_reg) { - if (dump_file) + if (is_gimple_reg (var)) { - fprintf (dump_file, "Now a gimple register: "); - print_generic_expr (dump_file, var); - fprintf (dump_file, "\n"); + if (dump_file) + { + fprintf (dump_file, "Now a gimple register: "); + print_generic_expr (dump_file, var); + fprintf (dump_file, "\n"); + } + bitmap_set_bit (suitable_for_renaming, DECL_UID (var)); } - bitmap_set_bit (suitable_for_renaming, DECL_UID (var)); + else + DECL_NOT_GIMPLE_REG_P (var) = 1; } } } |