Skip to content

betterC: send array overflows to C assert#6927

Merged
WalterBright merged 1 commit intodlang:masterfrom
WalterBright:betterC-array
Jul 1, 2017
Merged

betterC: send array overflows to C assert#6927
WalterBright merged 1 commit intodlang:masterfrom
WalterBright:betterC-array

Conversation

@WalterBright
Copy link
Member

So that betterC mode can support runtime array overflow detection.

@dlang-bot
Copy link
Contributor

dlang-bot commented Jun 23, 2017

Thanks for your pull request, @WalterBright!

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

@wilzbach
Copy link
Contributor

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.

@CyberShadow
Copy link
Member

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");
Copy link
Member

@MetaLang MetaLang Jun 23, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible here to include the index that caused the assert?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes but right now I just want it to work.

@WalterBright
Copy link
Member Author

Added switch errors, too.

@WalterBright WalterBright requested a review from MartinNowak June 26, 2017 19:56
Copy link
Member

@andralex andralex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

auto would be better but ok to keep existing style

@WalterBright
Copy link
Member Author

complete C-style asserts everywhere with -betterC?

Yes

@WalterBright WalterBright merged commit 2c02eb4 into dlang:master Jul 1, 2017
@WalterBright WalterBright deleted the betterC-array branch July 1, 2017 00:55

int foo(int[] a, int i)
{
return a[i];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@MartinNowak
Copy link
Member

Sorry, there are literally no active tests for this feature, it shouldn't have been merged.

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

Successfully merging this pull request may close these issues.

7 participants