LCOV - code coverage report
Current view: top level - gcc/cp - cvt.cc (source / functions) Coverage Total Hit
Test: gcc.info Lines: 78.8 % 1043 822
Test Date: 2024-12-21 13:15:12 Functions: 90.9 % 33 30
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: - 0 0

             Branch data     Line data    Source code
       1                 :             : /* Language-level data type conversion for GNU C++.
       2                 :             :    Copyright (C) 1987-2024 Free Software Foundation, Inc.
       3                 :             :    Hacked by Michael Tiemann (tiemann@cygnus.com)
       4                 :             : 
       5                 :             : This file is part of GCC.
       6                 :             : 
       7                 :             : GCC is free software; you can redistribute it and/or modify
       8                 :             : it under the terms of the GNU General Public License as published by
       9                 :             : the Free Software Foundation; either version 3, or (at your option)
      10                 :             : any later version.
      11                 :             : 
      12                 :             : GCC is distributed in the hope that it will be useful,
      13                 :             : but WITHOUT ANY WARRANTY; without even the implied warranty of
      14                 :             : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      15                 :             : GNU General Public License for more details.
      16                 :             : 
      17                 :             : You should have received a copy of the GNU General Public License
      18                 :             : along with GCC; see the file COPYING3.  If not see
      19                 :             : <http://www.gnu.org/licenses/>.  */
      20                 :             : 
      21                 :             : 
      22                 :             : /* This file contains the functions for converting C++ expressions
      23                 :             :    to different data types.  The only entry point is `convert'.
      24                 :             :    Every language front end must have a `convert' function
      25                 :             :    but what kind of conversions it does will depend on the language.  */
      26                 :             : 
      27                 :             : #include "config.h"
      28                 :             : #include "system.h"
      29                 :             : #include "coretypes.h"
      30                 :             : #include "target.h"
      31                 :             : #include "cp-tree.h"
      32                 :             : #include "stor-layout.h"
      33                 :             : #include "flags.h"
      34                 :             : #include "intl.h"
      35                 :             : #include "convert.h"
      36                 :             : #include "stringpool.h"
      37                 :             : #include "attribs.h"
      38                 :             : #include "escaped_string.h"
      39                 :             : #include "gcc-urlifier.h"
      40                 :             : 
      41                 :             : static tree convert_to_pointer_force (tree, tree, tsubst_flags_t);
      42                 :             : static tree build_type_conversion (tree, tree);
      43                 :             : static tree build_up_reference (tree, tree, int, tree, tsubst_flags_t);
      44                 :             : static void diagnose_ref_binding (location_t, tree, tree, tree);
      45                 :             : 
      46                 :             : /* Change of width--truncation and extension of integers or reals--
      47                 :             :    is represented with NOP_EXPR.  Proper functioning of many things
      48                 :             :    assumes that no other conversions can be NOP_EXPRs.
      49                 :             : 
      50                 :             :    Conversion between integer and pointer is represented with CONVERT_EXPR.
      51                 :             :    Converting integer to real uses FLOAT_EXPR
      52                 :             :    and real to integer uses FIX_TRUNC_EXPR.
      53                 :             : 
      54                 :             :    Here is a list of all the functions that assume that widening and
      55                 :             :    narrowing is always done with a NOP_EXPR:
      56                 :             :      In convert.cc, convert_to_integer[_maybe_fold].
      57                 :             :      In c-typeck.cc, build_binary_op_nodefault (boolean ops),
      58                 :             :         and c_common_truthvalue_conversion.
      59                 :             :      In expr.cc: expand_expr, for operands of a MULT_EXPR.
      60                 :             :      In fold-const.cc: fold.
      61                 :             :      In tree.cc: get_narrower and get_unwidened.
      62                 :             : 
      63                 :             :    C++: in multiple-inheritance, converting between pointers may involve
      64                 :             :    adjusting them by a delta stored within the class definition.  */
      65                 :             : 
      66                 :             : /* Subroutines of `convert'.  */
      67                 :             : 
      68                 :             : /* if converting pointer to pointer
      69                 :             :      if dealing with classes, check for derived->base or vice versa
      70                 :             :      else if dealing with method pointers, delegate
      71                 :             :      else convert blindly
      72                 :             :    else if converting class, pass off to build_type_conversion
      73                 :             :    else try C-style pointer conversion.  */
      74                 :             : 
      75                 :             : static tree
      76                 :    24669721 : cp_convert_to_pointer (tree type, tree expr, bool dofold,
      77                 :             :                        tsubst_flags_t complain)
      78                 :             : {
      79                 :    24669721 :   tree intype = TREE_TYPE (expr);
      80                 :    24669721 :   enum tree_code form;
      81                 :    24669721 :   tree rval;
      82                 :    24669721 :   location_t loc = cp_expr_loc_or_input_loc (expr);
      83                 :             : 
      84                 :    24669721 :   if (intype == error_mark_node)
      85                 :             :     return error_mark_node;
      86                 :             : 
      87                 :    24669721 :   if (MAYBE_CLASS_TYPE_P (intype))
      88                 :             :     {
      89                 :           3 :       intype = complete_type (intype);
      90                 :           3 :       if (!COMPLETE_TYPE_P (intype))
      91                 :             :         {
      92                 :           0 :           if (complain & tf_error)
      93                 :           0 :             error_at (loc, "cannot convert from incomplete type %qH to %qI",
      94                 :             :                       intype, type);
      95                 :           0 :           return error_mark_node;
      96                 :             :         }
      97                 :             : 
      98                 :           6 :       rval = build_type_conversion (type, expr);
      99                 :           3 :       if (rval)
     100                 :             :         {
     101                 :           0 :           if ((complain & tf_error)
     102                 :           0 :               && rval == error_mark_node)
     103                 :           0 :             error_at (loc, "conversion of %qE from %qH to %qI is ambiguous",
     104                 :             :                       expr, intype, type);
     105                 :           0 :           return rval;
     106                 :             :         }
     107                 :             :     }
     108                 :             : 
     109                 :             :   /* Handle anachronistic conversions from (::*)() to cv void* or (*)().  */
     110                 :    24669721 :   if (TYPE_PTR_P (type)
     111                 :    24669721 :       && (TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE
     112                 :    24511573 :           || VOID_TYPE_P (TREE_TYPE (type))))
     113                 :             :     {
     114                 :          12 :       if (TYPE_PTRMEMFUNC_P (intype)
     115                 :     2064324 :           || TREE_CODE (intype) == METHOD_TYPE)
     116                 :           9 :         return convert_member_func_to_ptr (type, expr, complain);
     117                 :     2064312 :       if (TYPE_PTR_P (TREE_TYPE (expr)))
     118                 :     1098638 :         return build_nop (type, expr);
     119                 :      965674 :       intype = TREE_TYPE (expr);
     120                 :             :     }
     121                 :             : 
     122                 :    23571074 :   if (expr == error_mark_node)
     123                 :             :     return error_mark_node;
     124                 :             : 
     125                 :    23571074 :   form = TREE_CODE (intype);
     126                 :             : 
     127                 :    23571074 :   if (INDIRECT_TYPE_P (intype))
     128                 :             :     {
     129                 :    15604101 :       intype = TYPE_MAIN_VARIANT (intype);
     130                 :             : 
     131                 :    15604101 :       if (TYPE_MAIN_VARIANT (type) != intype
     132                 :    10382469 :           && TYPE_PTR_P (type)
     133                 :    10376365 :           && TREE_CODE (TREE_TYPE (type)) == RECORD_TYPE
     134                 :     4275228 :           && MAYBE_CLASS_TYPE_P (TREE_TYPE (type))
     135                 :     4197323 :           && MAYBE_CLASS_TYPE_P (TREE_TYPE (intype))
     136                 :    19733620 :           && TREE_CODE (TREE_TYPE (intype)) == RECORD_TYPE)
     137                 :             :         {
     138                 :     4129519 :           enum tree_code code = PLUS_EXPR;
     139                 :     4129519 :           tree binfo;
     140                 :     4129519 :           tree intype_class;
     141                 :     4129519 :           tree type_class;
     142                 :     4129519 :           bool same_p;
     143                 :             : 
     144                 :     4129519 :           intype_class = TREE_TYPE (intype);
     145                 :     4129519 :           type_class = TREE_TYPE (type);
     146                 :             : 
     147                 :     4129519 :           same_p = same_type_p (TYPE_MAIN_VARIANT (intype_class),
     148                 :             :                                 TYPE_MAIN_VARIANT (type_class));
     149                 :     4129519 :           binfo = NULL_TREE;
     150                 :             :           /* Try derived to base conversion.  */
     151                 :     4129519 :           if (!same_p)
     152                 :       30730 :             binfo = lookup_base (intype_class, type_class, ba_check,
     153                 :             :                                  NULL, complain);
     154                 :     4129519 :           if (!same_p && !binfo)
     155                 :             :             {
     156                 :             :               /* Try base to derived conversion.  */
     157                 :          19 :               binfo = lookup_base (type_class, intype_class, ba_check,
     158                 :             :                                    NULL, complain);
     159                 :          19 :               code = MINUS_EXPR;
     160                 :             :             }
     161                 :     4129519 :           if (binfo == error_mark_node)
     162                 :             :             return error_mark_node;
     163                 :     4129510 :           if (binfo || same_p)
     164                 :             :             {
     165                 :     4129510 :               if (binfo)
     166                 :       30721 :                 expr = build_base_path (code, expr, binfo, 0, complain);
     167                 :             :               /* Add any qualifier conversions.  */
     168                 :     4129510 :               return build_nop (type, expr);
     169                 :             :             }
     170                 :             :         }
     171                 :             : 
     172                 :    11474582 :       if (TYPE_PTRMEMFUNC_P (type))
     173                 :             :         {
     174                 :           0 :           if (complain & tf_error)
     175                 :           0 :             error_at (loc, "cannot convert %qE from type %qH to type %qI",
     176                 :             :                       expr, intype, type);
     177                 :           0 :           return error_mark_node;
     178                 :             :         }
     179                 :             : 
     180                 :    11474582 :       return build_nop (type, expr);
     181                 :             :     }
     182                 :        1553 :   else if ((TYPE_PTRDATAMEM_P (type) && TYPE_PTRDATAMEM_P (intype))
     183                 :     7968428 :            || (TYPE_PTRMEMFUNC_P (type) && TYPE_PTRMEMFUNC_P (intype)))
     184                 :         113 :     return convert_ptrmem (type, expr, /*allow_inverse_p=*/false,
     185                 :         113 :                            /*c_cast_p=*/false, complain);
     186                 :     7966860 :   else if (TYPE_PTRMEMFUNC_P (intype))
     187                 :             :     {
     188                 :           0 :       if (!warn_pmf2ptr)
     189                 :             :         {
     190                 :           0 :           if (TREE_CODE (expr) == PTRMEM_CST)
     191                 :           0 :             return cp_convert_to_pointer (type, PTRMEM_CST_MEMBER (expr),
     192                 :           0 :                                           dofold, complain);
     193                 :           0 :           else if (TREE_CODE (expr) == OFFSET_REF)
     194                 :             :             {
     195                 :           0 :               tree object = TREE_OPERAND (expr, 0);
     196                 :           0 :               return get_member_function_from_ptrfunc (&object,
     197                 :           0 :                                                        TREE_OPERAND (expr, 1),
     198                 :             :                                                        complain);
     199                 :             :             }
     200                 :             :         }
     201                 :           0 :       if (complain & tf_error)
     202                 :           0 :         error_at (loc, "cannot convert %qE from type %qH to type %qI",
     203                 :             :                   expr, intype, type);
     204                 :           0 :       return error_mark_node;
     205                 :             :     }
     206                 :             : 
     207                 :     7966860 :   if (null_ptr_cst_p (expr))
     208                 :             :     {
     209                 :     5055502 :       if (TYPE_PTRMEMFUNC_P (type))
     210                 :         753 :         return build_ptrmemfunc (TYPE_PTRMEMFUNC_FN_TYPE (type), expr, 0,
     211                 :         753 :                                  /*c_cast_p=*/false, complain);
     212                 :             : 
     213                 :     5054749 :       if (complain & tf_warning)
     214                 :     3577772 :         maybe_warn_zero_as_null_pointer_constant (expr, loc);
     215                 :             : 
     216                 :             :       /* A NULL pointer-to-data-member is represented by -1, not by
     217                 :             :          zero.  */
     218                 :     5054749 :       tree val = (TYPE_PTRDATAMEM_P (type)
     219                 :     5054749 :                   ? build_int_cst_type (type, -1)
     220                 :     5053294 :                   : build_int_cst (type, 0));
     221                 :             : 
     222                 :     5054749 :       return (TREE_SIDE_EFFECTS (expr)
     223                 :     5054749 :               ? build2 (COMPOUND_EXPR, type, expr, val) : val);
     224                 :             :     }
     225                 :     2911358 :   else if (TYPE_PTRMEM_P (type) && INTEGRAL_CODE_P (form))
     226                 :             :     {
     227                 :           0 :       if (complain & tf_error)
     228                 :           0 :         error_at (loc, "invalid conversion from %qH to %qI", intype, type);
     229                 :           0 :       return error_mark_node;
     230                 :             :     }
     231                 :             : 
     232                 :     2911358 :   if (INTEGRAL_CODE_P (form))
     233                 :             :     {
     234                 :     2927069 :       if (TYPE_PRECISION (intype) == POINTER_SIZE)
     235                 :     2891185 :         return build1 (CONVERT_EXPR, type, expr);
     236                 :       20167 :       expr = cp_convert (c_common_type_for_size (TYPE_PRECISION (type), 0), expr,
     237                 :             :                          complain);
     238                 :             :       /* Modes may be different but sizes should be the same.  There
     239                 :             :          is supposed to be some integral type that is the same width
     240                 :             :          as a pointer.  */
     241                 :       60501 :       gcc_assert (GET_MODE_SIZE (SCALAR_INT_TYPE_MODE (TREE_TYPE (expr)))
     242                 :             :                   == GET_MODE_SIZE (SCALAR_INT_TYPE_MODE (type)));
     243                 :             : 
     244                 :             :       /* FIXME needed because convert_to_pointer_maybe_fold still folds
     245                 :             :          conversion of constants.  */
     246                 :       20167 :       if (!dofold)
     247                 :       20167 :         return build1 (CONVERT_EXPR, type, expr);
     248                 :             : 
     249                 :           0 :       return convert_to_pointer_maybe_fold (type, expr, dofold);
     250                 :             :     }
     251                 :             : 
     252                 :           6 :   if (type_unknown_p (expr))
     253                 :           0 :     return instantiate_type (type, expr, complain);
     254                 :             : 
     255                 :           6 :   if (complain & tf_error)
     256                 :           6 :     error_at (loc, "cannot convert %qE from type %qH to type %qI",
     257                 :             :               expr, intype, type);
     258                 :           6 :   return error_mark_node;
     259                 :             : }
     260                 :             : 
     261                 :             : /* Like convert, except permit conversions to take place which
     262                 :             :    are not normally allowed due to access restrictions
     263                 :             :    (such as conversion from sub-type to private super-type).  */
     264                 :             : 
     265                 :             : static tree
     266                 :     7539523 : convert_to_pointer_force (tree type, tree expr, tsubst_flags_t complain)
     267                 :             : {
     268                 :     7539523 :   tree intype = TREE_TYPE (expr);
     269                 :     7539523 :   enum tree_code form = TREE_CODE (intype);
     270                 :             : 
     271                 :     7539523 :   if (form == POINTER_TYPE)
     272                 :             :     {
     273                 :     7539523 :       intype = TYPE_MAIN_VARIANT (intype);
     274                 :             : 
     275                 :     7539523 :       if (TYPE_MAIN_VARIANT (type) != intype
     276                 :     2317870 :           && TREE_CODE (TREE_TYPE (type)) == RECORD_TYPE
     277                 :     2317841 :           && MAYBE_CLASS_TYPE_P (TREE_TYPE (type))
     278                 :     2317838 :           && MAYBE_CLASS_TYPE_P (TREE_TYPE (intype))
     279                 :     9857361 :           && TREE_CODE (TREE_TYPE (intype)) == RECORD_TYPE)
     280                 :             :         {
     281                 :     2317838 :           enum tree_code code = PLUS_EXPR;
     282                 :     2317838 :           tree binfo;
     283                 :             : 
     284                 :     2317838 :           binfo = lookup_base (TREE_TYPE (intype), TREE_TYPE (type),
     285                 :             :                                ba_unique, NULL, complain);
     286                 :     2317838 :           if (!binfo)
     287                 :             :             {
     288                 :           3 :               binfo = lookup_base (TREE_TYPE (type), TREE_TYPE (intype),
     289                 :             :                                    ba_unique, NULL, complain);
     290                 :           3 :               code = MINUS_EXPR;
     291                 :             :             }
     292                 :     2317838 :           if (binfo == error_mark_node)
     293                 :             :             return error_mark_node;
     294                 :     2317838 :           if (binfo)
     295                 :             :             {
     296                 :     2317835 :               expr = build_base_path (code, expr, binfo, 0, complain);
     297                 :     2317835 :               if (expr == error_mark_node)
     298                 :             :                  return error_mark_node;
     299                 :             :               /* Add any qualifier conversions.  */
     300                 :     2317835 :               if (!same_type_p (TREE_TYPE (TREE_TYPE (expr)),
     301                 :             :                                 TREE_TYPE (type)))
     302                 :      370399 :                 expr = build_nop (type, expr);
     303                 :     2317835 :               return expr;
     304                 :             :             }
     305                 :             :         }
     306                 :             :     }
     307                 :             : 
     308                 :     5221688 :   return cp_convert_to_pointer (type, expr, /*fold*/false, complain);
     309                 :             : }
     310                 :             : 
     311                 :             : /* We are passing something to a function which requires a reference.
     312                 :             :    The type we are interested in is in TYPE. The initial
     313                 :             :    value we have to begin with is in ARG.
     314                 :             : 
     315                 :             :    FLAGS controls how we manage access checking.
     316                 :             :    DIRECT_BIND in FLAGS controls how any temporaries are generated.
     317                 :             :      If DIRECT_BIND is set, DECL is the reference we're binding to.  */
     318                 :             : 
     319                 :             : static tree
     320                 :         235 : build_up_reference (tree type, tree arg, int flags, tree decl,
     321                 :             :                     tsubst_flags_t complain)
     322                 :             : {
     323                 :         235 :   tree rval;
     324                 :         235 :   tree argtype = TREE_TYPE (arg);
     325                 :         235 :   tree target_type = TREE_TYPE (type);
     326                 :             : 
     327                 :         235 :   gcc_assert (TYPE_REF_P (type));
     328                 :             : 
     329                 :         235 :   if ((flags & DIRECT_BIND) && ! lvalue_p (arg))
     330                 :             :     {
     331                 :             :       /* Create a new temporary variable.  We can't just use a TARGET_EXPR
     332                 :             :          here because it needs to live as long as DECL.  */
     333                 :           0 :       tree targ = arg;
     334                 :             : 
     335                 :           0 :       arg = make_temporary_var_for_ref_to_temp (decl, target_type);
     336                 :             : 
     337                 :             :       /* Process the initializer for the declaration.  */
     338                 :           0 :       DECL_INITIAL (arg) = targ;
     339                 :           0 :       cp_finish_decl (arg, targ, /*init_const_expr_p=*/false, NULL_TREE,
     340                 :             :                       LOOKUP_ONLYCONVERTING|DIRECT_BIND);
     341                 :             :     }
     342                 :         235 :   else if (!(flags & DIRECT_BIND) && ! obvalue_p (arg))
     343                 :           1 :     return get_target_expr (arg, complain);
     344                 :             : 
     345                 :             :   /* If we had a way to wrap this up, and say, if we ever needed its
     346                 :             :      address, transform all occurrences of the register, into a memory
     347                 :             :      reference we could win better.  */
     348                 :         234 :   rval = cp_build_addr_expr (arg, complain);
     349                 :         234 :   if (rval == error_mark_node)
     350                 :             :     return error_mark_node;
     351                 :             : 
     352                 :         234 :   if ((flags & LOOKUP_PROTECT)
     353                 :         234 :       && TYPE_MAIN_VARIANT (argtype) != TYPE_MAIN_VARIANT (target_type)
     354                 :           9 :       && MAYBE_CLASS_TYPE_P (argtype)
     355                 :         243 :       && MAYBE_CLASS_TYPE_P (target_type))
     356                 :             :     {
     357                 :             :       /* We go through lookup_base for the access control.  */
     358                 :           9 :       tree binfo = lookup_base (argtype, target_type, ba_check,
     359                 :             :                                 NULL, complain);
     360                 :           9 :       if (binfo == error_mark_node)
     361                 :             :         return error_mark_node;
     362                 :           9 :       if (binfo == NULL_TREE)
     363                 :           0 :         return error_not_base_type (target_type, argtype);
     364                 :           9 :       rval = build_base_path (PLUS_EXPR, rval, binfo, 1, complain);
     365                 :             :     }
     366                 :             :   else
     367                 :         225 :     rval
     368                 :         225 :       = convert_to_pointer_force (build_pointer_type (target_type),
     369                 :             :                                   rval, complain);
     370                 :         234 :   return build_nop (type, rval);
     371                 :             : }
     372                 :             : 
     373                 :             : /* Subroutine of convert_to_reference. REFTYPE is the target reference type.
     374                 :             :    INTYPE is the original rvalue type and DECL is an optional _DECL node
     375                 :             :    for diagnostics.
     376                 :             : 
     377                 :             :    [dcl.init.ref] says that if an rvalue is used to
     378                 :             :    initialize a reference, then the reference must be to a
     379                 :             :    non-volatile const type.  */
     380                 :             : 
     381                 :             : static void
     382                 :           7 : diagnose_ref_binding (location_t loc, tree reftype, tree intype, tree decl)
     383                 :             : {
     384                 :           7 :   tree ttl = TREE_TYPE (reftype);
     385                 :             : 
     386                 :           7 :   if (!TYPE_REF_IS_RVALUE (reftype)
     387                 :           7 :       && !CP_TYPE_CONST_NON_VOLATILE_P (ttl))
     388                 :             :     {
     389                 :           0 :       const char *msg;
     390                 :             : 
     391                 :           0 :       if (CP_TYPE_VOLATILE_P (ttl) && decl)
     392                 :             :         msg = G_("initialization of volatile reference type %q#T from "
     393                 :             :                  "rvalue of type %qT");
     394                 :           0 :       else if (CP_TYPE_VOLATILE_P (ttl))
     395                 :             :         msg = G_("conversion to volatile reference type %q#T "
     396                 :             :                  "from rvalue of type %qT");
     397                 :           0 :       else if (decl)
     398                 :             :         msg = G_("initialization of non-const reference type %q#T from "
     399                 :             :                  "rvalue of type %qT");
     400                 :             :       else
     401                 :           0 :         msg = G_("conversion to non-const reference type %q#T from "
     402                 :             :                  "rvalue of type %qT");
     403                 :             : 
     404                 :           0 :       permerror (loc, msg, reftype, intype);
     405                 :             :     }
     406                 :           7 : }
     407                 :             : 
     408                 :             : /* For C++: Only need to do one-level references, but cannot
     409                 :             :    get tripped up on signed/unsigned differences.
     410                 :             : 
     411                 :             :    DECL is either NULL_TREE or the _DECL node for a reference that is being
     412                 :             :    initialized.  It can be error_mark_node if we don't know the _DECL but
     413                 :             :    we know it's an initialization.  */
     414                 :             : 
     415                 :             : tree
     416                 :         237 : convert_to_reference (tree reftype, tree expr, int convtype,
     417                 :             :                       int flags, tree decl, tsubst_flags_t complain)
     418                 :             : {
     419                 :         237 :   tree type = TYPE_MAIN_VARIANT (TREE_TYPE (reftype));
     420                 :         237 :   tree intype;
     421                 :         237 :   tree rval = NULL_TREE;
     422                 :         237 :   tree rval_as_conversion = NULL_TREE;
     423                 :         237 :   bool can_convert_intype_to_type;
     424                 :         237 :   location_t loc = cp_expr_loc_or_input_loc (expr);
     425                 :             : 
     426                 :         237 :   if (TREE_CODE (type) == FUNCTION_TYPE
     427                 :         237 :       && TREE_TYPE (expr) == unknown_type_node)
     428                 :           0 :     expr = instantiate_type (type, expr, complain);
     429                 :             : 
     430                 :         237 :   if (expr == error_mark_node)
     431                 :             :     return error_mark_node;
     432                 :             : 
     433                 :         235 :   intype = TREE_TYPE (expr);
     434                 :             : 
     435                 :         235 :   gcc_assert (!TYPE_REF_P (intype));
     436                 :         235 :   gcc_assert (TYPE_REF_P (reftype));
     437                 :             : 
     438                 :         235 :   intype = TYPE_MAIN_VARIANT (intype);
     439                 :             : 
     440                 :         235 :   can_convert_intype_to_type = can_convert_standard (type, intype, complain);
     441                 :             : 
     442                 :         235 :   if (!can_convert_intype_to_type
     443                 :           4 :       && (convtype & CONV_IMPLICIT) && MAYBE_CLASS_TYPE_P (intype)
     444                 :         235 :       && ! (flags & LOOKUP_NO_CONVERSION))
     445                 :             :     {
     446                 :             :       /* Look for a user-defined conversion to lvalue that we can use.  */
     447                 :             : 
     448                 :           0 :       rval_as_conversion
     449                 :           0 :         = build_type_conversion (reftype, expr);
     450                 :             : 
     451                 :           0 :       if (rval_as_conversion && rval_as_conversion != error_mark_node
     452                 :           0 :           && lvalue_p (rval_as_conversion))
     453                 :             :         {
     454                 :             :           expr = rval_as_conversion;
     455                 :         235 :           rval_as_conversion = NULL_TREE;
     456                 :             :           intype = type;
     457                 :             :           can_convert_intype_to_type = 1;
     458                 :             :         }
     459                 :             :     }
     460                 :             : 
     461                 :         235 :   if (((convtype & CONV_STATIC)
     462                 :           0 :        && can_convert_standard (intype, type, complain))
     463                 :         235 :       || ((convtype & CONV_IMPLICIT) && can_convert_intype_to_type))
     464                 :             :     {
     465                 :         231 :       {
     466                 :         231 :         tree ttl = TREE_TYPE (reftype);
     467                 :         231 :         tree ttr = lvalue_type (expr);
     468                 :             : 
     469                 :         231 :         if ((complain & tf_error)
     470                 :         231 :             && ! lvalue_p (expr))
     471                 :           3 :           diagnose_ref_binding (loc, reftype, intype, decl);
     472                 :             : 
     473                 :         231 :         if (! (convtype & CONV_CONST)
     474                 :         231 :             && !at_least_as_qualified_p (ttl, ttr))
     475                 :             :           {
     476                 :           6 :             if (complain & tf_error)
     477                 :           6 :               permerror (loc, "conversion from %qH to %qI discards qualifiers",
     478                 :             :                          ttr, reftype);
     479                 :             :             else
     480                 :           0 :               return error_mark_node;
     481                 :             :           }
     482                 :             :       }
     483                 :             : 
     484                 :         231 :       return build_up_reference (reftype, expr, flags, decl, complain);
     485                 :             :     }
     486                 :           4 :   else if ((convtype & CONV_REINTERPRET) && obvalue_p (expr))
     487                 :             :     {
     488                 :             :       /* When casting an lvalue to a reference type, just convert into
     489                 :             :          a pointer to the new type and deference it.  This is allowed
     490                 :             :          by San Diego WP section 5.2.9 paragraph 12, though perhaps it
     491                 :             :          should be done directly (jason).  (int &)ri ---> *(int*)&ri */
     492                 :             : 
     493                 :             :       /* B* bp; A& ar = (A&)bp; is valid, but it's probably not what they
     494                 :             :          meant.  */
     495                 :           0 :       if ((complain & tf_warning)
     496                 :           0 :           && TYPE_PTR_P (intype)
     497                 :           0 :           && (comptypes (TREE_TYPE (intype), type,
     498                 :             :                          COMPARE_BASE | COMPARE_DERIVED)))
     499                 :           0 :         warning_at (loc, 0, "casting %qT to %qT does not dereference pointer",
     500                 :             :                     intype, reftype);
     501                 :             : 
     502                 :           0 :       rval = cp_build_addr_expr (expr, complain);
     503                 :           0 :       if (rval != error_mark_node)
     504                 :           0 :         rval = convert_force (build_pointer_type (TREE_TYPE (reftype)),
     505                 :             :                               rval, 0, complain);
     506                 :           0 :       if (rval != error_mark_node)
     507                 :           0 :         rval = build1 (NOP_EXPR, reftype, rval);
     508                 :             :     }
     509                 :             :   else
     510                 :             :     {
     511                 :           4 :       rval = convert_for_initialization (NULL_TREE, type, expr, flags,
     512                 :             :                                          ICR_CONVERTING, 0, 0, complain);
     513                 :           4 :       if (rval == NULL_TREE || rval == error_mark_node)
     514                 :             :         return rval;
     515                 :           4 :       if (complain & tf_error)
     516                 :           4 :         diagnose_ref_binding (loc, reftype, intype, decl);
     517                 :           4 :       rval = build_up_reference (reftype, rval, flags, decl, complain);
     518                 :             :     }
     519                 :             : 
     520                 :           4 :   if (rval)
     521                 :             :     {
     522                 :             :       /* If we found a way to convert earlier, then use it.  */
     523                 :             :       return rval;
     524                 :             :     }
     525                 :             : 
     526                 :           0 :   if (complain & tf_error)
     527                 :           0 :     error_at (loc, "cannot convert type %qH to type %qI", intype, reftype);
     528                 :             : 
     529                 :           0 :   return error_mark_node;
     530                 :             : }
     531                 :             : 
     532                 :             : /* We are using a reference VAL for its value. Bash that reference all the
     533                 :             :    way down to its lowest form.  */
     534                 :             : 
     535                 :             : tree
     536                 :  1629534939 : convert_from_reference (tree val)
     537                 :             : {
     538                 :  1629534939 :   if (TREE_TYPE (val)
     539                 :  1629534939 :       && TYPE_REF_P (TREE_TYPE (val)))
     540                 :             :     {
     541                 :   180422563 :       tree t = TREE_TYPE (TREE_TYPE (val));
     542                 :   180422563 :       tree ref = build1 (INDIRECT_REF, t, val);
     543                 :             : 
     544                 :   180422563 :       mark_exp_read (val);
     545                 :             :        /* We *must* set TREE_READONLY when dereferencing a pointer to const,
     546                 :             :           so that we get the proper error message if the result is used
     547                 :             :           to assign to.  Also, &* is supposed to be a no-op.  */
     548                 :   180422563 :       TREE_READONLY (ref) = CP_TYPE_CONST_P (t);
     549                 :   180422563 :       TREE_THIS_VOLATILE (ref) = CP_TYPE_VOLATILE_P (t);
     550                 :   180422563 :       TREE_SIDE_EFFECTS (ref)
     551                 :   180422563 :         = (TREE_THIS_VOLATILE (ref) || TREE_SIDE_EFFECTS (val));
     552                 :   180422563 :       val = ref;
     553                 :             :     }
     554                 :             : 
     555                 :  1629534939 :   return val;
     556                 :             : }
     557                 :             : 
     558                 :             : /* Really perform an lvalue-to-rvalue conversion, including copying an
     559                 :             :    argument of class type into a temporary.  */
     560                 :             : 
     561                 :             : tree
     562                 :    12575769 : force_rvalue (tree expr, tsubst_flags_t complain)
     563                 :             : {
     564                 :    12575769 :   tree type = TREE_TYPE (expr);
     565                 :    12575769 :   if (MAYBE_CLASS_TYPE_P (type) && TREE_CODE (expr) != TARGET_EXPR)
     566                 :             :     {
     567                 :      138828 :       releasing_vec args (make_tree_vector_single (expr));
     568                 :      138828 :       expr = build_special_member_call (NULL_TREE, complete_ctor_identifier,
     569                 :             :                                         &args, type, LOOKUP_NORMAL, complain);
     570                 :      138828 :       expr = build_cplus_new (type, expr, complain);
     571                 :      138828 :     }
     572                 :             :   else
     573                 :    12436941 :     expr = decay_conversion (expr, complain);
     574                 :             : 
     575                 :    12575769 :   return expr;
     576                 :             : }
     577                 :             : 
     578                 :             : 
     579                 :             : /* If EXPR and ORIG are INTEGER_CSTs, return a version of EXPR that has
     580                 :             :    TREE_OVERFLOW set only if it is set in ORIG.  Otherwise, return EXPR
     581                 :             :    unchanged.  */
     582                 :             : 
     583                 :             : static tree
     584                 :   133365721 : ignore_overflows (tree expr, tree orig)
     585                 :             : {
     586                 :   133365721 :   tree stripped_expr = tree_strip_any_location_wrapper (expr);
     587                 :   133365721 :   tree stripped_orig = tree_strip_any_location_wrapper (orig);
     588                 :             : 
     589                 :   133365721 :   if (TREE_CODE (stripped_expr) == INTEGER_CST
     590                 :    81902783 :       && TREE_CODE (stripped_orig) == INTEGER_CST
     591                 :   215265942 :       && TREE_OVERFLOW (stripped_expr) != TREE_OVERFLOW (stripped_orig))
     592                 :             :     {
     593                 :        4886 :       gcc_assert (!TREE_OVERFLOW (stripped_orig));
     594                 :             :       /* Ensure constant sharing.  */
     595                 :        4886 :       stripped_expr = wide_int_to_tree (TREE_TYPE (stripped_expr),
     596                 :        9772 :                                         wi::to_wide (stripped_expr));
     597                 :             :     }
     598                 :             : 
     599                 :   133365721 :   return preserve_any_location_wrapper (stripped_expr, expr);
     600                 :             : }
     601                 :             : 
     602                 :             : /* Fold away simple conversions, but make sure TREE_OVERFLOW is set
     603                 :             :    properly and propagate TREE_NO_WARNING if folding EXPR results
     604                 :             :    in the same expression code.  */
     605                 :             : 
     606                 :             : tree
     607                 :    31171140 : cp_fold_convert (tree type, tree expr)
     608                 :             : {
     609                 :    31171140 :   tree conv;
     610                 :    31171140 :   if (TREE_TYPE (expr) == type)
     611                 :             :     conv = expr;
     612                 :    13875938 :   else if (TREE_CODE (expr) == PTRMEM_CST
     613                 :    13875938 :            && same_type_p (TYPE_PTRMEM_CLASS_TYPE (type),
     614                 :             :                            PTRMEM_CST_CLASS (expr)))
     615                 :             :     {
     616                 :             :       /* Avoid wrapping a PTRMEM_CST in NOP_EXPR.  */
     617                 :         183 :       conv = copy_node (expr);
     618                 :         183 :       TREE_TYPE (conv) = type;
     619                 :             :     }
     620                 :    13875755 :   else if (TYPE_PTRMEM_P (type))
     621                 :             :     {
     622                 :           6 :       conv = convert_ptrmem (type, expr, true, false,
     623                 :             :                              tf_warning_or_error);
     624                 :           6 :       conv = cp_fully_fold (conv);
     625                 :             :     }
     626                 :             :   else
     627                 :             :     {
     628                 :    13875749 :       conv = fold_convert (type, expr);
     629                 :    13875749 :       conv = ignore_overflows (conv, expr);
     630                 :             :     }
     631                 :             : 
     632                 :    31171140 :   if (TREE_CODE (expr) == TREE_CODE (conv))
     633                 :    20488166 :     copy_warning (conv, expr);
     634                 :             : 
     635                 :    31171140 :   return conv;
     636                 :             : }
     637                 :             : 
     638                 :             : /* C++ conversions, preference to static cast conversions.  */
     639                 :             : 
     640                 :             : tree
     641                 :   205225118 : cp_convert (tree type, tree expr, tsubst_flags_t complain)
     642                 :             : {
     643                 :   205225118 :   return ocp_convert (type, expr, CONV_OLD_CONVERT, LOOKUP_NORMAL, complain);
     644                 :             : }
     645                 :             : 
     646                 :             : /* C++ equivalent of convert_and_check but using cp_convert as the
     647                 :             :    conversion function.
     648                 :             : 
     649                 :             :    Convert EXPR to TYPE, warning about conversion problems with constants.
     650                 :             :    Invoke this function on every expression that is converted implicitly,
     651                 :             :    i.e. because of language rules and not because of an explicit cast.  */
     652                 :             : 
     653                 :             : tree
     654                 :    54936973 : cp_convert_and_check (tree type, tree expr, tsubst_flags_t complain)
     655                 :             : {
     656                 :    54936973 :   tree result, expr_for_warning = expr;
     657                 :             : 
     658                 :    54936973 :   if (TREE_CODE (expr) == EXCESS_PRECISION_EXPR)
     659                 :          94 :     expr = TREE_OPERAND (expr, 0);
     660                 :    54936973 :   if (TREE_TYPE (expr) == type)
     661                 :             :     return expr;
     662                 :    54936960 :   if (expr == error_mark_node)
     663                 :             :     return expr;
     664                 :    54936960 :   result = cp_convert (type, expr, complain);
     665                 :             : 
     666                 :    54936960 :   if ((complain & tf_warning)
     667                 :    51005473 :       && c_inhibit_evaluation_warnings == 0)
     668                 :             :     {
     669                 :    49857754 :       tree folded = cp_fully_fold (expr_for_warning);
     670                 :    49857754 :       tree folded_result;
     671                 :    49857754 :       if (folded == expr)
     672                 :             :         folded_result = result;
     673                 :             :       else
     674                 :             :         {
     675                 :             :           /* Avoid bogus -Wparentheses warnings.  */
     676                 :    21390007 :           warning_sentinel w (warn_parentheses);
     677                 :    21390007 :           warning_sentinel c (warn_int_in_bool_context);
     678                 :    21390007 :           folded_result = cp_convert (type, folded, tf_none);
     679                 :    21390007 :         }
     680                 :    49857754 :       folded_result = fold_simple (folded_result);
     681                 :    39116880 :       if (!TREE_OVERFLOW_P (folded)
     682                 :    88974631 :           && folded_result != error_mark_node)
     683                 :    76278146 :         warnings_for_convert_and_check (cp_expr_loc_or_input_loc (expr),
     684                 :             :                                         type, folded, folded_result);
     685                 :             :     }
     686                 :             : 
     687                 :             :   return result;
     688                 :             : }
     689                 :             : 
     690                 :             : /* Conversion...
     691                 :             : 
     692                 :             :    FLAGS indicates how we should behave.  */
     693                 :             : 
     694                 :             : tree
     695                 :   328332549 : ocp_convert (tree type, tree expr, int convtype, int flags,
     696                 :             :              tsubst_flags_t complain)
     697                 :             : {
     698                 :   328332549 :   tree e = expr;
     699                 :   328332549 :   enum tree_code code = TREE_CODE (type);
     700                 :   328332549 :   const char *invalid_conv_diag;
     701                 :   328332549 :   tree e1;
     702                 :   328332549 :   location_t loc = cp_expr_loc_or_input_loc (expr);
     703                 :   328332549 :   bool dofold = (convtype & CONV_FOLD);
     704                 :             : 
     705                 :   328332549 :   if (error_operand_p (e) || type == error_mark_node)
     706                 :         107 :     return error_mark_node;
     707                 :             : 
     708                 :   328332442 :   if (TREE_CODE (e) == COMPOUND_EXPR)
     709                 :             :     {
     710                 :      421513 :       e = ocp_convert (type, TREE_OPERAND (e, 1), convtype, flags, complain);
     711                 :      421513 :       if (e == error_mark_node)
     712                 :             :         return error_mark_node;
     713                 :      421513 :       if (e == TREE_OPERAND (expr, 1))
     714                 :             :         return expr;
     715                 :      421495 :       e = build2_loc (EXPR_LOCATION (expr), COMPOUND_EXPR, TREE_TYPE (e),
     716                 :      421495 :                       TREE_OPERAND (expr, 0), e);
     717                 :      421495 :       copy_warning (e, expr);
     718                 :      421495 :       return e;
     719                 :             :     }
     720                 :             : 
     721                 :   327910929 :   complete_type (type);
     722                 :   327910929 :   complete_type (TREE_TYPE (expr));
     723                 :             : 
     724                 :   655821858 :   if ((invalid_conv_diag
     725                 :   327910929 :        = targetm.invalid_conversion (TREE_TYPE (expr), type)))
     726                 :             :     {
     727                 :           0 :       if (complain & tf_error)
     728                 :           0 :         error (invalid_conv_diag);
     729                 :           0 :       return error_mark_node;
     730                 :             :     }
     731                 :             : 
     732                 :             :   /* FIXME remove when moving to c_fully_fold model.  */
     733                 :   327910929 :   if (!CLASS_TYPE_P (type))
     734                 :             :     {
     735                 :   310887941 :       e = mark_rvalue_use (e);
     736                 :   310887941 :       tree v = scalar_constant_value (e);
     737                 :   310887941 :       if (!error_operand_p (v))
     738                 :   310887875 :         e = v;
     739                 :             :     }
     740                 :   327910929 :   if (error_operand_p (e))
     741                 :           0 :     return error_mark_node;
     742                 :             : 
     743                 :   327910929 :   if (NULLPTR_TYPE_P (type) && null_ptr_cst_p (e))
     744                 :             :     {
     745                 :        1965 :       if (complain & tf_warning)
     746                 :        1017 :         maybe_warn_zero_as_null_pointer_constant (e, loc);
     747                 :             : 
     748                 :        1965 :       if (!TREE_SIDE_EFFECTS (e))
     749                 :        1959 :         return nullptr_node;
     750                 :             :     }
     751                 :             : 
     752                 :   327908970 :   if (MAYBE_CLASS_TYPE_P (type) && (convtype & CONV_FORCE_TEMP))
     753                 :             :     /* We need a new temporary; don't take this shortcut.  */;
     754                 :   327040423 :   else if (same_type_ignoring_top_level_qualifiers_p (type, TREE_TYPE (e)))
     755                 :             :     {
     756                 :   161326862 :       tree etype = TREE_TYPE (e);
     757                 :   161326862 :       if (same_type_p (type, etype))
     758                 :             :         /* The call to fold will not always remove the NOP_EXPR as
     759                 :             :            might be expected, since if one of the types is a typedef;
     760                 :             :            the comparison in fold is just equality of pointers, not a
     761                 :             :            call to comptypes.  We don't call fold in this case because
     762                 :             :            that can result in infinite recursion; fold will call
     763                 :             :            convert, which will call ocp_convert, etc.  */
     764                 :             :         return e;
     765                 :             :       /* For complex data types, we need to perform componentwise
     766                 :             :          conversion.  */
     767                 :    15298431 :       else if (TREE_CODE (type) == COMPLEX_TYPE)
     768                 :           0 :         return convert_to_complex_maybe_fold (type, e, dofold);
     769                 :    15298431 :       else if (VECTOR_TYPE_P (type))
     770                 :        3052 :         return convert_to_vector (type, rvalue (e));
     771                 :    15295379 :       else if (TREE_CODE (e) == TARGET_EXPR)
     772                 :             :         {
     773                 :             :           /* Don't build a NOP_EXPR of class type.  Instead, change the
     774                 :             :              type of the temporary.  */
     775                 :       88113 :           gcc_assert (same_type_ignoring_top_level_qualifiers_p (type, etype));
     776                 :       88113 :           TREE_TYPE (e) = TREE_TYPE (TARGET_EXPR_SLOT (e)) = type;
     777                 :       88113 :           return e;
     778                 :             :         }
     779                 :    15207266 :       else if (TREE_CODE (e) == CONSTRUCTOR)
     780                 :             :         {
     781                 :           5 :           gcc_assert (same_type_ignoring_top_level_qualifiers_p (type, etype));
     782                 :           5 :           TREE_TYPE (e) = type;
     783                 :           5 :           return e;
     784                 :             :         }
     785                 :             :       else
     786                 :             :         {
     787                 :             :           /* We shouldn't be treating objects of ADDRESSABLE type as
     788                 :             :              rvalues.  */
     789                 :    15207261 :           gcc_assert (!TREE_ADDRESSABLE (type));
     790                 :    15207261 :           return build_nop (type, e);
     791                 :             :         }
     792                 :             :     }
     793                 :             : 
     794                 :   166582108 :   e1 = targetm.convert_to_type (type, e);
     795                 :   166582108 :   if (e1)
     796                 :             :     return e1;
     797                 :             : 
     798                 :   166582108 :   if (code == VOID_TYPE && (convtype & CONV_STATIC))
     799                 :             :     {
     800                 :       21276 :       e = convert_to_void (e, ICV_CAST, complain);
     801                 :       21276 :       return e;
     802                 :             :     }
     803                 :             : 
     804                 :   166560832 :   if (INTEGRAL_CODE_P (code))
     805                 :             :     {
     806                 :   126117671 :       tree intype = TREE_TYPE (e);
     807                 :   126117671 :       tree converted;
     808                 :             : 
     809                 :   126117671 :       if (TREE_CODE (type) == ENUMERAL_TYPE)
     810                 :             :         {
     811                 :             :           /* enum = enum, enum = int, enum = float, (enum)pointer are all
     812                 :             :              errors.  */
     813                 :      720758 :           if (((INTEGRAL_OR_ENUMERATION_TYPE_P (intype)
     814                 :           6 :                 || SCALAR_FLOAT_TYPE_P (intype))
     815                 :      720758 :                && ! (convtype & CONV_STATIC))
     816                 :      720758 :               || TYPE_PTR_P (intype))
     817                 :             :             {
     818                 :           0 :               if (complain & tf_error)
     819                 :           0 :                 permerror (loc, "conversion from %q#T to %q#T", intype, type);
     820                 :             :               else
     821                 :           0 :                 return error_mark_node;
     822                 :             :             }
     823                 :             : 
     824                 :             :           /* [expr.static.cast]
     825                 :             : 
     826                 :             :              8. A value of integral or enumeration type can be explicitly
     827                 :             :              converted to an enumeration type. The value is unchanged if
     828                 :             :              the original value is within the range of the enumeration
     829                 :             :              values. Otherwise, the resulting enumeration value is
     830                 :             :              unspecified.  */
     831                 :      720758 :           tree val = fold_for_warn (e);
     832                 :      720758 :           if ((complain & tf_warning)
     833                 :      720386 :               && TREE_CODE (val) == INTEGER_CST
     834                 :      169523 :               && ENUM_UNDERLYING_TYPE (type)
     835                 :      890278 :               && !int_fits_type_p (val, ENUM_UNDERLYING_TYPE (type)))
     836                 :         121 :             warning_at (loc, OPT_Wconversion,
     837                 :             :                         "the result of the conversion is unspecified because "
     838                 :             :                         "%qE is outside the range of type %qT",
     839                 :             :                         expr, type);
     840                 :             :         }
     841                 :   126117671 :       if (MAYBE_CLASS_TYPE_P (intype))
     842                 :             :         {
     843                 :           5 :           tree rval;
     844                 :          10 :           rval = build_type_conversion (type, e);
     845                 :           5 :           if (rval)
     846                 :             :             return rval;
     847                 :           0 :           if (complain & tf_error)
     848                 :           0 :             error_at (loc, "%q#T used where a %qT was expected", intype, type);
     849                 :           0 :           return error_mark_node;
     850                 :             :         }
     851                 :   126117666 :       if (code == BOOLEAN_TYPE)
     852                 :             :         {
     853                 :     6627694 :           if (VOID_TYPE_P (intype))
     854                 :             :             {
     855                 :          18 :               if (complain & tf_error)
     856                 :          18 :                 error_at (loc,
     857                 :             :                           "could not convert %qE from %<void%> to %<bool%>",
     858                 :             :                           expr);
     859                 :          18 :               return error_mark_node;
     860                 :             :             }
     861                 :             : 
     862                 :     6627676 :           if (VECTOR_TYPE_P (intype) && !gnu_vector_type_p (intype))
     863                 :             :             {
     864                 :           0 :               if (complain & tf_error)
     865                 :           0 :                 error_at (loc, "could not convert %qE from %qH to %qI", expr,
     866                 :           0 :                           TREE_TYPE (expr), type);
     867                 :           0 :               return error_mark_node;
     868                 :             :             }
     869                 :             : 
     870                 :             :           /* We can't implicitly convert a scoped enum to bool, so convert
     871                 :             :              to the underlying type first.  */
     872                 :     6627676 :           if (SCOPED_ENUM_P (intype) && (convtype & CONV_STATIC))
     873                 :          38 :             e = build_nop (ENUM_UNDERLYING_TYPE (intype), e);
     874                 :     6627676 :           if (complain & tf_warning)
     875                 :     3933804 :             return cp_truthvalue_conversion (e, complain);
     876                 :             :           else
     877                 :             :             {
     878                 :             :               /* Prevent bogus -Wint-in-bool-context warnings coming
     879                 :             :                  from c_common_truthvalue_conversion down the line.  */
     880                 :     2693872 :               warning_sentinel w (warn_int_in_bool_context);
     881                 :     2693872 :               warning_sentinel c (warn_sign_compare);
     882                 :     2693872 :               return cp_truthvalue_conversion (e, complain);
     883                 :     2693872 :             }
     884                 :             :         }
     885                 :             : 
     886                 :   119489972 :       converted = convert_to_integer_maybe_fold (type, e, dofold);
     887                 :             : 
     888                 :             :       /* Ignore any integer overflow caused by the conversion.  */
     889                 :   119489972 :       return ignore_overflows (converted, e);
     890                 :             :     }
     891                 :    40443161 :   if (INDIRECT_TYPE_P (type) || TYPE_PTRMEM_P (type))
     892                 :    19448033 :     return cp_convert_to_pointer (type, e, dofold, complain);
     893                 :    20995128 :   if (code == VECTOR_TYPE)
     894                 :             :     {
     895                 :        4354 :       tree in_vtype = TREE_TYPE (e);
     896                 :        4354 :       if (MAYBE_CLASS_TYPE_P (in_vtype))
     897                 :             :         {
     898                 :           0 :           tree ret_val;
     899                 :           0 :           ret_val = build_type_conversion (type, e);
     900                 :           0 :           if (ret_val)
     901                 :             :             return ret_val;
     902                 :           0 :           if (complain & tf_error)
     903                 :           0 :             error_at (loc, "%q#T used where a %qT was expected",
     904                 :             :                       in_vtype, type);
     905                 :           0 :           return error_mark_node;
     906                 :             :         }
     907                 :        4354 :       return convert_to_vector (type, rvalue (e));
     908                 :             :     }
     909                 :    20990774 :   if (code == REAL_TYPE || code == COMPLEX_TYPE)
     910                 :             :     {
     911                 :    20122221 :       if (MAYBE_CLASS_TYPE_P (TREE_TYPE (e)))
     912                 :             :         {
     913                 :           0 :           tree rval;
     914                 :           0 :           rval = build_type_conversion (type, e);
     915                 :           0 :           if (rval)
     916                 :             :             return rval;
     917                 :           0 :           else if (complain & tf_error)
     918                 :           0 :             error_at (loc,
     919                 :             :                       "%q#T used where a floating-point value was expected",
     920                 :           0 :                       TREE_TYPE (e));
     921                 :             :         }
     922                 :    20122221 :       if (code == REAL_TYPE)
     923                 :    19673169 :         return convert_to_real_maybe_fold (type, e, dofold);
     924                 :      449052 :       else if (code == COMPLEX_TYPE)
     925                 :      449052 :         return convert_to_complex_maybe_fold (type, e, dofold);
     926                 :             :     }
     927                 :             : 
     928                 :             :   /* New C++ semantics:  since assignment is now based on
     929                 :             :      memberwise copying,  if the rhs type is derived from the
     930                 :             :      lhs type, then we may still do a conversion.  */
     931                 :      868553 :   if (RECORD_OR_UNION_CODE_P (code))
     932                 :             :     {
     933                 :      868547 :       tree dtype = TREE_TYPE (e);
     934                 :      868547 :       tree ctor = NULL_TREE;
     935                 :             : 
     936                 :      868547 :       dtype = TYPE_MAIN_VARIANT (dtype);
     937                 :             : 
     938                 :             :       /* Conversion between aggregate types.  New C++ semantics allow
     939                 :             :          objects of derived type to be cast to objects of base type.
     940                 :             :          Old semantics only allowed this between pointers.
     941                 :             : 
     942                 :             :          There may be some ambiguity between using a constructor
     943                 :             :          vs. using a type conversion operator when both apply.  */
     944                 :             : 
     945                 :      868547 :       ctor = e;
     946                 :             : 
     947                 :      868547 :       if (abstract_virtuals_error (NULL_TREE, type, complain))
     948                 :           0 :         return error_mark_node;
     949                 :             : 
     950                 :      868547 :       if (BRACE_ENCLOSED_INITIALIZER_P (ctor))
     951                 :       21124 :         ctor = perform_implicit_conversion (type, ctor, complain);
     952                 :      847423 :       else if ((flags & LOOKUP_ONLYCONVERTING)
     953                 :      847423 :                && ! (CLASS_TYPE_P (dtype) && DERIVED_FROM_P (type, dtype)))
     954                 :             :         /* For copy-initialization, first we create a temp of the proper type
     955                 :             :            with a user-defined conversion sequence, then we direct-initialize
     956                 :             :            the target with the temp (see [dcl.init]).  */
     957                 :       14468 :         ctor = build_user_type_conversion (type, ctor, flags, complain);
     958                 :             :       else
     959                 :             :         {
     960                 :      832955 :           releasing_vec ctor_vec (make_tree_vector_single (ctor));
     961                 :      832955 :           ctor = build_special_member_call (NULL_TREE,
     962                 :             :                                             complete_ctor_identifier,
     963                 :             :                                             &ctor_vec,
     964                 :             :                                             type, flags, complain);
     965                 :      832955 :         }
     966                 :      868547 :       if (ctor)
     967                 :      868371 :         return build_cplus_new (type, ctor, complain);
     968                 :             :     }
     969                 :             : 
     970                 :         182 :   if (complain & tf_error)
     971                 :             :     {
     972                 :             :       /* If the conversion failed and expr was an invalid use of pointer to
     973                 :             :          member function, try to report a meaningful error.  */
     974                 :         182 :       if (invalid_nonstatic_memfn_p (loc, expr, complain))
     975                 :             :         /* We displayed the error message.  */;
     976                 :             :       else
     977                 :         179 :         error_at (loc, "conversion from %qH to non-scalar type %qI requested",
     978                 :         179 :                   TREE_TYPE (expr), type);
     979                 :             :     }
     980                 :         182 :   return error_mark_node;
     981                 :             : }
     982                 :             : 
     983                 :             : /* If CALL is a call, return the callee; otherwise null.  */
     984                 :             : 
     985                 :             : tree
     986                 :   677355414 : cp_get_callee (tree call)
     987                 :             : {
     988                 :   677355414 :   if (call == NULL_TREE)
     989                 :             :     return call;
     990                 :   677355414 :   else if (TREE_CODE (call) == CALL_EXPR)
     991                 :   645070332 :     return CALL_EXPR_FN (call);
     992                 :    32285082 :   else if (TREE_CODE (call) == AGGR_INIT_EXPR)
     993                 :    21134868 :     return AGGR_INIT_EXPR_FN (call);
     994                 :             :   return NULL_TREE;
     995                 :             : }
     996                 :             : 
     997                 :             : /* FN is the callee of a CALL_EXPR or AGGR_INIT_EXPR; return the FUNCTION_DECL
     998                 :             :    if we can.  */
     999                 :             : 
    1000                 :             : tree
    1001                 :   541151503 : cp_get_fndecl_from_callee (tree fn, bool fold /* = true */)
    1002                 :             : {
    1003                 :   541151503 :   if (fn == NULL_TREE)
    1004                 :             :     return fn;
    1005                 :             : 
    1006                 :             :   /* We evaluate constexpr functions on the original, pre-genericization
    1007                 :             :      bodies.  So block-scope extern declarations have not been mapped to
    1008                 :             :      declarations in outer scopes.  Use the namespace-scope declaration,
    1009                 :             :      if any, so that retrieve_constexpr_fundef can find it (PR111132).  */
    1010                 :  1032967067 :   auto fn_or_local_alias = [] (tree f)
    1011                 :             :     {
    1012                 :   493353893 :       if (DECL_LOCAL_DECL_P (f))
    1013                 :       41682 :         if (tree alias = DECL_LOCAL_DECL_ALIAS (f))
    1014                 :       41682 :           if (alias != error_mark_node)
    1015                 :       41682 :             return alias;
    1016                 :             :       return f;
    1017                 :             :     };
    1018                 :             : 
    1019                 :   539613174 :   if (TREE_CODE (fn) == FUNCTION_DECL)
    1020                 :     6790871 :     return fn_or_local_alias (fn);
    1021                 :   532822303 :   tree type = TREE_TYPE (fn);
    1022                 :   532822303 :   if (type == NULL_TREE || !INDIRECT_TYPE_P (type))
    1023                 :             :     return NULL_TREE;
    1024                 :   490966869 :   if (fold)
    1025                 :     2291022 :     fn = maybe_constant_init (fn);
    1026                 :   490966869 :   STRIP_NOPS (fn);
    1027                 :   490966869 :   if (TREE_CODE (fn) == ADDR_EXPR
    1028                 :   490966869 :       || TREE_CODE (fn) == FDESC_EXPR)
    1029                 :   486563116 :     fn = TREE_OPERAND (fn, 0);
    1030                 :   490966869 :   if (TREE_CODE (fn) == FUNCTION_DECL)
    1031                 :   486563022 :     return fn_or_local_alias (fn);
    1032                 :             :   return NULL_TREE;
    1033                 :             : }
    1034                 :             : 
    1035                 :             : /* Like get_callee_fndecl, but handles AGGR_INIT_EXPR as well and uses the
    1036                 :             :    constexpr machinery.  */
    1037                 :             : 
    1038                 :             : tree
    1039                 :           0 : cp_get_callee_fndecl (tree call)
    1040                 :             : {
    1041                 :           0 :   return cp_get_fndecl_from_callee (cp_get_callee (call));
    1042                 :             : }
    1043                 :             : 
    1044                 :             : /* As above, but not using the constexpr machinery.  */
    1045                 :             : 
    1046                 :             : tree
    1047                 :   223296541 : cp_get_callee_fndecl_nofold (tree call)
    1048                 :             : {
    1049                 :   223296541 :   return cp_get_fndecl_from_callee (cp_get_callee (call), false);
    1050                 :             : }
    1051                 :             : 
    1052                 :             : /* Subroutine of convert_to_void.  Warn if we're discarding something with
    1053                 :             :    attribute [[nodiscard]].  */
    1054                 :             : 
    1055                 :             : static void
    1056                 :     3948493 : maybe_warn_nodiscard (tree expr, impl_conv_void implicit)
    1057                 :             : {
    1058                 :     3948493 :   if (!warn_unused_result || c_inhibit_evaluation_warnings)
    1059                 :             :     return;
    1060                 :             : 
    1061                 :     3942435 :   tree call = expr;
    1062                 :     3942435 :   if (TREE_CODE (expr) == TARGET_EXPR)
    1063                 :       32602 :     call = TARGET_EXPR_INITIAL (expr);
    1064                 :     3942435 :   location_t loc = cp_expr_loc_or_input_loc (call);
    1065                 :     3942435 :   tree callee = cp_get_callee (call);
    1066                 :     3942435 :   if (!callee || !TREE_TYPE (callee))
    1067                 :             :     return;
    1068                 :             : 
    1069                 :     3940842 :   tree type = TREE_TYPE (callee);
    1070                 :     3940842 :   if (TYPE_PTRMEMFUNC_P (type))
    1071                 :           0 :     type = TYPE_PTRMEMFUNC_FN_TYPE (type);
    1072                 :     3940842 :   if (INDIRECT_TYPE_P (type))
    1073                 :     2291022 :     type = TREE_TYPE (type);
    1074                 :     3940842 :   if (!FUNC_OR_METHOD_TYPE_P (type))
    1075                 :             :     return;
    1076                 :             : 
    1077                 :     3940791 :   tree rettype = TREE_TYPE (type);
    1078                 :     3940791 :   tree fn = cp_get_fndecl_from_callee (callee);
    1079                 :     3940791 :   tree attr;
    1080                 :     3940791 :   if (implicit != ICV_CAST && fn
    1081                 :     3940791 :       && (attr = lookup_attribute ("nodiscard", DECL_ATTRIBUTES (fn))))
    1082                 :             :     {
    1083                 :         408 :       escaped_string msg;
    1084                 :         408 :       tree args = TREE_VALUE (attr);
    1085                 :         408 :       if (args)
    1086                 :          57 :         msg.escape (TREE_STRING_POINTER (TREE_VALUE (args)));
    1087                 :         408 :       const char *format
    1088                 :         408 :         = (msg
    1089                 :         408 :            ? G_("ignoring return value of %qD, "
    1090                 :             :                 "declared with attribute %<nodiscard%>: %qs")
    1091                 :             :            : G_("ignoring return value of %qD, "
    1092                 :         408 :                 "declared with attribute %<nodiscard%>%s"));
    1093                 :         408 :       const char *raw_msg = msg ? (const char *) msg : "";
    1094                 :         408 :       auto_diagnostic_group d;
    1095                 :         408 :       auto_urlify_attributes sentinel;
    1096                 :         408 :       if (warning_at (loc, OPT_Wunused_result, format, fn, raw_msg))
    1097                 :         408 :         inform (DECL_SOURCE_LOCATION (fn), "declared here");
    1098                 :         408 :     }
    1099                 :     3940383 :   else if (implicit != ICV_CAST
    1100                 :     3940383 :            && (attr = lookup_attribute ("nodiscard", TYPE_ATTRIBUTES (rettype))))
    1101                 :             :     {
    1102                 :         117 :       escaped_string msg;
    1103                 :         117 :       tree args = TREE_VALUE (attr);
    1104                 :         117 :       if (args)
    1105                 :          54 :         msg.escape (TREE_STRING_POINTER (TREE_VALUE (args)));
    1106                 :         117 :       const char *format
    1107                 :         117 :         = (msg
    1108                 :         117 :            ? G_("ignoring returned value of type %qT, "
    1109                 :             :                 "declared with attribute %<nodiscard%>: %qs")
    1110                 :             :            : G_("ignoring returned value of type %qT, "
    1111                 :         117 :                 "declared with attribute %<nodiscard%>%s"));
    1112                 :         117 :       const char *raw_msg = msg ? (const char *) msg : "";
    1113                 :         117 :       auto_diagnostic_group d;
    1114                 :         117 :       auto_urlify_attributes sentinel;
    1115                 :         117 :       if (warning_at (loc, OPT_Wunused_result, format, rettype, raw_msg))
    1116                 :             :         {
    1117                 :         117 :           if (fn)
    1118                 :          18 :             inform (DECL_SOURCE_LOCATION (fn),
    1119                 :             :                     "in call to %qD, declared here", fn);
    1120                 :         117 :           inform (DECL_SOURCE_LOCATION (TYPE_NAME (rettype)),
    1121                 :             :                   "%qT declared here", rettype);
    1122                 :             :         }
    1123                 :         117 :     }
    1124                 :     3940266 :   else if (TREE_CODE (expr) == TARGET_EXPR
    1125                 :     3940266 :            && lookup_attribute ("warn_unused_result", TYPE_ATTRIBUTES (type)))
    1126                 :             :     {
    1127                 :             :       /* The TARGET_EXPR confuses do_warn_unused_result into thinking that the
    1128                 :             :          result is used, so handle that case here.  */
    1129                 :          63 :       auto_urlify_attributes sentinel;
    1130                 :          63 :       if (fn)
    1131                 :             :         {
    1132                 :          63 :           auto_diagnostic_group d;
    1133                 :          63 :           if (warning_at (loc, OPT_Wunused_result,
    1134                 :             :                           "ignoring return value of %qD, "
    1135                 :             :                           "declared with attribute %<warn_unused_result%>",
    1136                 :             :                           fn))
    1137                 :          63 :             inform (DECL_SOURCE_LOCATION (fn), "declared here");
    1138                 :          63 :         }
    1139                 :             :       else
    1140                 :           0 :         warning_at (loc, OPT_Wunused_result,
    1141                 :             :                     "ignoring return value of function "
    1142                 :             :                     "declared with attribute %<warn_unused_result%>");
    1143                 :          63 :     }
    1144                 :             : }
    1145                 :             : 
    1146                 :             : /* When an expression is used in a void context, its value is discarded and
    1147                 :             :    no lvalue-rvalue and similar conversions happen [expr.static.cast/4,
    1148                 :             :    stmt.expr/1, expr.comma/1].  This permits dereferencing an incomplete type
    1149                 :             :    in a void context. The C++ standard does not define what an `access' to an
    1150                 :             :    object is, but there is reason to believe that it is the lvalue to rvalue
    1151                 :             :    conversion -- if it were not, `*&*p = 1' would violate [expr]/4 in that it
    1152                 :             :    accesses `*p' not to calculate the value to be stored. But, dcl.type.cv/8
    1153                 :             :    indicates that volatile semantics should be the same between C and C++
    1154                 :             :    where ever possible. C leaves it implementation defined as to what
    1155                 :             :    constitutes an access to a volatile. So, we interpret `*vp' as a read of
    1156                 :             :    the volatile object `vp' points to, unless that is an incomplete type. For
    1157                 :             :    volatile references we do not do this interpretation, because that would
    1158                 :             :    make it impossible to ignore the reference return value from functions. We
    1159                 :             :    issue warnings in the confusing cases.
    1160                 :             : 
    1161                 :             :    The IMPLICIT is ICV_CAST when the user is explicitly converting an expression
    1162                 :             :    to void via a cast. If an expression is being implicitly converted, IMPLICIT
    1163                 :             :    indicates the context of the implicit conversion.  */
    1164                 :             : 
    1165                 :             : tree
    1166                 :    76521826 : convert_to_void (tree expr, impl_conv_void implicit, tsubst_flags_t complain)
    1167                 :             : {
    1168                 :    79624865 :   location_t loc = cp_expr_loc_or_input_loc (expr);
    1169                 :             : 
    1170                 :    79624865 :   if (expr == error_mark_node
    1171                 :    79624865 :       || TREE_TYPE (expr) == error_mark_node)
    1172                 :             :     return error_mark_node;
    1173                 :             : 
    1174                 :    79444900 :   expr = maybe_undo_parenthesized_ref (expr);
    1175                 :             : 
    1176                 :    79444900 :   expr = mark_discarded_use (expr);
    1177                 :    79444900 :   if (implicit == ICV_CAST)
    1178                 :             :     /* An explicit cast to void avoids all -Wunused-but-set* warnings.  */
    1179                 :      321780 :     mark_exp_read (expr);
    1180                 :             : 
    1181                 :    79444900 :   if (!TREE_TYPE (expr))
    1182                 :             :     return expr;
    1183                 :    79444658 :   if (invalid_nonstatic_memfn_p (loc, expr, complain))
    1184                 :          20 :     return error_mark_node;
    1185                 :    79444638 :   if (TREE_CODE (expr) == PSEUDO_DTOR_EXPR)
    1186                 :             :     {
    1187                 :           6 :       if (complain & tf_error)
    1188                 :           6 :         error_at (loc, "pseudo-destructor is not called");
    1189                 :           6 :       return error_mark_node;
    1190                 :             :     }
    1191                 :             : 
    1192                 :             :   /* Explicitly evaluate void-converted concept checks since their
    1193                 :             :      satisfaction may produce ill-formed programs.  */
    1194                 :    79444632 :    if (concept_check_p (expr))
    1195                 :          29 :      expr = evaluate_concept_check (expr);
    1196                 :             : 
    1197                 :    79444632 :   if (VOID_TYPE_P (TREE_TYPE (expr)))
    1198                 :             :     return expr;
    1199                 :    50606175 :   switch (TREE_CODE (expr))
    1200                 :             :     {
    1201                 :       16137 :     case COND_EXPR:
    1202                 :       16137 :       {
    1203                 :             :         /* The two parts of a cond expr might be separate lvalues.  */
    1204                 :       16137 :         tree op1 = TREE_OPERAND (expr,1);
    1205                 :       16137 :         tree op2 = TREE_OPERAND (expr,2);
    1206                 :       16131 :         bool side_effects = ((op1 && TREE_SIDE_EFFECTS (op1))
    1207                 :       16446 :                              || TREE_SIDE_EFFECTS (op2));
    1208                 :       16137 :         tree new_op1, new_op2;
    1209                 :       16137 :         new_op1 = NULL_TREE;
    1210                 :       16137 :         if (implicit != ICV_CAST && !side_effects)
    1211                 :             :           {
    1212                 :          69 :             if (op1)
    1213                 :          66 :               new_op1 = convert_to_void (op1, ICV_SECOND_OF_COND, complain);
    1214                 :          69 :             new_op2 = convert_to_void (op2, ICV_THIRD_OF_COND, complain);
    1215                 :             :           }
    1216                 :             :         else
    1217                 :             :           {
    1218                 :       16068 :             if (op1)
    1219                 :       16065 :               new_op1 = convert_to_void (op1, ICV_CAST, complain);
    1220                 :       16068 :             new_op2 = convert_to_void (op2, ICV_CAST, complain);
    1221                 :             :           }
    1222                 :             : 
    1223                 :       16137 :         expr = build3_loc (loc, COND_EXPR, TREE_TYPE (new_op2),
    1224                 :       16137 :                            TREE_OPERAND (expr, 0), new_op1, new_op2);
    1225                 :       16137 :         break;
    1226                 :             :       }
    1227                 :             : 
    1228                 :      311854 :     case COMPOUND_EXPR:
    1229                 :      311854 :       {
    1230                 :             :         /* The second part of a compound expr contains the value.  */
    1231                 :      311854 :         tree op1 = TREE_OPERAND (expr,1);
    1232                 :      311854 :         tree new_op1;
    1233                 :      311854 :         if (implicit != ICV_CAST && !warning_suppressed_p (expr /* What warning? */))
    1234                 :      186957 :           new_op1 = convert_to_void (op1, ICV_RIGHT_OF_COMMA, complain);
    1235                 :             :         else
    1236                 :      124897 :           new_op1 = convert_to_void (op1, ICV_CAST, complain);
    1237                 :             : 
    1238                 :      311854 :         if (new_op1 != op1)
    1239                 :             :           {
    1240                 :      311854 :             tree t = build2_loc (loc, COMPOUND_EXPR, TREE_TYPE (new_op1),
    1241                 :      311854 :                                  TREE_OPERAND (expr, 0), new_op1);
    1242                 :      311854 :             expr = t;
    1243                 :             :           }
    1244                 :             : 
    1245                 :             :         break;
    1246                 :             :       }
    1247                 :             : 
    1248                 :             :     case NON_LVALUE_EXPR:
    1249                 :             :     case NOP_EXPR:
    1250                 :             :       /* These have already decayed to rvalue.  */
    1251                 :             :       break;
    1252                 :             : 
    1253                 :     4775896 :     case CALL_EXPR:   /* We have a special meaning for volatile void fn().  */
    1254                 :             :       /* cdtors may return this or void, depending on
    1255                 :             :          targetm.cxx.cdtor_returns_this, but this shouldn't affect our
    1256                 :             :          decisions here: neither nodiscard warnings (nodiscard dtors
    1257                 :             :          are nonsensical and ctors have a different behavior with that
    1258                 :             :          attribute that is handled in the TARGET_EXPR case), nor should
    1259                 :             :          any constexpr or template instantiations be affected by an ABI
    1260                 :             :          property that is, or at least ought to be transparent to the
    1261                 :             :          language.  */
    1262                 :     4775896 :       if (tree fn = cp_get_callee_fndecl_nofold (expr))
    1263                 :     8438958 :         if (DECL_CONSTRUCTOR_P (fn) || DECL_DESTRUCTOR_P (fn))
    1264                 :             :           return expr;
    1265                 :             : 
    1266                 :     4775896 :       if (complain & tf_warning)
    1267                 :     3915745 :         maybe_warn_nodiscard (expr, implicit);
    1268                 :             :       break;
    1269                 :             : 
    1270                 :     3326839 :     case INDIRECT_REF:
    1271                 :     3326839 :       {
    1272                 :     3326839 :         tree type = TREE_TYPE (expr);
    1273                 :     3326839 :         int is_reference = TYPE_REF_P (TREE_TYPE (TREE_OPERAND (expr, 0)));
    1274                 :     3326839 :         int is_volatile = TYPE_VOLATILE (type);
    1275                 :     3326839 :         if (is_volatile)
    1276                 :         305 :           complete_type (type);
    1277                 :     3326839 :         int is_complete = COMPLETE_TYPE_P (type);
    1278                 :             : 
    1279                 :             :         /* Don't load the value if this is an implicit dereference, or if
    1280                 :             :            the type needs to be handled by ctors/dtors.  */
    1281                 :     3326839 :         if (is_reference)
    1282                 :             :           {
    1283                 :         138 :             if (is_volatile && (complain & tf_warning)
    1284                 :             :                 /* A co_await expression, in its await_resume expression, also
    1285                 :             :                    contains an implicit dereference.  As a result, we don't
    1286                 :             :                    need to warn about them here.  */
    1287                 :     3103108 :                 && TREE_CODE (TREE_OPERAND (expr, 0)) != CO_AWAIT_EXPR)
    1288                 :          66 :               switch (implicit)
    1289                 :             :                 {
    1290                 :          36 :                   case ICV_CAST:
    1291                 :          36 :                     warning_at (loc, 0, "conversion to void will not access "
    1292                 :             :                                 "object of type %qT", type);
    1293                 :          36 :                     break;
    1294                 :           0 :                   case ICV_SECOND_OF_COND:
    1295                 :           0 :                     warning_at (loc, 0, "implicit dereference will not access "
    1296                 :             :                                 "object of type %qT in second operand of "
    1297                 :             :                                 "conditional expression", type);
    1298                 :           0 :                     break;
    1299                 :           0 :                   case ICV_THIRD_OF_COND:
    1300                 :           0 :                     warning_at (loc, 0, "implicit dereference will not access "
    1301                 :             :                                 "object of type %qT in third operand of "
    1302                 :             :                                 "conditional expression", type);
    1303                 :           0 :                     break;
    1304                 :           0 :                   case ICV_RIGHT_OF_COMMA:
    1305                 :           0 :                     warning_at (loc, 0, "implicit dereference will not access "
    1306                 :             :                                 "object of type %qT in right operand of "
    1307                 :             :                                 "comma operator", type);
    1308                 :           0 :                     break;
    1309                 :           0 :                   case ICV_LEFT_OF_COMMA:
    1310                 :           0 :                     warning_at (loc, 0, "implicit dereference will not access "
    1311                 :             :                                 "object of type %qT in left operand of comma "
    1312                 :             :                                 "operator", type);
    1313                 :           0 :                     break;
    1314                 :          30 :                   case ICV_STATEMENT:
    1315                 :          30 :                     warning_at (loc, 0, "implicit dereference will not access "
    1316                 :             :                                 "object of type %qT in statement",  type);
    1317                 :          30 :                      break;
    1318                 :           0 :                   case ICV_THIRD_IN_FOR:
    1319                 :           0 :                     warning_at (loc, 0, "implicit dereference will not access "
    1320                 :             :                                 "object of type %qT in for increment expression",
    1321                 :             :                                 type);
    1322                 :           0 :                     break;
    1323                 :           0 :                   default:
    1324                 :           0 :                     gcc_unreachable ();
    1325                 :             :                 }
    1326                 :             : 
    1327                 :             :             /* Since this was an implicit dereference, we should also act as if
    1328                 :             :                it was never there.  */
    1329                 :     3103039 :             return convert_to_void (TREE_OPERAND (expr, 0), implicit, complain);
    1330                 :             :           }
    1331                 :             :         /* Can't load the value if we don't know the type.  */
    1332                 :      223800 :         else if (is_volatile && !is_complete)
    1333                 :             :           {
    1334                 :          18 :             if (complain & tf_warning)
    1335                 :          18 :               switch (implicit)
    1336                 :             :                 {
    1337                 :          12 :                   case ICV_CAST:
    1338                 :          12 :                     warning_at (loc, 0, "conversion to void will not access "
    1339                 :             :                                 "object of incomplete type %qT", type);
    1340                 :          12 :                     break;
    1341                 :           0 :                   case ICV_SECOND_OF_COND:
    1342                 :           0 :                     warning_at (loc, 0, "indirection will not access object of "
    1343                 :             :                                 "incomplete type %qT in second operand "
    1344                 :             :                                 "of conditional expression", type);
    1345                 :           0 :                     break;
    1346                 :           0 :                   case ICV_THIRD_OF_COND:
    1347                 :           0 :                     warning_at (loc, 0, "indirection will not access object of "
    1348                 :             :                                 "incomplete type %qT in third operand "
    1349                 :             :                                 "of conditional expression", type);
    1350                 :           0 :                     break;
    1351                 :           0 :                   case ICV_RIGHT_OF_COMMA:
    1352                 :           0 :                     warning_at (loc, 0, "indirection will not access object of "
    1353                 :             :                                 "incomplete type %qT in right operand of "
    1354                 :             :                                 "comma operator", type);
    1355                 :           0 :                     break;
    1356                 :           0 :                   case ICV_LEFT_OF_COMMA:
    1357                 :           0 :                     warning_at (loc, 0, "indirection will not access object of "
    1358                 :             :                                 "incomplete type %qT in left operand of "
    1359                 :             :                                 "comma operator", type);
    1360                 :           0 :                     break;
    1361                 :           6 :                   case ICV_STATEMENT:
    1362                 :           6 :                     warning_at (loc, 0, "indirection will not access object of "
    1363                 :             :                                 "incomplete type %qT in statement", type);
    1364                 :           6 :                      break;
    1365                 :           0 :                   case ICV_THIRD_IN_FOR:
    1366                 :           0 :                     warning_at (loc, 0, "indirection will not access object of "
    1367                 :             :                                 "incomplete type %qT in for increment "
    1368                 :             :                                 "expression", type);
    1369                 :           0 :                     break;
    1370                 :           0 :                   default:
    1371                 :           0 :                     gcc_unreachable ();
    1372                 :             :                 }
    1373                 :             :           }
    1374                 :      223782 :         else if (is_volatile && TREE_ADDRESSABLE (type))
    1375                 :             :           {
    1376                 :           3 :             if (complain & tf_warning)
    1377                 :           3 :               switch (implicit)
    1378                 :             :                 {
    1379                 :           0 :                   case ICV_CAST:
    1380                 :           0 :                     warning_at (loc, 0, "conversion to void will not access "
    1381                 :             :                                 "object of non-trivially-copyable type %qT",
    1382                 :             :                                 type);
    1383                 :           0 :                     break;
    1384                 :           0 :                   case ICV_SECOND_OF_COND:
    1385                 :           0 :                     warning_at (loc, 0, "indirection will not access object of "
    1386                 :             :                                 "non-trivially-copyable type %qT in second "
    1387                 :             :                                 "operand of conditional expression", type);
    1388                 :           0 :                     break;
    1389                 :           0 :                   case ICV_THIRD_OF_COND:
    1390                 :           0 :                     warning_at (loc, 0, "indirection will not access object of "
    1391                 :             :                                 "non-trivially-copyable type %qT in third "
    1392                 :             :                                 "operand of conditional expression", type);
    1393                 :           0 :                     break;
    1394                 :           0 :                   case ICV_RIGHT_OF_COMMA:
    1395                 :           0 :                     warning_at (loc, 0, "indirection will not access object of "
    1396                 :             :                                 "non-trivially-copyable type %qT in right "
    1397                 :             :                                 "operand of comma operator", type);
    1398                 :           0 :                     break;
    1399                 :           0 :                   case ICV_LEFT_OF_COMMA:
    1400                 :           0 :                     warning_at (loc, 0, "indirection will not access object of "
    1401                 :             :                                 "non-trivially-copyable type %qT in left "
    1402                 :             :                                 "operand of comma operator", type);
    1403                 :           0 :                     break;
    1404                 :           3 :                   case ICV_STATEMENT:
    1405                 :           3 :                     warning_at (loc, 0, "indirection will not access object of "
    1406                 :             :                                 "non-trivially-copyable type %qT in statement",
    1407                 :             :                                 type);
    1408                 :           3 :                      break;
    1409                 :           0 :                   case ICV_THIRD_IN_FOR:
    1410                 :           0 :                     warning_at (loc, 0, "indirection will not access object of "
    1411                 :             :                                 "non-trivially-copyable type %qT in for "
    1412                 :             :                                 "increment expression", type);
    1413                 :           0 :                     break;
    1414                 :           0 :                   default:
    1415                 :           0 :                     gcc_unreachable ();
    1416                 :             :                 }
    1417                 :             :           }
    1418                 :      223800 :         if (!is_volatile || !is_complete || TREE_ADDRESSABLE (type))
    1419                 :             :           {
    1420                 :             :             /* Emit a warning (if enabled) when the "effect-less" INDIRECT_REF
    1421                 :             :                operation is stripped off. Note that we don't warn about
    1422                 :             :                - an expression with TREE_NO_WARNING set. (For an example of
    1423                 :             :                  such expressions, see build_over_call in call.cc.)
    1424                 :             :                - automatic dereferencing of references, since the user cannot
    1425                 :             :                  control it. (See also warn_if_unused_value() in c-common.cc.)  */
    1426                 :      223654 :             if (warn_unused_value
    1427                 :        1468 :                 && implicit != ICV_CAST
    1428                 :         950 :                 && (complain & tf_warning)
    1429                 :           9 :                 && !warning_suppressed_p (expr, OPT_Wunused_value)
    1430                 :      223654 :                 && !is_reference)
    1431                 :           9 :               warning_at (loc, OPT_Wunused_value, "value computed is not used");
    1432                 :      223654 :             expr = TREE_OPERAND (expr, 0);
    1433                 :             :           }
    1434                 :             : 
    1435                 :             :         break;
    1436                 :             :       }
    1437                 :             : 
    1438                 :       13542 :     case VAR_DECL:
    1439                 :       13542 :       {
    1440                 :             :         /* External variables might be incomplete.  */
    1441                 :       13542 :         tree type = TREE_TYPE (expr);
    1442                 :             : 
    1443                 :       13542 :         if (TYPE_VOLATILE (type)
    1444                 :         138 :             && !COMPLETE_TYPE_P (complete_type (type))
    1445                 :       13557 :             && (complain & tf_warning))
    1446                 :          15 :           switch (implicit)
    1447                 :             :             {
    1448                 :          12 :               case ICV_CAST:
    1449                 :          12 :                 warning_at (loc, 0, "conversion to void will not access "
    1450                 :             :                             "object %qE of incomplete type %qT", expr, type);
    1451                 :          12 :                 break;
    1452                 :           0 :               case ICV_SECOND_OF_COND:
    1453                 :           0 :                 warning_at (loc, 0, "variable %qE of incomplete type %qT will "
    1454                 :             :                             "not be accessed in second operand of "
    1455                 :             :                             "conditional expression", expr, type);
    1456                 :           0 :                 break;
    1457                 :           0 :               case ICV_THIRD_OF_COND:
    1458                 :           0 :                 warning_at (loc, 0, "variable %qE of incomplete type %qT will "
    1459                 :             :                             "not be accessed in third operand of "
    1460                 :             :                             "conditional expression", expr, type);
    1461                 :           0 :                 break;
    1462                 :           0 :               case ICV_RIGHT_OF_COMMA:
    1463                 :           0 :                 warning_at (loc, 0, "variable %qE of incomplete type %qT will "
    1464                 :             :                             "not be accessed in right operand of comma operator",
    1465                 :             :                             expr, type);
    1466                 :           0 :                 break;
    1467                 :           0 :               case ICV_LEFT_OF_COMMA:
    1468                 :           0 :                 warning_at (loc, 0, "variable %qE of incomplete type %qT will "
    1469                 :             :                             "not be accessed in left operand of comma operator",
    1470                 :             :                             expr, type);
    1471                 :           0 :                 break;
    1472                 :           3 :               case ICV_STATEMENT:
    1473                 :           3 :                 warning_at (loc, 0, "variable %qE of incomplete type %qT will "
    1474                 :             :                             "not be accessed in statement", expr, type);
    1475                 :           3 :                 break;
    1476                 :           0 :               case ICV_THIRD_IN_FOR:
    1477                 :           0 :                 warning_at (loc, 0, "variable %qE of incomplete type %qT will "
    1478                 :             :                             "not be accessed in for increment expression",
    1479                 :             :                             expr, type);
    1480                 :           0 :                 break;
    1481                 :           0 :               default:
    1482                 :           0 :                 gcc_unreachable ();
    1483                 :             :             }
    1484                 :             : 
    1485                 :             :         break;
    1486                 :             :       }
    1487                 :             : 
    1488                 :      616095 :     case TARGET_EXPR:
    1489                 :             :       /* Don't bother with the temporary object returned from a function if
    1490                 :             :          we don't use it, don't need to destroy it, and won't abort in
    1491                 :             :          assign_temp.  We'll still
    1492                 :             :          allocate space for it in expand_call or declare_return_variable,
    1493                 :             :          but we don't need to track it through all the tree phases.  */
    1494                 :      616095 :       if (TARGET_EXPR_IMPLICIT_P (expr)
    1495                 :      616095 :           && !TREE_ADDRESSABLE (TREE_TYPE (expr)))
    1496                 :             :         {
    1497                 :      302427 :           tree init = TARGET_EXPR_INITIAL (expr);
    1498                 :      302427 :           if (TREE_CODE (init) == AGGR_INIT_EXPR
    1499                 :      302427 :               && !AGGR_INIT_VIA_CTOR_P (init))
    1500                 :             :             {
    1501                 :           0 :               tree fn = AGGR_INIT_EXPR_FN (init);
    1502                 :           0 :               expr = build_call_array_loc (input_location,
    1503                 :           0 :                                            TREE_TYPE (TREE_TYPE
    1504                 :             :                                                       (TREE_TYPE (fn))),
    1505                 :             :                                            fn,
    1506                 :           0 :                                            aggr_init_expr_nargs (init),
    1507                 :           0 :                                            AGGR_INIT_EXPR_ARGP (init));
    1508                 :             :             }
    1509                 :             :         }
    1510                 :      616095 :       if (complain & tf_warning)
    1511                 :       32748 :         maybe_warn_nodiscard (expr, implicit);
    1512                 :             :       break;
    1513                 :             : 
    1514                 :         112 :     case CO_AWAIT_EXPR:
    1515                 :         112 :       if (auto awr = co_await_get_resume_call (expr))
    1516                 :         108 :         convert_to_void (awr, implicit, complain);
    1517                 :             :       break;
    1518                 :             : 
    1519                 :    47503136 :     default:;
    1520                 :             :     }
    1521                 :    47503136 :   expr = resolve_nondeduced_context (expr, complain);
    1522                 :    47503136 :   if (!mark_single_function (expr, complain))
    1523                 :           3 :     return error_mark_node;
    1524                 :             : 
    1525                 :    47503133 :   {
    1526                 :    47503133 :     tree probe = expr;
    1527                 :             : 
    1528                 :    47503133 :     if (TREE_CODE (probe) == ADDR_EXPR)
    1529                 :        1088 :       probe = TREE_OPERAND (expr, 0);
    1530                 :    47503133 :     if (type_unknown_p (probe))
    1531                 :             :       {
    1532                 :             :         /* [over.over] enumerates the places where we can take the address
    1533                 :             :            of an overloaded function, and this is not one of them.  */
    1534                 :          55 :         if (complain & tf_error)
    1535                 :          36 :           switch (implicit)
    1536                 :             :             {
    1537                 :          12 :               case ICV_CAST:
    1538                 :          12 :                 error_at (loc, "conversion to void "
    1539                 :             :                           "cannot resolve address of overloaded function");
    1540                 :          12 :                 break;
    1541                 :           0 :               case ICV_SECOND_OF_COND:
    1542                 :           0 :                 error_at (loc, "second operand of conditional expression "
    1543                 :             :                           "cannot resolve address of overloaded function");
    1544                 :           0 :                 break;
    1545                 :           0 :               case ICV_THIRD_OF_COND:
    1546                 :           0 :                 error_at (loc, "third operand of conditional expression "
    1547                 :             :                           "cannot resolve address of overloaded function");
    1548                 :           0 :                 break;
    1549                 :           0 :               case ICV_RIGHT_OF_COMMA:
    1550                 :           0 :                 error_at (loc, "right operand of comma operator "
    1551                 :             :                           "cannot resolve address of overloaded function");
    1552                 :           0 :                 break;
    1553                 :           0 :               case ICV_LEFT_OF_COMMA:
    1554                 :           0 :                 error_at (loc, "left operand of comma operator "
    1555                 :             :                           "cannot resolve address of overloaded function");
    1556                 :           0 :                 break;
    1557                 :          24 :               case ICV_STATEMENT:
    1558                 :          24 :                 error_at (loc, "statement "
    1559                 :             :                           "cannot resolve address of overloaded function");
    1560                 :          24 :                 break;
    1561                 :           0 :               case ICV_THIRD_IN_FOR:
    1562                 :           0 :                 error_at (loc, "for increment expression "
    1563                 :             :                           "cannot resolve address of overloaded function");
    1564                 :           0 :                 break;
    1565                 :             :             }
    1566                 :             :         else
    1567                 :          19 :           return error_mark_node;
    1568                 :          36 :         expr = void_node;
    1569                 :             :       }
    1570                 :    47503078 :     else if (implicit != ICV_CAST && probe == expr && is_overloaded_fn (probe))
    1571                 :             :       {
    1572                 :             :         /* Only warn when there is no &.  */
    1573                 :         102 :         if (complain & tf_warning)
    1574                 :         102 :           switch (implicit)
    1575                 :             :             {
    1576                 :           3 :               case ICV_SECOND_OF_COND:
    1577                 :           3 :                 warning_at (loc, OPT_Waddress,
    1578                 :             :                             "second operand of conditional expression "
    1579                 :             :                             "is a reference, not call, to function %qE", expr);
    1580                 :           3 :                 break;
    1581                 :           3 :               case ICV_THIRD_OF_COND:
    1582                 :           3 :                 warning_at (loc, OPT_Waddress,
    1583                 :             :                             "third operand of conditional expression "
    1584                 :             :                             "is a reference, not call, to function %qE", expr);
    1585                 :           3 :                 break;
    1586                 :           0 :               case ICV_RIGHT_OF_COMMA:
    1587                 :           0 :                 warning_at (loc, OPT_Waddress,
    1588                 :             :                             "right operand of comma operator "
    1589                 :             :                             "is a reference, not call, to function %qE", expr);
    1590                 :           0 :                 break;
    1591                 :           9 :               case ICV_LEFT_OF_COMMA:
    1592                 :           9 :                 warning_at (loc, OPT_Waddress,
    1593                 :             :                             "left operand of comma operator "
    1594                 :             :                             "is a reference, not call, to function %qE", expr);
    1595                 :           9 :                 break;
    1596                 :          87 :               case ICV_STATEMENT:
    1597                 :          87 :                 warning_at (loc, OPT_Waddress,
    1598                 :             :                             "statement is a reference, not call, to function %qE",
    1599                 :             :                             expr);
    1600                 :          87 :                 break;
    1601                 :           0 :               case ICV_THIRD_IN_FOR:
    1602                 :           0 :                 warning_at (loc, OPT_Waddress,
    1603                 :             :                             "for increment expression "
    1604                 :             :                             "is a reference, not call, to function %qE", expr);
    1605                 :           0 :                 break;
    1606                 :           0 :               default:
    1607                 :           0 :                 gcc_unreachable ();
    1608                 :             :             }
    1609                 :             : 
    1610                 :         102 :         if (TREE_CODE (expr) == COMPONENT_REF)
    1611                 :           9 :           expr = TREE_OPERAND (expr, 0);
    1612                 :             :       }
    1613                 :             :   }
    1614                 :             : 
    1615                 :    47503114 :   if (expr != error_mark_node && !VOID_TYPE_P (TREE_TYPE (expr)))
    1616                 :             :     {
    1617                 :    47175087 :       if (implicit != ICV_CAST
    1618                 :    46863145 :           && warn_unused_value
    1619                 :      611425 :           && !warning_suppressed_p (expr, OPT_Wunused_value)
    1620                 :      609921 :           && !processing_template_decl
    1621                 :      485364 :           && !cp_unevaluated_operand
    1622                 :    47638957 :           && (complain & tf_warning))
    1623                 :             :         {
    1624                 :             :           /* The middle end does not warn about expressions that have
    1625                 :             :              been explicitly cast to void, so we must do so here.  */
    1626                 :      462886 :           if (!TREE_SIDE_EFFECTS (expr))
    1627                 :             :             {
    1628                 :          96 :               switch (implicit)
    1629                 :             :                 {
    1630                 :           3 :                   case ICV_SECOND_OF_COND:
    1631                 :           3 :                     warning_at (loc, OPT_Wunused_value,
    1632                 :             :                                 "second operand of conditional expression "
    1633                 :             :                                 "has no effect");
    1634                 :           3 :                     break;
    1635                 :           3 :                   case ICV_THIRD_OF_COND:
    1636                 :           3 :                     warning_at (loc, OPT_Wunused_value,
    1637                 :             :                                 "third operand of conditional expression "
    1638                 :             :                                 "has no effect");
    1639                 :           3 :                     break;
    1640                 :          39 :                   case ICV_RIGHT_OF_COMMA:
    1641                 :          39 :                     warning_at (loc, OPT_Wunused_value,
    1642                 :             :                                 "right operand of comma operator has no effect");
    1643                 :          39 :                     break;
    1644                 :          12 :                   case ICV_LEFT_OF_COMMA:
    1645                 :          12 :                     warning_at (loc, OPT_Wunused_value,
    1646                 :             :                                 "left operand of comma operator has no effect");
    1647                 :          12 :                     break;
    1648                 :          39 :                   case ICV_STATEMENT:
    1649                 :          39 :                     warning_at (loc, OPT_Wunused_value,
    1650                 :             :                                 "statement has no effect");
    1651                 :          36 :                     break;
    1652                 :           0 :                   case ICV_THIRD_IN_FOR:
    1653                 :           0 :                     warning_at (loc, OPT_Wunused_value,
    1654                 :             :                                 "for increment expression has no effect");
    1655                 :           0 :                     break;
    1656                 :           0 :                   default:
    1657                 :           0 :                     gcc_unreachable ();
    1658                 :             :                 }
    1659                 :             :             }
    1660                 :             :           else
    1661                 :             :             {
    1662                 :             :               tree e = expr;
    1663                 :             :               /* We might like to warn about (say) "(int) f()", as the
    1664                 :             :                  cast has no effect, but the compiler itself will
    1665                 :             :                  generate implicit conversions under some
    1666                 :             :                  circumstances.  (For example a block copy will be
    1667                 :             :                  turned into a call to "__builtin_memcpy", with a
    1668                 :             :                  conversion of the return value to an appropriate
    1669                 :             :                  type.)  So, to avoid false positives, we strip
    1670                 :             :                  conversions.  Do not use STRIP_NOPs because it will
    1671                 :             :                  not strip conversions to "void", as that is not a
    1672                 :             :                  mode-preserving conversion.  */
    1673                 :      463147 :               while (TREE_CODE (e) == NOP_EXPR)
    1674                 :         357 :                 e = TREE_OPERAND (e, 0);
    1675                 :             : 
    1676                 :      462790 :               enum tree_code code = TREE_CODE (e);
    1677                 :      462790 :               enum tree_code_class tclass = TREE_CODE_CLASS (code);
    1678                 :      462790 :               if (tclass == tcc_comparison
    1679                 :             :                   || tclass == tcc_unary
    1680                 :      462790 :                   || tclass == tcc_binary
    1681                 :      462715 :                   || code == TRUTH_NOT_EXPR
    1682                 :      462715 :                   || code == ADDR_EXPR
    1683                 :             :                   || code == VEC_PERM_EXPR
    1684                 :      462708 :                   || code == VEC_COND_EXPR)
    1685                 :          88 :                 warn_if_unused_value (e, loc);
    1686                 :             :             }
    1687                 :             :         }
    1688                 :    47175084 :       expr = build1 (CONVERT_EXPR, void_type_node, expr);
    1689                 :             :     }
    1690                 :    47503111 :   if (! TREE_SIDE_EFFECTS (expr))
    1691                 :      943017 :     expr = void_node;
    1692                 :             :   return expr;
    1693                 :             : }
    1694                 :             : 
    1695                 :             : /* Create an expression whose value is that of EXPR,
    1696                 :             :    converted to type TYPE.  The TREE_TYPE of the value
    1697                 :             :    is always TYPE.  This function implements all reasonable
    1698                 :             :    conversions; callers should filter out those that are
    1699                 :             :    not permitted by the language being compiled.
    1700                 :             : 
    1701                 :             :    Most of this routine is from build_reinterpret_cast.
    1702                 :             : 
    1703                 :             :    The back end cannot call cp_convert (what was convert) because
    1704                 :             :    conversions to/from basetypes may involve memory references
    1705                 :             :    (vbases) and adding or subtracting small values (multiple
    1706                 :             :    inheritance), but it calls convert from the constant folding code
    1707                 :             :    on subtrees of already built trees after it has ripped them apart.
    1708                 :             : 
    1709                 :             :    Also, if we ever support range variables, we'll probably also have to
    1710                 :             :    do a little bit more work.  */
    1711                 :             : 
    1712                 :             : tree
    1713                 :   153817146 : convert (tree type, tree expr)
    1714                 :             : {
    1715                 :   153817146 :   tree intype;
    1716                 :             : 
    1717                 :   153817146 :   if (type == error_mark_node || expr == error_mark_node)
    1718                 :             :     return error_mark_node;
    1719                 :             : 
    1720                 :   153815034 :   intype = TREE_TYPE (expr);
    1721                 :             : 
    1722                 :   153815034 :   if (INDIRECT_TYPE_P (type) && INDIRECT_TYPE_P (intype))
    1723                 :    33548868 :     return build_nop (type, expr);
    1724                 :             : 
    1725                 :   120266166 :   return ocp_convert (type, expr, CONV_BACKEND_CONVERT,
    1726                 :             :                       LOOKUP_NORMAL|LOOKUP_NO_CONVERSION,
    1727                 :   120266166 :                       tf_warning_or_error);
    1728                 :             : }
    1729                 :             : 
    1730                 :             : /* Like convert, but in a static initializer (called from
    1731                 :             :    convert_and_check).  */
    1732                 :             : 
    1733                 :             : tree
    1734                 :           0 : convert_init (tree type, tree expr)
    1735                 :             : {
    1736                 :           0 :   return convert (type, expr);
    1737                 :             : }
    1738                 :             : 
    1739                 :             : /* Like cp_convert, except permit conversions to take place which
    1740                 :             :    are not normally allowed due to access restrictions
    1741                 :             :    (such as conversion from sub-type to private super-type).  */
    1742                 :             : 
    1743                 :             : tree
    1744                 :     7539298 : convert_force (tree type, tree expr, int convtype, tsubst_flags_t complain)
    1745                 :             : {
    1746                 :     7539298 :   tree e = expr;
    1747                 :     7539298 :   enum tree_code code = TREE_CODE (type);
    1748                 :             : 
    1749                 :     7539298 :   if (code == REFERENCE_TYPE)
    1750                 :           0 :     return convert_to_reference (type, e, CONV_C_CAST, 0,
    1751                 :           0 :                                  NULL_TREE, complain);
    1752                 :             : 
    1753                 :     7539298 :   if (code == POINTER_TYPE)
    1754                 :     7539298 :     return convert_to_pointer_force (type, e, complain);
    1755                 :             : 
    1756                 :             :   /* From typeck.cc convert_for_assignment */
    1757                 :           0 :   if (((TYPE_PTR_P (TREE_TYPE (e)) && TREE_CODE (e) == ADDR_EXPR
    1758                 :           0 :         && TREE_CODE (TREE_TYPE (TREE_TYPE (e))) == METHOD_TYPE)
    1759                 :           0 :        || integer_zerop (e)
    1760                 :           0 :        || TYPE_PTRMEMFUNC_P (TREE_TYPE (e)))
    1761                 :           0 :       && TYPE_PTRMEMFUNC_P (type))
    1762                 :             :     /* compatible pointer to member functions.  */
    1763                 :           0 :     return build_ptrmemfunc (TYPE_PTRMEMFUNC_FN_TYPE (type), e, 1,
    1764                 :           0 :                              /*c_cast_p=*/1, complain);
    1765                 :             : 
    1766                 :           0 :   return ocp_convert (type, e, CONV_C_CAST|convtype, LOOKUP_NORMAL, complain);
    1767                 :             : }
    1768                 :             : 
    1769                 :             : /* Convert an aggregate EXPR to type XTYPE.  If a conversion
    1770                 :             :    exists, return the attempted conversion.  This may
    1771                 :             :    return ERROR_MARK_NODE if the conversion is not
    1772                 :             :    allowed (references private members, etc).
    1773                 :             :    If no conversion exists, NULL_TREE is returned.
    1774                 :             : 
    1775                 :             :    FIXME: Ambiguity checking is wrong.  Should choose one by the implicit
    1776                 :             :    object parameter, or by the second standard conversion sequence if
    1777                 :             :    that doesn't do it.  This will probably wait for an overloading rewrite.
    1778                 :             :    (jason 8/9/95)  */
    1779                 :             : 
    1780                 :             : static tree
    1781                 :           8 : build_type_conversion (tree xtype, tree expr)
    1782                 :             : {
    1783                 :             :   /* C++: check to see if we can convert this aggregate type
    1784                 :             :      into the required type.  */
    1785                 :           8 :   return build_user_type_conversion (xtype, expr, LOOKUP_NORMAL,
    1786                 :           0 :                                      tf_warning_or_error);
    1787                 :             : }
    1788                 :             : 
    1789                 :             : /* Convert the given EXPR to one of a group of types suitable for use in an
    1790                 :             :    expression.  DESIRES is a combination of various WANT_* flags (q.v.)
    1791                 :             :    which indicates which types are suitable.  If COMPLAIN is true, complain
    1792                 :             :    about ambiguity; otherwise, the caller will deal with it.  */
    1793                 :             : 
    1794                 :             : tree
    1795                 :    44485705 : build_expr_type_conversion (int desires, tree expr, bool complain)
    1796                 :             : {
    1797                 :    44485705 :   tree basetype = TREE_TYPE (expr);
    1798                 :    44485705 :   tree conv = NULL_TREE;
    1799                 :    44485705 :   tree winner = NULL_TREE;
    1800                 :             : 
    1801                 :    44485705 :   if (null_node_p (expr)
    1802                 :             :       && (desires & WANT_INT)
    1803                 :    44485705 :       && !(desires & WANT_NULL))
    1804                 :             :     {
    1805                 :          36 :       location_t loc =
    1806                 :          36 :         expansion_point_location_if_in_system_header (input_location);
    1807                 :             : 
    1808                 :          36 :       warning_at (loc, OPT_Wconversion_null,
    1809                 :             :                   "converting NULL to non-pointer type");
    1810                 :             :     }
    1811                 :             : 
    1812                 :    44485705 :   if (basetype == error_mark_node)
    1813                 :             :     return error_mark_node;
    1814                 :             : 
    1815                 :    44485693 :   if (! MAYBE_CLASS_TYPE_P (basetype))
    1816                 :    44485491 :     switch (TREE_CODE (basetype))
    1817                 :             :       {
    1818                 :    35820356 :       case INTEGER_TYPE:
    1819                 :    35820356 :         if ((desires & WANT_NULL) && null_ptr_cst_p (expr))
    1820                 :             :           return expr;
    1821                 :             :         /* fall through.  */
    1822                 :             : 
    1823                 :    35856388 :       case BOOLEAN_TYPE:
    1824                 :    38754656 :         return (desires & WANT_INT) ? expr : NULL_TREE;
    1825                 :       65783 :       case ENUMERAL_TYPE:
    1826                 :       67443 :         return (desires & WANT_ENUM) ? expr : NULL_TREE;
    1827                 :     1738885 :       case REAL_TYPE:
    1828                 :     1738924 :         return (desires & WANT_FLOAT) ? expr : NULL_TREE;
    1829                 :     5722432 :       case POINTER_TYPE:
    1830                 :     7553726 :         return (desires & WANT_POINTER) ? expr : NULL_TREE;
    1831                 :             : 
    1832                 :     1031859 :       case FUNCTION_TYPE:
    1833                 :     1031859 :       case ARRAY_TYPE:
    1834                 :     1031859 :         return (desires & WANT_POINTER) ? decay_conversion (expr,
    1835                 :             :                                                             tf_warning_or_error)
    1836                 :             :                                         : NULL_TREE;
    1837                 :             : 
    1838                 :       54724 :       case VECTOR_TYPE:
    1839                 :       54724 :         if (!gnu_vector_type_p (basetype))
    1840                 :             :           return NULL_TREE;
    1841                 :             :         /* FALLTHROUGH */
    1842                 :       70084 :       case COMPLEX_TYPE:
    1843                 :       70084 :         if ((desires & WANT_VECTOR_OR_COMPLEX) == 0)
    1844                 :             :           return NULL_TREE;
    1845                 :       33043 :         switch (TREE_CODE (TREE_TYPE (basetype)))
    1846                 :             :           {
    1847                 :         400 :           case INTEGER_TYPE:
    1848                 :         400 :           case BOOLEAN_TYPE:
    1849                 :         400 :             return (desires & WANT_INT) ? expr : NULL_TREE;
    1850                 :           0 :           case ENUMERAL_TYPE:
    1851                 :           0 :             return (desires & WANT_ENUM) ? expr : NULL_TREE;
    1852                 :       32643 :           case REAL_TYPE:
    1853                 :       32649 :             return (desires & WANT_FLOAT) ? expr : NULL_TREE;
    1854                 :             :           default:
    1855                 :             :             return NULL_TREE;
    1856                 :             :           }
    1857                 :             : 
    1858                 :             :       default:
    1859                 :             :         return NULL_TREE;
    1860                 :             :       }
    1861                 :             : 
    1862                 :             :   /* The code for conversions from class type is currently only used for
    1863                 :             :      delete expressions.  Other expressions are handled by build_new_op.  */
    1864                 :         202 :   if (!complete_type_or_maybe_complain (basetype, expr, complain))
    1865                 :           0 :     return error_mark_node;
    1866                 :         202 :   if (!TYPE_HAS_CONVERSION (basetype))
    1867                 :             :     return NULL_TREE;
    1868                 :             : 
    1869                 :         407 :   for (conv = lookup_conversions (basetype); conv; conv = TREE_CHAIN (conv))
    1870                 :             :     {
    1871                 :         220 :       int win = 0;
    1872                 :         220 :       tree candidate;
    1873                 :         220 :       tree cand = TREE_VALUE (conv);
    1874                 :         220 :       cand = OVL_FIRST (cand);
    1875                 :             : 
    1876                 :         220 :       if (winner && winner == cand)
    1877                 :           0 :         continue;
    1878                 :             : 
    1879                 :         220 :       if (DECL_NONCONVERTING_P (cand))
    1880                 :           3 :         continue;
    1881                 :             : 
    1882                 :         217 :       candidate = non_reference (TREE_TYPE (TREE_TYPE (cand)));
    1883                 :             : 
    1884                 :         217 :       switch (TREE_CODE (candidate))
    1885                 :             :         {
    1886                 :         160 :         case BOOLEAN_TYPE:
    1887                 :         160 :         case INTEGER_TYPE:
    1888                 :         160 :           win = (desires & WANT_INT); break;
    1889                 :          15 :         case ENUMERAL_TYPE:
    1890                 :          15 :           win = (desires & WANT_ENUM); break;
    1891                 :           3 :         case REAL_TYPE:
    1892                 :           3 :           win = (desires & WANT_FLOAT); break;
    1893                 :          36 :         case POINTER_TYPE:
    1894                 :          36 :           win = (desires & WANT_POINTER); break;
    1895                 :             : 
    1896                 :           0 :         case COMPLEX_TYPE:
    1897                 :           0 :         case VECTOR_TYPE:
    1898                 :           0 :           if ((desires & WANT_VECTOR_OR_COMPLEX) == 0)
    1899                 :             :             break;
    1900                 :           0 :           switch (TREE_CODE (TREE_TYPE (candidate)))
    1901                 :             :             {
    1902                 :           0 :             case BOOLEAN_TYPE:
    1903                 :           0 :             case INTEGER_TYPE:
    1904                 :           0 :               win = (desires & WANT_INT); break;
    1905                 :           0 :             case ENUMERAL_TYPE:
    1906                 :           0 :               win = (desires & WANT_ENUM); break;
    1907                 :           0 :             case REAL_TYPE:
    1908                 :           0 :               win = (desires & WANT_FLOAT); break;
    1909                 :             :             default:
    1910                 :             :               break;
    1911                 :             :             }
    1912                 :             :           break;
    1913                 :             : 
    1914                 :           3 :         default:
    1915                 :             :           /* A wildcard could be instantiated to match any desired
    1916                 :             :              type, but we can't deduce the template argument.  */
    1917                 :           3 :           if (WILDCARD_TYPE_P (candidate))
    1918                 :             :             win = true;
    1919                 :             :           break;
    1920                 :             :         }
    1921                 :             : 
    1922                 :         214 :       if (win)
    1923                 :             :         {
    1924                 :         205 :           if (TREE_CODE (cand) == TEMPLATE_DECL)
    1925                 :             :             {
    1926                 :           6 :               if (complain)
    1927                 :           6 :                 error ("default type conversion cannot deduce template"
    1928                 :             :                        " argument for %qD", cand);
    1929                 :           6 :               return error_mark_node;
    1930                 :             :             }
    1931                 :             : 
    1932                 :         199 :           if (winner)
    1933                 :             :             {
    1934                 :          15 :               tree winner_type
    1935                 :          15 :                 = non_reference (TREE_TYPE (TREE_TYPE (winner)));
    1936                 :             : 
    1937                 :          15 :               if (!same_type_ignoring_top_level_qualifiers_p (winner_type,
    1938                 :             :                                                               candidate))
    1939                 :             :                 {
    1940                 :           3 :                   if (complain)
    1941                 :             :                     {
    1942                 :           3 :                       auto_diagnostic_group d;
    1943                 :           3 :                       error ("ambiguous default type conversion from %qT",
    1944                 :             :                              basetype);
    1945                 :           3 :                       inform (input_location,
    1946                 :             :                               "  candidate conversions include %qD and %qD",
    1947                 :             :                               winner, cand);
    1948                 :           3 :                     }
    1949                 :           3 :                   return error_mark_node;
    1950                 :             :                 }
    1951                 :             :             }
    1952                 :             : 
    1953                 :             :           winner = cand;
    1954                 :             :         }
    1955                 :             :     }
    1956                 :             : 
    1957                 :         187 :   if (winner)
    1958                 :             :     {
    1959                 :         181 :       tree type = non_reference (TREE_TYPE (TREE_TYPE (winner)));
    1960                 :         181 :       return build_user_type_conversion (type, expr, LOOKUP_NORMAL,
    1961                 :         181 :                                          tf_warning_or_error);
    1962                 :             :     }
    1963                 :             : 
    1964                 :             :   return NULL_TREE;
    1965                 :             : }
    1966                 :             : 
    1967                 :             : /* Implements integral promotion (4.1) and float->double promotion.  */
    1968                 :             : 
    1969                 :             : tree
    1970                 :   282737189 : type_promotes_to (tree type)
    1971                 :             : {
    1972                 :   288902361 :   tree promoted_type;
    1973                 :             : 
    1974                 :   288902361 :   if (type == error_mark_node)
    1975                 :             :     return error_mark_node;
    1976                 :             : 
    1977                 :   288902361 :   type = TYPE_MAIN_VARIANT (type);
    1978                 :             : 
    1979                 :             :   /* Check for promotions of target-defined types first.  */
    1980                 :   288902361 :   promoted_type = targetm.promoted_type (type);
    1981                 :   288902361 :   if (promoted_type)
    1982                 :             :     return promoted_type;
    1983                 :             : 
    1984                 :             :   /* bool always promotes to int (not unsigned), even if it's the same
    1985                 :             :      size.  */
    1986                 :   288902361 :   if (TREE_CODE (type) == BOOLEAN_TYPE)
    1987                 :     4165152 :     type = integer_type_node;
    1988                 :             : 
    1989                 :             :   /* Normally convert enums to int, but convert wide enums to something
    1990                 :             :      wider.  Scoped enums don't promote, but pretend they do for backward
    1991                 :             :      ABI bug compatibility wrt varargs.  */
    1992                 :   284737209 :   else if (TREE_CODE (type) == ENUMERAL_TYPE
    1993                 :   261007748 :            || type == char8_type_node
    1994                 :   260940134 :            || type == char16_type_node
    1995                 :   260659944 :            || type == char32_type_node
    1996                 :   260325842 :            || type == wchar_type_node)
    1997                 :             :     {
    1998                 :    25177495 :       tree prom = type;
    1999                 :             : 
    2000                 :    25177495 :       if (TREE_CODE (type) == ENUMERAL_TYPE)
    2001                 :             :         {
    2002                 :    23729461 :           prom = ENUM_UNDERLYING_TYPE (prom);
    2003                 :    23729461 :           if (!ENUM_IS_SCOPED (type)
    2004                 :    23729461 :               && ENUM_FIXED_UNDERLYING_TYPE_P (type))
    2005                 :             :             {
    2006                 :             :               /* ISO C++17, 7.6/4.  A prvalue of an unscoped enumeration type
    2007                 :             :                  whose underlying type is fixed (10.2) can be converted to a
    2008                 :             :                  prvalue of its underlying type. Moreover, if integral promotion
    2009                 :             :                  can be applied to its underlying type, a prvalue of an unscoped
    2010                 :             :                  enumeration type whose underlying type is fixed can also be
    2011                 :             :                  converted to a prvalue of the promoted underlying type.  */
    2012                 :             :               return type_promotes_to (prom);
    2013                 :             :             }
    2014                 :             :         }
    2015                 :             : 
    2016                 :    19012323 :       int precision = MAX (TYPE_PRECISION (type),
    2017                 :             :                            TYPE_PRECISION (integer_type_node));
    2018                 :    19012323 :       tree totype = c_common_type_for_size (precision, 0);
    2019                 :    19012323 :       if (TYPE_UNSIGNED (prom)
    2020                 :    19012323 :           && ! int_fits_type_p (TYPE_MAX_VALUE (prom), totype))
    2021                 :      629618 :         prom = c_common_type_for_size (precision, 1);
    2022                 :             :       else
    2023                 :             :         prom = totype;
    2024                 :    19012323 :       if (SCOPED_ENUM_P (type))
    2025                 :             :         {
    2026                 :          63 :           if (abi_version_crosses (6)
    2027                 :          33 :               && TYPE_MODE (prom) != TYPE_MODE (type))
    2028                 :          60 :             warning (OPT_Wabi, "scoped enum %qT passed through %<...%> as "
    2029                 :             :                      "%qT before %<-fabi-version=6%>, %qT after",
    2030                 :          30 :                      type, prom, ENUM_UNDERLYING_TYPE (type));
    2031                 :          33 :           if (!abi_version_at_least (6))
    2032                 :    19012293 :             type = prom;
    2033                 :             :         }
    2034                 :             :       else
    2035                 :             :         type = prom;
    2036                 :             :     }
    2037                 :   259559714 :   else if (c_promoting_integer_type_p (type))
    2038                 :             :     {
    2039                 :             :       /* Retain unsignedness if really not getting bigger.  */
    2040                 :     9295879 :       if (TYPE_UNSIGNED (type)
    2041                 :     9295879 :           && TYPE_PRECISION (type) == TYPE_PRECISION (integer_type_node))
    2042                 :           0 :         type = unsigned_type_node;
    2043                 :             :       else
    2044                 :     9295879 :         type = integer_type_node;
    2045                 :             :     }
    2046                 :   250263835 :   else if (type == float_type_node)
    2047                 :    10888532 :     type = double_type_node;
    2048                 :             : 
    2049                 :             :   return type;
    2050                 :             : }
    2051                 :             : 
    2052                 :             : /* The routines below this point are carefully written to conform to
    2053                 :             :    the standard.  They use the same terminology, and follow the rules
    2054                 :             :    closely.  Although they are used only in pt.cc at the moment, they
    2055                 :             :    should presumably be used everywhere in the future.  */
    2056                 :             : 
    2057                 :             : /* True iff EXPR can be converted to TYPE via a qualification conversion.
    2058                 :             :    Callers should check for identical types before calling this function.  */
    2059                 :             : 
    2060                 :             : bool
    2061                 :          51 : can_convert_qual (tree type, tree expr)
    2062                 :             : {
    2063                 :          51 :   tree expr_type = TREE_TYPE (expr);
    2064                 :          51 :   gcc_assert (!same_type_p (type, expr_type));
    2065                 :             : 
    2066                 :             :   /* A function pointer conversion also counts as a Qualification Adjustment
    2067                 :             :      under [over.ics.scs].  */
    2068                 :          51 :   if (fnptr_conv_p (type, expr_type))
    2069                 :             :     return true;
    2070                 :             : 
    2071                 :          41 :   if (TYPE_PTR_P (type) && TYPE_PTR_P (expr_type))
    2072                 :           8 :     return comp_ptr_ttypes (TREE_TYPE (type), TREE_TYPE (expr_type));
    2073                 :          33 :   else if (TYPE_PTRMEM_P (type) && TYPE_PTRMEM_P (expr_type))
    2074                 :          32 :     return (same_type_p (TYPE_PTRMEM_CLASS_TYPE (type),
    2075                 :             :                          TYPE_PTRMEM_CLASS_TYPE (expr_type))
    2076                 :          61 :             && comp_ptr_ttypes (TYPE_PTRMEM_POINTED_TO_TYPE (type),
    2077                 :          29 :                                 TYPE_PTRMEM_POINTED_TO_TYPE (expr_type)));
    2078                 :             :   else
    2079                 :             :     return false;
    2080                 :             : }
    2081                 :             : 
    2082                 :             : /* Attempt to perform qualification conversions on EXPR to convert it
    2083                 :             :    to TYPE.  Return the resulting expression, or error_mark_node if
    2084                 :             :    the conversion was impossible.  Since this is only used by
    2085                 :             :    convert_nontype_argument, we fold the conversion.  */
    2086                 :             : 
    2087                 :             : tree
    2088                 :         896 : perform_qualification_conversions (tree type, tree expr)
    2089                 :             : {
    2090                 :         896 :   tree expr_type;
    2091                 :             : 
    2092                 :         896 :   expr_type = TREE_TYPE (expr);
    2093                 :             : 
    2094                 :         896 :   if (same_type_p (type, expr_type))
    2095                 :             :     return expr;
    2096                 :          21 :   else if (can_convert_qual (type, expr))
    2097                 :          14 :     return cp_fold_convert (type, expr);
    2098                 :             :   else
    2099                 :           7 :     return error_mark_node;
    2100                 :             : }
    2101                 :             : 
    2102                 :             : /* True iff T is a transaction-safe function type.  */
    2103                 :             : 
    2104                 :             : bool
    2105                 :     7471787 : tx_safe_fn_type_p (tree t)
    2106                 :             : {
    2107                 :     7471787 :   if (!FUNC_OR_METHOD_TYPE_P (t))
    2108                 :             :     return false;
    2109                 :     7467382 :   return !!lookup_attribute ("transaction_safe", TYPE_ATTRIBUTES (t));
    2110                 :             : }
    2111                 :             : 
    2112                 :             : /* Return the transaction-unsafe variant of transaction-safe function type
    2113                 :             :    T.  */
    2114                 :             : 
    2115                 :             : tree
    2116                 :          38 : tx_unsafe_fn_variant (tree t)
    2117                 :             : {
    2118                 :          38 :   gcc_assert (tx_safe_fn_type_p (t));
    2119                 :          38 :   tree attrs = remove_attribute ("transaction_safe",
    2120                 :          38 :                                  TYPE_ATTRIBUTES (t));
    2121                 :          38 :   return cp_build_type_attribute_variant (t, attrs);
    2122                 :             : }
    2123                 :             : 
    2124                 :             : /* Return true iff FROM can convert to TO by a transaction-safety
    2125                 :             :    conversion.  */
    2126                 :             : 
    2127                 :             : static bool
    2128                 :    87994345 : can_convert_tx_safety (tree to, tree from)
    2129                 :             : {
    2130                 :        3578 :   return (flag_tm && tx_safe_fn_type_p (from)
    2131                 :    87994381 :           && same_type_p (to, tx_unsafe_fn_variant (from)));
    2132                 :             : }
    2133                 :             : 
    2134                 :             : /* Return true iff FROM can convert to TO by dropping noexcept.
    2135                 :             :    This is just a subroutine of fnptr_conv_p.  */
    2136                 :             : 
    2137                 :             : static bool
    2138                 :    88437699 : noexcept_conv_p (tree to, tree from)
    2139                 :             : {
    2140                 :    88437699 :   if (!flag_noexcept_type)
    2141                 :             :     return false;
    2142                 :             : 
    2143                 :    88087856 :   if (TREE_CODE (to) != TREE_CODE (from))
    2144                 :             :     return false;
    2145                 :    45563705 :   if (!FUNC_OR_METHOD_TYPE_P (from))
    2146                 :             :     return false;
    2147                 :     1934270 :   if (!type_throw_all_p (to)
    2148                 :     1934270 :       || type_throw_all_p (from))
    2149                 :       91451 :     return false;
    2150                 :     1842819 :   tree v = build_exception_variant (from, NULL_TREE);
    2151                 :     1842819 :   return same_type_p (to, v);
    2152                 :             : }
    2153                 :             : 
    2154                 :             : /* Return true iff FROM can convert to TO by a function pointer conversion.  */
    2155                 :             : 
    2156                 :             : bool
    2157                 :    88437699 : fnptr_conv_p (tree to, tree from)
    2158                 :             : {
    2159                 :    88437699 :   tree t = to;
    2160                 :    88437699 :   tree f = from;
    2161                 :         765 :   if (TYPE_PTRMEMFUNC_P (t)
    2162                 :    88438464 :       && TYPE_PTRMEMFUNC_P (f))
    2163                 :             :     {
    2164                 :         702 :       t = TYPE_PTRMEMFUNC_FN_TYPE (t);
    2165                 :         702 :       f = TYPE_PTRMEMFUNC_FN_TYPE (f);
    2166                 :             :     }
    2167                 :    88437699 :   if (INDIRECT_TYPE_P (t)
    2168                 :    86713859 :       && INDIRECT_TYPE_P (f))
    2169                 :             :     {
    2170                 :    86713848 :       t = TREE_TYPE (t);
    2171                 :    86713848 :       f = TREE_TYPE (f);
    2172                 :             :     }
    2173                 :             : 
    2174                 :    88437699 :   return (noexcept_conv_p (t, f)
    2175                 :    88437699 :           || can_convert_tx_safety (t, f));
    2176                 :             : }
    2177                 :             : 
    2178                 :             : /* Return FN with any NOP_EXPRs stripped that represent function pointer
    2179                 :             :    conversions or conversions to the same type.  */
    2180                 :             : 
    2181                 :             : tree
    2182                 :         728 : strip_fnptr_conv (tree fn)
    2183                 :             : {
    2184                 :         739 :   while (TREE_CODE (fn) == NOP_EXPR)
    2185                 :             :     {
    2186                 :          33 :       tree op = TREE_OPERAND (fn, 0);
    2187                 :          33 :       tree ft = TREE_TYPE (fn);
    2188                 :          33 :       tree ot = TREE_TYPE (op);
    2189                 :          66 :       if (same_type_p (ft, ot)
    2190                 :          33 :           || fnptr_conv_p (ft, ot))
    2191                 :             :         fn = op;
    2192                 :             :       else
    2193                 :             :         break;
    2194                 :             :     }
    2195                 :         728 :   return fn;
    2196                 :             : }
        

Generated by: LCOV version 2.1-beta

LCOV profile is generated on x86_64 machine using following configure options: configure --disable-bootstrap --enable-coverage=opt --enable-languages=c,c++,fortran,go,jit,lto,rust,m2 --enable-host-shared. GCC test suite is run with the built compiler.