[Bug middle-end/83858] [8 Regression] error: invalid cast from type 'poly_uint16' to type 'long long int'

2018-01-16 Thread rsandifo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83858

rsandifo at gcc dot gnu.org  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #5 from rsandifo at gcc dot gnu.org  
---
Patch applied.

[Bug middle-end/83858] [8 Regression] error: invalid cast from type 'poly_uint16' to type 'long long int'

2018-01-16 Thread rsandifo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83858

--- Comment #4 from rsandifo at gcc dot gnu.org  
---
Author: rsandifo
Date: Tue Jan 16 14:47:49 2018
New Revision: 256744

URL: https://gcc.gnu.org/viewcvs?rev=256744=gcc=rev
Log:
Move pa.h FUNCTION_ARG_SIZE to pa.c (PR83858)

The port-local FUNCTION_ARG_SIZE:

  MODE) != BLKmode \
 ? (HOST_WIDE_INT) GET_MODE_SIZE (MODE) \
 : int_size_in_bytes (TYPE)) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)

is used by code in pa.c and by ASM_DECLARE_FUNCTION_NAME in som.h.
Treating GET_MODE_SIZE as a constant is OK for the former but not
the latter, which is used in target-independent code.  This caused
a build failure on hppa2.0w-hp-hpux11.11.

2018-01-16  Richard Sandiford  

gcc/
PR target/83858
* config/pa/pa.h (FUNCTION_ARG_SIZE): Delete.
* config/pa/pa-protos.h (pa_function_arg_size): Declare.
* config/pa/som.h (ASM_DECLARE_FUNCTION_NAME): Use
pa_function_arg_size instead of FUNCTION_ARG_SIZE.
* config/pa/pa.c (pa_function_arg_advance): Likewise.
(pa_function_arg, pa_arg_partial_bytes): Likewise.
(pa_function_arg_size): New function.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/pa/pa-protos.h
trunk/gcc/config/pa/pa.c
trunk/gcc/config/pa/pa.h
trunk/gcc/config/pa/som.h

[Bug middle-end/83858] [8 Regression] error: invalid cast from type 'poly_uint16' to type 'long long int'

2018-01-16 Thread rsandifo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83858

rsandifo at gcc dot gnu.org  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2018-01-16
   Assignee|unassigned at gcc dot gnu.org  |rsandifo at gcc dot 
gnu.org
 Ever confirmed|0   |1

--- Comment #3 from rsandifo at gcc dot gnu.org  
---
Sorry about that.  I'd used hppa64-hp-hpux11.23 for the hppa testing, and like
you say, that doesn't seem to be affected.

I agree moving it to pa.c is the right fix.

[Bug middle-end/83858] [8 Regression] error: invalid cast from type 'poly_uint16' to type 'long long int'

2018-01-16 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83858

Richard Biener  changed:

   What|Removed |Added

 CC||rsandifo at gcc dot gnu.org
   Target Milestone|--- |8.0

[Bug middle-end/83858] [8 Regression] error: invalid cast from type 'poly_uint16' to type 'long long int'

2018-01-15 Thread danglin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83858

--- Comment #2 from John David Anglin  ---
It looks to me like FUNCTION_ARG_SIZE needs to me to pa.c...

[Bug middle-end/83858] [8 Regression] error: invalid cast from type 'poly_uint16' to type 'long long int'

2018-01-15 Thread danglin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83858

--- Comment #1 from John David Anglin  ---
In varasm.ii, we have


inline __attribute__ ((always_inline)) poly_uint16
GET_MODE_SIZE (machine_mode mode)
{
  return mode_to_bytes (mode);
}

template
inline __attribute__ ((always_inline)) typename if_poly::type
GET_MODE_SIZE (const T )
{
  return mode_to_bytes (mode);
}

template
inline __attribute__ ((always_inline)) typename if_nonpoly::type
GET_MODE_SIZE (const T )
{
  return mode_to_bytes (mode).coeffs[0];
}

In machmode.h, we have

#if ONLY_FIXED_SIZE_MODES
#define GET_MODE_SIZE(MODE) ((unsigned short) mode_to_bytes (MODE).coeffs[0])
#else
ALWAYS_INLINE poly_uint16
GET_MODE_SIZE (machine_mode mode)
{
  return mode_to_bytes (mode);
}

template
ALWAYS_INLINE typename if_poly::type
GET_MODE_SIZE (const T )
{
  return mode_to_bytes (mode);
}

template
ALWAYS_INLINE typename if_nonpoly::type
GET_MODE_SIZE (const T )
{
  return mode_to_bytes (mode).coeffs[0];
}
#endif

and

/* Always treat machine modes as fixed-size while compiling code specific
   to targets that have no variable-size modes.  */
#if defined (IN_TARGET_CODE) && NUM_POLY_INT_COEFFS == 1
#define ONLY_FIXED_SIZE_MODES 1
#else
#define ONLY_FIXED_SIZE_MODES 0
#endif

NUM_POLY_INT_COEFFS is defined to 1 in insn-modes.h, so IN_TARGET_CODE
must not be defined.