This is the mail archive of the gcc-patches@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]

PATCH - [mainline] AltiVec power-pc-darwin fix for vec_ld



Following test case shows a bug in selection of overloaded c++ version
of altivec intrinsic functions with 'const' qualifier in their parameter type:



typedef vector unsigned char vuc_t; const vuc_t* p; int main() { vec_ld(0,p); }

g++ issues bogus error, because, it does not add 'const' qualifier in building the
parameter type when matching the overloaded function: 'vec_ld'


mygcct5 -x c++ -faltivec bad.c
bad.c: In function `int main()':
bad.c:7: error: invalid conversion from `const unsigned char __vector__*' to `unsigned char __vector__*'
bad.c:7: error: initializing argument 2 of `unsigned char __vector__ vec_ld(int, unsigned char __vector__*)'


Following patch, bootstrapped, dejagnu tested on ppc-darwin fixes the problem.

OK for mainline?

- Thanks, fariborz


ChangeLog:


2004-05-10 Fariborz Jahanian <fjahanian@apple.com>

        * config/rs6000/rs6000.c (rs6000_handle_altivec_attribute):
        Add const qualifier to altivec vector type if one is needed.


Index: rs6000.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.c,v retrieving revision 1.635 diff -c -p -r1.635 rs6000.c *** rs6000.c 7 May 2004 23:00:39 -0000 1.635 --- rs6000.c 10 May 2004 22:13:56 -0000 *************** rs6000_handle_altivec_attribute (tree *n *** 15040,15045 **** --- 15040,15048 ---- default: break; }

+   if (result && result != type && TYPE_READONLY(type))
+     result = build_qualified_type (result, TYPE_QUAL_CONST);
+
    *no_add_attrs = true;  /* No need to hang on to the attribute.  */

if (!result)


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