[Bug c/83989] [8 Regression] -Wrestrict false positive with malloc-style functions

2018-01-26 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83989

Jakub Jelinek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #5 from Jakub Jelinek  ---
Fixed.

[Bug c/83989] [8 Regression] -Wrestrict false positive with malloc-style functions

2018-01-26 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83989

--- Comment #4 from Jakub Jelinek  ---
Author: jakub
Date: Fri Jan 26 11:47:11 2018
New Revision: 257086

URL: https://gcc.gnu.org/viewcvs?rev=257086=gcc=rev
Log:
PR c/83989
* gimple-ssa-warn-restrict.c (builtin_memref::builtin_memref): Don't
use SSA_NAME_VAR as base for SSA_NAMEs with non-NULL SSA_NAME_VAR.

* c-c++-common/Wrestrict-3.c: New test.

Added:
trunk/gcc/testsuite/c-c++-common/Wrestrict-3.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/gimple-ssa-warn-restrict.c
trunk/gcc/testsuite/ChangeLog

[Bug c/83989] [8 Regression] -Wrestrict false positive with malloc-style functions

2018-01-25 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83989

Jakub Jelinek  changed:

   What|Removed |Added

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

--- Comment #3 from Jakub Jelinek  ---
Created attachment 43239
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43239=edit
gcc8-pr83989.patch

The assumption that if 2 different SSA_NAMEs have the same SSA_NAME_VAR they
must have the same value is completely wrong.  Didn't see any testsuite
regressions with this change on any of the tests added or modified in the
-Wrestrict commits, but so far have not tested it further than that.

[Bug c/83989] [8 Regression] -Wrestrict false positive with malloc-style functions

2018-01-23 Thread dmalcolm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83989

David Malcolm  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2018-01-23
 Ever confirmed|0   |1

--- Comment #2 from David Malcolm  ---
Here's a more minimal version:

/* compile with: -O2 -Wrestrict */

__attribute__((__malloc__)) extern void *my_malloc(__SIZE_TYPE__ n);

#define SIZE 32

void test (void)
{
  void *recmem = __builtin_malloc(SIZE);
  while (1)
{
  void *oldrecmem = recmem;
  recmem = __builtin_malloc(SIZE);
  __builtin_memcpy(recmem, oldrecmem, SIZE);
}
}

void test_2 (void)
{
  void *recmem = my_malloc(SIZE);
  while (1)
{
  void *oldrecmem = recmem;
  recmem = my_malloc(SIZE);
  __builtin_memcpy(recmem, oldrecmem, SIZE);
}
}

[Bug c/83989] [8 Regression] -Wrestrict false positive with malloc-style functions

2018-01-23 Thread dmalcolm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83989

David Malcolm  changed:

   What|Removed |Added

 CC||dmalcolm at gcc dot gnu.org

--- Comment #1 from David Malcolm  ---
Began with r255755.

[Bug c/83989] [8 Regression] -Wrestrict false positive with malloc-style functions

2018-01-23 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83989

Richard Biener  changed:

   What|Removed |Added

   Keywords||diagnostic
 CC||msebor at gcc dot gnu.org
   Target Milestone|--- |8.0
Summary|-Wrestrict false positive   |[8 Regression] -Wrestrict
   |with malloc-style functions |false positive with
   ||malloc-style functions