https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87049

            Bug ID: 87049
           Summary: __clear_cache() prototype confusion
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bunk at stusta dot de
  Target Milestone: ---

$ cat test.cc
extern "C" void __clear_cache(char *beg, char *end);
$ g++-5 -c test.cc
test.cc:1:51: warning: new declaration 'void __clear_cache(char*, char*)'
ambiguates built-in declaration 'void __clear_cache(void*, void*)'
 extern "C" void __clear_cache(char *beg, char *end);
                                                   ^
$ g++-7 -c test.cc
test.cc:1:17: warning: new declaration 'void __clear_cache(char*, char*)'
ambiguates built-in declaration 'void __clear_cache(void*, void*)'
[-Wbuiltin-declaration-mismatch]
 extern "C" void __clear_cache(char *beg, char *end);
                 ^~~~~~~~~~~~~
$ g++-8 -c test.cc
test.cc:1:17: error: new declaration 'void __clear_cache(char*, char*)'
ambiguates built-in declaration 'void __clear_cache(void*, void*)'
[-fpermissive]
 extern "C" void __clear_cache(char *beg, char *end);
                 ^~~~~~~~~~~~~
$ 

The bug is not that g++ became more strict, the bug is that the built-in
declaration differs from the documented declaration.

Relevant part of the gcc sources:

gcc/builtins.def:DEF_EXT_LIB_BUILTIN    (BUILT_IN_CLEAR_CACHE, "__clear_cache",
BT_FN_VOID_PTR_PTR, ATTR_NOTHROW_LEAF_LIST)
gcc/doc/extend.texi:@deftypefn {Built-in Function} void __builtin___clear_cache
(char *@var{begin}, char *@var{end})
libgcc/libgcc2.h:extern void __clear_cache (char *, char *);

Doesn't seem to be a new issue:
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20130513/079828.html

Reply via email to