[Bug libstdc++/78530] New: std::copy of volatile array triggers invalid conversion error
poganoe at mail dot ru
gcc-bugzilla@gcc.gnu.org
Fri Nov 25 16:33:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78530
Bug ID: 78530
Summary: std::copy of volatile array triggers invalid
conversion error
Product: gcc
Version: 5.4.1
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: poganoe at mail dot ru
Target Milestone: ---
I'm using arm-none-eabi-g++.exe (GNU Tools for ARM Embedded Processors) 5.4.1
20160919 (release) [ARM/embedded-5-branch revision 240496] for Windows. As far
as I know it's the latest version of arm-none-eabi target.
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-eabi\include\c++\5.4.1\bits\stl_algobase.h:384:23: error: invalid
conversion from 'volatile void*' to 'void*' [-fpermissive]
__builtin_memmove(__result, __first, sizeof(_Tp) * _Num);
^
<built-in>: note: initializing argument 1 of 'void* __builtin_memmove(void*,
const void*, unsigned int)'
arm-none-eabi\include\c++\5.4.1\bits\stl_algobase.h:384:23: error: invalid
conversion from 'const volatile void*' to 'const void*' [-fpermissive]
<built-in>: note: initializing argument 2 of 'void* __builtin_memmove(void*,
const void*, unsigned int)'
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.
More information about the Gcc-bugs
mailing list