I'm writing an application for a VxWorks
project and hence use the diab
compiler. Now, I'm trying to cast a void*
to a MyType*
but I get some weird error, what am I doing wrong I'm wondering, my code:
int switch_transaction_management(map_type_t pType, void* pData)
{
switch_port_t pPort;
switch_VID_t pVid;
switch_vpws_t pVpws;
switch (pType) {
case MAP_TYPE_PORT:
pPort = (switch_port_t*) pData;
...
...
and the error I get is:
: internal error: assertion failed: Invalid C99 IL expression kind (./../src/eparse/lower_c99.c, line 3690)
pPort = (switch_port_t*) pData;
Doesn't make any sense to me, anyone?
Your code is incorrect. You have:
switch_port_t pPort;
followed by:
pPort = (switch_port_t*) pData;
You're trying to assign a value of type switch_port_t*
to an object of type switch_port_t
, which is invalid and should have caused the compiler to issue an error message.
The compiler you're using is also incorrect. Rather than issuing an error message, your code has triggered a bug in the compiler itself:
internal error: assertion failed: Invalid C99 IL expression kind (./../src/eparse/lower_c99.c, line 3690)
(The "IL" is probably an abbreviation for "Intermediate Language", something used internally by the compiler.)
You should correct your code (it's likely that that will avoid triggering the compiler bug). I don't know whether you should drop the *
in the cast or change the declaration of pPort
.
You should also, as Deduplicator suggested, report the compiler bug to the maintainers of the compiler you're using. Provide a small test case that exhibits the problem and as much information as seems reasonable (or a little more) about your environment, the version of the compiler you're using, and so forth.