[Bug c/84919] [8/9/10 Regression] error: passing argument 1 to restrict-qualified parameter aliases with argument 5 [-Werror=restrict]

2020-01-23 Thread cvs-commit at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84919

--- Comment #19 from CVS Commits  ---
The master branch has been updated by Martin Sebor :

https://gcc.gnu.org/g:8a990ffafaaa18981c6e91d4ed88f05ed74c5f3f

commit r10-6170-g8a990ffafaaa18981c6e91d4ed88f05ed74c5f3f
Author: Martin Sebor 
Date:   Thu Jan 23 11:37:02 2020 +0100

PR c/84919 - bogus -Wrestrict on sprintf %p with destination as argument

gcc/c-family/ChangeLog:

PR c/84919
* c-common.c (check_function_arguments): Avoid overlap checking
of sprintf functions.

gcc/testsuite/ChangeLog:

PR c/84919
* gcc.dg/Wrestrict-20.c: New test.

[Bug c/84919] [8/9/10 Regression] error: passing argument 1 to restrict-qualified parameter aliases with argument 5 [-Werror=restrict]

2020-01-22 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84919

Martin Sebor  changed:

   What|Removed |Added

   Keywords|deferred|patch

--- Comment #18 from Martin Sebor  ---
GCC 10 patch: https://gcc.gnu.org/ml/gcc-patches/2020-01/msg01471.html

[Bug c/84919] [8/9/10 Regression] error: passing argument 1 to restrict-qualified parameter aliases with argument 5 [-Werror=restrict]

2019-12-04 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84919

--- Comment #17 from Martin Sebor  ---
The patch below avoids the warning.  Unfortunately, as a result of bug 92666,
it triggers another bogus warning during bootstrap.

Index: gcc/c-family/c-common.c
===
--- gcc/c-family/c-common.c (revision 278975)
+++ gcc/c-family/c-common.c (working copy)
@@ -5763,8 +5763,26 @@ check_function_arguments (location_t loc, const_tr
   if (warn_format)
 check_function_sentinel (fntype, nargs, argarray);

-  if (warn_restrict)
-warned_p |= check_function_restrict (fndecl, fntype, nargs, argarray);
+  if (fndecl && fndecl_built_in_p (fndecl, BUILT_IN_NORMAL))
+{
+  switch (DECL_FUNCTION_CODE (fndecl))
+   {
+   case BUILT_IN_SPRINTF:
+   case BUILT_IN_SPRINTF_CHK:
+   case BUILT_IN_SNPRINTF:
+   case BUILT_IN_SNPRINTF_CHK:
+ /* Let the sprintf pass handle these.  */
+ return warned_p;
+
+   default:
+ break;
+   }
+}
+
+  /* check_function_restrict sets the DECL_READ_P for arguments
+ so it must be called unconiditionally.  */
+  warned_p |= check_function_restrict (fndecl, fntype, nargs, argarray);
+
   return warned_p;
 }

[Bug c/84919] [8/9/10 Regression] error: passing argument 1 to restrict-qualified parameter aliases with argument 5 [-Werror=restrict]

2019-11-22 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84919

Martin Sebor  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |msebor at gcc dot 
gnu.org

[Bug c/84919] [8/9/10 Regression] error: passing argument 1 to restrict-qualified parameter aliases with argument 5 [-Werror=restrict]

2019-08-12 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84919

Jakub Jelinek  changed:

   What|Removed |Added

   Target Milestone|9.2 |9.3

--- Comment #16 from Jakub Jelinek  ---
GCC 9.2 has been released.

[Bug c/84919] [8/9/10 Regression] error: passing argument 1 to restrict-qualified parameter aliases with argument 5 [-Werror=restrict]

2019-05-03 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84919

Jakub Jelinek  changed:

   What|Removed |Added

   Target Milestone|9.0 |9.2

--- Comment #15 from Jakub Jelinek  ---
GCC 9.1 has been released.