betterC: send array overflows to C assert#6927
Conversation
|
Thanks for your pull request, @WalterBright! Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. |
|
Hmm @CyberShadow - should I just deploy dlang/dlang-bot#87? I am pretty sure Martin will be okay and otherwise we can always revert it - it's not like there's anything depending on the bot's codebase. |
d7a934c to
90d116e
Compare
|
Up to you. I don't think it's urgent unless someone finds it annoying. |
| { | ||
| if (global.params.betterC) | ||
| { | ||
| return callCAssert(irs, loc, null, null, "array overflow"); |
There was a problem hiding this comment.
Is it possible here to include the index that caused the assert?
There was a problem hiding this comment.
Yes but right now I just want it to work.
90d116e to
665ab6a
Compare
|
Added switch errors, too. |
andralex
left a comment
There was a problem hiding this comment.
Great, so now we have complete C-style asserts everywhere with -betterC?
| elem *econd = toElem(ae.e1, irs); | ||
|
|
||
| //printf("callCAssert.toElem() %s\n", e.toChars()); | ||
| Module m = cast(Module)irs.blx._module; |
There was a problem hiding this comment.
auto would be better but ok to keep existing style
Yes |
|
|
||
| int foo(int[] a, int i) | ||
| { | ||
| return a[i]; |
There was a problem hiding this comment.
Not testing much here. We're not even linking the compilable tests.
You should at least run this and grep in the output, at least on some platforms.
|
Sorry, there are literally no active tests for this feature, it shouldn't have been merged. |
So that
betterCmode can support runtime array overflow detection.