Custom Query (145 matches)
Results (1 - 3 of 145)
Ticket | Owner | Reporter | Resolution | Summary |
---|---|---|---|---|
#35 | fixed | Function pointer casts are broken | ||
Description |
I need this to work for external scheduling : extern void save( void (*func)() ); void foo( int a ) { save( &foo ); } |
|||
#250 | fixed | Incorrect address calculation of polymorphc object on clean-up | ||
Description |
Given the following code. The handling of destructors is broken unless the 'sized' assertion is removed. trait trt(L & | sized(L)) {}; forall(L & | trt(L)) struct object { L * f2; }; forall(L & | trt(L)) void bar(L * ) { object(L) obj; } Without the size assertion, the generated code is fairly simple since the compiler correctly detects that the layout of the object is indenpendent of 'L'. void _X3barQ1_0_0_0__Fv_PBD0__1(__attribute__ ((unused)) void *__anonymous_object2142){ void __cleanup_dtor17(struct object *_dst){ { ((void)_X11_destructorQ1_0_0_0__Fv_S6object_BD0__autogen___1(_dst)); } } __attribute__ ((cleanup(__cleanup_dtor17))) struct object _X3objS6object_Y1L__2; { ((void)_X12_constructorQ1_0_0_0__Fv_S6object_BD0__autogen___1((&_X3objS6object_Y1L__2))); } }
Note the use of When adding the 'sized' assertion the code generations changes to use a char array rather than a static struct: void _X3barQ1_0_0_0__Fv_PBD0__1(__attribute__ ((unused)) unsigned long int _sizeof_Y1L, __attribute__ ((unused)) unsigned long int _alignof_Y1L, __attribute__ ((unused)) void *__anonymous_object2142){ void __cleanup_dtor17(void *_dst){ { ((void)_X11_destructorQ1_0_0_0__Fv_S6object_BD0__autogen___1(_sizeof_Y1L, _alignof_Y1L, ((void *)_dst))); } } unsigned long int _sizeof_S6object_Y1L_; unsigned long int _alignof_S6object_Y1L_; unsigned long int _offsetof_S6object_Y1L_[1]; ((void)_layoutof_object((&_sizeof_S6object_Y1L_), (&_alignof_S6object_Y1L_), _offsetof_S6object_Y1L_, _sizeof_Y1L, _alignof_Y1L)); __attribute__ ((aligned(8))) char _buf32[_sizeof_S6object_Y1L_]; __attribute__ ((cleanup(__cleanup_dtor17))) void *_X3objS6object_Y1L__2 = _buf32; { ((void)_X12_constructorQ1_0_0_0__Fv_S6object_BD0__autogen___1(_sizeof_Y1L, _alignof_Y1L, ((void *)_X3objS6object_Y1L__2))); } }
Note that the cleanup is on the pointer rather than the buffer therefore the correct address is the value of
This is incorrect because |
|||
#39 | fixed | Global const array initialization broke with references | ||
Description |
const int fred[1] = { -2 }; // fails for const and negative value test.c:8 error: No reasonable alternatives for expression Cast of: Applying untyped: Name: ?[?] ...to: Variable Expression: fred: array of const signed int with dimension of Cast of: constant expression (1 1: one_t) to: long unsigned int with environment: Types: Non-types: Variable Expression: _index0: signed int to: reference to signed int error: No reasonable alternatives for expression Cast of: Applying untyped: Name: ?[?] ...to: Variable Expression: fred: array of const signed int with dimension of Cast of: constant expression (1 1: one_t) to: long unsigned int with environment: Types: Non-types: Variable Expression: _index0: signed int to: reference to signed int |