[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-apl] Possible bug in PrintBuffer.cc
From: |
Jay Foad |
Subject: |
Re: [Bug-apl] Possible bug in PrintBuffer.cc |
Date: |
Tue, 14 Jan 2014 08:36:20 +0000 |
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.