buildit-lang / buildit Goto Github PK
View Code? Open in Web Editor NEWOnline demo without installing at - https://buildit.so/tryit
Home Page: https://buildit.so
License: MIT License
Online demo without installing at - https://buildit.so/tryit
Home Page: https://buildit.so
License: MIT License
Hi, I got a failed assertion recently with the following error message:
buildit/include/builder/static_var.h:117: builder::static_var<T>::~static_var() [with T = double]: Assertion builder_context::current_builder_context->static_var_tuples.back().ptr == (unsigned char *)&val' failed.
I probably made a mistake somewhere in my code; is there a particular situation in which this assertion is triggered? Would be super helpful to know what to look for when I go bug hunting.
Thank you!
buildit/samples/sample27.cpp
buildit.pdf paper, Fig. 7, top of page 4;
constexpr
int power(int base, int exponent) {
int res = 1, x = base;
while (exponent > 1) { // while (exponent > 0) {
if (exponent % 2 == 1)
res = res * x;
x = x * x;
exponent = exponent / 2;
}
return res * x; // return res;
}
static_assert( power(2,0) == 1 ); // FAIL
static_assert( power(2,1) == 2 );
static_assert( power(2,2) == 4 );
As they say in Yorkshire; "Owt to the nowt is one".
Apologies for the OCD pedantry; I know it's just a sample...
Enjoying the read; interesting stuff. Thanks for putting this out here.
There is a bug in the control flow extraction when a block of code that contains a jump target is duplicated because of "failure to merge". This causes the inserted goto to jump to a jump target that is in a different branch. This completely messes up the assumption in loop_finder that gotos and labels are structured.
A sample code that reproduces the bug is as follows -
static void bar(void) { dyn_var<int> k = 0;
dyn_var<int> t = 0;
while (1) {
while (k != 0) {
if (k == 0)
break;
}
while (k != 0) {
}
}
}
Complete example in online tool: https://buildit.so/tryit/?sample=shared&pid=0f5cd93baaaa44ac2992bc4656d178ce
A potential fix would require the label inserter to disentangle the copies and try to maintain the structured loop invariant. This bug was discovered by @VedantParanjape when working on the loop analysis pass.
Please add: mkdir build
to the documentation, or else make silently does nothing.
Also, it is unclear how to actually compile and run the emitted code. The examples seem to output something that can't be input into a C compiler. This is strange for a library which claims to be easy to use.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.