bugGNU Octave - Bugs: bug #54389, warnings when building on Solaris

 
 

bug #54389: warnings when building on Solaris

Submitter:  John W. Eaton <jwe>
Submitted:  Thu 26 Jul 2018 04:33:17 PM UTC
   
 
Category:  Configuration and Build System Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Other
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Solaris/SunOS
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Tue 28 Aug 2018 12:58:37 AM UTC, comment #19: 

According to comment #18, there are no further warnings building on a Solaris system.  Marking as fixed and closing report.

Rik <rik5>
Group administrator
Mon 30 Jul 2018 07:22:37 PM UTC, comment #18: 

I think the alignas change would work, but this change makes more sense to me:

http://hg.savannah.gnu.org/hgweb/octave/rev/96584a825b0f

Pushed on stable and merged with default.  I don't see the warning on the Solaris system now.

John W. Eaton <jwe>
Group administrator
Mon 30 Jul 2018 04:38:37 AM UTC, comment #17: 

Did the alignas diff I posted in comment #15 work?  That is the last warning of the original post that needs fixing.  You could post the next round of warnings to this bug report as well.

Rik <rik5>
Group administrator
Thu 26 Jul 2018 10:57:56 PM UTC, comment #16: 

Maybe run configure with --disable-fltk.  The focus is now on the qt toolkit and it probably isn't worth developer time to suppress those errors.

Rik <rik5>
Group administrator
Thu 26 Jul 2018 09:59:53 PM UTC, comment #15: 

Attached is a possible fix for the alignment warning in oct-base64.cc.  It doesn't provoke any problems on my Linux build, but I can't tell if it does anything towards solving the problem on Solaris.

