View mode: basic / threaded / horizontal-split · Log in · Help
April 13, 2012
In/out contract inheritance in gdc
Hello all,

I've come across a compilation problem with gdc 4.6.3 (the package in the Ubuntu 
repositories).

I have some code, available from
https://github.com/WebDrake/SampleD

... which uses in contracts on some class functions: a base class has one in 
contract for one of its methods (lines 16-26), and a subclass overrides this 
method and provides its own in contract (lines 50-66).

If I compile without the -release switch, e.g.

   gdmd -O -inline -oftest sampled.d

I get the following error:

   sampled.d:50: Error: function [classname].select cannot get frame pointer to
   __require

Is this an instance of this bug?
https://bitbucket.org/goshawk/gdc/issue/78/d1-d2-in-out-contract-inheritance

... or something different?

The code compiles without problem using regular dmd.

'Tis a shame, as in general I'm finding gdc much preferable to dmd -- the code 
it produces is much, much faster!

Thanks and best wishes,

    -- Joe
April 14, 2012
Re: In/out contract inheritance in gdc
Joseph Rushton Wakeling, el 13 de abril a las 23:36 me escribiste:
> Hello all,
> 
> I've come across a compilation problem with gdc 4.6.3 (the package
> in the Ubuntu repositories).
> 
> I have some code, available from
> https://github.com/WebDrake/SampleD
> 
> ... which uses in contracts on some class functions: a base class
> has one in contract for one of its methods (lines 16-26), and a
> subclass overrides this method and provides its own in contract
> (lines 50-66).
> 
> If I compile without the -release switch, e.g.
> 
>    gdmd -O -inline -oftest sampled.d
> 
> I get the following error:
> 
>    sampled.d:50: Error: function [classname].select cannot get frame pointer to
>    __require

Doesn't look exactly like the same problem, but just in case, you might
want to take a look at this bug:
http://d.puremagic.com/issues/show_bug.cgi?id=7699

-- 
Leandro Lucarella (AKA luca)                     http://llucax.com.ar/
----------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------
If you don't know what direction you should take
You don't know where you are
April 14, 2012
Re: In/out contract inheritance in gdc
On 14/04/12 02:11, Leandro Lucarella wrote:
> Doesn't look exactly like the same problem, but just in case, you might
> want to take a look at this bug:
> http://d.puremagic.com/issues/show_bug.cgi?id=7699

Hmmm.  Compiling still fails when -inline is removed from the compiler 
statement, but now there are _two_ errors reported:

gdc -oftest sampled.d

sampled.d:87: Error: function 
sampled.SamplingAlgorithmSkip!(MersenneTwisterEngine!(uint,32,624,397,31,-1727483681u,11,7,-1658038656u,15,-272236544u,18)).SamplingAlgorithmSkip.select 
cannot get frame pointer to __require
sampled.d:50: Error: function 
sampled.SamplingAlgorithmS!(MersenneTwisterEngine!(uint,32,624,397,31,-1727483681u,11,7,-1658038656u,15,-272236544u,18)).SamplingAlgorithmS.select 
cannot get frame pointer to __require
April 17, 2012
Re: In/out contract inheritance in gdc
On 14/04/12 02:11, Leandro Lucarella wrote:
> Doesn't look exactly like the same problem, but just in case, you might
> want to take a look at this bug:
> http://d.puremagic.com/issues/show_bug.cgi?id=7699

Here's a minimal(-ish) example that reproduces the problem (with or without 
-inline statement in place).  The same compiler error arises if you replace in{} 
with out{}.

/////////////////////////////////////////////////////////////
class A
{
      double foo(double x)
      in
      {
            assert(x>0);
      }
      body
      {
            return x+1;
      }
}

class B : A
{
      override double foo(double x)
      in
      {
            assert(x>10);
      }
      body
      {
            return x+10;
      }
}
/////////////////////////////////////////////////////////////

Shall I make a new bug report?  Is it preferred at BitBucket or GitHub?
April 17, 2012
Re: In/out contract inheritance in gdc
On 4/17/2012 9:44 AM, Joseph Rushton Wakeling wrote:
> Shall I make a new bug report? Is it preferred at BitBucket or GitHub?

Please do.  We're still using BitBucket at the moment.
April 17, 2012
Re: In/out contract inheritance in gdc
On 14 April 2012 02:17, Joseph Rushton Wakeling
<joseph.wakeling@webdrake.net> wrote:
> On 14/04/12 02:11, Leandro Lucarella wrote:
>>
>> Doesn't look exactly like the same problem, but just in case, you might
>> want to take a look at this bug:
>> http://d.puremagic.com/issues/show_bug.cgi?id=7699
>
>
> Hmmm.  Compiling still fails when -inline is removed from the compiler
> statement, but now there are _two_ errors reported:
>
> gdc -oftest sampled.d
>
> sampled.d:87: Error: function
> sampled.SamplingAlgorithmSkip!(MersenneTwisterEngine!(uint,32,624,397,31,-1727483681u,11,7,-1658038656u,15,-272236544u,18)).SamplingAlgorithmSkip.select
> cannot get frame pointer to __require
> sampled.d:50: Error: function
> sampled.SamplingAlgorithmS!(MersenneTwisterEngine!(uint,32,624,397,31,-1727483681u,11,7,-1658038656u,15,-272236544u,18)).SamplingAlgorithmS.select
> cannot get frame pointer to __require

I can't reproduce this or the bug in puremagic on my build, so I will
go on the assumption this will be fixed in the 4.7.0 package due to
ship with Ubuntu at the end of the month.


Regards
-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';
April 18, 2012
Re: In/out contract inheritance in gdc
On 17/04/12 22:56, Iain Buclaw wrote:
> I can't reproduce this or the bug in puremagic on my build, so I will
> go on the assumption this will be fixed in the 4.7.0 package due to
> ship with Ubuntu at the end of the month.

Oh, fantastic!  Very pleased to hear that 4.7.0 will be making it into Precise.
April 18, 2012
Re: In/out contract inheritance in gdc
On 17/04/12 21:16, Daniel Green wrote:
> On 4/17/2012 9:44 AM, Joseph Rushton Wakeling wrote:
>> Shall I make a new bug report? Is it preferred at BitBucket or GitHub?
>
> Please do. We're still using BitBucket at the moment.

OK, done: 
https://bitbucket.org/goshawk/gdc/issue/333/in-out-contract-overrides-cause-cannot-get

Following Iain's remarks, this will hopefully be short-lived. :-)
Top | Discussion index | About this forum | D home