octave-maintainers
[Top][All Lists]
Advanced

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

Re: fopen always returns fid=-1 since revision 8380


From: Thomas Treichl
Subject: Re: fopen always returns fid=-1 since revision 8380
Date: Mon, 08 Dec 2008 11:22:55 +0100
User-agent: Thunderbird 2.0.0.18 (Macintosh/20081105)

Thomas Treichl schrieb:
Hi,

with revision 8380, "allow initialized local buffers", there came a strange problem with it. I don't see this problem with revision 8379. Because this changeset is very small I hope somebody can tell me what is going on.

If I do

  fid = fopen ("file.txt", "w")

then I always get a fid=-1 if the file is not there and must be created. If the file is already there then it can be opened correctly for overwriting and I get a valid fid.

I noticed that problem because the number of failures while doing "make check" increased rapidly from revision 8379 to 8380, for example

>>>>> processing /Users/Thomas/Development/octave/src/DLD-FUNCTIONS/dlmread.cc
  ***** shared file
  file = tmpnam ();
  fid = fopen (file, "wt");
  fwrite (fid, "1, 2, 3\n4, 5, 6\n7, 8, 9\n10, 11, 12");
  fclose (fid);
  !!!!! test failed
  fwrite: invalid stream number = -1shared variables {
    file = [](0x0)
  }

dlmread.cc on its own produces 20 failures on my Mac. Which line of changeset 8380 could make that problems?

If I knew that my first trial would already succeed then I just would have sent the solution how it can be solved ;) It seems that I'm the lucky one who has a compiler that doesn't like OCTAVE_LOCAL_BUFFER always. A changeset for that line that is causing the problem is attached (which is just a copy and paste from the old lines that were there in revision 8379).

Regards,

  Thomas
# HG changeset patch
# User Thomas Treichl  <address@hidden>
# Date 1228726675 -3600
# Node ID de7ad006fcb5297cb0662a4c71975ad45a37af10
# Parent  dbe67764e628c6a211bdef4410a69898b8b69723
One change of OCTAVE_LOCAL_BUFFER.

diff --git a/liboctave/Array.cc b/liboctave/Array.cc
--- a/liboctave/Array.cc
+++ b/liboctave/Array.cc
@@ -1915,7 +1915,10 @@
     }
   else
     {
-      OCTAVE_LOCAL_BUFFER (T, pvi, ns);
+      // Don't use OCTAVE_LOCAL_BUFFER (T, pvi, ns); here as it
+      // doesn't work with bool on some compilers.
+      Array<T> vi (ns);
+      T *pvi = vi.fortran_vec ();
 
       for (octave_idx_type j = 0; j < iter; j++) 
        {
diff --git a/liboctave/ChangeLog b/liboctave/ChangeLog
--- a/liboctave/ChangeLog
+++ b/liboctave/ChangeLog
@@ -1,3 +1,7 @@
+2008-12-08  Thomas Treichl  <address@hidden>
+
+       * Array.cc: One change of OCTAVE_LOCAL_BUFFER.
+
 2008-12-07  Jaroslav Hajek  <address@hidden>
 
        * mx-inlines.cc (mx_inline_fill_vs): New template function.

reply via email to

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