[trans-mem] undefined reference to a static cloned function
Patrick Marlier
patrick.marlier@unine.ch
Mon Jun 14 08:21:00 GMT 2010
Hello Aldy,
> +element_t*
> +element_alloc (coordinate_t* coordinates, long numCoordinate)
> +{
> + element_t* elementPtr;
> + elementPtr = (element_t*)xmalloc(sizeof(element_t));
> + if (elementPtr) {
> + calculateCircumCircle(elementPtr);
> + }
> + return elementPtr;
> +}
> +
> +__attribute__((transaction_safe))
> +element_t*
> +TMelement_alloc (coordinate_t* coordinates, long numCoordinate)
> +{
> + element_t* elementPtr;
> + elementPtr = (element_t*)xmalloc(sizeof(element_t));
> + if (elementPtr) {
> + calculateCircumCircle(elementPtr);
> + }
> + return elementPtr;
> +}
As we can see here, calculateCircumCircle function can be called into a
transaction_safe function but also in a regular function. So the
function calculateCircumCircle must have the transaction_safe attribute
but...
if calculateCircumCircle is declared and defined like that (without
transaction_safe):
static void
calculateCircumCircle (element_t* elementPtr)
GCC doesn't complain about transaction_safe attribute. The reason could
be that the elementPtr is allocated inside the transaction (is gcc-tm
able to detect that?) but if I modify the function TMelement_alloc to
use a global variable, gcc still doesn't complain. So I don't understand
the behaviour here.
Can you just explain me why it doesn't complain that the
calculateCircumCircle isn't safe? is it a mistake?
Thank you,
Patrick.
More information about the Gcc-patches
mailing list