(file #44632)

Rik <rik5>
Group administrator
Thu 26 Jul 2018 09:22:31 PM UTC, comment #14: 

Also many warnings from FLTK because this time I didn't explicitly disable anything and it found packages in /opt/csw/...

John W. Eaton <jwe>
Group administrator
Thu 26 Jul 2018 09:21:33 PM UTC, comment #13: 

For the alignment warnings, would it be possible to use C++11 alignas() keyword?  See https://en.cppreference.com/w/cpp/language/alignas.

Rik <rik5>
Group administrator
Thu 26 Jul 2018 09:12:31 PM UTC, comment #12: 

Yeah, the ultra-minimal build was disabling a lot of code such as that associated with freetype and fontconfig.  You will probably discover a few more warnings as you back off the number of features that are disabled in configure.

Rik <rik5>
Group administrator
Thu 26 Jul 2018 09:05:48 PM UTC, comment #11: 

I started a new build and these popped up:


../../src/octave-4.4.1-rc1/libinterp/corefcn/ft-text-renderer.cc: In member function ‘FT_UInt octave::ft_text_renderer::process_character(FT_ULong, FT_UInt)’:

../../src/octave-4.4.1-rc1/libinterp/corefcn/ft-text-renderer.cc:784:67: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                     for (int r = 0; static_cast<unsigned int> (r) < bitmap.rows; r++)
                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~

../../src/octave-4.4.1-rc1/libinterp/corefcn/ft-text-renderer.cc:785:69: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                       for (int c = 0; static_cast<unsigned int> (c) < bitmap.width; c++)


John W. Eaton <jwe>
Group administrator
Thu 26 Jul 2018 08:34:44 PM UTC, comment #10: 

Yes, I think those are the only ones left.

John W. Eaton <jwe>
Group administrator
Thu 26 Jul 2018 08:26:08 PM UTC, comment #9: 

What remains?  Some -Wcast-align warnings?

Rik <rik5>
Group administrator
Thu 26 Jul 2018 08:17:06 PM UTC, comment #8: 
John W. Eaton <jwe>
Group administrator
Thu 26 Jul 2018 07:58:09 PM UTC, comment #7: 

Yes, on the Solaris system we are using for testing, pthread_t is uint_t.  I don't see anything requiring it to be unsigned.  Or even to be an integral type.  These functions for printing the sigset and sigmask are not used in Octave.  I think I added them for debugging purposes and never removed them since they could be useful.  I still think they could be useful for debugging, so we might as well keep them.  To silence the warning it would be safe enough to cast to long int.  It's a C file though, so no static_cast.  I'll fix it.

John W. Eaton <jwe>
Group administrator
Thu 26 Jul 2018 07:36:30 PM UTC, comment #6: 

Much better solution to just delete the cruft of sun-utils.h.

Rik <rik5>
Group administrator
Thu 26 Jul 2018 07:35:33 PM UTC, comment #5: 

For the warnings related to printf and pthread_t, if I check /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h I find


typedef unsigned long int pthread_t;


so on my Linux system "%ld" is an okay printf specifier.  I assume if you check on Solaris you will find that pthread_t is defined as just unsigned int.  In this case, we could throw in a static_cast to <unsigned long int> to guarantee the format works out.


fprintf (of, "%ld: %s%d (%s)\n", pthread_self (), prefix, sig,
=>
fprintf (of, "%ld: %s%d (%s)\n", static_cast<unsigned long int> (pthread_self ()), prefix, sig,



Rik <rik5>
Group administrator
Thu 26 Jul 2018 07:34:04 PM UTC, comment #4: 

How about just make it irrelevant instead?  I pushed the following changeset on stable and merged with default:

http://hg.savannah.gnu.org/hgweb/octave/rev/bef21ac72618

John W. Eaton <jwe>
Group administrator
Thu 26 Jul 2018 07:12:24 PM UTC, comment #3: 

The old-style casts in sun-utils.h should be easy to resove by switching them to static_cast.

Rik <rik5>
Group administrator
Thu 26 Jul 2018 06:58:54 PM UTC, comment #2: 

The END_LONG_DOUBLE_ROUNDING macro is also conditional. It's defined to an empty expression on non-x86 systems, so oldcw is indeed unused.

Mike Miller <mtmiller>
Group Member
Thu 26 Jul 2018 06:46:08 PM UTC, comment #1: 

The first one seems like a problem with either gcc or cpp expansion.

In fpucw-wrappers.c the code is


void
octave_end_long_double_rounding (unsigned int oldcw)
{
  END_LONG_DOUBLE_ROUNDING ();
}


So the parameter oldcw isn't used per se.  But if you look at gnulib/lib/fpucw.h there is a definition for END_LONG_DOUBLE_ROUNDING which is


# define END_LONG_DOUBLE_ROUNDING() \
  SET_FPUCW (oldcw)


so oldcw is getting used.  Maybe the fact that SET_FPUCW is in turn a macro is causing problems in that it isn't fully expanding all macros before passing the results to gcc.


Rik <rik5>
Group administrator
Thu 26 Jul 2018 04:33:17 PM UTC, original submission:  

The following warnings occur when building on Solaris with GCC 7.3:


../../src/octave-4.4.1-rc1/liboctave/wrappers/fpucw-wrappers.c: In function ‘octave_end_long_double_rounding’:
../../src/octave-4.4.1-rc1/liboctave/wrappers/fpucw-wrappers.c:70:47: warning: unused parameter ‘oldcw’ [-Wunused-parameter]
 octave_end_long_double_rounding (unsigned int oldcw)
                                               ^~~~~

../../src/octave-4.4.1-rc1/liboctave/wrappers/signal-wrappers.c: In function ‘print_sigset’:
../../src/octave-4.4.1-rc1/liboctave/wrappers/signal-wrappers.c:736:27: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 3 has type ‘pthread_t {aka unsigned int}’ [-Wformat=]
           fprintf (of, "%ld: %s%d (%s)\n", pthread_self (), prefix, sig,
                         ~~^                ~~~~~~~~~~~~~~~
                         %d

../../src/octave-4.4.1-rc1/liboctave/wrappers/signal-wrappers.c:742:21: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 3 has type ‘pthread_t {aka unsigned int}’ [-Wformat=]
     fprintf (of, "%ld: %s<empty signal set>\n", pthread_self (), prefix);
                   ~~^                           ~~~~~~~~~~~~~~~
                   %d

../../src/octave-4.4.1-rc1/libinterp/corefcn/load-save.cc: In function ‘void write_header(std::ostream&, load_save_format)’:
../../src/octave-4.4.1-rc1/libinterp/corefcn/load-save.cc:1195:72: warning: cast from ‘const char*’ to ‘const int16_t* {aka const short int*}’ increases required alignment of target type [-Wcast-align]
         int16_t number = *(reinterpret_cast<const int16_t *>("\x00\x01"));
                                                                        ^

In file included from ../../src/octave-4.4.1-rc1/liboctave/numeric/Quad.cc:34:0:
../../src/octave-4.4.1-rc1/liboctave/util/sun-utils.h: In function ‘double access_double(double*)’:
../../src/octave-4.4.1-rc1/liboctave/util/sun-utils.h:41:32: warning: use of old-style cast [-Wold-style-cast]
   union d2i *p = (union d2i *) unaligned_ptr;
                                ^~~~~~~~~~~~~

../../src/octave-4.4.1-rc1/liboctave/util/sun-utils.h: In function ‘void assign_double(double*, double)’:
../../src/octave-4.4.1-rc1/liboctave/util/sun-utils.h:56:32: warning: use of old-style cast [-Wold-style-cast]
   union d2i *v = (union d2i *) ptr;
                                ^~~

../../src/octave-4.4.1-rc1/liboctave/util/sun-utils.h:57:32: warning: use of old-style cast [-Wold-style-cast]
   union d2i *p = (union d2i *) unaligned_ptr;
                                ^~~~~~~~~~~~~

../../src/octave-4.4.1-rc1/liboctave/util/oct-base64.cc: In function ‘Array<double> octave::base64_decode(const string&)’:
../../src/octave-4.4.1-rc1/liboctave/util/oct-base64.cc:85:55: warning: cast from ‘char*’ to ‘double*’ increases required alignment of target type [-Wcast-align]
         double *dout = reinterpret_cast<double *> (out);


John W. Eaton <jwe>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #44632:  oct-base64.diff added by rik5 (411B - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by jwe (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 13 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-08-28 rik5 StatusIn Progress Fixed
        Open/ClosedOpen Closed
    2018-07-26 rik5 Attached File- Added oct-base64.diff, #44632
    2018-07-26 rik5 CategoryNone Configuration and Build System
        Item GroupNone Other
        StatusNone In Progress
    2018-07-26 jwe CategoryConfiguration and Build System None
        Item GroupOther None
        StatusIn Progress None
    2018-07-26 rik5 CategoryNone Configuration and Build System
        Item GroupNone Other
        StatusNone In Progress
    2018-07-26 jwe Summarycast warnings when building on Solaris warnings when building on Solaris

    Back to the top

    Powered by Savane 3.13-b921.
    Corresponding source code