473,396 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

g++ compilation - invalid conversion from void* to double*

Hi all,

uname -a
SunOS cbmrsd1a1 5.10 Generic_118833-17 sun4us sparc FJSV,GPUZC-M

g++ -v
Reading specs from
/usr/local/lib/gcc-lib/sparc-sun-solaris2.10/3.3.2/specs
Configured with: ../configure --with-as=/usr/ccs/bin/as
--with-ld=/usr/ccs/bin/ld --disable-nls
Thread model: posix
gcc version 3.3.2

With 32 bit compilation, I compiled my application code successfully -
But I got the following errors when I tried 64-bit compilation by
giving options (-m64, -mcpu=v9) -

/usr/local/bin/g++ -m64 -mcpu=v9 -c -o PVA/PVA_ValueTable.o
PVA/PVA_ValueTable.cpp

/usr/local/include/c++/3.3.2/bits/stl_vector.h: In member function
`_Tp*
std::_Vector_alloc_base<_Tp, _Allocator, _IsStatic>::_M_allocate(long
unsigned int) [with _Tp = double, _Allocator = EFL_Allocator<double>,
bool
_IsStatic = false]':
/usr/local/include/c++/3.3.2/bits/vector.tcc:236: instantiated from
`void std::vector<_Tp, _Alloc>::_M_insert_aux(__gnu_cxx:
:__normal_iterator<_Tp*, std::vector<_Tp, _Alloc, const _Tp&) [with
_Tp = double, _Alloc = EFL_Allocator<double>]'
/usr/local/include/c++/3.3.2/bits/stl_vector.h:603: instantiated from
`void std::vector<_Tp, _Alloc>::push_back(const _Tp&)
[with _Tp = double, _Alloc = EFL_Allocator<double>]'
/export/home/edge/EDGE/edge/src/ETP/EVS/PVA/PVA_ValueTableColumnImpl.h:779:
instantiated from `void PVA_ValueTableColumnImpl
<T>::add(T) [with T = double]'
/export/home/edge/EDGE/edge/src/ETP/EVS/PVA/PVA_ValueTableColumnImpl.h:1231:
instantiated from here
/usr/local/include/c++/3.3.2/bits/stl_vector.h:97: error: invalid
conversion
from `void*' to `double*'
/usr/local/include/c++/3.3.2/bits/stl_vector.h: In member function
`_Tp*
std::_Vector_alloc_base<_Tp, _Allocator, _IsStatic>::_M_allocate(long
unsigned int) [with _Tp = float, _Allocator = EFL_Allocator<float>,
bool
_IsStatic = false]':
/usr/local/include/c++/3.3.2/bits/vector.tcc:236: instantiated from
`void std::vector<_Tp, _Alloc>::_M_insert_aux(__gnu_cxx:
:__normal_iterator<_Tp*, std::vector<_Tp, _Alloc, const _Tp&) [with
_Tp = float, _Alloc = EFL_Allocator<float>]'
/usr/local/include/c++/3.3.2/bits/stl_vector.h:603: instantiated from
`void std::vector<_Tp, _Alloc>::push_back(const _Tp&)
[with _Tp = float, _Alloc = EFL_Allocator<float>]'
/export/home/edge/EDGE/edge/src/ETP/EVS/PVA/PVA_ValueTableColumnImpl.h:779:
instantiated from `void PVA_ValueTableColumnImpl
<T>::add(T) [with T = float]'
/export/home/edge/EDGE/edge/src/ETP/EVS/PVA/PVA_ValueTableColumnImpl.h:1241:
instantiated from here
/usr/local/include/c++/3.3.2/bits/stl_vector.h:97: error: invalid
conversion
from `void*' to `float*'

But the same thing got compiled with 32 bit compilation. No clues, why
its failing to convert from void* to long*, double*, float*, short*
with
only 64 bit compilation...

Thanks in Advance...

Sep 12 '06 #1
2 13421
tk*********@gmail.com writes:
But the same thing got compiled with 32 bit compilation. No clues, why
its failing to convert from void* to long*, double*, float*, short*
with
only 64 bit compilation...
At first, you need to show the code in question, since noone can tell
what line 97 of bits/stl_vector.hpp of your version of gcc is without
downloading it.

Then, this question is more suited for a gcc-secific group, since
c.l.c++ is more targetted to platform independent discussion.

Jens
Sep 12 '06 #2
tk*********@gmail.com wrote:
Hi all,

uname -a
SunOS cbmrsd1a1 5.10 Generic_118833-17 sun4us sparc FJSV,GPUZC-M

g++ -v
Reading specs from
/usr/local/lib/gcc-lib/sparc-sun-solaris2.10/3.3.2/specs
Configured with: ../configure --with-as=/usr/ccs/bin/as
--with-ld=/usr/ccs/bin/ld --disable-nls
Thread model: posix
gcc version 3.3.2

With 32 bit compilation, I compiled my application code successfully -
But I got the following errors when I tried 64-bit compilation by
giving options (-m64, -mcpu=v9) -

/usr/local/bin/g++ -m64 -mcpu=v9 -c -o PVA/PVA_ValueTable.o
PVA/PVA_ValueTable.cpp

