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

Clang: Flexible array member with non-trivial destruction #2

Closed
mratsim opened this issue Apr 3, 2018 · 2 comments
Closed

Clang: Flexible array member with non-trivial destruction #2

mratsim opened this issue Apr 3, 2018 · 2 comments

Comments

@mratsim
Copy link
Contributor

mratsim commented Apr 3, 2018

Currently tests are failing for me on MacOS with Clang:

Error: execution of an external compiler program 'clang++ -c  -w -I/Users/<User>/.nimble/pkgs/ttmath-0.5.0  -I'/Users/<User>/.choosenim/toolchains/nim-#devel/lib' -o /Users/<User>/Programming/Status/nimbus/tests/nimcache/nimbus_stack_test.o /Users/<User>/Programming/Status/nimbus/tests/nimcache/nimbus_stack_test.cpp' failed with exit code: 1

/Users/<User>/Programming/Status/nimbus/tests/nimcache/nimbus_stack_test.cpp:242:29: error: flexible array member 'data' of type 'TY_fSgjjjotfhO8wSAxXj6bfw []' with non-trivial destruction
  TY_fSgjjjotfhO8wSAxXj6bfw data[SEQ_DECL_SIZE];

The offending line is:

struct tySequence_sp47cI5UpQ9bwXDfsT164pg : TGenericSeq {
  TY_fSgjjjotfhO8wSAxXj6bfw data[SEQ_DECL_SIZE];
};

It is used at several places in the generated C++ code, full output available here.

Edit: GCC-7 does not have the same issue

@mratsim mratsim changed the title Flexible array member with non-trivial destruction Clang: Flexible array member with non-trivial destruction Apr 3, 2018
mratsim added a commit that referenced this issue Apr 3, 2018
@arnetheduck
Copy link
Member

The issue here is SEQ_DECL_SIZE which is declared empty (in nimbase.h) - this leads to an empty ("flexible") array - that's not part of the C++ standard (it's a C only feature) so llvm is right to reject it, even if it happens to work for gcc (I wouldn't be surprised if gcc rejected it in pedantic mode or with extensions turned off)

@mratsim
Copy link
Contributor Author

mratsim commented Apr 4, 2018

Closed by 1d81a7c and #5

@mratsim mratsim closed this as completed Apr 4, 2018
stefantalpalaru added a commit that referenced this issue Oct 28, 2019
jlokier added a commit that referenced this issue Apr 29, 2021
Note: This is a WIP patch with an intentionally small value, to verify that it
_fails_ CI and is therefore reducing the stack limit.  It will be replaced with
the correct value after.

Turns out 400k stack is large enough for 32-bit Windows to pass, maybe.
Let's try 200k.

Signed-off-by: Jamie Lokier <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants