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

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

[Octave-bug-tracker] [bug #63415] Error in fwrite() or rand() or randn()


From: Dmitri A. Sergatskov
Subject: [Octave-bug-tracker] [bug #63415] Error in fwrite() or rand() or randn(), I'm not sure
Date: Wed, 15 Mar 2023 20:22:02 -0400 (EDT)

Follow-up Comment #23, bug #63415 (project octave):

I see the test failing on octave 9.0.0 (hg id: 16b233ccaeab)
when compiled with

../configure --disable-docs --disable-java CFLAGS="-ggdb3 -O0
-fsanitize=thread" CXXFLAGS="-ggdb3 -O0 -fsanitize=thread" FFLAGS="-ggdb3 -O0
-fsanitize=thread"


Start octave as:


TSAN_OPTIONS="ignore_noninstrumented_modules=1" ./run-octave --gui



GNU Octave, version 9.0.0
Copyright (C) 1993-2023 The Octave Project Developers.
This is free software; see the source code for copying conditions.
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  For details, type 'warranty'.

Octave was configured for "x86_64-pc-linux-gnu".

Home page:            https://octave.org
Support resources:    https://octave.org/support
Improve Octave:       https://octave.org/get-involved

For changes from previous versions, type 'news'.

==================
WARNING: ThreadSanitizer: data race (pid=222630)
  Write of size 8 at 0x7fd05a031598 by thread T7:
    #0 SelfListener::recvData(char const*, int)
libgui/qterminal/libqterminal/unix/moc-SelfListener.cc:137
(liboctgui.so.9+0x14661e)
    #1 SelfListener::run()
../libgui/qterminal/libqterminal/unix/SelfListener.cpp:32
(liboctgui.so.9+0x121193)
    #2 QThreadPrivate::start(void*) <null> (libQt5Core.so.5+0xe9bf8)

  Previous read of size 8 at 0x7fd05a031598 by main thread:
    [failed to restore the stack]

  As if synchronized via sleep:
    #0 nanosleep <null> (libtsan.so.0+0x67afc)
    #1 qt_nanosleep(timespec) <null> (libQt5Core.so.5+0x2f8334)
    #2 QThreadPrivate::start(void*) <null> (libQt5Core.so.5+0xe9bf8)

  Location is stack of thread T7.

  Thread T7 'SelfListener' (tid=222653, running) created by main thread at:
    #0 pthread_create <null> (libtsan.so.0+0x61748)
    #1 QThread::start(QThread::Priority) <null> (libQt5Core.so.5+0xe969e)
    #2 QUnixTerminalImpl::initialize()
../libgui/qterminal/libqterminal/unix/QUnixTerminalImpl.cpp:80
(liboctgui.so.9+0x105c3b)
    #3 QUnixTerminalImpl::QUnixTerminalImpl(QWidget*)
../libgui/qterminal/libqterminal/unix/QUnixTerminalImpl.cpp:30
(liboctgui.so.9+0x1055fb)
    #4 QTerminal::create(QWidget*)
../libgui/qterminal/libqterminal/QTerminal.cc:59 (liboctgui.so.9+0x1388c4)
    #5 octave::terminal_dock_widget::terminal_dock_widget(QWidget*, bool)
../libgui/src/terminal-dock-widget.cc:85 (liboctgui.so.9+0x347a20)
    #6 octave::base_qobject::terminal_widget(octave::main_window*)
../libgui/src/octave-qobject.cc:459 (liboctgui.so.9+0x2df5a8)
    #7 octave::main_window::adopt_terminal_widget()
../libgui/src/main-window.cc:218 (liboctgui.so.9+0x2a5e07)
    #8 octave::main_window::adopt_dock_widgets()
../libgui/src/main-window.cc:205 (liboctgui.so.9+0x2a5d10)
    #9 octave::main_window::main_window(octave::base_qobject&)
../libgui/src/main-window.cc:159(liboctgui.so.9+0x2a557c)
    #10 octave::base_qobject::base_qobject(octave::qt_application&, bool)
../libgui/src/octave-qobject.cc:285 (liboctgui.so.9+0x2de3b3)
    #11 octave::qt_application::execute() ../libgui/src/qt-application.cc:100
(liboctgui.so.9+0x2fbd2b)
    #12 main ../src/main-gui.cc:150 (lt-octave-gui+0x403815)

SUMMARY: ThreadSanitizer: data race
libgui/qterminal/libqterminal/unix/moc-SelfListener.cc:137 in
SelfListener::recvData(char const*, int)
==================
>> clear all

fid = fopen ("m_eye.bin", "wb", "ieee-le");
matA = eye (100,150);
n = fwrite (fid, matA, "double");
fclose(fid);

assert (stat ("m_eye.bin").size == numel(matA) * 8)

fid = fopen ("m_rand.bin", "wb", "ieee-le");
matB = rand (100,150);
n = fwrite (fid, matB, "double");
fclose(fid);

assert (stat ("m_rand.bin").size == numel(matB) * 8)

fid = fopen ("m_eye.bin", "rb");
matC = fread (fid, inf, "double");
fclose(fid);

fid = fopen ("m_rand.bin", "rb");
matD = fread (fid, inf, "double");
fclose(fid);

assert (all (matC == matA(:)))
assert (all (matD == matB(:)))

clear ans fid
whos
error: assert (stat ("m_rand.bin").size == numel (matB) * 8) failed
error: called from
    assert at line 107 column 11
error: assert (all (matC == matA (:))) failed
error: called from
    assert at line 107 column 11
error: mx_el_eq: nonconformant arguments (op1 is 14404x1, op2 is 15000x1)
Variables visible from the current scope:

variables in scope: top scope

  Attr   Name        Size                     Bytes  Class
  ====   ====        ====                     =====  =====
         matA      100x150                      800  double
         matB      100x150                   120000  double
         matC    15000x1                     120000  double
         matD    14404x1                     115232  double
         n           1x1                          8  double

Total is 59405 elements using 356040 bytes

>>


I tried a fe times and 100% failure in GUI mode and 100% OK in cli mode.

gcc version 11.3.1 20221121 (Red Hat 11.3.1-4) (GCC)

Dmitri.
-- 



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?63415>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

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