bug-apl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-apl] Possible bug in PrintBuffer.cc


From: Elias Mårtenson
Subject: Re: [Bug-apl] Possible bug in PrintBuffer.cc
Date: Tue, 14 Jan 2014 16:51:50 +0800

Yeah, you're probably right.

I left it out of my patchset though, so that Jürgen can make a decision on it though.

Regards,
Elias


On 14 January 2014 16:36, Jay Foad <address@hidden> wrote:
On 14 January 2014 08:34, Elias Mårtenson <address@hidden> wrote:
> Another potential bug showing up when I was going through the warning
> messages:
>
> In PrintBuffer.cc, line 70, the following code is found:
>
> const ShapeItem ec = value.element_count();
>    if (ec == 0)   // empty value of any dimension
>       {
>          const Shape sh = value.get_shape().without_axis(sh.get_rank() - 1);
>          if (sh.get_volume() <= 1)   // empty vector
>             {
>
>
> The call to sh.get_rank() refers sh itself before it's initialised. I'm not
> sure what the intent of this code is, so I don't want to guess how to fix
> it.

I came up with:

Index: PrintBuffer.cc
===================================================================
--- PrintBuffer.cc (revision 90)
+++ PrintBuffer.cc (working copy)
@@ -67,7 +67,7 @@
 const ShapeItem ec = value.element_count();
    if (ec == 0)   // empty value of any dimension
       {
-         const Shape sh = value.get_shape().without_axis(sh.get_rank() - 1);
+         const Shape sh = value.get_shape().without_axis(value.get_rank() - 1);
          if (sh.get_volume() <= 1)   // empty vector
             {
               if (pctx.get_style() == PR_APL_FUN)

Jay.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]