www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - -profile

reply "Anthony Goins" <neontotem gmail.com> writes:
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?
Jun 07 2013
next sibling parent "bearophile" <bearophileHUGS lycos.com> writes:
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
Jun 07 2013
prev sibling parent reply "bearophile" <bearophileHUGS lycos.com> writes:
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
Jun 07 2013
parent reply "Anthony Goins" <neontotem gmail.com> writes:
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?
Jun 07 2013
parent reply "Anthony Goins" <neontotem gmail.com> writes:
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?
Jun 07 2013
next sibling parent reply "bearophile" <bearophileHUGS lycos.com> writes:
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
Jun 07 2013
parent reply "Anthony Goins" <neontotem gmail.com> writes:
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
Jun 07 2013
parent "bearophile" <bearophileHUGS lycos.com> writes:
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
Jun 07 2013
prev sibling parent "bearophile" <bearophileHUGS lycos.com> writes:
Anthony Goins:

 Is this even worth a bug report?
http://d.puremagic.com/issues/show_bug.cgi?id=10295 Bye, bearophile
Jun 07 2013