diff options
author | Richard Biener <rguenther@suse.de> | 2023-10-16 12:50:46 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2023-10-17 08:23:33 +0200 |
commit | ce55521bcd149fdc431f1d78e706b66d470210ae (patch) | |
tree | 94e32f390a504b1e88d4cf781bcd97e95240a92b /gcc/testsuite | |
parent | 3aaf704bca3e01c72d9fe6de01ae5416dba6b5db (diff) | |
download | gcc-ce55521bcd149fdc431f1d78e706b66d470210ae.zip gcc-ce55521bcd149fdc431f1d78e706b66d470210ae.tar.gz gcc-ce55521bcd149fdc431f1d78e706b66d470210ae.tar.bz2 |
middle-end/111818 - failed DECL_NOT_GIMPLE_REG_P setting of volatile
The following addresses a missed DECL_NOT_GIMPLE_REG_P setting of
a volatile declared parameter which causes inlining to substitute
a constant parameter into a context where its address is required.
The main issue is in update_address_taken which clears
DECL_NOT_GIMPLE_REG_P from the parameter but fails to rewrite it
because is_gimple_reg returns false for volatiles. The following
changes maybe_optimize_var to make the 1:1 correspondence between
clearing DECL_NOT_GIMPLE_REG_P of a register typed decl and
actually rewriting it to SSA.
PR middle-end/111818
* tree-ssa.cc (maybe_optimize_var): When clearing
DECL_NOT_GIMPLE_REG_P always rewrite into SSA.
* gcc.dg/torture/pr111818.c: New testcase.
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr111818.c | 11 |
1 files changed, 11 insertions, 0 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); +} |