Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails on global uninitialised structs #155

Open
skade opened this issue Jul 4, 2017 · 2 comments
Open

Fails on global uninitialised structs #155

skade opened this issue Jul 4, 2017 · 2 comments

Comments

@skade
Copy link

skade commented Jul 4, 2017

Consider the following C code:

typedef struct _test test;

struct _test {
   int test;
};

static test bar;

Corrode fails:

$ corrode uninitialized-global.c
("uninitialized-global.c": line 7): illegal initializer; check whether a real C compiler accepts this:
    { }

gcc accepts it:

$ gcc -c uninitialized-global.c -o test.o
$ echo $?
0
@skade
Copy link
Author

skade commented Jul 4, 2017

I would be willing to provide a patch if I had a rough idea on where to look and to approach the problem. (I got the Rust experience and a bit of Haskell, but not the Corrode experience)

@flip111
Copy link

flip111 commented Nov 14, 2017

https://github.com/jameysharp/corrode/blob/34053342c2f1ca04f23ad94d67057f14e74d9fb9/src/Language/Rust/Corrode/C.md#declarations i guess

try import Debug.Trace (trace) then expr <- trace ("faulty Ctype maybe? " ++ show ty) $ interpretInitializer ty (fromMaybe (CInitList [] node) minit)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants