Custom Query (145 matches)
Results (58 - 60 of 145)
Ticket | Owner | Reporter | Resolution | Summary |
---|---|---|---|---|
#182 | fixed | Static Const Global variable segfault in generated code | ||
Description |
The following code segfaults when run: static const char foo = -1; int main() {} |
|||
#189 | fixed | Reference and pointer types allow unsound initialization | ||
Description |
This code implies a reinterpret pointer cast. But the code does not do a cast. int main() { float x = 3.14; float & xx = x; int & yy = xx; // not sound int y = yy; printf("%d\n", y); } Expected: Compiler error at "not sound" line, saying cannot initialize int & from float &. Actual: Compiler success; program prints 1078523331 which is the decimal value of 0x4048f5c3, which is the IEEE 754 representation of 3.14. Note that this unsoundness also happens at function return. This allows for: forall (dtype T, dtype S) T & anycvt( S & s ) { return s; // not sound } int main() { float x = 3.14; int y = anycvt(x); printf("%d\n", y); } Expected: Compiler error at "not sound" line, saying cannot initialize T & from S &. Actual: Compiler success; program prints 1078523331. This behaviour also occurs with pointers. Furthermore, this example is trimmed such that it can run with -n (no prelude). struct A {}; struct B {}; void f() { A * ap; B * bp = ap; // not sound } Expected: Compiler error at "not sound" line, saying cannot initialize B* from A*.
Actual: |
|||
#192 | fixed | Can't catch exception raised by default resumption handler of another exception | ||
Description |
#include <exception.hfa> TRIVIAL_EXCEPTION( A ); TRIVIAL_EXCEPTION( B ); void defaultResumptionHandler( B & ) { printf("DRH B\n"); } void defaultResumptionHandler( A & ) { printf("DRH A\n"); throwResume (B){}; } int main() { try { throwResume (A){}; } catchResume (B *) { printf("caught B\n"); } } Expect DRH A caught B Actual DRH A DRH B |