[Bug target/80482] [7/8 Regression] vec_mul produces compilation error if 1 of its parms is const or volatile
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat Apr 22 19:55:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80482
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2017-04-22
CC| |jakub at gcc dot gnu.org
Target Milestone|--- |7.0
Summary|[7 Regression] vec_mul |[7/8 Regression] vec_mul
|produces compilation error |produces compilation error
|if 1 of its parms is const |if 1 of its parms is const
|or volatile |or volatile
Ever confirmed|0 |1
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with r237183.
I think best would be just to require that the types are compatible, like below
(swapped the TREE_CODE check because it is cheaper).
Or you can compare TYPE_MAIN_VARIANT (arg0_type) with TYPE_MAIN_VARIANT
(arg1_type), but that is less robust.
--- gcc/rs6000-c.c.jj 2017-03-29 07:11:23.000000000 +0200
+++ gcc/rs6000-c.c 2017-04-22 21:50:24.614009489 +0200
@@ -5596,10 +5596,10 @@ altivec_resolve_overloaded_builtin (loca
tree arg1_type = TREE_TYPE (arg1);
/* Both arguments must be vectors and the types must match. */
- if (arg0_type != arg1_type)
- goto bad;
if (TREE_CODE (arg0_type) != VECTOR_TYPE)
goto bad;
+ if (!types_compatible_p (arg0_type, arg1_type))
+ goto bad;
switch (TYPE_MODE (TREE_TYPE (arg0_type)))
{
@@ -5610,8 +5610,8 @@ altivec_resolve_overloaded_builtin (loca
case TImode:
{
/* For scalar types just use a multiply expression. */
- return fold_build2_loc (loc, MULT_EXPR, TREE_TYPE (arg0),
- arg0, arg1);
+ return fold_build2_loc (loc, MULT_EXPR, TREE_TYPE (arg0), arg0,
+ fold_convert (TREE_TYPE (arg0), arg1));
}
case SFmode:
{
More information about the Gcc-bugs
mailing list