Skip to content

fix Issue 19463 - DIP1008 - _d_newclass is called instead of _d_newTh…#9481

Merged
WalterBright merged 1 commit intodlang:masterfrom
WalterBright:fix19463
Mar 26, 2019
Merged

fix Issue 19463 - DIP1008 - _d_newclass is called instead of _d_newTh…#9481
WalterBright merged 1 commit intodlang:masterfrom
WalterBright:fix19463

Conversation

@WalterBright
Copy link
Member

…rowable

Well, this is embarrassing. I must have never checked that code in. The trouble is, I'm not sure how to test it, other than manually checking the output which I've done.

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @WalterBright!

Bugzilla references

Auto-close Bugzilla Severity Description
19463 major DIP1008 - _d_newclass is called instead of _d_newThrowable

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub fetch digger
dub run digger -- build "master + dmd#9481"

@thewilsonator
Copy link
Contributor

A simple shell test of ! ( dmd file.d -o file.o && nm file.o | grep _d_new_class) should do the trick.

@Geod24
Copy link
Member

Geod24 commented Mar 24, 2019

Well, this is embarrassing. I must have never checked that code in. The trouble is, I'm not sure how to test it, other than manually checking the output which I've done.

Two options I can think of:

  • In a test, define _d_newClass to be assert(0) so calling it would crash the binary
  • Check the resulting binary's symbol table

The first option has the advantage of being rather simple and platform-independent

@WalterBright
Copy link
Member Author

Unfortunately, even in a trivial program _d_newclass is being called from elsewhere, and that idea fails. So it's the script plan.

@thewilsonator
Copy link
Contributor

program

Thats why I suggested an object file.

@WalterBright
Copy link
Member Author

@thewilsonator I added a script, can you please have a look at it? Not very experienced with scripts.

@thewilsonator
Copy link
Contributor

I hate script tests too, but that looks fine to me. We'll have to see what the autotester thinks.

@WalterBright
Copy link
Member Author

@atilaneves can you please look into the buildkite/dmd failure, as it is kaliedoscope

@thewilsonator
Copy link
Contributor

Seems to be a problem with exception.toString

@thewilsonator
Copy link
Contributor

e.g.

tests/ut/wrap/traits.d:61 - Expected: "Unsupported function type double(int) for foo"
tests/ut/wrap/traits.d:61 -      Got: ""

@WalterBright
Copy link
Member Author

This PR also appears to resolve https://issues.dlang.org/show_bug.cgi?id=19317

@jacob-carlborg
Copy link
Contributor

jacob-carlborg commented Mar 24, 2019

Isn't it better to check that _d_newThrowable is called? Implement that function, in the implementation change a module level variable and assert that is changed correctly.

Unfortunately, even in a trivial program _d_newclass is being called from elsewhere, and that idea fails.

Perhaps check which ClassInfo is passed and assert only when it matches the ClassInfo of the thrown class.

@atilaneves
Copy link
Contributor

I pushed and tagged a new excel-d, should work now.

@WalterBright
Copy link
Member Author

Added test case from https://issues.dlang.org/show_bug.cgi?id=19317

@WalterBright
Copy link
Member Author

Thanks, @atilaneves !

@WalterBright
Copy link
Member Author

@atilaneves sadly, it's still failing kaleidoscope

@atilaneves
Copy link
Contributor

@WalterBright It's failing on the old tag (0.4.1), I pushed the new tag (0.4.2) to the wrong remote by mistake. Should work now.

@WalterBright
Copy link
Member Author

Thank you, @atilaneves ! Now, if only @thewilsonator or @wilzbach would approve this!

@thewilsonator
Copy link
Contributor

This PR also appears to resolve https://issues.dlang.org/show_bug.cgi?id=19317

Please adjust the commit message to reflect that so the dlang bot picks up on it.

@WalterBright
Copy link
Member Author

I resolved 19317 as a duplicate of 19463, and the test case for it was added to this PR.

@WalterBright WalterBright merged commit dfbe5d0 into dlang:master Mar 26, 2019
@WalterBright WalterBright deleted the fix19463 branch March 26, 2019 04:46
@thewilsonator
Copy link
Contributor

OK.



$DMD -c -dip1008 -m${MODEL} -of${OUTPUT_BASE}${OBJ} -I${EXTRA_FILES} ${EXTRA_FILES}/${TEST_NAME}.d
!(nm ${OUTPUT_BASE}${OBJ} | grep _d_newclass)
Copy link
Contributor

Choose a reason for hiding this comment

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

@WalterBright As far as I understand this verifies that _d_newclass is not called, not that _d_newThrowable is called. I recommend implementing _d_newThrowable instead and verify it's getting called. This way a shell script is not required.

@rainers
Copy link
Member

rainers commented Mar 28, 2019

Well, this is embarrassing.

Still embarrassing that this now always calls _d_newThrowable, irrespective of whether -dip1008 is specified or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants