std::copy of volatile array triggers invalid conversion error
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
GNU Arm Embedded Toolchain |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
I'm using arm-none-
I'm trying to compile this:
#include <algorithm>
volatile uint8_t buf[10];
volatile uint8_t dest[10];
int main(void)
{
std::copy(buf, buf+5, dest);
return 0;
}
And I get:
arm-none-
_
<built-in>: note: initializing argument 1 of 'void* __builtin_
arm-none-
<built-in>: note: initializing argument 2 of 'void* __builtin_
I'm not sure if it's correct behaviour but it certainly doesn't seem like it. It should be possible to copy one array to the other array of the same type.
I can reproduce the issue but I cannot convince myself whether this is a bug or not. It seems indeed that this only gives an error because of the way std::copy is implemented: using __builtin_memmove which has non volatile parameters.
That said this is not ARM specific so I suggest you report the bug in GCC's bugzilla instead. This will reach C++ front end maintainers of GCC who will have a more definite opinion on the question.
Please post the bugzilla number here once you have done so.
Best regards.