tree-optimization/112856 - fix LC SSA after loop header copying
[official-gcc.git] / libgfortran / runtime / main.c
blobbcdcb20a1236f5b257d226526848b87ce10335b1
1 /* Copyright (C) 2002-2023 Free Software Foundation, Inc.
2 Contributed by Andy Vaught and Paul Brook <paul@nowt.org>
4 This file is part of the GNU Fortran runtime library (libgfortran).
6 Libgfortran is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3, or (at your option)
9 any later version.
11 Libgfortran is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 Under Section 7 of GPL version 3, you are granted additional
17 permissions described in the GCC Runtime Library Exception, version
18 3.1, as published by the Free Software Foundation.
20 You should have received a copy of the GNU General Public License and
21 a copy of the GCC Runtime Library Exception along with this program;
22 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23 <http://www.gnu.org/licenses/>. */
25 #include "libgfortran.h"
28 /* Stupid function to be sure the constructor is always linked in, even
29 in the case of static linking. See PR libfortran/22298 for details. */
30 void
31 stupid_function_name_for_static_linking (void)
33 return;
37 static int argc_save;
38 static char **argv_save;
41 /* Set the saved values of the command line arguments. */
43 void
44 set_args (int argc, char **argv)
46 argc_save = argc;
47 argv_save = argv;
49 iexport(set_args);
52 /* Retrieve the saved values of the command line arguments. */
54 void
55 get_args (int *argc, char ***argv)
57 *argc = argc_save;
58 *argv = argv_save;
62 /* Initialize the runtime library. */
64 static void __attribute__((constructor))
65 init (void)
67 /* Must be first */
68 init_variables ();
70 init_units ();
72 /* If (and only if) the user asked for it, set up the FPU state. */
73 if (options.fpe != 0)
74 set_fpu ();
76 init_compile_options ();
80 /* Cleanup the runtime library. */
82 static void __attribute__((destructor))
83 cleanup (void)
85 close_units ();