LCOV - code coverage report
Current view: top level - gcc/fortran - f95-lang.cc (source / functions) Coverage Total Hit
Test: gcc.info Lines: 99.7 % 337 336
Test Date: 2026-12-05 16:10:02 Functions: 100.0 % 20 20
Legend: Lines:     hit not hit

            Line data    Source code
       1              : /* gfortran backend interface
       2              :    Copyright (C) 2000-2026 Free Software Foundation, Inc.
       3              :    Contributed by Paul Brook.
       4              : 
       5              : This file is part of GCC.
       6              : 
       7              : GCC is free software; you can redistribute it and/or modify it under
       8              : the terms of the GNU General Public License as published by the Free
       9              : Software Foundation; either version 3, or (at your option) any later
      10              : version.
      11              : 
      12              : GCC is distributed in the hope that it will be useful, but WITHOUT ANY
      13              : WARRANTY; without even the implied warranty of MERCHANTABILITY or
      14              : FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
      15              : 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              : /* f95-lang.cc-- GCC backend interface stuff */
      22              : 
      23              : /* declare required prototypes: */
      24              : 
      25              : #include "config.h"
      26              : #include "system.h"
      27              : #include "coretypes.h"
      28              : #include "target.h"
      29              : #include "function.h"
      30              : #include "tree.h"
      31              : #include "gfortran.h"
      32              : #include "trans.h"
      33              : #include "stringpool.h"
      34              : #include "diagnostic.h" /* For errorcount/warningcount */
      35              : #include "langhooks.h"
      36              : #include "langhooks-def.h"
      37              : #include "toplev.h"
      38              : #include "debug.h"
      39              : #include "cpp.h"
      40              : #include "trans-types.h"
      41              : #include "trans-const.h"
      42              : #include "attribs.h"
      43              : 
      44              : /* Language-dependent contents of an identifier.  */
      45              : 
      46              : struct GTY(())
      47              : lang_identifier {
      48              :   struct tree_identifier common;
      49              : };
      50              : 
      51              : /* The resulting tree type.  */
      52              : 
      53              : union GTY((desc ("TREE_CODE (&%h.generic) == IDENTIFIER_NODE"),
      54              :      chain_next ("CODE_CONTAINS_STRUCT (TREE_CODE (&%h.generic), TS_COMMON) ? ((union lang_tree_node *) TREE_CHAIN (&%h.generic)) : NULL")))
      55              : lang_tree_node {
      56              :   union tree_node GTY((tag ("0"),
      57              :                        desc ("tree_node_structure (&%h)"))) generic;
      58              :   struct lang_identifier GTY((tag ("1"))) identifier;
      59              : };
      60              : 
      61              : /* Save and restore the variables in this file and elsewhere
      62              :    that keep track of the progress of compilation of the current function.
      63              :    Used for nested functions.  */
      64              : 
      65              : struct GTY(())
      66              : language_function {
      67              :   /* struct gfc_language_function base; */
      68              :   struct binding_level *binding_level;
      69              : };
      70              : 
      71              : static void gfc_init_decl_processing (void);
      72              : static void gfc_init_builtin_functions (void);
      73              : static bool global_bindings_p (void);
      74              : 
      75              : /* Each front end provides its own.  */
      76              : static bool gfc_init (void);
      77              : static void gfc_finish (void);
      78              : static void gfc_be_parse_file (void);
      79              : static void gfc_init_ts (void);
      80              : static tree gfc_builtin_function (tree);
      81              : 
      82              : /* Handle an "omp declare target" attribute; arguments as in
      83              :    struct attribute_spec.handler.  */
      84              : static tree
      85         1421 : gfc_handle_omp_declare_target_attribute (tree *, tree, tree, int, bool *)
      86              : {
      87         1421 :   return NULL_TREE;
      88              : }
      89              : 
      90              : /* Table of valid Fortran attributes.  */
      91              : static const attribute_spec gfc_gnu_attributes[] =
      92              : {
      93              :   /* { name, min_len, max_len, decl_req, type_req, fn_type_req,
      94              :        affects_type_identity, handler, exclude } */
      95              :   { "omp declare target", 0, -1, true,  false, false, false,
      96              :     gfc_handle_omp_declare_target_attribute, NULL },
      97              :   { "omp declare target link", 0, 0, true,  false, false, false,
      98              :     gfc_handle_omp_declare_target_attribute, NULL },
      99              :   { "omp declare target indirect", 0, 0, true,  false, false, false,
     100              :     gfc_handle_omp_declare_target_attribute, NULL },
     101              :   { "oacc function", 0, -1, true,  false, false, false,
     102              :     gfc_handle_omp_declare_target_attribute, NULL },
     103              :   { "omp groupprivate", 0, 0, true,  false, false, false,
     104              :     gfc_handle_omp_declare_target_attribute, NULL },
     105              : };
     106              : 
     107              : static const scoped_attribute_specs gfc_gnu_attribute_table =
     108              : {
     109              :   "gnu", { gfc_gnu_attributes }
     110              : };
     111              : 
     112              : static const scoped_attribute_specs *const gfc_attribute_table[] =
     113              : {
     114              :   &gfc_gnu_attribute_table
     115              : };
     116              : 
     117              : /* Get a value for the SARIF v2.1.0 "artifact.sourceLanguage" property,
     118              :    based on the list in SARIF v2.1.0 Appendix J.  */
     119              : 
     120              : static const char *
     121            2 : gfc_get_sarif_source_language (const char *)
     122              : {
     123            2 :   return "fortran";
     124              : }
     125              : 
     126              : #undef LANG_HOOKS_NAME
     127              : #undef LANG_HOOKS_INIT
     128              : #undef LANG_HOOKS_FINISH
     129              : #undef LANG_HOOKS_OPTION_LANG_MASK
     130              : #undef LANG_HOOKS_INIT_OPTIONS_STRUCT
     131              : #undef LANG_HOOKS_INIT_OPTIONS
     132              : #undef LANG_HOOKS_HANDLE_OPTION
     133              : #undef LANG_HOOKS_POST_OPTIONS
     134              : #undef LANG_HOOKS_PARSE_FILE
     135              : #undef LANG_HOOKS_MARK_ADDRESSABLE
     136              : #undef LANG_HOOKS_TYPE_FOR_MODE
     137              : #undef LANG_HOOKS_TYPE_FOR_SIZE
     138              : #undef LANG_HOOKS_INIT_TS
     139              : #undef LANG_HOOKS_OMP_ARRAY_DATA
     140              : #undef LANG_HOOKS_OMP_ARRAY_DATA_PRIVATIZE
     141              : #undef LANG_HOOKS_OMP_ARRAY_SIZE
     142              : #undef LANG_HOOKS_OMP_IS_ALLOCATABLE_OR_PTR
     143              : #undef LANG_HOOKS_OMP_CHECK_OPTIONAL_ARGUMENT
     144              : #undef LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE
     145              : #undef LANG_HOOKS_OMP_PREDETERMINED_SHARING
     146              : #undef LANG_HOOKS_OMP_PREDETERMINED_MAPPING
     147              : #undef LANG_HOOKS_OMP_REPORT_DECL
     148              : #undef LANG_HOOKS_OMP_CLAUSE_DEFAULT_CTOR
     149              : #undef LANG_HOOKS_OMP_CLAUSE_COPY_CTOR
     150              : #undef LANG_HOOKS_OMP_CLAUSE_ASSIGN_OP
     151              : #undef LANG_HOOKS_OMP_CLAUSE_LINEAR_CTOR
     152              : #undef LANG_HOOKS_OMP_CLAUSE_DTOR
     153              : #undef LANG_HOOKS_OMP_FINISH_CLAUSE
     154              : #undef LANG_HOOKS_OMP_DEEP_MAPPING
     155              : #undef LANG_HOOKS_OMP_DEEP_MAPPING_P
     156              : #undef LANG_HOOKS_OMP_DEEP_MAPPING_CNT
     157              : #undef LANG_HOOKS_OMP_ALLOCATABLE_P
     158              : #undef LANG_HOOKS_OMP_POINTER_P
     159              : #undef LANG_HOOKS_OMP_SCALAR_TARGET_P
     160              : #undef LANG_HOOKS_OMP_SCALAR_P
     161              : #undef LANG_HOOKS_OMP_DISREGARD_VALUE_EXPR
     162              : #undef LANG_HOOKS_OMP_PRIVATE_DEBUG_CLAUSE
     163              : #undef LANG_HOOKS_OMP_PRIVATE_OUTER_REF
     164              : #undef LANG_HOOKS_OMP_FIRSTPRIVATIZE_TYPE_SIZES
     165              : #undef LANG_HOOKS_BUILTIN_FUNCTION
     166              : #undef LANG_HOOKS_BUILTIN_FUNCTION
     167              : #undef LANG_HOOKS_GET_ARRAY_DESCR_INFO
     168              : #undef LANG_HOOKS_ATTRIBUTE_TABLE
     169              : #undef LANG_HOOKS_GET_SARIF_SOURCE_LANGUAGE
     170              : 
     171              : /* Define lang hooks.  */
     172              : #define LANG_HOOKS_NAME                 "GNU Fortran"
     173              : #define LANG_HOOKS_INIT                 gfc_init
     174              : #define LANG_HOOKS_FINISH               gfc_finish
     175              : #define LANG_HOOKS_OPTION_LANG_MASK     gfc_option_lang_mask
     176              : #define LANG_HOOKS_INIT_OPTIONS_STRUCT  gfc_init_options_struct
     177              : #define LANG_HOOKS_INIT_OPTIONS         gfc_init_options
     178              : #define LANG_HOOKS_HANDLE_OPTION        gfc_handle_option
     179              : #define LANG_HOOKS_POST_OPTIONS         gfc_post_options
     180              : #define LANG_HOOKS_PARSE_FILE           gfc_be_parse_file
     181              : #define LANG_HOOKS_TYPE_FOR_MODE        gfc_type_for_mode
     182              : #define LANG_HOOKS_TYPE_FOR_SIZE        gfc_type_for_size
     183              : #define LANG_HOOKS_INIT_TS              gfc_init_ts
     184              : #define LANG_HOOKS_OMP_ARRAY_DATA               gfc_omp_array_data
     185              : #define LANG_HOOKS_OMP_ARRAY_DATA_PRIVATIZE     gfc_omp_array_data_privatize
     186              : #define LANG_HOOKS_OMP_ARRAY_SIZE               gfc_omp_array_size
     187              : #define LANG_HOOKS_OMP_IS_ALLOCATABLE_OR_PTR    gfc_omp_is_allocatable_or_ptr
     188              : #define LANG_HOOKS_OMP_CHECK_OPTIONAL_ARGUMENT  gfc_omp_check_optional_argument
     189              : #define LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE   gfc_omp_privatize_by_reference
     190              : #define LANG_HOOKS_OMP_PREDETERMINED_SHARING    gfc_omp_predetermined_sharing
     191              : #define LANG_HOOKS_OMP_PREDETERMINED_MAPPING    gfc_omp_predetermined_mapping
     192              : #define LANG_HOOKS_OMP_REPORT_DECL              gfc_omp_report_decl
     193              : #define LANG_HOOKS_OMP_CLAUSE_DEFAULT_CTOR      gfc_omp_clause_default_ctor
     194              : #define LANG_HOOKS_OMP_CLAUSE_COPY_CTOR         gfc_omp_clause_copy_ctor
     195              : #define LANG_HOOKS_OMP_CLAUSE_ASSIGN_OP         gfc_omp_clause_assign_op
     196              : #define LANG_HOOKS_OMP_CLAUSE_LINEAR_CTOR       gfc_omp_clause_linear_ctor
     197              : #define LANG_HOOKS_OMP_CLAUSE_DTOR              gfc_omp_clause_dtor
     198              : #define LANG_HOOKS_OMP_FINISH_CLAUSE            gfc_omp_finish_clause
     199              : #define LANG_HOOKS_OMP_DEEP_MAPPING             gfc_omp_deep_mapping
     200              : #define LANG_HOOKS_OMP_DEEP_MAPPING_P           gfc_omp_deep_mapping_p
     201              : #define LANG_HOOKS_OMP_DEEP_MAPPING_CNT         gfc_omp_deep_mapping_cnt
     202              : #define LANG_HOOKS_OMP_ALLOCATABLE_P            gfc_omp_allocatable_p
     203              : #define LANG_HOOKS_OMP_POINTER_P                gfc_omp_pointer_p
     204              : #define LANG_HOOKS_OMP_SCALAR_P                 gfc_omp_scalar_p
     205              : #define LANG_HOOKS_OMP_SCALAR_TARGET_P          gfc_omp_scalar_target_p
     206              : #define LANG_HOOKS_OMP_DISREGARD_VALUE_EXPR     gfc_omp_disregard_value_expr
     207              : #define LANG_HOOKS_OMP_PRIVATE_DEBUG_CLAUSE     gfc_omp_private_debug_clause
     208              : #define LANG_HOOKS_OMP_PRIVATE_OUTER_REF        gfc_omp_private_outer_ref
     209              : #define LANG_HOOKS_OMP_FIRSTPRIVATIZE_TYPE_SIZES \
     210              :   gfc_omp_firstprivatize_type_sizes
     211              : #define LANG_HOOKS_BUILTIN_FUNCTION     gfc_builtin_function
     212              : #define LANG_HOOKS_GET_ARRAY_DESCR_INFO gfc_get_array_descr_info
     213              : #define LANG_HOOKS_ATTRIBUTE_TABLE      gfc_attribute_table
     214              : #define LANG_HOOKS_GET_SARIF_SOURCE_LANGUAGE gfc_get_sarif_source_language
     215              : 
     216              : struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
     217              : 
     218              : #define NULL_BINDING_LEVEL (struct binding_level *) NULL
     219              : 
     220              : /* A chain of binding_level structures awaiting reuse.  */
     221              : 
     222              : static GTY(()) struct binding_level *free_binding_level;
     223              : 
     224              : /* True means we've initialized exception handling.  */
     225              : static bool gfc_eh_initialized_p;
     226              : 
     227              : /* The current translation unit.  */
     228              : static GTY(()) tree current_translation_unit;
     229              : 
     230              : 
     231              : static void
     232        32921 : gfc_create_decls (void)
     233              : {
     234              :   /* GCC builtins.  */
     235        32921 :   gfc_init_builtin_functions ();
     236              : 
     237              :   /* Runtime/IO library functions.  */
     238        32921 :   gfc_build_builtin_function_decls ();
     239              : 
     240        32921 :   gfc_init_constants ();
     241              : 
     242              :   /* Build our translation-unit decl.  */
     243        32921 :   current_translation_unit
     244        32921 :     = build_translation_unit_decl (get_identifier (main_input_filename));
     245        32921 :   debug_hooks->register_main_translation_unit (current_translation_unit);
     246        32921 : }
     247              : 
     248              : 
     249              : static void
     250        32921 : gfc_be_parse_file (void)
     251              : {
     252        32921 :   gfc_create_decls ();
     253        32921 :   gfc_parse_file ();
     254        32910 :   gfc_generate_constructors ();
     255              : 
     256              :   /* Clear the binding level stack.  */
     257        32910 :   while (!global_bindings_p ())
     258            7 :     poplevel (0, 0);
     259              : 
     260              :   /* Finalize all of the globals.
     261              : 
     262              :      Emulated tls lowering needs to see all TLS variables before we
     263              :      call finalize_compilation_unit.  The C/C++ front ends manage this
     264              :      by calling decl_rest_of_compilation on each global and static
     265              :      variable as they are seen.  The Fortran front end waits until
     266              :      here.  */
     267    151512569 :   for (tree decl = getdecls (); decl ; decl = DECL_CHAIN (decl))
     268    151479659 :     rest_of_decl_compilation (decl, true, true);
     269              : 
     270              :   /* Switch to the default tree diagnostics here, because there may be
     271              :      diagnostics before gfc_finish().  */
     272        32910 :   gfc_diagnostics_finish ();
     273              : 
     274        32910 :   global_decl_processing ();
     275        32910 : }
     276              : 
     277              : 
     278              : /* Initialize everything.  */
     279              : 
     280              : static bool
     281        32938 : gfc_init (void)
     282              : {
     283        32938 :   if (!gfc_cpp_enabled () || gfc_option.flag_preprocessed)
     284              :     {
     285        31747 :       linemap_add (line_table, LC_ENTER, false, gfc_source_file, 1);
     286        31747 :       linemap_add (line_table, LC_RENAME, false, special_fname_builtin (), 0);
     287              :     }
     288              :   else
     289         1191 :     gfc_cpp_init_0 ();
     290              : 
     291        32938 :   gfc_init_decl_processing ();
     292        32938 :   gfc_static_ctors = NULL_TREE;
     293              : 
     294        32938 :   if (gfc_cpp_enabled () && !gfc_option.flag_preprocessed)
     295         1191 :     gfc_cpp_init ();
     296              : 
     297        32938 :   gfc_init_1 ();
     298              : 
     299              :   /* Calls exit in case of a fail. */
     300        32938 :   gfc_new_file ();
     301              : 
     302        32934 :   if (flag_preprocess_only)
     303           13 :     return false;
     304              : 
     305              :   return true;
     306              : }
     307              : 
     308              : 
     309              : static void
     310        32919 : gfc_finish (void)
     311              : {
     312        32919 :   gfc_cpp_done ();
     313        32919 :   gfc_done_1 ();
     314        32919 :   gfc_release_include_path ();
     315        32919 :   return;
     316              : }
     317              : 
     318              : /* These functions and variables deal with binding contours.  We only
     319              :    need these functions for the list of PARM_DECLs, but we leave the
     320              :    functions more general; these are a simplified version of the
     321              :    functions from GNAT.  */
     322              : 
     323              : /* For each binding contour we allocate a binding_level structure which
     324              :    records the entities defined or declared in that contour.  Contours
     325              :    include:
     326              : 
     327              :         the global one
     328              :         one for each subprogram definition
     329              :         one for each compound statement (declare block)
     330              : 
     331              :    Binding contours are used to create GCC tree BLOCK nodes.  */
     332              : 
     333              : struct GTY(())
     334              : binding_level {
     335              :   /* A chain of ..._DECL nodes for all variables, constants, functions,
     336              :      parameters and type declarations.  These ..._DECL nodes are chained
     337              :      through the DECL_CHAIN field.  */
     338              :   tree names;
     339              :   /* For each level (except the global one), a chain of BLOCK nodes for all
     340              :      the levels that were entered and exited one level down from this one.  */
     341              :   tree blocks;
     342              :   /* The binding level containing this one (the enclosing binding level).  */
     343              :   struct binding_level *level_chain;
     344              :   /* True if nreverse has been already called on names; if false, names
     345              :      are ordered from newest declaration to oldest one.  */
     346              :   bool reversed;
     347              : };
     348              : 
     349              : /* The binding level currently in effect.  */
     350              : static GTY(()) struct binding_level *current_binding_level = NULL;
     351              : 
     352              : /* The outermost binding level. This binding level is created when the
     353              :    compiler is started and it will exist through the entire compilation.  */
     354              : static GTY(()) struct binding_level *global_binding_level;
     355              : 
     356              : /* Binding level structures are initialized by copying this one.  */
     357              : static struct binding_level clear_binding_level = { NULL, NULL, NULL, false };
     358              : 
     359              : 
     360              : /* Return true if we are in the global binding level.  */
     361              : 
     362              : bool
     363    153963463 : global_bindings_p (void)
     364              : {
     365        32917 :   return current_binding_level == global_binding_level;
     366              : }
     367              : 
     368              : tree
     369      5117487 : getdecls (void)
     370              : {
     371      5117487 :   if (!current_binding_level->reversed)
     372              :     {
     373      2577561 :       current_binding_level->reversed = true;
     374      2577561 :       current_binding_level->names = nreverse (current_binding_level->names);
     375              :     }
     376      5117487 :   return current_binding_level->names;
     377              : }
     378              : 
     379              : /* Enter a new binding level.  */
     380              : 
     381              : void
     382      2577589 : pushlevel (void)
     383              : {
     384      2577589 :   struct binding_level *newlevel = ggc_alloc<binding_level> ();
     385              : 
     386      2577589 :   *newlevel = clear_binding_level;
     387              : 
     388              :   /* Add this level to the front of the chain (stack) of levels that are
     389              :      active.  */
     390      2577589 :   newlevel->level_chain = current_binding_level;
     391      2577589 :   current_binding_level = newlevel;
     392      2577589 : }
     393              : 
     394              : /* Exit a binding level.
     395              :    Pop the level off, and restore the state of the identifier-decl mappings
     396              :    that were in effect when this level was entered.
     397              : 
     398              :    If KEEP is nonzero, this level had explicit declarations, so
     399              :    and create a "block" (a BLOCK node) for the level
     400              :    to record its declarations and subblocks for symbol table output.
     401              : 
     402              :    If FUNCTIONBODY is nonzero, this level is the body of a function,
     403              :    so create a block as if KEEP were set and also clear out all
     404              :    label names.  */
     405              : 
     406              : tree
     407      2544651 : poplevel (int keep, int functionbody)
     408              : {
     409              :   /* Points to a BLOCK tree node. This is the BLOCK node constructed for the
     410              :      binding level that we are about to exit and which is returned by this
     411              :      routine.  */
     412      2544651 :   tree block_node = NULL_TREE;
     413      2544651 :   tree decl_chain = getdecls ();
     414      2544651 :   tree subblock_chain = current_binding_level->blocks;
     415      2544651 :   tree subblock_node;
     416              : 
     417              :   /* If there were any declarations in the current binding level, or if this
     418              :      binding level is a function body, or if there are any nested blocks then
     419              :      create a BLOCK node to record them for the life of this function.  */
     420      2544651 :   if (keep || functionbody)
     421       757366 :     block_node = build_block (keep ? decl_chain : 0, subblock_chain, 0, 0);
     422              : 
     423              :   /* Record the BLOCK node just built as the subblock its enclosing scope.  */
     424      3621454 :   for (subblock_node = subblock_chain; subblock_node;
     425      1076803 :        subblock_node = BLOCK_CHAIN (subblock_node))
     426      1076803 :     BLOCK_SUPERCONTEXT (subblock_node) = block_node;
     427              : 
     428              :   /* Clear out the meanings of the local variables of this level.  */
     429              : 
     430      4674919 :   for (subblock_node = decl_chain; subblock_node;
     431      2130268 :        subblock_node = DECL_CHAIN (subblock_node))
     432      2130268 :     if (DECL_NAME (subblock_node) != 0)
     433              :       /* If the identifier was used or addressed via a local extern decl,
     434              :          don't forget that fact.  */
     435       973865 :       if (DECL_EXTERNAL (subblock_node))
     436              :         {
     437          290 :           if (TREE_USED (subblock_node))
     438           69 :             TREE_USED (DECL_NAME (subblock_node)) = 1;
     439          290 :           if (TREE_ADDRESSABLE (subblock_node))
     440           57 :             TREE_ADDRESSABLE (DECL_ASSEMBLER_NAME (subblock_node)) = 1;
     441              :         }
     442              : 
     443              :   /* Pop the current level.  */
     444      2544651 :   current_binding_level = current_binding_level->level_chain;
     445              : 
     446      2544651 :   if (functionbody)
     447              :     /* This is the top level block of a function.  */
     448       120723 :     DECL_INITIAL (current_function_decl) = block_node;
     449      2423928 :   else if (current_binding_level == global_binding_level)
     450              :     /* When using gfc_start_block/gfc_finish_block from middle-end hooks,
     451              :        don't add newly created BLOCKs as subblocks of global_binding_level.  */
     452              :     ;
     453      2419760 :   else if (block_node)
     454              :     {
     455       633578 :       current_binding_level->blocks
     456       633578 :         = block_chainon (current_binding_level->blocks, block_node);
     457              :     }
     458              : 
     459              :   /* If we did not make a block for the level just exited, any blocks made for
     460              :      inner levels (since they cannot be recorded as subblocks in that level)
     461              :      must be carried forward so they will later become subblocks of something
     462              :      else.  */
     463      1786182 :   else if (subblock_chain)
     464       212173 :     current_binding_level->blocks
     465       212173 :       = block_chainon (current_binding_level->blocks, subblock_chain);
     466      2544651 :   if (block_node)
     467       757366 :     TREE_USED (block_node) = 1;
     468              : 
     469      2544651 :   return block_node;
     470              : }
     471              : 
     472              : 
     473              : /* Records a ..._DECL node DECL as belonging to the current lexical scope.
     474              :    Returns the ..._DECL node.  */
     475              : 
     476              : tree
     477    153687174 : pushdecl (tree decl)
     478              : {
     479    153687174 :   if (global_bindings_p ())
     480    151556906 :     DECL_CONTEXT (decl) = current_translation_unit;
     481              :   else
     482              :     {
     483              :       /* External objects aren't nested.  For debug info insert a copy
     484              :          of the decl into the binding level.  */
     485      2130268 :       if (DECL_EXTERNAL (decl))
     486              :         {
     487          290 :           tree orig = decl;
     488          290 :           decl = copy_node (decl);
     489          290 :           DECL_CONTEXT (orig) = NULL_TREE;
     490              :         }
     491      2130268 :       DECL_CONTEXT (decl) = current_function_decl;
     492              :     }
     493              : 
     494              :   /* Put the declaration on the list.  */
     495    153687174 :   DECL_CHAIN (decl) = current_binding_level->names;
     496    153687174 :   current_binding_level->names = decl;
     497              : 
     498              :   /* For the declaration of a type, set its name if it is not already set.  */
     499              : 
     500    153687174 :   if (TREE_CODE (decl) == TYPE_DECL && TYPE_NAME (TREE_TYPE (decl)) == 0)
     501              :     {
     502       725108 :       if (DECL_SOURCE_LINE (decl) == 0)
     503       725108 :         TYPE_NAME (TREE_TYPE (decl)) = decl;
     504              :       else
     505            0 :         TYPE_NAME (TREE_TYPE (decl)) = DECL_NAME (decl);
     506              :     }
     507              : 
     508    153687174 :   return decl;
     509              : }
     510              : 
     511              : 
     512              : /* Like pushdecl, only it places X in GLOBAL_BINDING_LEVEL.  */
     513              : 
     514              : tree
     515        22328 : pushdecl_top_level (tree x)
     516              : {
     517        22328 :   tree t;
     518        22328 :   struct binding_level *b = current_binding_level;
     519              : 
     520        22328 :   current_binding_level = global_binding_level;
     521        22328 :   t = pushdecl (x);
     522        22328 :   current_binding_level = b;
     523        22328 :   return t;
     524              : }
     525              : 
     526              : #ifndef CHAR_TYPE_SIZE
     527              : #define CHAR_TYPE_SIZE BITS_PER_UNIT
     528              : #endif
     529              : 
     530              : #ifndef INT_TYPE_SIZE
     531              : #define INT_TYPE_SIZE BITS_PER_WORD
     532              : #endif
     533              : 
     534              : #undef SIZE_TYPE
     535              : #define SIZE_TYPE "long unsigned int"
     536              : 
     537              : /* Create tree nodes for the basic scalar types of Fortran 95,
     538              :    and some nodes representing standard constants (0, 1, (void *) 0).
     539              :    Initialize the global binding level.
     540              :    Make definitions for built-in primitive functions.  */
     541              : static void
     542        32938 : gfc_init_decl_processing (void)
     543              : {
     544        32938 :   current_function_decl = NULL;
     545        32938 :   current_binding_level = NULL_BINDING_LEVEL;
     546        32938 :   free_binding_level = NULL_BINDING_LEVEL;
     547              : 
     548              :   /* Make the binding_level structure for global names. We move all
     549              :      variables that are in a COMMON block to this binding level.  */
     550        32938 :   pushlevel ();
     551        32938 :   global_binding_level = current_binding_level;
     552              : 
     553              :   /* Build common tree nodes. char_type_node is unsigned because we
     554              :      only use it for actual characters, not for INTEGER(1).  */
     555        32938 :   build_common_tree_nodes (false);
     556              : 
     557              :   /* Set up F95 type nodes.  */
     558        32938 :   gfc_init_kinds ();
     559        32938 :   gfc_init_types ();
     560        32938 :   gfc_init_c_interop_kinds ();
     561        32938 : }
     562              : 
     563              : 
     564              : /* Builtin function initialization.  */
     565              : 
     566              : static tree
     567    145717648 : gfc_builtin_function (tree decl)
     568              : {
     569    145717648 :   pushdecl (decl);
     570    145717648 :   return decl;
     571              : }
     572              : 
     573              : /* So far we need just these 12 attribute types.  */
     574              : #define ATTR_NULL                       0
     575              : #define ATTR_LEAF_LIST                  (ECF_LEAF)
     576              : #define ATTR_NOTHROW_LEAF_LIST          (ECF_NOTHROW | ECF_LEAF)
     577              : #define ATTR_NOTHROW_LEAF_MALLOC_LIST   (ECF_NOTHROW | ECF_LEAF | ECF_MALLOC)
     578              : #define ATTR_CONST_NOTHROW_LEAF_LIST    (ECF_NOTHROW | ECF_LEAF | ECF_CONST)
     579              : #define ATTR_PURE_NOTHROW_LEAF_LIST     (ECF_NOTHROW | ECF_LEAF | ECF_PURE)
     580              : #define ATTR_NOTHROW_LIST               (ECF_NOTHROW)
     581              : #define ATTR_CONST_NOTHROW_LIST         (ECF_NOTHROW | ECF_CONST)
     582              : #define ATTR_ALLOC_WARN_UNUSED_RESULT_SIZE_2_NOTHROW_LIST \
     583              :                                         (ECF_NOTHROW | ECF_LEAF | ECF_MALLOC)
     584              : #define ATTR_ALLOC_WARN_UNUSED_RESULT_SIZE_2_NOTHROW_LEAF_LIST \
     585              :                                         (ECF_NOTHROW | ECF_LEAF)
     586              : #define ATTR_COLD_NORETURN_NOTHROW_LEAF_LIST \
     587              :                                         (ECF_COLD | ECF_NORETURN | \
     588              :                                          ECF_NOTHROW | ECF_LEAF)
     589              : #define ATTR_CALLBACK_ONLY_GOMP_LIST (ECF_CB_1_2 | ATTR_NOTHROW_LIST)
     590              : #define ATTR_PURE_NOTHROW_LIST (ECF_PURE | ECF_NOTHROW)
     591              : 
     592              : static void
     593     20710604 : gfc_define_builtin (const char *name, tree type, enum built_in_function code,
     594              :                     const char *library_name, int attr)
     595              : {
     596     20710604 :   tree decl;
     597              : 
     598     20710604 :   decl = add_builtin_function (name, type, code, BUILT_IN_NORMAL,
     599              :                                library_name, NULL_TREE);
     600     20710604 :   set_call_expr_flags (decl, attr);
     601              : 
     602     20710604 :   set_builtin_decl (code, decl, true);
     603     20710604 : }
     604              : 
     605              : 
     606              : #define DO_DEFINE_MATH_BUILTIN(code, name, argtype, tbase) \
     607              :     gfc_define_builtin ("__builtin_" name "l", tbase##longdouble[argtype], \
     608              :                         BUILT_IN_ ## code ## L, name "l", \
     609              :                         ATTR_CONST_NOTHROW_LEAF_LIST); \
     610              :     gfc_define_builtin ("__builtin_" name, tbase##double[argtype], \
     611              :                         BUILT_IN_ ## code, name, \
     612              :                         ATTR_CONST_NOTHROW_LEAF_LIST); \
     613              :     gfc_define_builtin ("__builtin_" name "f", tbase##float[argtype], \
     614              :                         BUILT_IN_ ## code ## F, name "f", \
     615              :                         ATTR_CONST_NOTHROW_LEAF_LIST);
     616              : 
     617              : #define DEFINE_MATH_BUILTIN(code, name, argtype) \
     618              :     DO_DEFINE_MATH_BUILTIN (code, name, argtype, mfunc_)
     619              : 
     620              : #define DEFINE_MATH_BUILTIN_C(code, name, argtype) \
     621              :     DO_DEFINE_MATH_BUILTIN (code, name, argtype, mfunc_) \
     622              :     DO_DEFINE_MATH_BUILTIN (C##code, "c" name, argtype, mfunc_c)
     623              : 
     624              : 
     625              : /* Create function types for builtin functions.  */
     626              : 
     627              : static void
     628       197526 : build_builtin_fntypes (tree *fntype, tree type)
     629              : {
     630              :   /* type (*) (type) */
     631       197526 :   fntype[0] = build_function_type_list (type, type, NULL_TREE);
     632              :   /* type (*) (type, type) */
     633       197526 :   fntype[1] = build_function_type_list (type, type, type, NULL_TREE);
     634              :   /* type (*) (type, int) */
     635       197526 :   fntype[2] = build_function_type_list (type,
     636              :                                         type, integer_type_node, NULL_TREE);
     637              :   /* type (*) (void) */
     638       197526 :   fntype[3] = build_function_type_list (type, NULL_TREE);
     639              :   /* type (*) (type, &int) */
     640       197526 :   fntype[4] = build_function_type_list (type, type,
     641              :                                         build_pointer_type (integer_type_node),
     642              :                                         NULL_TREE);
     643              :   /* type (*) (int, type) */
     644       197526 :   fntype[5] = build_function_type_list (type,
     645              :                                         integer_type_node, type, NULL_TREE);
     646       197526 : }
     647              : 
     648              : 
     649              : static tree
     650       164605 : builtin_type_for_size (int size, bool unsignedp)
     651              : {
     652       164605 :   tree type = gfc_type_for_size (size, unsignedp);
     653       164605 :   return type ? type : error_mark_node;
     654              : }
     655              : 
     656              : /* Initialization of builtin function nodes.  */
     657              : 
     658              : static void
     659        32921 : gfc_init_builtin_functions (void)
     660              : {
     661        32921 :   enum builtin_type
     662              :   {
     663              : #define DEF_PRIMITIVE_TYPE(NAME, VALUE) NAME,
     664              : #define DEF_FUNCTION_TYPE_0(NAME, RETURN) NAME,
     665              : #define DEF_FUNCTION_TYPE_1(NAME, RETURN, ARG1) NAME,
     666              : #define DEF_FUNCTION_TYPE_2(NAME, RETURN, ARG1, ARG2) NAME,
     667              : #define DEF_FUNCTION_TYPE_3(NAME, RETURN, ARG1, ARG2, ARG3) NAME,
     668              : #define DEF_FUNCTION_TYPE_4(NAME, RETURN, ARG1, ARG2, ARG3, ARG4) NAME,
     669              : #define DEF_FUNCTION_TYPE_5(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5) NAME,
     670              : #define DEF_FUNCTION_TYPE_6(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
     671              :                             ARG6) NAME,
     672              : #define DEF_FUNCTION_TYPE_7(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
     673              :                             ARG6, ARG7) NAME,
     674              : #define DEF_FUNCTION_TYPE_8(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
     675              :                             ARG6, ARG7, ARG8) NAME,
     676              : #define DEF_FUNCTION_TYPE_9(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
     677              :                             ARG6, ARG7, ARG8, ARG9) NAME,
     678              : #define DEF_FUNCTION_TYPE_10(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
     679              :                              ARG6, ARG7, ARG8, ARG9, ARG10) NAME,
     680              : #define DEF_FUNCTION_TYPE_11(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
     681              :                              ARG6, ARG7, ARG8, ARG9, ARG10, ARG11) NAME,
     682              : #define DEF_FUNCTION_TYPE_VAR_0(NAME, RETURN) NAME,
     683              : #define DEF_FUNCTION_TYPE_VAR_1(NAME, RETURN, ARG1) NAME,
     684              : #define DEF_FUNCTION_TYPE_VAR_2(NAME, RETURN, ARG1, ARG2) NAME,
     685              : #define DEF_FUNCTION_TYPE_VAR_6(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
     686              :                                  ARG6) NAME,
     687              : #define DEF_FUNCTION_TYPE_VAR_7(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
     688              :                                 ARG6, ARG7) NAME,
     689              : #define DEF_POINTER_TYPE(NAME, TYPE) NAME,
     690              : #include "types.def"
     691              : #undef DEF_PRIMITIVE_TYPE
     692              : #undef DEF_FUNCTION_TYPE_0
     693              : #undef DEF_FUNCTION_TYPE_1
     694              : #undef DEF_FUNCTION_TYPE_2
     695              : #undef DEF_FUNCTION_TYPE_3
     696              : #undef DEF_FUNCTION_TYPE_4
     697              : #undef DEF_FUNCTION_TYPE_5
     698              : #undef DEF_FUNCTION_TYPE_6
     699              : #undef DEF_FUNCTION_TYPE_7
     700              : #undef DEF_FUNCTION_TYPE_8
     701              : #undef DEF_FUNCTION_TYPE_9
     702              : #undef DEF_FUNCTION_TYPE_10
     703              : #undef DEF_FUNCTION_TYPE_11
     704              : #undef DEF_FUNCTION_TYPE_VAR_0
     705              : #undef DEF_FUNCTION_TYPE_VAR_1
     706              : #undef DEF_FUNCTION_TYPE_VAR_2
     707              : #undef DEF_FUNCTION_TYPE_VAR_6
     708              : #undef DEF_FUNCTION_TYPE_VAR_7
     709              : #undef DEF_POINTER_TYPE
     710              :     BT_LAST
     711              :   };
     712              : 
     713        32921 :   tree mfunc_float[6];
     714        32921 :   tree mfunc_double[6];
     715        32921 :   tree mfunc_longdouble[6];
     716        32921 :   tree mfunc_cfloat[6];
     717        32921 :   tree mfunc_cdouble[6];
     718        32921 :   tree mfunc_clongdouble[6];
     719        32921 :   tree func_cfloat_float, func_float_cfloat;
     720        32921 :   tree func_cdouble_double, func_double_cdouble;
     721        32921 :   tree func_clongdouble_longdouble, func_longdouble_clongdouble;
     722        32921 :   tree func_float_floatp_floatp;
     723        32921 :   tree func_double_doublep_doublep;
     724        32921 :   tree func_longdouble_longdoublep_longdoublep;
     725        32921 :   tree ftype, ptype;
     726        32921 :   tree builtin_types[(int) BT_LAST + 1];
     727              : 
     728        32921 :   int attr;
     729              : 
     730        32921 :   build_builtin_fntypes (mfunc_float, float_type_node);
     731        32921 :   build_builtin_fntypes (mfunc_double, double_type_node);
     732        32921 :   build_builtin_fntypes (mfunc_longdouble, long_double_type_node);
     733        32921 :   build_builtin_fntypes (mfunc_cfloat, complex_float_type_node);
     734        32921 :   build_builtin_fntypes (mfunc_cdouble, complex_double_type_node);
     735        32921 :   build_builtin_fntypes (mfunc_clongdouble, complex_long_double_type_node);
     736              : 
     737        32921 :   func_cfloat_float = build_function_type_list (float_type_node,
     738              :                                                 complex_float_type_node,
     739              :                                                 NULL_TREE);
     740              : 
     741        32921 :   func_float_cfloat = build_function_type_list (complex_float_type_node,
     742              :                                                 float_type_node, NULL_TREE);
     743              : 
     744        32921 :   func_cdouble_double = build_function_type_list (double_type_node,
     745              :                                                   complex_double_type_node,
     746              :                                                   NULL_TREE);
     747              : 
     748        32921 :   func_double_cdouble = build_function_type_list (complex_double_type_node,
     749              :                                                   double_type_node, NULL_TREE);
     750              : 
     751        32921 :   func_clongdouble_longdouble
     752        32921 :     = build_function_type_list (long_double_type_node,
     753              :                                 complex_long_double_type_node, NULL_TREE);
     754              : 
     755        32921 :   func_longdouble_clongdouble
     756        32921 :     = build_function_type_list (complex_long_double_type_node,
     757              :                                 long_double_type_node, NULL_TREE);
     758              : 
     759        32921 :   ptype = build_pointer_type (float_type_node);
     760        32921 :   func_float_floatp_floatp
     761        32921 :     = build_function_type_list (void_type_node, float_type_node, ptype, ptype,
     762              :                                 NULL_TREE);
     763              : 
     764        32921 :   ptype = build_pointer_type (double_type_node);
     765        32921 :   func_double_doublep_doublep
     766        32921 :     = build_function_type_list (void_type_node, double_type_node, ptype,
     767              :                                 ptype, NULL_TREE);
     768              : 
     769        32921 :   ptype = build_pointer_type (long_double_type_node);
     770        32921 :   func_longdouble_longdoublep_longdoublep
     771        32921 :     = build_function_type_list (void_type_node, long_double_type_node, ptype,
     772              :                                 ptype, NULL_TREE);
     773              : 
     774              : /* Non-math builtins are defined manually, so they're not included here.  */
     775              : #define OTHER_BUILTIN(ID,NAME,TYPE,CONST)
     776              : 
     777              : #include "mathbuiltins.def"
     778              : 
     779        32921 :   gfc_define_builtin ("__builtin_roundl", mfunc_longdouble[0],
     780              :                       BUILT_IN_ROUNDL, "roundl", ATTR_CONST_NOTHROW_LEAF_LIST);
     781        32921 :   gfc_define_builtin ("__builtin_round", mfunc_double[0],
     782              :                       BUILT_IN_ROUND, "round", ATTR_CONST_NOTHROW_LEAF_LIST);
     783        32921 :   gfc_define_builtin ("__builtin_roundf", mfunc_float[0],
     784              :                       BUILT_IN_ROUNDF, "roundf", ATTR_CONST_NOTHROW_LEAF_LIST);
     785              : 
     786        32921 :   gfc_define_builtin ("__builtin_truncl", mfunc_longdouble[0],
     787              :                       BUILT_IN_TRUNCL, "truncl", ATTR_CONST_NOTHROW_LEAF_LIST);
     788        32921 :   gfc_define_builtin ("__builtin_trunc", mfunc_double[0],
     789              :                       BUILT_IN_TRUNC, "trunc", ATTR_CONST_NOTHROW_LEAF_LIST);
     790        32921 :   gfc_define_builtin ("__builtin_truncf", mfunc_float[0],
     791              :                       BUILT_IN_TRUNCF, "truncf", ATTR_CONST_NOTHROW_LEAF_LIST);
     792              : 
     793        32921 :   gfc_define_builtin ("__builtin_cabsl", func_clongdouble_longdouble,
     794              :                       BUILT_IN_CABSL, "cabsl", ATTR_CONST_NOTHROW_LEAF_LIST);
     795        32921 :   gfc_define_builtin ("__builtin_cabs", func_cdouble_double,
     796              :                       BUILT_IN_CABS, "cabs", ATTR_CONST_NOTHROW_LEAF_LIST);
     797        32921 :   gfc_define_builtin ("__builtin_cabsf", func_cfloat_float,
     798              :                       BUILT_IN_CABSF, "cabsf", ATTR_CONST_NOTHROW_LEAF_LIST);
     799              : 
     800        32921 :   gfc_define_builtin ("__builtin_copysignl", mfunc_longdouble[1],
     801              :                       BUILT_IN_COPYSIGNL, "copysignl",
     802              :                       ATTR_CONST_NOTHROW_LEAF_LIST);
     803        32921 :   gfc_define_builtin ("__builtin_copysign", mfunc_double[1],
     804              :                       BUILT_IN_COPYSIGN, "copysign",
     805              :                       ATTR_CONST_NOTHROW_LEAF_LIST);
     806        32921 :   gfc_define_builtin ("__builtin_copysignf", mfunc_float[1],
     807              :                       BUILT_IN_COPYSIGNF, "copysignf",
     808              :                       ATTR_CONST_NOTHROW_LEAF_LIST);
     809              : 
     810        32921 :   gfc_define_builtin ("__builtin_nextafterl", mfunc_longdouble[1],
     811              :                       BUILT_IN_NEXTAFTERL, "nextafterl",
     812              :                       ATTR_CONST_NOTHROW_LEAF_LIST);
     813        32921 :   gfc_define_builtin ("__builtin_nextafter", mfunc_double[1],
     814              :                       BUILT_IN_NEXTAFTER, "nextafter",
     815              :                       ATTR_CONST_NOTHROW_LEAF_LIST);
     816        32921 :   gfc_define_builtin ("__builtin_nextafterf", mfunc_float[1],
     817              :                       BUILT_IN_NEXTAFTERF, "nextafterf",
     818              :                       ATTR_CONST_NOTHROW_LEAF_LIST);
     819              : 
     820              :   /* Some built-ins depend on rounding mode. Depending on compilation options, they
     821              :      will be "pure" or "const".  */
     822        32921 :   attr = flag_rounding_math ? ATTR_PURE_NOTHROW_LEAF_LIST : ATTR_CONST_NOTHROW_LEAF_LIST;
     823              : 
     824        32921 :   gfc_define_builtin ("__builtin_rintl", mfunc_longdouble[0],
     825              :                       BUILT_IN_RINTL, "rintl", attr);
     826        32921 :   gfc_define_builtin ("__builtin_rint", mfunc_double[0],
     827              :                       BUILT_IN_RINT, "rint", attr);
     828        32921 :   gfc_define_builtin ("__builtin_rintf", mfunc_float[0],
     829              :                       BUILT_IN_RINTF, "rintf", attr);
     830              : 
     831        32921 :   gfc_define_builtin ("__builtin_remainderl", mfunc_longdouble[1],
     832              :                       BUILT_IN_REMAINDERL, "remainderl", attr);
     833        32921 :   gfc_define_builtin ("__builtin_remainder", mfunc_double[1],
     834              :                       BUILT_IN_REMAINDER, "remainder", attr);
     835        32921 :   gfc_define_builtin ("__builtin_remainderf", mfunc_float[1],
     836              :                       BUILT_IN_REMAINDERF, "remainderf", attr);
     837              : 
     838        32921 :   gfc_define_builtin ("__builtin_logbl", mfunc_longdouble[0],
     839              :                       BUILT_IN_LOGBL, "logbl", ATTR_CONST_NOTHROW_LEAF_LIST);
     840        32921 :   gfc_define_builtin ("__builtin_logb", mfunc_double[0],
     841              :                       BUILT_IN_LOGB, "logb", ATTR_CONST_NOTHROW_LEAF_LIST);
     842        32921 :   gfc_define_builtin ("__builtin_logbf", mfunc_float[0],
     843              :                       BUILT_IN_LOGBF, "logbf", ATTR_CONST_NOTHROW_LEAF_LIST);
     844              : 
     845              : 
     846        32921 :   gfc_define_builtin ("__builtin_frexpl", mfunc_longdouble[4],
     847              :                       BUILT_IN_FREXPL, "frexpl", ATTR_NOTHROW_LEAF_LIST);
     848        32921 :   gfc_define_builtin ("__builtin_frexp", mfunc_double[4],
     849              :                       BUILT_IN_FREXP, "frexp", ATTR_NOTHROW_LEAF_LIST);
     850        32921 :   gfc_define_builtin ("__builtin_frexpf", mfunc_float[4],
     851              :                       BUILT_IN_FREXPF, "frexpf", ATTR_NOTHROW_LEAF_LIST);
     852              : 
     853        32921 :   gfc_define_builtin ("__builtin_fabsl", mfunc_longdouble[0],
     854              :                       BUILT_IN_FABSL, "fabsl", ATTR_CONST_NOTHROW_LEAF_LIST);
     855        32921 :   gfc_define_builtin ("__builtin_fabs", mfunc_double[0],
     856              :                       BUILT_IN_FABS, "fabs", ATTR_CONST_NOTHROW_LEAF_LIST);
     857        32921 :   gfc_define_builtin ("__builtin_fabsf", mfunc_float[0],
     858              :                       BUILT_IN_FABSF, "fabsf", ATTR_CONST_NOTHROW_LEAF_LIST);
     859              : 
     860        32921 :   gfc_define_builtin ("__builtin_scalbnl", mfunc_longdouble[2],
     861              :                       BUILT_IN_SCALBNL, "scalbnl", ATTR_CONST_NOTHROW_LEAF_LIST);
     862        32921 :   gfc_define_builtin ("__builtin_scalbn", mfunc_double[2],
     863              :                       BUILT_IN_SCALBN, "scalbn", ATTR_CONST_NOTHROW_LEAF_LIST);
     864        32921 :   gfc_define_builtin ("__builtin_scalbnf", mfunc_float[2],
     865              :                       BUILT_IN_SCALBNF, "scalbnf", ATTR_CONST_NOTHROW_LEAF_LIST);
     866              : 
     867        32921 :   gfc_define_builtin ("__builtin_fmaxl", mfunc_longdouble[1],
     868              :                       BUILT_IN_FMAXL, "fmaxl", ATTR_CONST_NOTHROW_LEAF_LIST);
     869        32921 :   gfc_define_builtin ("__builtin_fmax", mfunc_double[1],
     870              :                       BUILT_IN_FMAX, "fmax", ATTR_CONST_NOTHROW_LEAF_LIST);
     871        32921 :   gfc_define_builtin ("__builtin_fmaxf", mfunc_float[1],
     872              :                       BUILT_IN_FMAXF, "fmaxf", ATTR_CONST_NOTHROW_LEAF_LIST);
     873              : 
     874        32921 :   gfc_define_builtin ("__builtin_fminl", mfunc_longdouble[1],
     875              :                       BUILT_IN_FMINL, "fminl", ATTR_CONST_NOTHROW_LEAF_LIST);
     876        32921 :   gfc_define_builtin ("__builtin_fmin", mfunc_double[1],
     877              :                       BUILT_IN_FMIN, "fmin", ATTR_CONST_NOTHROW_LEAF_LIST);
     878        32921 :   gfc_define_builtin ("__builtin_fminf", mfunc_float[1],
     879              :                       BUILT_IN_FMINF, "fminf", ATTR_CONST_NOTHROW_LEAF_LIST);
     880              : 
     881        32921 :   gfc_define_builtin ("__builtin_fmodl", mfunc_longdouble[1],
     882              :                       BUILT_IN_FMODL, "fmodl", ATTR_CONST_NOTHROW_LEAF_LIST);
     883        32921 :   gfc_define_builtin ("__builtin_fmod", mfunc_double[1],
     884              :                       BUILT_IN_FMOD, "fmod", ATTR_CONST_NOTHROW_LEAF_LIST);
     885        32921 :   gfc_define_builtin ("__builtin_fmodf", mfunc_float[1],
     886              :                       BUILT_IN_FMODF, "fmodf", ATTR_CONST_NOTHROW_LEAF_LIST);
     887              : 
     888              :   /* iround{f,,l}, lround{f,,l} and llround{f,,l} */
     889        32921 :   ftype = build_function_type_list (integer_type_node,
     890              :                                     float_type_node, NULL_TREE);
     891        32921 :   gfc_define_builtin("__builtin_iroundf", ftype, BUILT_IN_IROUNDF,
     892              :                      "iroundf", ATTR_CONST_NOTHROW_LEAF_LIST);
     893        32921 :   ftype = build_function_type_list (long_integer_type_node,
     894              :                                     float_type_node, NULL_TREE);
     895        32921 :   gfc_define_builtin ("__builtin_lroundf", ftype, BUILT_IN_LROUNDF,
     896              :                       "lroundf", ATTR_CONST_NOTHROW_LEAF_LIST);
     897        32921 :   ftype = build_function_type_list (long_long_integer_type_node,
     898              :                                     float_type_node, NULL_TREE);
     899        32921 :   gfc_define_builtin ("__builtin_llroundf", ftype, BUILT_IN_LLROUNDF,
     900              :                       "llroundf", ATTR_CONST_NOTHROW_LEAF_LIST);
     901              : 
     902        32921 :   ftype = build_function_type_list (integer_type_node,
     903              :                                     double_type_node, NULL_TREE);
     904        32921 :   gfc_define_builtin("__builtin_iround", ftype, BUILT_IN_IROUND,
     905              :                      "iround", ATTR_CONST_NOTHROW_LEAF_LIST);
     906        32921 :   ftype = build_function_type_list (long_integer_type_node,
     907              :                                     double_type_node, NULL_TREE);
     908        32921 :   gfc_define_builtin ("__builtin_lround", ftype, BUILT_IN_LROUND,
     909              :                       "lround", ATTR_CONST_NOTHROW_LEAF_LIST);
     910        32921 :   ftype = build_function_type_list (long_long_integer_type_node,
     911              :                                     double_type_node, NULL_TREE);
     912        32921 :   gfc_define_builtin ("__builtin_llround", ftype, BUILT_IN_LLROUND,
     913              :                       "llround", ATTR_CONST_NOTHROW_LEAF_LIST);
     914              : 
     915        32921 :   ftype = build_function_type_list (integer_type_node,
     916              :                                     long_double_type_node, NULL_TREE);
     917        32921 :   gfc_define_builtin("__builtin_iroundl", ftype, BUILT_IN_IROUNDL,
     918              :                      "iroundl", ATTR_CONST_NOTHROW_LEAF_LIST);
     919        32921 :   ftype = build_function_type_list (long_integer_type_node,
     920              :                                     long_double_type_node, NULL_TREE);
     921        32921 :   gfc_define_builtin ("__builtin_lroundl", ftype, BUILT_IN_LROUNDL,
     922              :                       "lroundl", ATTR_CONST_NOTHROW_LEAF_LIST);
     923        32921 :   ftype = build_function_type_list (long_long_integer_type_node,
     924              :                                     long_double_type_node, NULL_TREE);
     925        32921 :   gfc_define_builtin ("__builtin_llroundl", ftype, BUILT_IN_LLROUNDL,
     926              :                       "llroundl", ATTR_CONST_NOTHROW_LEAF_LIST);
     927              : 
     928              :   /* These are used to implement the ** operator.  */
     929        32921 :   gfc_define_builtin ("__builtin_powl", mfunc_longdouble[1],
     930              :                       BUILT_IN_POWL, "powl", ATTR_CONST_NOTHROW_LEAF_LIST);
     931        32921 :   gfc_define_builtin ("__builtin_pow", mfunc_double[1],
     932              :                       BUILT_IN_POW, "pow", ATTR_CONST_NOTHROW_LEAF_LIST);
     933        32921 :   gfc_define_builtin ("__builtin_powf", mfunc_float[1],
     934              :                       BUILT_IN_POWF, "powf", ATTR_CONST_NOTHROW_LEAF_LIST);
     935        32921 :   gfc_define_builtin ("__builtin_cpowl", mfunc_clongdouble[1],
     936              :                       BUILT_IN_CPOWL, "cpowl", ATTR_CONST_NOTHROW_LEAF_LIST);
     937        32921 :   gfc_define_builtin ("__builtin_cpow", mfunc_cdouble[1],
     938              :                       BUILT_IN_CPOW, "cpow", ATTR_CONST_NOTHROW_LEAF_LIST);
     939        32921 :   gfc_define_builtin ("__builtin_cpowf", mfunc_cfloat[1],
     940              :                       BUILT_IN_CPOWF, "cpowf", ATTR_CONST_NOTHROW_LEAF_LIST);
     941        32921 :   gfc_define_builtin ("__builtin_powil", mfunc_longdouble[2],
     942              :                       BUILT_IN_POWIL, "powil", ATTR_CONST_NOTHROW_LEAF_LIST);
     943        32921 :   gfc_define_builtin ("__builtin_powi", mfunc_double[2],
     944              :                       BUILT_IN_POWI, "powi", ATTR_CONST_NOTHROW_LEAF_LIST);
     945        32921 :   gfc_define_builtin ("__builtin_powif", mfunc_float[2],
     946              :                       BUILT_IN_POWIF, "powif", ATTR_CONST_NOTHROW_LEAF_LIST);
     947              : 
     948              : 
     949        32921 :   if (targetm.libc_has_function (function_c99_math_complex, NULL_TREE))
     950              :     {
     951        32921 :       gfc_define_builtin ("__builtin_cbrtl", mfunc_longdouble[0],
     952              :                           BUILT_IN_CBRTL, "cbrtl",
     953              :                           ATTR_CONST_NOTHROW_LEAF_LIST);
     954        32921 :       gfc_define_builtin ("__builtin_cbrt", mfunc_double[0],
     955              :                           BUILT_IN_CBRT, "cbrt",
     956              :                           ATTR_CONST_NOTHROW_LEAF_LIST);
     957        32921 :       gfc_define_builtin ("__builtin_cbrtf", mfunc_float[0],
     958              :                           BUILT_IN_CBRTF, "cbrtf",
     959              :                           ATTR_CONST_NOTHROW_LEAF_LIST);
     960        32921 :       gfc_define_builtin ("__builtin_cexpil", func_longdouble_clongdouble,
     961              :                           BUILT_IN_CEXPIL, "cexpil",
     962              :                           ATTR_CONST_NOTHROW_LEAF_LIST);
     963        32921 :       gfc_define_builtin ("__builtin_cexpi", func_double_cdouble,
     964              :                           BUILT_IN_CEXPI, "cexpi",
     965              :                           ATTR_CONST_NOTHROW_LEAF_LIST);
     966        32921 :       gfc_define_builtin ("__builtin_cexpif", func_float_cfloat,
     967              :                           BUILT_IN_CEXPIF, "cexpif",
     968              :                           ATTR_CONST_NOTHROW_LEAF_LIST);
     969              :     }
     970              : 
     971        32921 :   if (targetm.libc_has_function (function_sincos, NULL_TREE))
     972              :     {
     973        32921 :       gfc_define_builtin ("__builtin_sincosl",
     974              :                           func_longdouble_longdoublep_longdoublep,
     975              :                           BUILT_IN_SINCOSL, "sincosl", ATTR_NOTHROW_LEAF_LIST);
     976        32921 :       gfc_define_builtin ("__builtin_sincos", func_double_doublep_doublep,
     977              :                           BUILT_IN_SINCOS, "sincos", ATTR_NOTHROW_LEAF_LIST);
     978        32921 :       gfc_define_builtin ("__builtin_sincosf", func_float_floatp_floatp,
     979              :                           BUILT_IN_SINCOSF, "sincosf", ATTR_NOTHROW_LEAF_LIST);
     980              :     }
     981              : 
     982              :   /* For LEADZ, TRAILZ, POPCNT and POPPAR.  */
     983        32921 :   ftype = build_function_type_list (integer_type_node,
     984              :                                     unsigned_type_node, NULL_TREE);
     985        32921 :   gfc_define_builtin ("__builtin_clz", ftype, BUILT_IN_CLZ,
     986              :                       "__builtin_clz", ATTR_CONST_NOTHROW_LEAF_LIST);
     987        32921 :   gfc_define_builtin ("__builtin_ctz", ftype, BUILT_IN_CTZ,
     988              :                       "__builtin_ctz", ATTR_CONST_NOTHROW_LEAF_LIST);
     989        32921 :   gfc_define_builtin ("__builtin_parity", ftype, BUILT_IN_PARITY,
     990              :                       "__builtin_parity", ATTR_CONST_NOTHROW_LEAF_LIST);
     991        32921 :   gfc_define_builtin ("__builtin_popcount", ftype, BUILT_IN_POPCOUNT,
     992              :                       "__builtin_popcount", ATTR_CONST_NOTHROW_LEAF_LIST);
     993              : 
     994        32921 :   ftype = build_function_type_list (integer_type_node,
     995              :                                     long_unsigned_type_node, NULL_TREE);
     996        32921 :   gfc_define_builtin ("__builtin_clzl", ftype, BUILT_IN_CLZL,
     997              :                       "__builtin_clzl", ATTR_CONST_NOTHROW_LEAF_LIST);
     998        32921 :   gfc_define_builtin ("__builtin_ctzl", ftype, BUILT_IN_CTZL,
     999              :                       "__builtin_ctzl", ATTR_CONST_NOTHROW_LEAF_LIST);
    1000        32921 :   gfc_define_builtin ("__builtin_parityl", ftype, BUILT_IN_PARITYL,
    1001              :                       "__builtin_parityl", ATTR_CONST_NOTHROW_LEAF_LIST);
    1002        32921 :   gfc_define_builtin ("__builtin_popcountl", ftype, BUILT_IN_POPCOUNTL,
    1003              :                       "__builtin_popcountl", ATTR_CONST_NOTHROW_LEAF_LIST);
    1004              : 
    1005        32921 :   ftype = build_function_type_list (integer_type_node,
    1006              :                                     long_long_unsigned_type_node, NULL_TREE);
    1007        32921 :   gfc_define_builtin ("__builtin_clzll", ftype, BUILT_IN_CLZLL,
    1008              :                       "__builtin_clzll", ATTR_CONST_NOTHROW_LEAF_LIST);
    1009        32921 :   gfc_define_builtin ("__builtin_ctzll", ftype, BUILT_IN_CTZLL,
    1010              :                       "__builtin_ctzll", ATTR_CONST_NOTHROW_LEAF_LIST);
    1011        32921 :   gfc_define_builtin ("__builtin_parityll", ftype, BUILT_IN_PARITYLL,
    1012              :                       "__builtin_parityll", ATTR_CONST_NOTHROW_LEAF_LIST);
    1013        32921 :   gfc_define_builtin ("__builtin_popcountll", ftype, BUILT_IN_POPCOUNTLL,
    1014              :                       "__builtin_popcountll", ATTR_CONST_NOTHROW_LEAF_LIST);
    1015              : 
    1016              :   /* Other builtin functions we use.  */
    1017              : 
    1018        32921 :   ftype = build_function_type_list (long_integer_type_node,
    1019              :                                     long_integer_type_node,
    1020              :                                     long_integer_type_node, NULL_TREE);
    1021        32921 :   gfc_define_builtin ("__builtin_expect", ftype, BUILT_IN_EXPECT,
    1022              :                       "__builtin_expect", ATTR_CONST_NOTHROW_LEAF_LIST);
    1023              : 
    1024        32921 :   ftype = build_function_type_list (void_type_node,
    1025              :                                     pvoid_type_node, NULL_TREE);
    1026        32921 :   gfc_define_builtin ("__builtin_free", ftype, BUILT_IN_FREE,
    1027              :                       "free", ATTR_NOTHROW_LEAF_LIST);
    1028              : 
    1029        32921 :   ftype = build_function_type_list (pvoid_type_node,
    1030              :                                     size_type_node, NULL_TREE);
    1031        32921 :   gfc_define_builtin ("__builtin_malloc", ftype, BUILT_IN_MALLOC,
    1032              :                       "malloc", ATTR_NOTHROW_LEAF_MALLOC_LIST);
    1033              : 
    1034        32921 :   ftype = build_function_type_list (pvoid_type_node, size_type_node,
    1035              :                                     size_type_node, NULL_TREE);
    1036        32921 :   gfc_define_builtin ("__builtin_calloc", ftype, BUILT_IN_CALLOC,
    1037              :                       "calloc", ATTR_NOTHROW_LEAF_MALLOC_LIST);
    1038        32921 :   DECL_IS_MALLOC (builtin_decl_explicit (BUILT_IN_CALLOC)) = 1;
    1039              : 
    1040        32921 :   ftype = build_function_type_list (pvoid_type_node, pvoid_type_node,
    1041              :                                     size_type_node, NULL_TREE);
    1042        32921 :   gfc_define_builtin ("__builtin_realloc", ftype, BUILT_IN_REALLOC,
    1043              :                       "realloc", ATTR_NOTHROW_LEAF_LIST);
    1044              : 
    1045        32921 :   ftype = build_function_type_list (size_type_node, pchar_type_node,
    1046              :                                     size_type_node, NULL_TREE);
    1047        32921 :   gfc_define_builtin ("__builtin_strnlen", ftype, BUILT_IN_STRNLEN,
    1048              :                       "strnlen", ATTR_PURE_NOTHROW_LEAF_LIST);
    1049              : 
    1050              :   /* Type-generic floating-point classification built-ins.  */
    1051              : 
    1052        32921 :   ftype = build_function_type (integer_type_node, NULL_TREE);
    1053        32921 :   gfc_define_builtin ("__builtin_isfinite", ftype, BUILT_IN_ISFINITE,
    1054              :                       "__builtin_isfinite", ATTR_CONST_NOTHROW_LEAF_LIST);
    1055        32921 :   gfc_define_builtin ("__builtin_isinf", ftype, BUILT_IN_ISINF,
    1056              :                       "__builtin_isinf", ATTR_CONST_NOTHROW_LEAF_LIST);
    1057        32921 :   gfc_define_builtin ("__builtin_isinf_sign", ftype, BUILT_IN_ISINF_SIGN,
    1058              :                       "__builtin_isinf_sign", ATTR_CONST_NOTHROW_LEAF_LIST);
    1059        32921 :   gfc_define_builtin ("__builtin_isnan", ftype, BUILT_IN_ISNAN,
    1060              :                       "__builtin_isnan", ATTR_CONST_NOTHROW_LEAF_LIST);
    1061        32921 :   gfc_define_builtin ("__builtin_isnormal", ftype, BUILT_IN_ISNORMAL,
    1062              :                       "__builtin_isnormal", ATTR_CONST_NOTHROW_LEAF_LIST);
    1063        32921 :   gfc_define_builtin ("__builtin_issignaling", ftype, BUILT_IN_ISSIGNALING,
    1064              :                       "__builtin_issignaling", ATTR_CONST_NOTHROW_LEAF_LIST);
    1065        32921 :   gfc_define_builtin ("__builtin_signbit", ftype, BUILT_IN_SIGNBIT,
    1066              :                       "__builtin_signbit", ATTR_CONST_NOTHROW_LEAF_LIST);
    1067        32921 :   gfc_define_builtin ("__builtin_fpclassify", ftype, BUILT_IN_FPCLASSIFY,
    1068              :                       "__builtin_fpclassify", ATTR_CONST_NOTHROW_LEAF_LIST);
    1069              : 
    1070        32921 :   gfc_define_builtin ("__builtin_isless", ftype, BUILT_IN_ISLESS,
    1071              :                       "__builtin_isless", ATTR_CONST_NOTHROW_LEAF_LIST);
    1072        32921 :   gfc_define_builtin ("__builtin_islessequal", ftype, BUILT_IN_ISLESSEQUAL,
    1073              :                       "__builtin_islessequal", ATTR_CONST_NOTHROW_LEAF_LIST);
    1074        32921 :   gfc_define_builtin ("__builtin_islessgreater", ftype, BUILT_IN_ISLESSGREATER,
    1075              :                       "__builtin_islessgreater", ATTR_CONST_NOTHROW_LEAF_LIST);
    1076        32921 :   gfc_define_builtin ("__builtin_isgreater", ftype, BUILT_IN_ISGREATER,
    1077              :                       "__builtin_isgreater", ATTR_CONST_NOTHROW_LEAF_LIST);
    1078        32921 :   gfc_define_builtin ("__builtin_isgreaterequal", ftype,
    1079              :                       BUILT_IN_ISGREATEREQUAL, "__builtin_isgreaterequal",
    1080              :                       ATTR_CONST_NOTHROW_LEAF_LIST);
    1081        32921 :   gfc_define_builtin ("__builtin_isunordered", ftype, BUILT_IN_ISUNORDERED,
    1082              :                       "__builtin_isunordered", ATTR_CONST_NOTHROW_LEAF_LIST);
    1083        32921 :   gfc_define_builtin ("__builtin_iseqsig", ftype, BUILT_IN_ISEQSIG,
    1084              :                       "__builtin_iseqsig", ATTR_CONST_NOTHROW_LEAF_LIST);
    1085              : 
    1086              : 
    1087              : #define DEF_PRIMITIVE_TYPE(ENUM, VALUE) \
    1088              :   builtin_types[(int) ENUM] = VALUE;
    1089              : #define DEF_FUNCTION_TYPE_0(ENUM, RETURN)                       \
    1090              :   builtin_types[(int) ENUM]                                     \
    1091              :     = build_function_type_list (builtin_types[(int) RETURN],    \
    1092              :                                 NULL_TREE);
    1093              : #define DEF_FUNCTION_TYPE_1(ENUM, RETURN, ARG1)                         \
    1094              :   builtin_types[(int) ENUM]                                             \
    1095              :     = build_function_type_list (builtin_types[(int) RETURN],            \
    1096              :                                 builtin_types[(int) ARG1],              \
    1097              :                                 NULL_TREE);
    1098              : #define DEF_FUNCTION_TYPE_2(ENUM, RETURN, ARG1, ARG2)           \
    1099              :   builtin_types[(int) ENUM]                                     \
    1100              :     = build_function_type_list (builtin_types[(int) RETURN],    \
    1101              :                                 builtin_types[(int) ARG1],      \
    1102              :                                 builtin_types[(int) ARG2],      \
    1103              :                                 NULL_TREE);
    1104              : #define DEF_FUNCTION_TYPE_3(ENUM, RETURN, ARG1, ARG2, ARG3)             \
    1105              :   builtin_types[(int) ENUM]                                             \
    1106              :     = build_function_type_list (builtin_types[(int) RETURN],            \
    1107              :                                 builtin_types[(int) ARG1],              \
    1108              :                                 builtin_types[(int) ARG2],              \
    1109              :                                 builtin_types[(int) ARG3],              \
    1110              :                                 NULL_TREE);
    1111              : #define DEF_FUNCTION_TYPE_4(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4)       \
    1112              :   builtin_types[(int) ENUM]                                             \
    1113              :     = build_function_type_list (builtin_types[(int) RETURN],            \
    1114              :                                 builtin_types[(int) ARG1],              \
    1115              :                                 builtin_types[(int) ARG2],              \
    1116              :                                 builtin_types[(int) ARG3],              \
    1117              :                                 builtin_types[(int) ARG4],              \
    1118              :                                 NULL_TREE);
    1119              : #define DEF_FUNCTION_TYPE_5(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5) \
    1120              :   builtin_types[(int) ENUM]                                             \
    1121              :     = build_function_type_list (builtin_types[(int) RETURN],            \
    1122              :                                 builtin_types[(int) ARG1],              \
    1123              :                                 builtin_types[(int) ARG2],              \
    1124              :                                 builtin_types[(int) ARG3],              \
    1125              :                                 builtin_types[(int) ARG4],              \
    1126              :                                 builtin_types[(int) ARG5],              \
    1127              :                                 NULL_TREE);
    1128              : #define DEF_FUNCTION_TYPE_6(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
    1129              :                             ARG6)                                       \
    1130              :   builtin_types[(int) ENUM]                                             \
    1131              :     = build_function_type_list (builtin_types[(int) RETURN],            \
    1132              :                                 builtin_types[(int) ARG1],              \
    1133              :                                 builtin_types[(int) ARG2],              \
    1134              :                                 builtin_types[(int) ARG3],              \
    1135              :                                 builtin_types[(int) ARG4],              \
    1136              :                                 builtin_types[(int) ARG5],              \
    1137              :                                 builtin_types[(int) ARG6],              \
    1138              :                                 NULL_TREE);
    1139              : #define DEF_FUNCTION_TYPE_7(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
    1140              :                             ARG6, ARG7)                                 \
    1141              :   builtin_types[(int) ENUM]                                             \
    1142              :     = build_function_type_list (builtin_types[(int) RETURN],            \
    1143              :                                 builtin_types[(int) ARG1],              \
    1144              :                                 builtin_types[(int) ARG2],              \
    1145              :                                 builtin_types[(int) ARG3],              \
    1146              :                                 builtin_types[(int) ARG4],              \
    1147              :                                 builtin_types[(int) ARG5],              \
    1148              :                                 builtin_types[(int) ARG6],              \
    1149              :                                 builtin_types[(int) ARG7],              \
    1150              :                                 NULL_TREE);
    1151              : #define DEF_FUNCTION_TYPE_8(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
    1152              :                             ARG6, ARG7, ARG8)                           \
    1153              :   builtin_types[(int) ENUM]                                             \
    1154              :     = build_function_type_list (builtin_types[(int) RETURN],            \
    1155              :                                 builtin_types[(int) ARG1],              \
    1156              :                                 builtin_types[(int) ARG2],              \
    1157              :                                 builtin_types[(int) ARG3],              \
    1158              :                                 builtin_types[(int) ARG4],              \
    1159              :                                 builtin_types[(int) ARG5],              \
    1160              :                                 builtin_types[(int) ARG6],              \
    1161              :                                 builtin_types[(int) ARG7],              \
    1162              :                                 builtin_types[(int) ARG8],              \
    1163              :                                 NULL_TREE);
    1164              : #define DEF_FUNCTION_TYPE_9(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
    1165              :                             ARG6, ARG7, ARG8, ARG9)                     \
    1166              :   builtin_types[(int) ENUM]                                             \
    1167              :     = build_function_type_list (builtin_types[(int) RETURN],            \
    1168              :                                 builtin_types[(int) ARG1],              \
    1169              :                                 builtin_types[(int) ARG2],              \
    1170              :                                 builtin_types[(int) ARG3],              \
    1171              :                                 builtin_types[(int) ARG4],              \
    1172              :                                 builtin_types[(int) ARG5],              \
    1173              :                                 builtin_types[(int) ARG6],              \
    1174              :                                 builtin_types[(int) ARG7],              \
    1175              :                                 builtin_types[(int) ARG8],              \
    1176              :                                 builtin_types[(int) ARG9],              \
    1177              :                                 NULL_TREE);
    1178              : #define DEF_FUNCTION_TYPE_10(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4,      \
    1179              :                              ARG5, ARG6, ARG7, ARG8, ARG9, ARG10)       \
    1180              :   builtin_types[(int) ENUM]                                             \
    1181              :     = build_function_type_list (builtin_types[(int) RETURN],            \
    1182              :                                 builtin_types[(int) ARG1],              \
    1183              :                                 builtin_types[(int) ARG2],              \
    1184              :                                 builtin_types[(int) ARG3],              \
    1185              :                                 builtin_types[(int) ARG4],              \
    1186              :                                 builtin_types[(int) ARG5],              \
    1187              :                                 builtin_types[(int) ARG6],              \
    1188              :                                 builtin_types[(int) ARG7],              \
    1189              :                                 builtin_types[(int) ARG8],              \
    1190              :                                 builtin_types[(int) ARG9],              \
    1191              :                                 builtin_types[(int) ARG10],             \
    1192              :                                 NULL_TREE);
    1193              : #define DEF_FUNCTION_TYPE_11(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4,      \
    1194              :                              ARG5, ARG6, ARG7, ARG8, ARG9, ARG10, ARG11)\
    1195              :   builtin_types[(int) ENUM]                                             \
    1196              :     = build_function_type_list (builtin_types[(int) RETURN],            \
    1197              :                                 builtin_types[(int) ARG1],              \
    1198              :                                 builtin_types[(int) ARG2],              \
    1199              :                                 builtin_types[(int) ARG3],              \
    1200              :                                 builtin_types[(int) ARG4],              \
    1201              :                                 builtin_types[(int) ARG5],              \
    1202              :                                 builtin_types[(int) ARG6],              \
    1203              :                                 builtin_types[(int) ARG7],              \
    1204              :                                 builtin_types[(int) ARG8],              \
    1205              :                                 builtin_types[(int) ARG9],              \
    1206              :                                 builtin_types[(int) ARG10],             \
    1207              :                                 builtin_types[(int) ARG11],             \
    1208              :                                 NULL_TREE);
    1209              : #define DEF_FUNCTION_TYPE_VAR_0(ENUM, RETURN)                           \
    1210              :   builtin_types[(int) ENUM]                                             \
    1211              :     = build_varargs_function_type_list (builtin_types[(int) RETURN],    \
    1212              :                                         NULL_TREE);
    1213              : #define DEF_FUNCTION_TYPE_VAR_1(ENUM, RETURN, ARG1)                     \
    1214              :   builtin_types[(int) ENUM]                                             \
    1215              :     = build_varargs_function_type_list (builtin_types[(int) RETURN],    \
    1216              :                                         builtin_types[(int) ARG1],      \
    1217              :                                         NULL_TREE);
    1218              : #define DEF_FUNCTION_TYPE_VAR_2(ENUM, RETURN, ARG1, ARG2)               \
    1219              :   builtin_types[(int) ENUM]                                             \
    1220              :     = build_varargs_function_type_list (builtin_types[(int) RETURN],    \
    1221              :                                         builtin_types[(int) ARG1],      \
    1222              :                                         builtin_types[(int) ARG2],      \
    1223              :                                         NULL_TREE);
    1224              : #define DEF_FUNCTION_TYPE_VAR_6(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
    1225              :                                 ARG6)   \
    1226              :   builtin_types[(int) ENUM]                                             \
    1227              :     = build_varargs_function_type_list (builtin_types[(int) RETURN],    \
    1228              :                                         builtin_types[(int) ARG1],      \
    1229              :                                         builtin_types[(int) ARG2],      \
    1230              :                                         builtin_types[(int) ARG3],      \
    1231              :                                         builtin_types[(int) ARG4],      \
    1232              :                                         builtin_types[(int) ARG5],      \
    1233              :                                         builtin_types[(int) ARG6],      \
    1234              :                                         NULL_TREE);
    1235              : #define DEF_FUNCTION_TYPE_VAR_7(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
    1236              :                                 ARG6, ARG7)                             \
    1237              :   builtin_types[(int) ENUM]                                             \
    1238              :     = build_varargs_function_type_list (builtin_types[(int) RETURN],    \
    1239              :                                         builtin_types[(int) ARG1],      \
    1240              :                                         builtin_types[(int) ARG2],      \
    1241              :                                         builtin_types[(int) ARG3],      \
    1242              :                                         builtin_types[(int) ARG4],      \
    1243              :                                         builtin_types[(int) ARG5],      \
    1244              :                                         builtin_types[(int) ARG6],      \
    1245              :                                         builtin_types[(int) ARG7],      \
    1246              :                                         NULL_TREE);
    1247              : #define DEF_POINTER_TYPE(ENUM, TYPE)                    \
    1248              :   builtin_types[(int) ENUM]                             \
    1249              :     = build_pointer_type (builtin_types[(int) TYPE]);
    1250              : #include "types.def"
    1251              : #undef DEF_PRIMITIVE_TYPE
    1252              : #undef DEF_FUNCTION_TYPE_0
    1253              : #undef DEF_FUNCTION_TYPE_1
    1254              : #undef DEF_FUNCTION_TYPE_2
    1255              : #undef DEF_FUNCTION_TYPE_3
    1256              : #undef DEF_FUNCTION_TYPE_4
    1257              : #undef DEF_FUNCTION_TYPE_5
    1258              : #undef DEF_FUNCTION_TYPE_6
    1259              : #undef DEF_FUNCTION_TYPE_7
    1260              : #undef DEF_FUNCTION_TYPE_8
    1261              : #undef DEF_FUNCTION_TYPE_10
    1262              : #undef DEF_FUNCTION_TYPE_VAR_0
    1263              : #undef DEF_FUNCTION_TYPE_VAR_1
    1264              : #undef DEF_FUNCTION_TYPE_VAR_2
    1265              : #undef DEF_FUNCTION_TYPE_VAR_6
    1266              : #undef DEF_FUNCTION_TYPE_VAR_7
    1267              : #undef DEF_POINTER_TYPE
    1268        32921 :   builtin_types[(int) BT_LAST] = NULL_TREE;
    1269              : 
    1270              :   /* Initialize synchronization builtins.  */
    1271              : #undef DEF_SYNC_BUILTIN
    1272              : #define DEF_SYNC_BUILTIN(code, name, type, attr) \
    1273              :     gfc_define_builtin (name, builtin_types[type], code, name, \
    1274              :                         attr);
    1275              : #include "../sync-builtins.def"
    1276              : #undef DEF_SYNC_BUILTIN
    1277              : 
    1278        32921 :   if (flag_openacc)
    1279              :     {
    1280              : #undef DEF_GOACC_BUILTIN
    1281              : #define DEF_GOACC_BUILTIN(code, name, type, attr) \
    1282              :       gfc_define_builtin ("__builtin_" name, builtin_types[type], \
    1283              :                           code, name, attr);
    1284              : #undef DEF_GOACC_BUILTIN_COMPILER
    1285              : #define DEF_GOACC_BUILTIN_COMPILER(code, name, type, attr) \
    1286              :       gfc_define_builtin (name, builtin_types[type], code, name, attr);
    1287              : #undef DEF_GOACC_BUILTIN_ONLY
    1288              : #define DEF_GOACC_BUILTIN_ONLY(code, name, type, attr) \
    1289              :       gfc_define_builtin ("__builtin_" name, builtin_types[type], code, NULL, \
    1290              :                           attr);
    1291              : #undef DEF_GOMP_BUILTIN
    1292              : #define DEF_GOMP_BUILTIN(code, name, type, attr) /* ignore */
    1293              : #undef DEF_GOMP_BUILTIN_COMPILER
    1294              : #define DEF_GOMP_BUILTIN_COMPILER(code, name, type, attr) /* ignore */
    1295              : #include "../omp-builtins.def"
    1296              : #undef DEF_GOACC_BUILTIN
    1297              : #undef DEF_GOACC_BUILTIN_COMPILER
    1298              : #undef DEF_GOMP_BUILTIN
    1299              : #undef DEF_GOMP_BUILTIN_COMPILER
    1300              :     }
    1301              : 
    1302        32921 :   if (flag_openmp || flag_openmp_simd || flag_tree_parallelize_loops)
    1303              :     {
    1304              : #undef DEF_GOACC_BUILTIN
    1305              : #define DEF_GOACC_BUILTIN(code, name, type, attr) /* ignore */
    1306              : #undef DEF_GOACC_BUILTIN_COMPILER
    1307              : #define DEF_GOACC_BUILTIN_COMPILER(code, name, type, attr)  /* ignore */
    1308              : #undef DEF_GOMP_BUILTIN
    1309              : #define DEF_GOMP_BUILTIN(code, name, type, attr) \
    1310              :       gfc_define_builtin ("__builtin_" name, builtin_types[type], \
    1311              :                           code, name, attr);
    1312              : #undef DEF_GOMP_BUILTIN_COMPILER
    1313              : #define DEF_GOMP_BUILTIN_COMPILER(code, name, type, attr) \
    1314              :       if (flag_openmp) \
    1315              :         gfc_define_builtin ("__builtin_" name, builtin_types[type], \
    1316              :                               code, name, attr);
    1317              : #include "../omp-builtins.def"
    1318              : #undef DEF_GOACC_BUILTIN
    1319              : #undef DEF_GOACC_BUILTIN_COMPILER
    1320              : #undef DEF_GOMP_BUILTIN
    1321              : #undef DEF_GOMP_BUILTIN_COMPILER
    1322        32921 :       tree gomp_alloc = builtin_decl_explicit (BUILT_IN_GOMP_ALLOC);
    1323        32921 :       tree two = build_int_cst (integer_type_node, 2);
    1324        32921 :       DECL_ATTRIBUTES (gomp_alloc)
    1325        65842 :         = tree_cons (get_identifier ("warn_unused_result"), NULL_TREE,
    1326              :                      tree_cons (get_identifier ("alloc_size"),
    1327              :                                 build_tree_list (NULL_TREE, two),
    1328        32921 :                                 DECL_ATTRIBUTES (gomp_alloc)));
    1329              :     }
    1330              : 
    1331        32921 :   gfc_define_builtin ("__builtin_trap", builtin_types[BT_FN_VOID],
    1332              :                       BUILT_IN_TRAP, NULL, ATTR_NOTHROW_LEAF_LIST);
    1333        32921 :   TREE_THIS_VOLATILE (builtin_decl_explicit (BUILT_IN_TRAP)) = 1;
    1334              : 
    1335        32921 :   ftype = build_varargs_function_type_list (ptr_type_node, const_ptr_type_node,
    1336              :                                             size_type_node, NULL_TREE);
    1337        32921 :   gfc_define_builtin ("__builtin_assume_aligned", ftype,
    1338              :                       BUILT_IN_ASSUME_ALIGNED,
    1339              :                       "__builtin_assume_aligned",
    1340              :                       ATTR_CONST_NOTHROW_LEAF_LIST);
    1341              : 
    1342        32921 :   ftype = build_function_type_list (long_double_type_node, long_double_type_node,
    1343              :                                     long_double_type_node, long_double_type_node,
    1344              :                                     NULL_TREE);
    1345        32921 :   gfc_define_builtin ("__builtin_fmal", ftype, BUILT_IN_FMAL,
    1346              :                       "fmal", ATTR_CONST_NOTHROW_LEAF_LIST);
    1347        32921 :   ftype = build_function_type_list (double_type_node, double_type_node,
    1348              :                                     double_type_node, double_type_node,
    1349              :                                     NULL_TREE);
    1350        32921 :   gfc_define_builtin ("__builtin_fma", ftype, BUILT_IN_FMA,
    1351              :                       "fma", ATTR_CONST_NOTHROW_LEAF_LIST);
    1352        32921 :   ftype = build_function_type_list (float_type_node, float_type_node,
    1353              :                                     float_type_node, float_type_node,
    1354              :                                     NULL_TREE);
    1355        32921 :   gfc_define_builtin ("__builtin_fmaf", ftype, BUILT_IN_FMAF,
    1356              :                       "fmaf", ATTR_CONST_NOTHROW_LEAF_LIST);
    1357              : 
    1358        32921 :   gfc_define_builtin ("__emutls_get_address",
    1359              :                       builtin_types[BT_FN_PTR_PTR],
    1360              :                       BUILT_IN_EMUTLS_GET_ADDRESS,
    1361              :                       "__emutls_get_address", ATTR_CONST_NOTHROW_LEAF_LIST);
    1362        32921 :   gfc_define_builtin ("__emutls_register_common",
    1363              :                       builtin_types[BT_FN_VOID_PTR_WORD_WORD_PTR],
    1364              :                       BUILT_IN_EMUTLS_REGISTER_COMMON,
    1365              :                       "__emutls_register_common", ATTR_NOTHROW_LEAF_LIST);
    1366              : 
    1367        32921 :   build_common_builtin_nodes ();
    1368        32921 :   targetm.init_builtins ();
    1369        32921 : }
    1370              : 
    1371              : #undef DEFINE_MATH_BUILTIN_C
    1372              : #undef DEFINE_MATH_BUILTIN
    1373              : 
    1374              : static void
    1375        32939 : gfc_init_ts (void)
    1376              : {
    1377        32939 :   tree_contains_struct[NAMESPACE_DECL][TS_DECL_NON_COMMON] = 1;
    1378        32939 :   tree_contains_struct[NAMESPACE_DECL][TS_DECL_WITH_VIS] = 1;
    1379        32939 :   tree_contains_struct[NAMESPACE_DECL][TS_DECL_WRTL] = 1;
    1380        32939 :   tree_contains_struct[NAMESPACE_DECL][TS_DECL_COMMON] = 1;
    1381        32939 :   tree_contains_struct[NAMESPACE_DECL][TS_DECL_MINIMAL] = 1;
    1382        32939 : }
    1383              : 
    1384              : void
    1385        19584 : gfc_maybe_initialize_eh (void)
    1386              : {
    1387        19584 :   if (!flag_exceptions || gfc_eh_initialized_p)
    1388              :     return;
    1389              : 
    1390            9 :   gfc_eh_initialized_p = true;
    1391            9 :   using_eh_for_cleanups ();
    1392              : }
    1393              : 
    1394              : 
    1395              : #include "gt-fortran-f95-lang.h"
    1396              : #include "gtype-fortran.h"
        

Generated by: LCOV version 2.6-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.