octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #41827] Fix dead assignment octave_rand::do_fl


From: anonymous
Subject: [Octave-bug-tracker] [bug #41827] Fix dead assignment octave_rand::do_float_scalar
Date: Tue, 11 Mar 2014 03:39:07 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:12.0) Gecko/20100101 Firefox/12.0

URL:
  <http://savannah.gnu.org/bugs/?41827>

                 Summary: Fix dead assignment octave_rand::do_float_scalar
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Tue 11 Mar 2014 03:39:05 AM UTC
                Category: Libraries
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: Branden Archer
        Originator Email: address@hidden
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: GNU/Linux

    _______________________________________________________

Details:

>From running Clang's scan-build tool, which performs some static 
source code analysis, on the current head from the repository, 
it was found that the octave_rand::do_float_scalar() method in

   liboctave/numberic/oct-rand.cc

has a 'dead assignment' on line 447. That is, under a specific
scenario (gamma distribution, use_old_generators==true,
and certain values of the passed in float to the function)
the result would be 0.0 (default value) instead of octave_NaN
(assigned value). From the context, it appears that the result 
should be octave_NaN but is not due to a typo.

Attached is a patch which resolves the issue.

Note that this was found with static source code analysis,
and not by producing the issue in octave proper. Instead
of just submitting a fix, I am also interested in writing
a test case that will actually produce the error and
show that it is resolved. Can you point me in the right direction
toward causing this issue to occur in octave, and how one
would include it as a test case for automated testing? If it
is not too bad, I would like to then resubmit the patch
and include the related automated test with the change.

Thanks!



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Tue 11 Mar 2014 03:39:05 AM UTC  Name: 18539.patch  Size: 938B   By:
None

<http://savannah.gnu.org/bugs/download.php?file_id=30853>

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?41827>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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