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

Probable gcc bug with symptom in h_carray_append #121

Open
mrdomino opened this issue Jan 4, 2015 · 3 comments
Open

Probable gcc bug with symptom in h_carray_append #121

mrdomino opened this issue Jan 4, 2015 · 3 comments

Comments

@mrdomino
Copy link

mrdomino commented Jan 4, 2015

Minimalish example: https://gist.github.com/mrdomino/5f7de7b4aa9f74d13747

That segfaults (dereferencing 0) on -O3 and exits normally on -O2. Trial elimination of optimization flags reveals that -O -fvect-cost-model(=(dynamic|unlimited)|) -ftree-loop-vectorize is sufficient to trigger the bad behavior. Adding fprintf(stderr, "%zu\n", i); to the loop at datastructures.c:30 (the h_carray_append array->used loop) also causes the code to exit normally.

This always fails at exactly 33 elements or greater (so at the capacity jump to 64), and completes successfully on 32 or fewer elements. It has nothing to do with the size of thingy.data, but seems to depend on act_thingy getting a TT_SEQUENCE.

@mrdomino
Copy link
Author

mrdomino commented Jan 4, 2015

Experimentally, the attached gist doesn't fail at -O3, but does fail at -O2 -fvect-cost-model=unlimited -ftree-loop-vectorize. The parser the example is extracted from fails at -O3.

@mrdomino
Copy link
Author

mrdomino commented Jan 4, 2015

This is on Arch x64.

$ uname -a
Linux wooten 3.17.6-1-ARCH #1 SMP PREEMPT Sun Dec 7 23:43:32 UTC 2014 x86_64 GNU/Linux
$ gcc --version |head -n1
gcc (GCC) 4.9.2 20141224 (prerelease)

@mrdomino
Copy link
Author

mrdomino commented Jan 4, 2015

And just to clarify, these are hammer compilation flags. The gist doesn't need any special flags at all.

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

1 participant