Patch for Quad.cc compile error on Sun/GCC

Carsten Clark tantumquantum+gnuoctave at gmail.com
Mon Apr 13 23:10:07 CDT 2009


Hello all,

There is a problem building the development sources on Solaris using
GCC.  In liboctave/Quad.cc (float_user_function), the nonexistent
utility functions access_float() and assign_float() are called.  This
was done in changeset 7805 (62affb34e648), apparently imitating the
use of the existing functions access_double() and assign_double().

I'm attaching a patch that fixes this particular problem, removing the
special handling of Sun/GCC which does not seem necessary.  The fix
seems low-risk, but I have not gotten a build yet so I can't confirm
that it will run.  I'd be happy to hang onto this patch until I can
get a build and test it.

I included a ChangeLog entry but I'm not used to ChangeLogs and won't
mind if you don't use it.

$ uname -a
SunOS soon 5.11 snv_101b i86pc i386 i86pc
$ g++ --version
g++ (GCC) 3.4.3 (csl-sol210-3_4-20050802)

Pre-patch, the build breaks thus:

$ gmake
gawk -f ./mk-ops.awk prefix=mx make_inclusive_header=mx-ops.h ./mx-ops
> mx-ops.h-t
if [ -s mx-ops.h-t ]; then ../move-if-change mx-ops.h-t mx-ops.h; else
echo "mx-ops.h-t is empty!" 1>&2; rm -f mx-ops.h-t; exit 1; fi
mx-ops.h is unchanged
g++ -c -I/usr/include/pcre -I/usr/include/freetype2 -fPIC -I. -I..
-I../liboctave -I../src -I../libcruft/misc  -DHAVE_CONFIG_H -mieee-fp
-Wall -W -Wshadow -Wold-style-cast -Wformat -g -O2
-I/usr/include/freetype2 Quad.cc -o pic/Quad.o
In file included from Quad.cc:32:
sun-utils.h: In function `double access_double(double*)':
sun-utils.h:39: warning: use of old-style cast
sun-utils.h: In function `void assign_double(double*, double)':
sun-utils.h:54: warning: use of old-style cast
sun-utils.h:55: warning: use of old-style cast
Quad.cc: In function `octave_idx_type float_user_function(float*,
int&, float*)':
Quad.cc:110: error: `access_float' undeclared (first use this function)
Quad.cc:110: error: (Each undeclared identifier is reported only once
for each function it appears in.)
Quad.cc:120: error: `assign_float' undeclared (first use this function)
gmake: *** [pic/Quad.o] Error 1


Post-patch, I have a seemingly unrelated error (let's see if you agree):

$ gmake
gawk -f ./mk-ops.awk prefix=mx make_inclusive_header=mx-ops.h ./mx-ops
> mx-ops.h-t
if [ -s mx-ops.h-t ]; then ../move-if-change mx-ops.h-t mx-ops.h; else
echo "mx-ops.h-t is empty!" 1>&2; rm -f mx-ops.h-t; exit 1; fi
mx-ops.h is unchanged
g++ -c -I/usr/include/pcre -I/usr/include/freetype2 -fPIC -I. -I..
-I../liboctave -I../src -I../libcruft/misc  -DHAVE_CONFIG_H -mieee-fp
-Wall -W -Wshadow -Wold-style-cast -Wformat -g -O2
-I/usr/include/freetype2 int64NDArray.cc -o pic/int64NDArray.o
oct-inttypes.h: In function `bool operator!=(const octave_int<T>&,
const double&) [with T = int64_t]':
intNDArray.cc:57:   instantiated from `bool
intNDArray<T>::any_element_not_one_or_zero() const [with T =
octave_int64]'
int64NDArray.cc:32:   instantiated from here
oct-inttypes.h:1052: error: call of overloaded `mop(int64_t, const
double&)' is ambiguous
oct-inttypes.h:177: note: candidates are: static bool
octave_int_cmp_op::mop(T, double) [with xop = octave_int_cmp_op::ne, T
= long long int]
oct-inttypes.h:182: note:                 static bool
octave_int_cmp_op::mop(double, T) [with xop = octave_int_cmp_op::ne, T
= double]
oct-inttypes.h:212: note:                 static bool
octave_int_cmp_op::mop(double, uint64_t) [with xop =
octave_int_cmp_op::ne]
oct-inttypes.h:213: note:                 static bool
octave_int_cmp_op::mop(double, int64_t) [with xop =
octave_int_cmp_op::ne]
oct-inttypes.h:214: note:                 static bool
octave_int_cmp_op::mop(int64_t, double) [with xop =
octave_int_cmp_op::ne]
oct-inttypes.h:215: note:                 static bool
octave_int_cmp_op::mop(uint64_t, double) [with xop =
octave_int_cmp_op::ne]


Regards,
Carsten Clark
-------------- next part --------------
diff -r 4bb94a71913b liboctave/ChangeLog
--- a/liboctave/ChangeLog	Sun Apr 12 20:40:53 2009 -0400
+++ b/liboctave/ChangeLog	Mon Apr 13 23:51:31 2009 -0400
@@ -1,3 +1,8 @@
+2008-05-21  Carsten Clark  <tantumquantum+gnuoctave at gmail.com>
+
+	* Quad.cc (float_user_function): Remove Sun/GCC special case
+	calling nonexistent utility functions.
+
 2009-04-04  Jaroslav Hajek  <highegg at gmail.com>
 
 	* Array.cc (Array<T>::make_unique): Don't economize when unique.
diff -r 4bb94a71913b liboctave/Quad.cc
--- a/liboctave/Quad.cc	Sun Apr 12 20:40:53 2009 -0400
+++ b/liboctave/Quad.cc	Mon Apr 13 23:51:31 2009 -0400
@@ -106,21 +106,13 @@
 {
   BEGIN_INTERRUPT_WITH_EXCEPTIONS;
 
-#if defined (sun) && defined (__GNUC__)
-  float xx = access_float (x);
-#else
   float xx = *x;
-#endif
 
   quad_integration_error = 0;
 
   float xresult = (*float_user_fcn) (xx);
 
-#if defined (sun) && defined (__GNUC__)
-  assign_float (result, xresult);
-#else
   *result = xresult;
-#endif
 
   if (quad_integration_error)
     ierr = -1;


More information about the Bug-octave mailing list