public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "e.tadeu at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/60872] New: Cannot memcpy array of restricted pointers
Date: Thu, 17 Apr 2014 12:14:00 -0000	[thread overview]
Message-ID: <bug-60872-4@http.gcc.gnu.org/bugzilla/> (raw)

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;
}


             reply	other threads:[~2014-04-17 12:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-17 12:14 e.tadeu at gmail dot com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-60872-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).