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

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

[Octave-bug-tracker] [bug #60316] New warnings, errors showing up during


From: Rik
Subject: [Octave-bug-tracker] [bug #60316] New warnings, errors showing up during compilation
Date: Fri, 2 Apr 2021 11:04:23 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36

Follow-up Comment #8, bug #60316 (project octave):

@Markus: I didn't look too closely at what the gnulib wrapper function does. 
A true replacement for unsigned int would probably be

int
octave_ui_multiply_overflow_wrapper (unsigned int a, unsigned int b,
                                     unsigned int *r)
{
  *r = a * b;
  return 0;
}

This computes the multiplication and always indicates that *no* overflow
occurred.

As far as I can tell, the C standard requires that unsigned integers implement
wraparound semantics.  Therefore, these multiplications are performed the same
everywhere and there are no cross-platform issues.  See, as just one random
reference,
https://www.learncpp.com/cpp-tutorial/unsigned-integers-and-why-to-avoid-them/.

However, the C standard is silent about signed integer multiplications. 
Hence, this becomes compiler and architecture dependendent.  The gnulib
wrappers provide a way of guaranteeing consistency, but that is only necessary
for signed integers.

I will try updating gnulib and see if it helps.  If it doesn't, I suggest we
avoid the macros where they are not required.


    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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