Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 182178 - sci-mathematics/octave miscompiled (incorrect function visibility): broken max() functiion, and others
Summary: sci-mathematics/octave miscompiled (incorrect function visibility): broken ma...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: High major (vote)
Assignee: Gentoo Science Mathematics related packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-06-15 21:29 UTC by Alexey Spiridonov
Modified: 2007-06-23 11:52 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Fix the visibility of octave_value::numel() and double_value() (octave-2.1.73-gcc4.1-visibility.patch,874 bytes, patch)
2007-06-15 21:31 UTC, Alexey Spiridonov
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Spiridonov 2007-06-15 21:29:52 UTC
I compiled 2.1.73 (plain, and r2) and 2.1.72 with GCC 4.1.2. In all cases, I have the same problem. If I execute the line "max([2,3])", I get an error message about

/usr/libexec/octave/2.1.73/oct/i686-pc-linux-gnu/max.oct

complaining that 'octave_value::numel() const' (the C++ mangled version thereof, rather) is undefined. Instead, I expect to receive the correct answer, the number 3. A number of other loadable functions are similarly affected (fft, filter, ifft, min, max, fsolve, quad; the latter two because of octave_value::double_value()), and so are their users (e.g. hist). 

The issue is that octave is compiled with -fvisibility-inlines-hidden, so non-inlined versions of inline functions are not available from libraries (e.g. liboctinterp.so).. At the same time, numel() and double_value() are virtual functions, so they usually have to be treated as non-inlined. Since they're hidden from the liboctinterp.so interface, the dynamically linked modules fail to work. 

It's not clear to me whether this is a compiler bug, or an octave bug, but I did make a workaround by explicitly setting the visibility of the two functions in question to 'default'. The patch is attached.


Reproducible: Always

Steps to Reproduce:
Comment 1 Alexey Spiridonov 2007-06-15 21:31:00 UTC
Created attachment 122196 [details, diff]
Fix the visibility of octave_value::numel() and double_value()

This patch fixes the bug for me.
Comment 2 Markus Dittrich (RETIRED) gentoo-dev 2007-06-16 03:18:15 UTC
Could you please post your emerge --info?

Thanks,
Markus
Comment 3 Alexey Spiridonov 2007-06-18 21:26:24 UTC
Sorry, I should've done that right away! Here it is:

Portage 2.1.2.7 (default-linux/x86/2006.1/desktop, gcc-4.1.2, glibc-2.5-r3, 2.6.19.2 i686)
=================================================================
System uname: 2.6.19.2 i686 Intel(R) Pentium(R) M processor 2.00GHz
Gentoo Base System release 1.12.9
Timestamp of tree: Thu, 14 Jun 2007 06:30:01 +0000
dev-lang/python:     2.4.4-r4
dev-python/pycrypto: 2.0.1-r5
sys-apps/sandbox:    1.2.17
sys-devel/autoconf:  2.13, 2.61
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.16.1-r3
sys-devel/gcc-config: 1.3.16
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.17-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-pipe -march=pentium-m -mmmx -msse -msse2 -mfpmath=sse         -O2"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/gconf /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c"
CXXFLAGS="-pipe -march=pentium-m -mmmx -msse -msse2 -mfpmath=sse         -O2 -fvisibility-inlines-hidden"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks metadata-transfer sandbox sfperms strict"
GENTOO_MIRRORS="http://gentoo.mirrors.pair.com/ ftp://mirror.datapipe.net/gentoo ftp://gentoo.mirrors.pair.com/ http://mirror.phy.olemiss.edu/mirror/gentoo http://ftp.belnet.be/mirror/rsync.gentoo.org/gentoo/ http://gentoo.osuosl.org/ ftp://distro.ibiblio.org/pub/linux/distributions/gentoo/"
LANG="POSIX"
LDFLAGS="-Wl,-O1"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X Xaw3d a52 aac acl acpi alsa bash-completion berkdb bitmap-fonts blas bzip2 cairo cdparanoia cdr cli cracklib crypt cups dbus dri dts dvd dvdr dvdread encode exif fam ffmpeg fftw firefox flac foomaticdb fortran gdbm gif gmp gpm gstreamer gtk gtk2 hal iconv imagemagick imap ipv6 isdnlog jpeg lapack lcms ldap libg++ logrotate mad maildir matroska md5sum midi mikmod mmx mp3 mpeg mudflap ncurses nptl nptlonly offensive ogg openal openexr opengl openmp oss pam pcre perl png ppds pppd python qt3 qt4 quicktime readline reflection sdl session speex spell spl sse sse2 ssl svg tcpd tetex theora tiff truetype truetype-fonts type1-fonts unicode usb vcd vorbis wifi win32codecs wmf x86 xml xorg xpm xprint xv xvid zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="apm ark chips cirrus cyrix dummy fbdev glint i128 i740 i810 imstt mach64 mga neomagic nsc nv r128 radeon rendition s3 s3virge savage siliconmotion sis sisusb tdfx tga trident tseng v4l vesa vga via vmware voodoo"
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LINGUAS, MAKEOPTS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 4 Markus Dittrich (RETIRED) gentoo-dev 2007-06-19 12:59:34 UTC
Hi Alexey,

The proper solution in this case would be to remove 
-fvisibility-inlines-hidden from your CXXFLAGS. Personally,
I am of the opinion that this flag should not be used by
users but only by applications themselves since they
need to be specifically designed to get visibility correct.
-fvisibility-inlines-hidden can break standard compliant code
particularly once shared objects are involved.

Best,
Markus
Comment 5 Alexey Spiridonov 2007-06-22 13:43:34 UTC
Ugh, my bad! I had no recollection of putting it there, and assumed it was specified by Octave. Feel free to close the bug, then. Perhaps I should forward the patch to octave, and let them know that once it's applied, they can enable -fvisibility-inlines-hidden?
Comment 6 Markus Dittrich (RETIRED) gentoo-dev 2007-06-23 11:52:39 UTC
Hi  Alexey,

You could definitely let upstream know about this.
They will have much better insight into their code base
to decide if -fvisibility-inlines-hidden would be a good
thing for them or likely break things lateron.

I'll close this bug then. 

Have a good weekend!

Thanks,
Markus