![]() |
Blitz Support : |
From: Julian Cummings (cummings_at_[hidden])
Date: 2005-05-06 19:20:17
Just wanted to note that I have sent a bug report query to the gcc folks
regarding this problem. I have isolated the cause of the problem in the
blitz code, but I am not sure at this point if the blitz code is truly
incorrect or if this is a compiler bug. The compiler is getting confused
when we try to add or multiply two enumerators from an unnamed enumeration.
It only gets confused in the presence of templated overloaded versions of
operator+ and operator*. I am puzzled by this behavior because enumerators
should always be treated as integers in arithmetic operations. This problem
does not occur with gcc-3.4 and earlier versions. I don't know if gcc-4.0
is enforcing some bizarre corner case of the ANSI C++ standard or what. I
will follow up on this once I hear something back from the gcc folks.
Regards, Julian C.
Dr. Julian C. Cummings Office: PB-111
Caltech/CACR, MC 158-79 Phone: 626-395-2543
1200 E. California Blvd. Fax: 626-584-5917
Pasadena, CA 91125
> -----Original Message-----
> From: blitz-support-bounces_at_[hidden]
> [mailto:blitz-support-bounces_at_[hidden]] On Behalf Of
> psong_at_[hidden]
> Sent: Friday, April 22, 2005 2:39 PM
> To: blitz-support_at_[hidden]
> Subject: [Blitz-support] Unable to compile with g++-4.0.0
>
> Hello everyone,
> Today I installed the latest GNU compiler g++-4.0.0 on my
> linux box and started to experiment it with my C++ programs.
> However, any program using
> blitz++-0.8 refused to compile. I re-installed blitz++-0.8 using
> blitz++g++-4.0.0 as
> the default C++ compiler ($./configure
> CXX=~/gcc-4.0.0/bin/g++) but the problem persisted. For
> example, I tried to compile the following program
>
>
> ######################## start of program ##########################
> #include <iostream>
> #include <blitz/array.h>
> int main()
> {
> blitz::Array<int,2> a1(3,3);
> return 0;
> }
> ######################### end of program ############################
>
>
> by doing
> $~/gcc-4.0.0/bin/g++ -c -Wall -I~/blitz-0.8 foo.cpp I got
> the following error message:
>
>
> ########################### start of error message
> ########################
> ~/blitz-0.8/blitz/meta/product.h: In static member function
> 'static typename blitz::NumericTypeTraits<typename
> T_expr1::T_numtype>::T_sumtype
> blitz::_bz_meta_vectorProduct<N, I>::f(const T_expr1&) [with
> T_expr1 = blitz::TinyVector<int, 2>, int N = 2, int I = 0]':
> ~/blitz-0.8/blitz/tvecglobs.h:68: instantiated from 'typename
> blitz::NumericTypeTraits<P_numtype>::T_sumtype
> blitz::product(const blitz::TinyVector<P_numtype, N_length>&)
> [with T_numtype1 = int, int N_length = 2]
> ~/blitz-0.8/blitz/array-impl.h:986: instantiated from 'int
> blitz::Array<T,
> N>::numElements() const [with P_numtype = int, int N_rank = 2]
> ~/blitz-0.8/blitz/array/methods.cc:254: instantiated from 'void
> blitz::Array<T, N>::setupStorage(int) [with P_numtype = int,
> int N_rank = 2]
> ~/blitz-0.8/blitz/array-impl.h:193: instantiated from
> 'blitz::Array<T,
> N>::Array(int, int, blitz::GeneralArrayStorage<N_rank>) [with
> P_numtype
> N>=
> int, int N_rank = 2]
> test_blitz.cpp:7: instantiated from here
> ~/blitz-0.8/blitz/meta/product.h:49: error:
> 'blitz::_bz_meta_vectorProduct<2,
> 0>::<anonymous enum>' is/uses anonymous type
> ~/blitz-0.8/blitz/meta/product.h:49: error: trying to instantiate
> 'template<class T> T blitz::operator*(const T&,
> blitz::_bz_meta_nullOperand)
> ~/blitz-0.8/blitz/meta/product.h:49: error:
> 'blitz::_bz_meta_vectorProduct<2,
> 0>::<anonymous enum>' is/uses anonymous type
> ~/blitz-0.8/blitz/meta/product.h:49: error: trying to instantiate
> 'template<class T> T blitz::operator*(const T&,
> blitz::_bz_meta_nullOperand)
> ~/blitz-0.8/blitz/meta/product.h: In static member function
> 'static typename blitz::NumericTypeTraits<typename
> T_expr1::T_numtype>::T_sumtype
> blitz::_bz_meta_vectorProduct<N, I>::f(const T_expr1&) [with
> T_expr1 = blitz::TinyVector<int, 2>, int N = 2, int I = 1]':
> ~/blitz-0.8/blitz/meta/product.h:49: instantiated from
> 'static typename
> blitz::NumericTypeTraits<typename
> T_expr1::T_numtype>::T_sumtype
> blitz::_bz_meta_vectorProduct<N, I>::f(const T_expr1&) [with
> T_expr1 = blitz::TinyVector<int, 2>, int N = 2, int I = 0]
> ~/blitz-0.8/blitz/tvecglobs.h:68: instantiated from 'typename
> blitz::NumericTypeTraits<P_numtype>::T_sumtype
> blitz::product(const blitz::TinyVector<P_numtype, N_length>&)
> [with T_numtype1 = int, int N_length = 2]
> ~/blitz-0.8/blitz/array-impl.h:986: instantiated from 'int
> blitz::Array<T,
> N>::numElements() const [with P_numtype = int, int N_rank = 2]
> ~/blitz-0.8/blitz/array/methods.cc:254: instantiated from 'void
> blitz::Array<T, N>::setupStorage(int) [with P_numtype = int,
> int N_rank = 2]
> ~/blitz-0.8/blitz/array-impl.h:193: instantiated from
> 'blitz::Array<T,
> N>::Array(int, int, blitz::GeneralArrayStorage<N_rank>) [with
> P_numtype
> N>=
> int, int N_rank = 2]
> test_blitz.cpp:7: instantiated from here
> ~/blitz-0.8/blitz/meta/product.h:49: error:
> 'blitz::_bz_meta_vectorProduct<2,
> 1>::<anonymous enum>' is/uses anonymous type
> ~/blitz-0.8/blitz/meta/product.h:49: error: trying to instantiate
> 'template<class T> T blitz::operator*(const T&,
> blitz::_bz_meta_nullOperand)
> ~/blitz-0.8/blitz/meta/product.h:49: error:
> 'blitz::_bz_meta_vectorProduct<2,
> 1>::<anonymous enum>' is/uses anonymous type
> ~/blitz-0.8/blitz/meta/product.h:49: error: trying to instantiate
> 'template<class T> T blitz::operator*(const T&,
> blitz::_bz_meta_nullOperand)
> make: *** [foo.o] Error 1
> ############################ end of error message
> #########################
>
>
> Can anyone tell me why this happens and how can I fix it? Thanks!
>
>
> Best Wishes,
>
> Pengcheng Song
>
>
> _______________________________________________
> Blitz-support mailing list
> Blitz-support_at_[hidden]
> http://www.oonumerics.org/mailman/listinfo.cgi/blitz-support
>