This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug optimization/12047] New: Problems with optimization (O3)


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12047

           Summary: Problems with optimization (O3)
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: peter at peem dot als dot lbl dot gov
                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: i686-pc-linux-gnu

Enabling optimization at the O3 level breaks the build of the source file
s.C. gcc 3.3 has no problems compiling this code.

Environment:
System: Linux kiste 2.4.20-4GB #1 Fri Jul 11 07:33:18 UTC 2003 i686 unknown unknown GNU/Linux
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc/configure --enable-threads=posix --enable-languages=c,c++,f77,objc --enable-__cxa_atexit --enable-libstdcxx-debug

How-To-Repeat:
source code s.C
template<typename T, T low, T high>
struct Range {
    struct Error {};
    Range(T value): value_(value) {
	if (value>=high || value<low)
	    throw Error();
    }
    Range& operator=(Range &r) { this->value_ = r.value_; }
    Range& operator=(T value) { return *this = Range(value); }
    operator T() { return value_; }
private:
    T value_;
};


extern double const low = -1.0, high = 1.0;
Range<double const&, low, high> val(0.0);

int main() {
    try {
	val = 2.0;
    } catch (...) {
    }
    return 0;
}
g++ -v -O3 s.C
Reading specs from /usr/local/lib/gcc/i686-pc-linux-gnu/3.4/specs
Configured with: ../gcc/configure --enable-threads=posix --enable-languages=c,c++,f77,objc --enable-__cxa_atexit --enable-libstdcxx-debug
Thread model: posix
gcc version 3.4 20030820 (experimental)
 /usr/local/libexec/gcc/i686-pc-linux-gnu/3.4/cc1plus -quiet -v -D_GNU_SOURCE s.C -quiet -dumpbase s.C -mtune=pentiumpro -auxbase s -O3 -version -o /tmp/cckwfSf6.s
ignoring nonexistent directory "NONE/include"
ignoring nonexistent directory "/usr/local/lib/gcc/i686-pc-linux-gnu/3.4/../../../../i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/lib/gcc/i686-pc-linux-gnu/3.4/../../../../include/c++/3.4
 /usr/local/lib/gcc/i686-pc-linux-gnu/3.4/../../../../include/c++/3.4/i686-pc-linux-gnu
 /usr/local/lib/gcc/i686-pc-linux-gnu/3.4/../../../../include/c++/3.4/backward
 /usr/local/include
 /usr/local/lib/gcc/i686-pc-linux-gnu/3.4/include
 /usr/include
End of search list.
GNU C++ version 3.4 20030820 (experimental) (i686-pc-linux-gnu)
	compiled by GNU C version 3.4 20030820 (experimental).
GGC heuristics: --param ggc-min-expand=47 --param ggc-min-heapsize=31899
 as -V -Qy -o /tmp/ccWmViR6.o /tmp/cckwfSf6.s
GNU assembler version 2.13.90.0.18 (i486-suse-linux) using BFD version 2.13.90.0.18 20030121 (SuSE Linux)
 /usr/local/libexec/gcc/i686-pc-linux-gnu/3.4/collect2 --eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 /usr/lib/crt1.o /usr/lib/crti.o /usr/local/lib/gcc/i686-pc-linux-gnu/3.4/crtbegin.o -L/usr/local/lib/gcc/i686-pc-linux-gnu/3.4 -L/usr/local/lib/gcc/i686-pc-linux-gnu/3.4/../../.. /tmp/ccWmViR6.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/local/lib/gcc/i686-pc-linux-gnu/3.4/crtend.o /usr/lib/crtn.o
/tmp/ccWmViR6.o(.text+0x52): In function `main':
: undefined reference to `typeinfo for Range<double const&, low, high>::Error'
/tmp/ccWmViR6.o(.gnu.linkonce.t._ZN5RangeIRKdXL_Z3lowEEXL_Z4highEEEaSES1_+0x4b): In function `Range<double const&, low, high>::operator=(double const&)':
: undefined reference to `typeinfo for Range<double const&, low, high>::Error'
collect2: ld returned 1 exit status


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]