forked from iains/gcc-14-branch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PR tree-optimization/86196 - Bogus -Wrestrict on memcpy between array…
… elements at unequal indices gcc/ChangeLog: PR tree-optimization/86196 * gimple-ssa-warn-restrict.c (builtin_memref::builtin_memref): Use base size only of arrays. gcc/testsuite/ChangeLog: PR tree-optimization/86196 * gcc.dg/Wrestrict-18.c: New test. From-SVN: r266967
- Loading branch information
Martin Sebor
authored and
Martin Sebor
committed
Dec 11, 2018
1 parent
03da9b7
commit 1486eb7
Showing
4 changed files
with
59 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
2018-12-10 Martin Sebor <[email protected]> | ||
|
||
PR tree-optimization/86196 | ||
* gimple-ssa-warn-restrict.c (builtin_memref::builtin_memref): Use | ||
base size only of arrays. | ||
|
||
2018-12-10 Segher Boessenkool <[email protected]> | ||
|
||
* config.gcc (Obsolete configurations): Delete powerpc*-*-*spe*. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
2018-12-10 Martin Sebor <[email protected]> | ||
|
||
PR tree-optimization/86196 | ||
* gimple-ssa-warn-restrict.c (builtin_memref::builtin_memref): Use | ||
base size only of arrays. | ||
|
||
2018-12-10 Uros Bizjak <[email protected]> | ||
|
||
* gcc.dg/sinatan-1.c: Use dg-add-options ieee. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* PR tree-optimization/86196 - Bogus -Wrestrict on memcpy between array | ||
elements at unequal indices | ||
{ dg-do compile } | ||
{ dg-options "-O2 -Wall" } */ | ||
|
||
typedef __SIZE_TYPE__ size_t; | ||
|
||
extern void* memcpy (void*, const void*, size_t); | ||
|
||
struct S | ||
{ | ||
int n; | ||
void * p; | ||
}; | ||
|
||
/* Test case submitted in the PR. */ | ||
|
||
void pr86196_c0 (struct S * a, size_t n) | ||
{ | ||
for (size_t i = 0, j = 0; i != n; ++i) | ||
{ | ||
if (a[i].n == 0) | ||
{ | ||
if (i != j) | ||
memcpy (&a[j], &a[i], sizeof (struct S)); /* { dg-bogus "\\\[-Wrestrict" } */ | ||
++j; | ||
} | ||
} | ||
} | ||
|
||
/* Reduced test case. */ | ||
|
||
void pr86196_c1 (struct S *a, int i, int j) | ||
{ | ||
if (i != j) | ||
memcpy (&a[j], &a[i], sizeof (struct S)); /* { dg-bogus "\\\[-Wrestrict" } */ | ||
} |