__assert.c Wpointer-to-int-cast
Gedare Bloom
gedare at rtems.org
Tue Oct 14 02:21:26 UTC 2014
Hi,
cpukit/libcsupport/src/__assert.c52:43:
warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
rtems_fatal( RTEMS_FATAL_SOURCE_ASSERT, (rtems_fatal_code) &assert_context );
This code casts the address of assert_control into an
rtems_fatal_code, which is uint32_t. I assume it was done so one can
find the context while debugging, but it is non-portable behavior for
64-bit addresses.
We could fix this a few ways:
1) Make rtems_fatal_code a uintptr_t type so it gets the same width as a pointer
2) Make rtems_fatal accept a uintptr_t type so it can get a wider int
than rtems_fatal_code
3) Don't allow this abuse of rtems_fatal. A workaround could be to
pass the offset in the frame of the assert_control. Less clean for
debugging though.
-Gedare
More information about the devel
mailing list