__assert.c Wpointer-to-int-cast

Joel Sherrill joel.sherrill at oarcorp.com
Tue Oct 14 02:23:59 UTC 2014



On October 13, 2014 9:21:26 PM CDT, Gedare Bloom <gedare at rtems.org> wrote:
>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.

I would lean to 1 or 2.


>-Gedare
>_______________________________________________
>devel mailing list
>devel at rtems.org
>http://lists.rtems.org/mailman/listinfo/devel




More information about the devel mailing list