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

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

[Octave-bug-tracker] [bug #42704] mkoctfile returns 0 if compile failed


From: Andreas Weber
Subject: [Octave-bug-tracker] [bug #42704] mkoctfile returns 0 if compile failed but linking succeeded
Date: Tue, 08 Jul 2014 10:55:48 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:30.0) Gecko/20100101 Firefox/30.0 Iceweasel/30.0

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

                 Summary: mkoctfile returns 0 if compile failed but linking
succeeded
                 Project: GNU Octave
            Submitted by: andy1978
            Submitted on: Di 08 Jul 2014 10:55:47 GMT
                Category: Libraries
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: GNU/Linux

    _______________________________________________________

Details:

hg id 49961d67e4b9

mkoctfile returns 0 if compilation of file.cc fails but link succeeds because
of already existent (from previous compilation) file.o.

I don't know exactly what the desired behavior for this is but I think
mkoctfile should return the exit status immediatly and stop further execution
if a command fails.

I've added debugging outputs "cmd =" and "result ="
in mkoctfile.in.cc:364 run_command (const std::string& cmd)

create a simple file hello.cc:

#include <iostream>
int main()
{
  std::cout << "hello bug hunter..." << std::endl;
  return 0;
}
-verbatim

now compile with mkoctfile:
$ mkoctfile -v hello.cc 

cmd = ccache g++ -c  -fPIC -I/usr/local/include/octave-4.1.0+/octave/..
-I/usr/local/include/octave-4.1.0+/octave -I/usr/local/include  -g -O2
-pthread    hello.cc -o hello.o
result = 0
cmd = ccache g++ -shared -Wl,-Bsymbolic  -o hello.oct  hello.o  
-L/usr/local/lib/octave/4.1.0+ -L/usr/local/lib -loctinterp -loctave   
result = 0


All went fine as expected. Now add a syntax error to hello.cc and run
mkoctfile again:

$ mkoctfile -v hello.cc 
cmd = ccache g++ -c  -fPIC -I/usr/local/include/octave-4.1.0+/octave/..
-I/usr/local/include/octave-4.1.0+/octave -I/usr/local/include  -g -O2
-pthread    hello.cc -o hello.o
hello.cc: In function ‘int main()’:
hello.cc:5:3: error: ‘xyz’ was not declared in this scope
   xyz
   ^
result = 256
cmd = ccache g++ -shared -Wl,-Bsymbolic  -o hello.oct  hello.o  
-L/usr/local/lib/octave/4.1.0+ -L/usr/local/lib -loctinterp -loctave   
result = 0

$ echo $?
0


As you can see g++ failed and returned 256 but mkoctfile nevertheless tries to
link hello.o which succeeds and returns 0 therefore.

-- Andy




    _______________________________________________________

Reply to this item at:

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

_______________________________________________
  Nachricht gesendet von/durch Savannah
  http://savannah.gnu.org/




reply via email to

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