Custom Query (145 matches)
Results (16 - 18 of 145)
Ticket | Resolution | Summary | Owner | Reporter |
---|---|---|---|---|
#214 | fixed | Assertion with sized generic parameter breaks the declaring function's body | ||
Description |
A sized generic struct cannot be instantiated in a function with an assertion that takes this struct as a parameter. forall( otype X ) struct wrapper { X item; }; forall( otype Y #ifndef HIDE_ERROR | { void unusedHelper( wrapper(Y) ); } #endif ) void f() { wrapper(Y) myvar; } Actual (plain): GCC error: '_sizeof_S7wrapper_Y1Y_' undeclared Actual (-DHIDE_ERROR), Expected (both): Compiler success
Desired for the following case in the memory allocator. Here, the affected function is forall( dtype T | sized(T) ) { union U_fill { char c; T * a; T t; }; struct SS_fill { char tag; U_fill(T) fill; }; } static inline forall( dtype T | sized(T) ) { T * $balloc_internal( void * Resize, void * Realloc, size_t Align, size_t Dim, SS_fill(T) Fill) { return (T*)0p; } // $balloc_internal forall( ttype TT | { T * $balloc_internal( void *, void *, size_t, size_t, SS_fill(T), TT ); } ) { T * balloc( TT all ) { return $balloc_internal( (void*)0p, (void*)0p, 16, 1, (SS_fill(T)){'0', (U_fill(T)){'0'}}, all); } // balloc } // distribution TT } // distribution T int main() { int * abc = balloc(); free(abc); return 0; } Actual: GCC error: '_sizeof_S7SS_fill_Y1T_' undeclared Expected: Compiler success
This revision shows the assertion is at fault (but it does not provide a workaround). The assumption of a TT-fitting forall( dtype T | sized(T) ) { union U_fill { char c; T * a; T t; }; struct SS_fill { char tag; U_fill(T) fill; }; } static inline forall( dtype T | sized(T) ) { T * $balloc_internal( void * Resize, void * Realloc, size_t Align, size_t Dim, SS_fill(T) Fill) { return (T*)0p; } // $balloc_internal forall( ttype TT ) { T * $balloc_internal( void *, void *, size_t, size_t, SS_fill(T), TT ); T * balloc( TT all ) { return $balloc_internal( (void*)0p, (void*)0p, 16, 1, (SS_fill(T)){'0', (U_fill(T)){'0'}}, all); } // balloc } // distribution TT } // distribution T int main() { int * abc = balloc(); free(abc); return 0; }
Actual and expected: Compiler success, linker failure to find |
|||
#212 | fixed | Revert InferUnion change in new-ast | ||
Description |
The partially unresolved inferred parameters are actually useful as suggested by test results. In new-ast an optimization caused this to be no longer possible. The previous change silenced errors in this case and dropped all unresolved inferred parameters, assuming those alternatives are always eliminated. Unfortunately, this does not always happen, so the memory optimization makes resolver incorrect. Affected code: ResolvExpr::InferMatcher? at SatisfyAssertions?.cpp:226 Expr::InferUnion? at Expr.hpp:68 Old implementation: ResolvExpr::InferMatcher? at ResolveAssertions?.cc:327 |
|||
#204 | fixed | Conversion cost ignores type parameters | ||
Description |
The conversionCost function incorrectly produces a cost of zero between parametric types. with declaration forall (dtype DT) struct A; A(int) aint; the invalid cast (A(char)) aint is accepted by the compiler. There is an algorithmic error in conversionCost: struct types are already handled in typesCompatible call, which correctly considers type parameters. However, incompatible structs are passed into ConversionCost? pass again which only consider names and not parameters. |