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

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

[Octave-bug-tracker] [bug #54237] 'abs' function template hack in pr-out


From: Mike Miller
Subject: [Octave-bug-tracker] [bug #54237] 'abs' function template hack in pr-output.cc is not portable
Date: Mon, 2 Jul 2018 17:41:57 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0

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

                 Summary: 'abs' function template hack in pr-output.cc is not
portable
                 Project: GNU Octave
            Submitted by: mtmiller
            Submitted on: Mon 02 Jul 2018 02:41:55 PM PDT
                Category: Configuration and Build System
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Build Failure
                  Status: Postponed
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: Any

    _______________________________________________________

Details:

The local 'abs' function template in pr-output.cc and marked with a 'FIXME'
comment is not a good general or portable solution. The intent here is to
create explicit 'abs' overrides for all signed and unsigned integer types to
avoid a GCC warning message about comparison between signed and unsigned
types.

In execution, this local 'abs' declaration has a few problems:

* Building with the Clang compiler on 64-bit GNU/Linux produces "warning:
unused function 'abs'" on the 'SPECIALIZE_UABS(long long)' template
instantiation, see bug #53650. On 64-bit systems, 'long long' and 'unsigned
long long' are never used by Octave.

* Building with GCC 4.9.2 on Solaris 10 fails to compile with an error message
"error: call of overloaded ‘abs(short int)’ is ambiguous", and likewise
for other integer types. For some reason the compiler is unable to declare
that the local template overloads for integer types are better than the
standard library floating-point 'abs' functions. See bug #54217 for the full
error message. Changing the names of the local function templates to 'xabs'
fixed this error.




    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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