ReDim to empty does not work

Bug #474844 reported by jimav
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenOffice
Invalid
Undecided
Unassigned
libreoffice (Ubuntu)
Expired
Undecided
Unassigned
openoffice.org (Ubuntu)
Won't Fix
Undecided
Unassigned

Bug Description

Binary package hint: openoffice.org

ReDim (and Dim) throw a run-time error if UpperBound = (LowerBound-1).
For example
  Dim foo(0 to 9)
  ...
  ReDim foo(0 to -1) 'causes error

This should not be an error, but should make the array contain zero elements.
Note that arrays can be declared as empty with
   Dim foo()
which has the save effect as ReDim foo(0 to -1) [except that it works...].

However that form does not allow easy use in algorithms which compute array bounds at run-time and may validly want to result an empty array.

DEMO: See attached file.

For example
  sub RemoveLastElements(ary(), n)
     ReDim Preserve ary(LBound(ary) to UBound(ary)-n)
  end sub
... should work for for n up to and including the total number of elements, but instead you currently have to code it like this:

  sub RemoveLastElements(ary(), n)
     if UBound(ary)-LBound(ary) > n then
        ReDim Preserve ary(LBound(ary) to UBound(ary)-n)
     else
        ReDim ary()
     end if
end sub

ProblemType: Bug
Architecture: amd64
Date: Wed Nov 4 14:25:11 2009
DistroRelease: Ubuntu 9.10
ExecutablePath: /usr/lib/openoffice/program/soffice.bin
Package: openoffice.org-core 1:3.1.1-5ubuntu1 [modified: var/lib/openoffice/basis3.1/program/services.rdb]
ProcEnviron:
 PATH=(custom, user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
ProcVersionSignature: Ubuntu 2.6.31-14.48-generic
SourcePackage: openoffice.org
Uname: Linux 2.6.31-14-generic x86_64

---
Architecture: amd64
DistroRelease: Ubuntu 10.04
InstallationMedia: Ubuntu 10.04 LTS "Lucid Lynx" - Release amd64 (20100429)
Package: openoffice.org-calc 1:3.2.0-7ubuntu4
PackageArchitecture: amd64
ProcEnviron:
 PATH=(custom, user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
ProcVersionSignature: Ubuntu 2.6.32-22.33-generic 2.6.32.11+drm33.2
Tags: lucid
Uname: Linux 2.6.32-22-generic x86_64
UserGroups: adm admin audio cdrom dialout dip fax floppy fuse games lpadmin netdev plugdev sambashare tape users vboxusers video

Revision history for this message
jimav (james-avera) wrote :
Chris Cheney (ccheney)
tags: added: karmic
Revision history for this message
Chris Cheney (ccheney) wrote :

[This is an automatic notification.]

This bug was reported against an earlier version of Ubuntu, can you test if it still occurs on Ubuntu 10.04 LTS (Lucid Lynx)?

Please note we also provide technical support for older versions of Ubuntu, but not in the bug tracker. Instead, to raise the issue through normal support channels, please see:

    http://www.ubuntu.com/support

If you are the original reporter and can still reproduce the issue on Lucid, please run the following command to refresh the report:

  apport-collect 474844

Bear in mind that you may need to install the python-launchpadlib package from the universe repository. Additionally, when prompted to give apport-collect permissions for Launchpad you will need to give it at least the ability to "Change Non-Private" data as it will be adding information to your bug report.

If you are not the original reporter, please file a new bug report, so we can work with you as the original reporter instead (you can reference bug 474844 in your report if you think it may be related):

  ubuntu-bug openoffice.org

If by chance you can no longer reproduce the issue on Lucid or if you feel it is no longer relevant, please mark the bug report 'Fix Released' or 'Invalid' as appropriate, at the following URL:

  https://bugs.launchpad.net/ubuntu/+bug/474844

Changed in openoffice.org (Ubuntu):
status: New → Incomplete
Revision history for this message
jimav (james-avera) wrote :

Still here in Lucid.

description: updated
tags: added: apport-collected
description: updated
Revision history for this message
jimav (james-avera) wrote : Dependencies.txt

apport information

Chris Cheney (ccheney)
summary: - ReDim to empty does not work
+ [upstream] ReDim to empty does not work
Changed in openoffice.org (Ubuntu):
status: Incomplete → Triaged
Changed in openoffice.org (Ubuntu):
status: Triaged → Won't Fix
Revision history for this message
Björn Michaelsen (bjoern-michaelsen) wrote : migrating packaging from OpenOffice.org to Libreoffice

[This is an automated message.]
There are no new official OpenOffice.org releases in Ubuntu packaging anymore => Won't Fix

If the problem persists, please mark this bug as "also affects project Libreoffice" or "also affects distribution Libreoffice (Ubuntu)" if that has not happened already.

Please leave references to upstream OpenOffice.org bugs in place to allow cross pollination.

Revision history for this message
penalvch (penalvch) wrote : Re: [upstream] ReDim to empty does not work

No reference URL.

Changed in openoffice:
status: New → Invalid
summary: - [upstream] ReDim to empty does not work
+ ReDim to empty does not work
Revision history for this message
penalvch (penalvch) wrote :

jimav, this issue is unreproducible in LibreOffice Calc. Does this occur for you in LibreOffice? If so could you please post a screenshot of the runtime error? If using Lucid or Maverick feel free to type at the Terminal:

sudo add-apt-repository ppa:libreoffice/ppa && sudo apt-get update && sudo apt-get -y upgrade && sudo apt-get -y install libreoffice-writer

For more on LibreOffice installation, please see:
https://wiki.ubuntu.com/LibreOffice

lsb_release -rd
Description: Ubuntu 11.04
Release: 11.04

 apt-cache policy libreoffice-calc
libreoffice-calc:
  Installed: 1:3.3.3-1ubuntu2
  Candidate: 1:3.3.3-1ubuntu2
  Version table:
 *** 1:3.3.3-1ubuntu2 0
        500 http://us.archive.ubuntu.com/ubuntu/ natty-updates/main i386 Packages
        100 /var/lib/dpkg/status
     1:3.3.2-1ubuntu4 0
        500 http://us.archive.ubuntu.com/ubuntu/ natty/main i386 Packages

Changed in libreoffice (Ubuntu):
status: New → Incomplete
Revision history for this message
jimav (james-avera) wrote :

The problem is still there in Libre Office 3.4.3

Unfortunately I attached the wrong bug demo file in comment #3 (it was for a different problem). Sorry about that!

I will attach the correct demo file to this comment.

penalvch (penalvch)
Changed in libreoffice (Ubuntu):
status: Incomplete → New
Revision history for this message
Bryan Quigley (bryanquigley) wrote :

Is this still reproducible on Ubuntu 14.04?

Changed in libreoffice (Ubuntu):
status: New → Incomplete
Revision history for this message
jimav (james-avera) wrote :

Yes, problem is present in LibreOffice 4.3.3.2 in Ubuntu 14.10

Revision history for this message
jimav (james-avera) wrote :
Changed in libreoffice (Ubuntu):
status: Incomplete → New
Revision history for this message
Marcus Tomlinson (marcustomlinson) wrote :

This release of Ubuntu is no longer receiving maintenance updates. If this is still an issue on a maintained version of Ubuntu please let us know.

Changed in libreoffice (Ubuntu):
status: New → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for libreoffice (Ubuntu) because there has been no activity for 60 days.]

Changed in libreoffice (Ubuntu):
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.