[Bug c++/27356] New: Right read operator not accessible after overloading.
When compiling the following program with the shipped gcc 4.0.1 from XCode 2.2 on an Apple iMac, the result is: > Mac:~/Desktop pfeil$ ./bugdemo > write write write write > true but should be: > write read write read > true Or in other words, the compiler should use the read/const version of the operator[] when there is no assignment and the lvalue/reference version when there is an assignment to the reference of the operator. Or again in other words: How to access the read opperator? --- // g++ bugdemo.cpp -o bugdemo #include using namespace std; class Array { bool data[ 100 ]; public: const bool operator[]( const unsigned int index ) const { cout << "read "; return data[ index ]; } bool &operator[]( const unsigned int index ) { cout << "write "; return data[ index ]; } }; int main( int argc, char **argv ) { Array a; a[ 0 ] = true; a[ 1 ] = a[ 0 ]; cout << endl << (a[ 0 ]?"true":"false") << endl; return 0; } -- Summary: Right read operator not accessible after overloading. Product: gcc Version: 4.0.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: pfl at iis dot fhg dot de GCC build triplet: i686-apple-darwin8 GCC host triplet: i686-apple-darwin8 GCC target triplet: i686-apple-darwin8 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27356
[Bug target/23231] cross compiling fails for mips-sgi-irix6.5
--- Comment #5 from pfl at iis dot fhg dot de 2005-11-09 18:35 --- Ok, I switched to MacOSX. There I have a /usr/gnu/build/gcc-4.0.2 diectory with the original sources. Then I do a ../gcc-4.0.2/configure --cache-file=../mips-gcc-4.0.2.configure.cache --prefix=/usr/gnu --bindir=/usr/gnu/bin --sbindir=/usr/gnu/sbin --libdir=/usr/gnu/lib32 --disable-nls --disable-multilib --disable-intl --enable-languages=c,c++ --target=mips-sgi-irix6.5 --program-prefix=mips-sgi-irix6.5- --with-libs=/usr/gnu/mips-sgi-irix6.5/lib --with-gnu-ld --with-ld=/usr/gnu/bin/mips-sgi-irix6.5-ld --with-gnu-as --with-as=/usr/gnu/bin/mips-sgi-irix6.5-as in the directory: /usr/gnu/build/mips-gcc-4.0.2-compile As preparation I did a: > CFLAGS=-O1 CXXFLAGS=-O1 ./configure --cache-file=../binutils_configure.cache > --prefix=/usr/gnu --bindir=/usr/gnu/bin --sbindir=/usr/gnu/sbin > --libdir=/usr/gnu/lib32 --program-prefix=mips-sgi-irix6.5- > --target=mips-sgi-irix6.5 > make > make install on the binutils-2.16.1 in: /usr/gnu/build/mips-binutils-2.16.1. Furthermore, I copied the original libs from the SGI box (IRIX 6.5.25) to: /usr/gnu/mips-sgi-irix6.5/lib and the headers to: /usr/gnu/mips-sgi-irix6.5/sys-include This it the contens of those directorys: > pwd /usr/gnu/mips-sgi-irix6.5/lib > ls -l total 14536 -rw-r--r--1 pfeil pfeil 30 Sep 11 23:13 COPIED drwxr-xr-x 32 pfeil pfeil 1088 Sep 29 23:28 ldscripts -r-xr-xr-x1 pfeil pfeil 3322796 Sep 30 00:17 libc.so -r-xr-xr-x1 pfeil pfeil 3322796 Sep 11 23:30 libc.so.1 -r--r--r--1 pfeil pfeil 128088 Sep 11 23:30 libdisk.so -r--r--r--1 pfeil pfeil67600 Sep 11 23:30 libpam.so -r--r--r--1 pfeil pfeil25224 Sep 11 23:30 libpam_misc.so -rwxr-xr-x1 pfeil pfeil 555440 Sep 11 23:30 rld > pwd /usr/gnu/mips-sgi-irix6.5/sys-include > ls ABIinfo.h ieeefp.hresolv.h FlexLexer.h internalrld_interface.h MediaViewer inttypes.h rpc Mrm invent.hrpcsvc Sgm isam.h rsvp SpeedShop iso646.hsac.h Vk kmem.h sat.h X11 ksyssched.h Xm langinfo.h scncomment.h a.out.h lastlog.h scnhdr.h abi_mutex.h ldfcn.h search.h aio.h libXlate.h semaphore.h alloca.hlibdwarf.h setjmp.h aouthdr.h libelf.hsex.h ar.hliberrno.h sgi_nl.h archives.h libexc.hsgidefs.h arcslibftn.hsgidlfcn.h arpalibgen.hsgtty.h asm.h libw.h shadow.h assert.hlimits.hshlib.h auxv.h linenum.h sigfpe.h bstring.h locale.hsiginfo.h cap_net.h locale_attr.h signal.h capability.hmakesnmp cblas.h malloc.hsock_extern.h ckpt.h math.h ssdi.h clearance.h math62.hstamp.h clibdefs.h mdbm.h standards.h cmplrs mediad.hstd.h compact_reloc.h memory.hstdarg.h core.out.h mls.h stddef.h cpio.h mntent.hstdio.h cr1.h mon.h stdlib.h craymonetary.h storclass.h crypt.h mpc.h string.h cs.hmpool.h strings.h ctype.h mqueue.hstropts.h curses.hmsym.h stsupport.h db.hmutex.h sum.h dbm.h namefs svr4_math.h deflt.h nan.h sym.h devmgmt.h nanothread.hsym64.h di_aux.hndbm.h sym_aux.h di_group.h net symconst.h di_passwd.h netconfig.h syms.h dial.h netdb.h sys dirent.hnetdir.hsys.s disassembler.h netinet sysexits.h dlfcn.h netman syslog.h dslib.h netns tar.h dwarf.h nl_types.h task.h elf.h nlist.h tcpd.h elf_abi.h ns_api.hterm.h elf_delta.h ns_daemon.h termio.h elf_mips.h obj.h termios.h elf
[Bug target/23231] cross compiling fails for mips-sgi-irix6.5
--- Additional Comments From pfl at iis dot fhg dot de 2005-08-07 09:22 --- I tried your suggestions with the following parameters: I compilied with gcc-4.0.2 binutils 2.16.1 with: CC="ccache i686-pc-linux-gnu-gcc-4.0" CXX="ccache i686-pc-linux-gnu-g++-4.0" CFLAGS="-O1" CXXFLAGS="-O1" configure --cache-file=../binutils_configure-i686. cache --prefix=/home/pfl/gnu --bindir=/home/pfl/gnu/bin --sbindir=/home/pfl/gnu/ sbin --libdir=/home/pfl/gnu/lib32 --program-prefix=i686-pc-linux-gnu- Then I compiled gcc-4.0.2 with: CC="ccache i686-pc-linux-gnu-gcc-4.0" CXX="ccache i686-pc-linux-gnu-g++-4.0" CFLAGS="-O1" CXXFLAGS="-O1" ../gcc-4.0-20050728/configure --cache-file=../ gcc40_configure-mips.cache --prefix=/home/pfl/gnu --bindir=/home/pfl/gnu/bin -- sbindir=/home/pfl/gnu/sbin --libdir=/home/pfl/gnu/lib32 --disable-nls --disable- multilib --disable-intl --enable-languages=c,c++ --target=mips-sgi-irix6.5 -- program-prefix=mips-sgi-irix6.5- --without-headers --with-newlib --with-gnu-ld - -with-ld=/home/pfl/gnu/bin/mips-sgi-irix6.5-ld --with-gnu-as --with-as=/home/ pfl/gnu/bin/mips-pc-linux-gnu-as This leads to: ... /home/pfl/gnu/mips-sgi-irix6.5/bin/ld: cannot find -lc collect2: ld returned 1 exit status ... Then I tried: CC="ccache i686-pc-linux-gnu-gcc-4.0" CXX="ccache i686-pc-linux-gnu-g++-4.0" CFLAGS="-O1" CXXFLAGS="-O1" ../gcc-4.0-20050728/configure --cache-file=../ gcc40_configure-mips.cache --prefix=/home/pfl/gnu --bindir=/home/pfl/gnu/bin -- sbindir=/home/pfl/gnu/sbin --libdir=/home/pfl/gnu/lib32 --disable-nls --disable- multilib --disable-intl --enable-languages=c,c++ --target=mips-sgi-irix6.5 -- program-prefix=mips-sgi-irix6.5- --without-headers --with-newlib --with-gnu-ld Which broke at the same line with: ... /home/pfl/gnu/mips-sgi-irix6.5/bin/ld: cannot find -lc collect2: ld returned 1 exit status make[2]: *** [libgcc_s.so] Fehler 1 make[2]: Verlassen des Verzeichnisses Verzeichnis »/home/pfl/gnu/build/mips-gcc- 4.0/gcc« make[1]: *** [stmp-multilib] Fehler 2 rm gfdl.pod gcov.pod cpp.pod gpl.pod gcc.pod fsf-funding.pod make[1]: Verlassen des Verzeichnisses Verzeichnis »/home/pfl/gnu/build/mips-gcc- 4.0/gcc« make: *** [all-gcc] Fehler 2 If I manualy executed the line without -lc the line compiles/links. But the make file tries to redo this step so I find myself in an endless loop of manual compiling/linking and starting make. I think the -lc linker switch could perhaps be removed from the Makefile. I have a coupel of very fast machines and I am willing to try some parameter constellations for you if you like. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23231
[Bug bootstrap/23231] New: cross compiling fails for mips-sgi-irix6.5
when cross compiling the gcc 4.0.2 on a i686-pc-linux-gnu with intel: binutils 2.16.1 - compiled with gcc 4.1.0 mips: binutils 2.16.1 - compiled with gcc 4.1.0 the following error occures: /home/pfl/gnu/mips-sgi-irix6.5/bin/ld: unrecognized option '-_SYSTYPE_SVR4' /home/pfl/gnu/mips-sgi-irix6.5/bin/ld: use the --help option for usage information collect2: ld returned 1 exit status and the compilation exits. The same problem occures when the binutils are: intel: binutils 2.16.1 - compiled with gcc 4.0.2 mips: binutils 2.16.1 - compiled with gcc 4.0.2 I get also the same problem when compiling on an apple mac - tiger 10.4.2. -- Summary: cross compiling fails for mips-sgi-irix6.5 Product: gcc Version: 4.0.2 Status: UNCONFIRMED Severity: normal Priority: P2 Component: bootstrap AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: pfl at iis dot fhg dot de CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: mips-sgi-irix6.5 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23231