[Top][All Lists]

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

Re: warnings shut off in ov.cc?

From: John W. Eaton
Subject: Re: warnings shut off in ov.cc?
Date: Tue, 15 Oct 2019 16:26:55 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0

On 10/15/19 2:21 PM, Rik wrote:

Can you try the attached patch which implements a warning when non-scalar
arguments are used with the colon operator?  Everything looks correct, and
the printf debugging that I started using when I got confused shows that
the code is executing, but no warnings are printed.  The code is exactly
the same format as the warning for complex values using in colon
expressions, however that warning fires.  Is there something that disables
warnings temporarily in the interpreter when calling operators?

Sample session:

running do_colon_op
Got here
Got here2
ans =

    1   2   3


octave:1> 1:3*i
running do_colon_op
warning: imaginary part of complex colon arguments is ignored
ans = [](1x0)

Maybe this is a red herring, but occasionally warnings seem to be turned
off for the complex code path as well.

octave:2> 1:(3i)
running do_colon_op
ans = [](1x0)

The last example should also have produced a warning.

I think you are seeing the effect of constant folding in the parser:


Warnings are intentionally disabled when doing constant folding operations. The original idea may have been the same as what we should be doing for errors, which is to be silent about them when attempting constant folding, but if there is an error (or warning), fail to generate a constant value so that the expression will generate an error (or warning) later at run time. This is clearly not happening for warnings.

Unfortunately, I don't think that skipping the message but detecting the warning is an easy thing to do.

Maybe we should just eliminate the constant folding operations in the parser? I'm not sure that they really provide that much advantage.


reply via email to

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