/usr/local/include/c++/3.3.2/bits/stl_vector.h: In member function
`_Tp*
std::_Vector_alloc_base<_Tp, _Allocator, _IsStatic>::_M_allocate(long
unsigned int) [with _Tp = double, _Allocator = EFL_Allocator<double>,
bool
_IsStatic = false]':
/usr/local/include/c++/3.3.2/bits/vector.tcc:236: instantiated from
`void std::vector<_Tp, _Alloc>::_M_insert_aux(__gnu_cxx:
:__normal_iterator<_Tp*, std::vector<_Tp, _Alloc, const _Tp&) [with
_Tp = double, _Alloc = EFL_Allocator<double>]'
/usr/local/include/c++/3.3.2/bits/stl_vector.h:603: instantiated from
`void std::vector<_Tp, _Alloc>::push_back(const _Tp&)
[with _Tp = double, _Alloc = EFL_Allocator<double>]'
/export/home/edge/EDGE/edge/src/ETP/EVS/PVA/PVA_ValueTableColumnImpl.h:779:
instantiated from `void PVA_ValueTableColumnImpl
<T>::add(T) [with T = double]'
/export/home/edge/EDGE/edge/src/ETP/EVS/PVA/PVA_ValueTableColumnImpl.h:1231:
instantiated from here
/usr/local/include/c++/3.3.2/bits/stl_vector.h:97: error: invalid
conversion
from `void*' to `double*'
/usr/local/include/c++/3.3.2/bits/stl_vector.h: In member function
`_Tp*
std::_Vector_alloc_base<_Tp, _Allocator, _IsStatic>::_M_allocate(long
unsigned int) [with _Tp = float, _Allocator = EFL_Allocator<float>,
bool
_IsStatic = false]':
/usr/local/include/c++/3.3.2/bits/vector.tcc:236: instantiated from
`void std::vector<_Tp, _Alloc>::_M_insert_aux(__gnu_cxx:
:__normal_iterator<_Tp*, std::vector<_Tp, _Alloc, const _Tp&) [with
_Tp = float, _Alloc = EFL_Allocator<float>]'
/usr/local/include/c++/3.3.2/bits/stl_vector.h:603: instantiated from
`void std::vector<_Tp, _Alloc>::push_back(const _Tp&)
[with _Tp = float, _Alloc = EFL_Allocator<float>]'
/export/home/edge/EDGE/edge/src/ETP/EVS/PVA/PVA_ValueTableColumnImpl.h:779:
instantiated from `void PVA_ValueTableColumnImpl
<T>::add(T) [with T = float]'
/export/home/edge/EDGE/edge/src/ETP/EVS/PVA/PVA_ValueTableColumnImpl.h:1241:
instantiated from here
/usr/local/include/c++/3.3.2/bits/stl_vector.h:97: error: invalid
conversion
from `void*' to `float*'

But the same thing got compiled with 32 bit compilation. No clues, why
its failing to convert from void* to long*, double*, float*, short*
with
only 64 bit compilation...

Thanks in Advance...
For a guide on how to post on this newsgroup, please see point 5.8 of
Mashall Clines excellent FAQ:
http://www.parashift.com/c++-faq-lite/how-to-post.html

One requirement would be to send a complete and minimal testcase.
Something like:

int main() {
void *p;
double *d = p; // works in C, compile error in C++
}

int main() {
void *p;
double *d = (double *) p; // works for C and C++
}

It is possible, that this has to do with malloc and the grey area of
grateful incompatibilities between C/C++ , but this stuff is over my
head. Just do the "right thing" in the first place (which, according to
P.J. Plauger: http://www.thescripts.com/forum/post844763-55.html) is
using explicit casts, as given in my second example. In your case the
bug seems to be not in your own code, but in the library.

I thus think, you are in the wrong newsgroup, a more helpful place
would probably be http://gcc.gnu.org/ml/gcc-help/ as this seems to be a
bug with a very specific std library version of a very specific
compiler, that probably has been fixed for several years.

Yours, Felix

Sep 12 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: jeff regoord | last post by:
A user inputs a float value. The scanf() function gets the value. However, I need to create an error handler with an if else statement saying invalid input if the input is not a number. Does...
5
by: spoilsport | last post by:
Ive got to write a multi-function program and I'm plugging in the functions but I keep getting this error from line 40. Im new to this and cant find an answer anywhere. Sam #include...
31
by: Bjørn Augestad | last post by:
Below is a program which converts a double to an integer in two different ways, giving me two different values for the int. The basic expression is 1.0 / (1.0 * 365.0) which should be 365, but one...
1
by: hunter hou | last post by:
Hello,Please look at the following code(from C++ in a nutshell) and my questions.Thanks,***Hunter... typedef void (*strproc)(const char*); void print(const char* str) { std::cout << "const...
14
by: Richard G. Riley | last post by:
Would it be wrong to use "implicit casting" instead of the standards "implicit conversion" when talking about implicit conversions between certain data types. The standard mentions "explicit...
11
by: Martin Jørgensen | last post by:
Hi, I'm using this alloc_mem-function: - - - - - - - - - - - - - - - - - - - - - - - - void *alloc_mem (size_t num_elems, size_t elem_size, char *filename, int line, size_t *total_mem) {
3
by: Gary Wessle | last post by:
Hi I am trying to return a derived type pointer as the base type pointer and the compiler is complaining, here is what I mean. class A { public: A(){} virtual void lol()=0; };
4
by: tom | last post by:
I have a code segment list below, for the function call "calc()" in the main function, a standard conversion from "double"->"int" is made while "double"->"LongDouble" is also viable, does anyone...
1
by: BSand0764 | last post by:
I'm getting an error that I can't seem to resolve. When I compile the Functor related logic in a test program, the files compile and execute properly (see Listing #1). However, when I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.