public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/60872] New: Cannot memcpy array of restricted pointers
@ 2014-04-17 12:14 e.tadeu at gmail dot com
2014-04-17 12:37 ` [Bug c++/60872] " jakub at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: e.tadeu at gmail dot com @ 2014-04-17 12:14 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60872
Bug ID: 60872
Summary: Cannot memcpy array of restricted pointers
Product: gcc
Version: 4.7.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: e.tadeu at gmail dot com
When trying to use memcpy to copy arrays of restricted pointers, it fails with
the message:
error: '__restrict_' qualifiers cannot be applied to 'void'
This is a failing testcase:
#include <iostream>
#include <cstring>
typedef double* __restrict__ T;
void do_copy(T* a, const T* b)
{
memcpy(a, b, sizeof(T) * 3);
}
int main()
{
double x[3] = {1.5, 2.5, 3.5};
double *p0[3] = {&x[2], &x[1], &x[0]};
double *p1[3];
do_copy(p1, p0);
std::cout << *p1[2] << std::endl;
return 0;
}
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/60872] Cannot memcpy array of restricted pointers
2014-04-17 12:14 [Bug c++/60872] New: Cannot memcpy array of restricted pointers e.tadeu at gmail dot com
@ 2014-04-17 12:37 ` jakub at gcc dot gnu.org
2014-04-18 18:11 ` jason at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-04-17 12:37 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60872
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Reduced testcase:
typedef double * __restrict__ T;
void bar (void *);
void
foo (T *a)
{
bar (a);
}
Whether this is valid C++ or not will leave to our C++ folks. Not a regression
of any kind, even g++ 3.2 fails the same way.
Note that in C, you get a warning for this and with explicit cast (bar ((void
*) a);) it is accepted without diagnostics. In C++ it errors even for that,
and for the various C++ *_cast <void *> (a).
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/60872] Cannot memcpy array of restricted pointers
2014-04-17 12:14 [Bug c++/60872] New: Cannot memcpy array of restricted pointers e.tadeu at gmail dot com
2014-04-17 12:37 ` [Bug c++/60872] " jakub at gcc dot gnu.org
@ 2014-04-18 18:11 ` jason at gcc dot gnu.org
2014-04-19 5:10 ` jason at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: jason at gcc dot gnu.org @ 2014-04-18 18:11 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60872
--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Fri Apr 18 18:11:22 2014
New Revision: 209520
URL: http://gcc.gnu.org/viewcvs?rev=209520&root=gcc&view=rev
Log:
PR c++/60872
* call.c (standard_conversion): Don't try to apply restrict to void.
Added:
trunk/gcc/testsuite/g++.dg/ext/restrict2.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/call.c
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/60872] Cannot memcpy array of restricted pointers
2014-04-17 12:14 [Bug c++/60872] New: Cannot memcpy array of restricted pointers e.tadeu at gmail dot com
2014-04-17 12:37 ` [Bug c++/60872] " jakub at gcc dot gnu.org
2014-04-18 18:11 ` jason at gcc dot gnu.org
@ 2014-04-19 5:10 ` jason at gcc dot gnu.org
2014-08-07 18:55 ` jason at gcc dot gnu.org
2014-08-07 18:56 ` jason at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: jason at gcc dot gnu.org @ 2014-04-19 5:10 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60872
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2014-04-19
CC| |jason at gcc dot gnu.org
Assignee|unassigned at gcc dot gnu.org |jason at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed on trunk so far.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/60872] Cannot memcpy array of restricted pointers
2014-04-17 12:14 [Bug c++/60872] New: Cannot memcpy array of restricted pointers e.tadeu at gmail dot com
` (2 preceding siblings ...)
2014-04-19 5:10 ` jason at gcc dot gnu.org
@ 2014-08-07 18:55 ` jason at gcc dot gnu.org
2014-08-07 18:56 ` jason at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: jason at gcc dot gnu.org @ 2014-08-07 18:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60872
--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Thu Aug 7 18:54:34 2014
New Revision: 213725
URL: https://gcc.gnu.org/viewcvs?rev=213725&root=gcc&view=rev
Log:
PR c++/60872
* call.c (standard_conversion): Don't try to apply restrict to void.
Added:
branches/gcc-4_9-branch/gcc/testsuite/g++.dg/ext/restrict2.C
Modified:
branches/gcc-4_9-branch/gcc/cp/ChangeLog
branches/gcc-4_9-branch/gcc/cp/call.c
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/60872] Cannot memcpy array of restricted pointers
2014-04-17 12:14 [Bug c++/60872] New: Cannot memcpy array of restricted pointers e.tadeu at gmail dot com
` (3 preceding siblings ...)
2014-08-07 18:55 ` jason at gcc dot gnu.org
@ 2014-08-07 18:56 ` jason at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: jason at gcc dot gnu.org @ 2014-08-07 18:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60872
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
Target Milestone|--- |4.9.2
--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for 4.9.2.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-08-07 18:56 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-17 12:14 [Bug c++/60872] New: Cannot memcpy array of restricted pointers e.tadeu at gmail dot com
2014-04-17 12:37 ` [Bug c++/60872] " jakub at gcc dot gnu.org
2014-04-18 18:11 ` jason at gcc dot gnu.org
2014-04-19 5:10 ` jason at gcc dot gnu.org
2014-08-07 18:55 ` jason at gcc dot gnu.org
2014-08-07 18:56 ` jason at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).