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 c++/16882] New: overloading confused by const vector arguments


Some of the <altivec.h> functionality no longer works from C++.  I've only
tried it on powerpc-linux, but it fails using generic vectors so is probably
target-independent.  This test case shows the problem using generic vectors.
                                                                               
                
#define vector __attribute__((vector_size(16)))
                                                                               
                
vector signed int vld (int a1, const vector signed int *a2) { return *a2; }
vector signed short vld (int a1, const vector signed short *a2) { return *a2; }
vector signed char vld (int a1, const vector signed char *a2) { return *a2; }
                                                                               
                
extern int i;
extern vector signed short vss;
extern vector signed short *vssp;
extern const vector signed short *cvssp;
                                                                               
                
void foo ()
{
  vss = vld(i, vssp);
  vss = vld(i, cvssp);
}
                                                                               
                
Output from this test using mainline built last night:
                                                                               
                
elm3b11% /opt/gcc-nightly/mline-20040804/bin/g++ -c vecld2.C
vecld2.C: In function `void foo()':
vecld2.C:14: error: call of overloaded `vld(int&, short int __vector__*&)' is
ambiguous
vecld2.C:3: note: candidates are: int __vector__ vld(int, const int __vector__*)
vecld2.C:4: note:                 short int __vector__ vld(int, const short int
__vector__*)
vecld2.C:5: note:                 signed char __vector__ vld(int, const signed
char __vector__*) 
                                                                               
              
The test starts failing with the following patch:
2004-07-21  Paolo Bonzini  <bonzini@gnu.org>
                                                                               
                
        * c-common.c (vector_types_convertible_p): Use vector types'
        TYPE_SIZE and TREE_TYPE instead of their mode.
        * convert.c (convert_to_integer): Likewise.
        (convert_to_vector): Likewise.
        * fold-const.c (fold_convert): Likewise.
        * varasm.c (output_constant): Likewise.
        * expr.c (store_constructor): Split ARRAY_TYPE and VECTOR_TYPE.
        Allow a VECTOR_TYPE initializer to be made of several vectors.
        For ARRAY_TYPEs and VECTOR_TYPES, simplify a bit the handling
        of cleared and need_to_clear, and use fold_convert.
        * c-typeck.c (build_binary_op): Do not use RDIV_EXPR for
        integer vectors.
                                                                               
                
cp:
                                                                               
                
2004-07-21  Paolo Bonzini  <bonzini@gnu.org>
                                                                               
                
       * typeck.c (build_binary_op): Do not use RDIV_EXPR for
       integer vectors.

-- 
           Summary: overloading confused by const vector arguments
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: janis187 at us dot ibm dot com
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: powerpc-unknown-linux-gnu


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


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