aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/builtins.c10
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr100316.c18
2 files changed, 22 insertions, 6 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 3e57eb0..80a1bb1 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -5163,12 +5163,10 @@ default_emit_call_builtin___clear_cache (rtx begin, rtx end)
void
maybe_emit_call_builtin___clear_cache (rtx begin, rtx end)
{
- if ((GET_MODE (begin) != ptr_mode && GET_MODE (begin) != Pmode)
- || (GET_MODE (end) != ptr_mode && GET_MODE (end) != Pmode))
- {
- error ("both arguments to %<__builtin___clear_cache%> must be pointers");
- return;
- }
+ gcc_assert ((GET_MODE (begin) == ptr_mode || GET_MODE (begin) == Pmode
+ || CONST_INT_P (begin))
+ && (GET_MODE (end) == ptr_mode || GET_MODE (end) == Pmode
+ || CONST_INT_P (end)));
if (targetm.have_clear_cache ())
{
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr100316.c b/gcc/testsuite/gcc.c-torture/compile/pr100316.c
new file mode 100644
index 0000000..38eca86
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr100316.c
@@ -0,0 +1,18 @@
+void foo(){
+ __builtin___clear_cache(0, 0);
+}
+
+void foo1(){
+ __builtin___clear_cache((void*)0, (void*)0);
+}
+
+void foo2(){
+ void *yy = 0;
+ __builtin___clear_cache(yy, yy);
+}
+
+void foo3(){
+ void *yy = (void*)0x1000;
+ __builtin___clear_cache(yy, yy);
+}
+