Thread overview | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
June 07, 2013 -profile | ||||
---|---|---|---|---|
| ||||
Compiling with -profile and without -release Gives the following error (not exactly but the best I can recall) balancedParens is not nothrow safe pure With -release and -profile all is fine. Builds fine without -profile. Simple question is why? |
June 07, 2013 Re: -profile | ||||
---|---|---|---|---|
| ||||
Posted in reply to Anthony Goins | Anthony Goins:
> Simple question is why?
Looks like a little compiler bug. Please create a minimal example that shows the problem. If it's a real problem then it's for Bugzilla.
Bye,
bearophile
|
June 07, 2013 Re: -profile | ||||
---|---|---|---|---|
| ||||
Posted in reply to Anthony Goins | Anthony Goins:
> Simple question is why?
I am compiling this code with -profile, and I don't see errors:
import std.string: balancedParens;
void main() {
assert(balancedParens("[[]]", '[', ']'));
}
Bye,
bearophile
|
June 07, 2013 Re: -profile | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | On Friday, 7 June 2013 at 21:39:26 UTC, bearophile wrote: > Anthony Goins: > >> Simple question is why? > > I am compiling this code with -profile, and I don't see errors: > > > import std.string: balancedParens; > void main() { > assert(balancedParens("[[]]", '[', ']')); > } > > > Bye, > bearophile okay found it module profiletest; import std.path; void main() { assert(globMatch("foo.bar", "*")); } dmd -profile profiletest.d /usr/include/dmd/phobos/std/path.d(2187): Error: balancedParens is not nothrow /usr/include/dmd/phobos/std/path.d(2188): Error: balancedParens is not nothrow globMatch is @safe pure nothrow balancedParens is not nothrow -release ignores contracts, right? |
June 07, 2013 Re: -profile | ||||
---|---|---|---|---|
| ||||
Posted in reply to Anthony Goins | On Friday, 7 June 2013 at 23:42:58 UTC, Anthony Goins wrote:
> On Friday, 7 June 2013 at 21:39:26 UTC, bearophile wrote:
>> Anthony Goins:
>>
>>> Simple question is why?
>>
>> I am compiling this code with -profile, and I don't see errors:
>>
>>
>> import std.string: balancedParens;
>> void main() {
>> assert(balancedParens("[[]]", '[', ']'));
>> }
>>
>>
>> Bye,
>> bearophile
>
> okay found it
>
> module profiletest;
> import std.path;
>
> void main()
> {
> assert(globMatch("foo.bar", "*"));
> }
>
> dmd -profile profiletest.d
> /usr/include/dmd/phobos/std/path.d(2187): Error: balancedParens is not nothrow
> /usr/include/dmd/phobos/std/path.d(2188): Error: balancedParens is not nothrow
>
>
> globMatch is @safe pure nothrow
> balancedParens is not nothrow
> -release ignores contracts, right?
oops forgot to say
balancedParens is called from the 'in' contract of globMatch.
Is this even worth a bug report?
|
June 07, 2013 Re: -profile | ||||
---|---|---|---|---|
| ||||
Posted in reply to Anthony Goins | Anthony Goins:
> Is this even worth a bug report?
Yes, it's worth a bug report in Bugzilla, it's a (small) Phobos Bug. I confirmed its presence.
Bye,
bearophile
|
June 08, 2013 Re: -profile | ||||
---|---|---|---|---|
| ||||
Posted in reply to Anthony Goins | Anthony Goins: > Is this even worth a bug report? http://d.puremagic.com/issues/show_bug.cgi?id=10295 Bye, bearophile |
June 08, 2013 Re: -profile | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | On Friday, 7 June 2013 at 23:57:37 UTC, bearophile wrote:
> Anthony Goins:
>
>> Is this even worth a bug report?
>
> Yes, it's worth a bug report in Bugzilla, it's a (small) Phobos Bug. I confirmed its presence.
>
> Bye,
> bearophile
Thank you for all your help. Not just here but throughout the forums.
One more question though...
What is the error here :)
1. dmd profiletest.d
should fail because balancedParens is not nothrow
even though it is called from a contract.
2. dmd -profile profiletest.d
should succeed because nothrow, @safe, pure don't apply to contracts
|
June 08, 2013 Re: -profile | ||||
---|---|---|---|---|
| ||||
Posted in reply to Anthony Goins | Anthony Goins:
> What is the error here :)
> 1. dmd profiletest.d
> should fail because balancedParens is not nothrow
> even though it is called from a contract.
>
> 2. dmd -profile profiletest.d
> should succeed because nothrow, @safe, pure don't apply to contracts
I think -profile and pre-conditions should not be correlated. That's why I have reported this bug as a dmd bug instead just of a Phobos bug.
I am not sure what's the right answer. I think the right answer is 1.
Bye,
bearophile
|
Copyright © 1999-2021 by the D Language Foundation