Comments (2)
After further investigation it turns out that the real problem is another one.
This works:
p print(int[SIZE][SIZE] _) {
int[SIZE][SIZE] grid = {
{ 3, 0, 6, 5, 0, 8, 4, 0, 0 },
{ 5, 2, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 8, 7, 0, 0, 0, 0, 3, 1 },
{ 0, 0, 3, 0, 1, 0, 0, 8, 0 },
{ 9, 0, 0, 8, 6, 3, 0, 0, 5 },
{ 0, 5, 0, 0, 9, 0, 6, 0, 0 },
{ 1, 3, 0, 0, 0, 0, 2, 5, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 7, 4 },
{ 0, 0, 5, 2, 0, 6, 3, 0, 0 }
};
foreach int[SIZE] row : grid {
foreach int cell : row {
printf("%d ", cell);
}
printf("\n");
}
}
while this crashes the compiler:
p print(int[SIZE][SIZE] grid) {
foreach int[SIZE] row : grid {
foreach int cell : row {
printf("%d ", cell);
}
printf("\n");
}
}
So it seams that parameters behave differently than var declarations.
from spice.
The solution is now to not allow dynamically sized arrays as function/procedure parameters.
from spice.
Related Issues (20)
- Crash when trying to access non-primitive struct fields under certain circumstances
- Std not accessible on Linux HOT 1
- Crash if the compiler tries to set a differently sized array to a globally defined constant
- External struct assertion error
- Compiler stuck in certain situations HOT 1
- Failed to call compiler executable within Docker container HOT 1
- Logical and/or function verification error HOT 2
- Could not use global variables in other modules HOT 1
- Segfault when function name matches the import identifier HOT 1
- Compiler runs forever if accessing a member by omitting the `this.` prefix
- Crash when `sizeof` expects a value, but gets a type
- Bug in nested in-place array initialization HOT 1
- Assertion fails for external struct, passed to another external function
- Faulty variable value updates
- `char*` to `string` cast only for strings with length greater or equal 8 HOT 1
- Error when trying to build HOT 2
- Error using dev-setup script on Linux amd64 HOT 8
- Improve compiler '-version' info HOT 1
- Split up type information from Type to Type and QualType HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spice.