diff options
author | Alexandre Oliva <oliva@adacore.com> | 2024-12-20 18:02:01 -0300 |
---|---|---|
committer | Alexandre Oliva <oliva@gnu.org> | 2024-12-20 18:02:01 -0300 |
commit | 09dd47bc383f30f1ba03ec80f8bd849eb6283d29 (patch) | |
tree | 6a96b793b2b1fd5cfe2dc54a8ed07da44bda7c37 /gcc | |
parent | e7108c34a3685eaf9edd3b1fefbd3645b9bd8def (diff) | |
download | gcc-09dd47bc383f30f1ba03ec80f8bd849eb6283d29.zip gcc-09dd47bc383f30f1ba03ec80f8bd849eb6283d29.tar.gz gcc-09dd47bc383f30f1ba03ec80f8bd849eb6283d29.tar.bz2 |
strub: accept indirection of volatile pointer types [PR118007]
We don't want to indirect pointers in strub wrappers, because it
generally isn't profitable, but if the argument is volatile, then we
must use indirection to preserve access patterns, so amend the
assertion check.
for gcc/ChangeLog
PR middle-end/118007
* ipa-strub.cc (pass_ipa_strub::execute): Accept indirecting
volatile args of pointer types.
for gcc/testsuite/ChangeLog
PR middle-end/118007
* gcc.dg/strub-pr118007.c: New.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ipa-strub.cc | 13 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/strub-pr118007.c | 5 |
2 files changed, 12 insertions, 6 deletions
diff --git a/gcc/ipa-strub.cc b/gcc/ipa-strub.cc index 29ba143..6b3f5b0 100644 --- a/gcc/ipa-strub.cc +++ b/gcc/ipa-strub.cc @@ -2881,12 +2881,13 @@ pass_ipa_strub::execute (function *) && (tree_to_uhwi (TYPE_SIZE_UNIT (TREE_TYPE (nparm))) <= 4 * UNITS_PER_WORD)))) { - /* No point in indirecting pointer types. Presumably they - won't ever pass the size-based test above, but check the - assumption here, because getting this wrong would mess - with attribute access and possibly others. We deal with - fn spec below. */ - gcc_checking_assert (!POINTER_TYPE_P (TREE_TYPE (nparm))); + /* No point in indirecting pointer types, unless they're + volatile. Presumably they won't ever pass the size-based + test above, but check the assumption here, because + getting this wrong would mess with attribute access and + possibly others. We deal with fn spec below. */ + gcc_checking_assert (!POINTER_TYPE_P (TREE_TYPE (nparm)) + || TREE_THIS_VOLATILE (parm)); indirect_nparms.add (nparm); diff --git a/gcc/testsuite/gcc.dg/strub-pr118007.c b/gcc/testsuite/gcc.dg/strub-pr118007.c new file mode 100644 index 0000000..6c24cad --- /dev/null +++ b/gcc/testsuite/gcc.dg/strub-pr118007.c @@ -0,0 +1,5 @@ +/* { dg-require-effective-target strub } */ +/* { dg-do compile } */ +/* { dg-options "-fstrub=all -O2" } */ + +void rb_ec_error_print(struct rb_execution_context_struct *volatile) {} |