Bug Summary

File:build/gcc/align.h
Warning:line 33, column 16
The result of the left shift is undefined because the right operand is negative

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name toplev.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -analyzer-config-compatibility-mode=true -mrelocation-model static -mframe-pointer=none -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir /usr/lib64/clang/11.0.0 -D TARGET_NAME="x86_64-pc-linux-gnu" -D IN_GCC -D HAVE_CONFIG_H -I . -I . -I /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc -I /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/. -I /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/../include -I /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/../libcpp/include -I /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/../libcody -I /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/../libdecnumber -I /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/../libdecnumber/bid -I ../libdecnumber -I /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/../libbacktrace -internal-isystem /usr/bin/../lib64/gcc/x86_64-suse-linux/10/../../../../include/c++/10 -internal-isystem /usr/bin/../lib64/gcc/x86_64-suse-linux/10/../../../../include/c++/10/x86_64-suse-linux -internal-isystem /usr/bin/../lib64/gcc/x86_64-suse-linux/10/../../../../include/c++/10/backward -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/11.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-narrowing -Wwrite-strings -Wno-error=format-diag -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fdeprecated-macro -fdebug-compilation-dir /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/objdir/gcc -ferror-limit 19 -fno-rtti -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -analyzer-output=plist-html -analyzer-config silence-checkers=core.NullDereference -faddrsig -o /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/objdir/clang-static-analyzer/2021-01-16-135054-17580-1/report-iSNESM.plist -x c++ /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/toplev.c

/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/toplev.c

1/* Top level of GCC compilers (cc1, cc1plus, etc.)
2 Copyright (C) 1987-2021 Free Software Foundation, Inc.
3
4This file is part of GCC.
5
6GCC is free software; you can redistribute it and/or modify it under
7the terms of the GNU General Public License as published by the Free
8Software Foundation; either version 3, or (at your option) any later
9version.
10
11GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12WARRANTY; without even the implied warranty of MERCHANTABILITY or
13FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14for more details.
15
16You should have received a copy of the GNU General Public License
17along with GCC; see the file COPYING3. If not see
18<http://www.gnu.org/licenses/>. */
19
20/* This is the top level of cc1/c++.
21 It parses command args, opens files, invokes the various passes
22 in the proper order, and counts the time used by each.
23 Error messages and low-level interface to malloc also handled here. */
24
25#include "config.h"
26#include "system.h"
27#include "coretypes.h"
28#include "backend.h"
29#include "target.h"
30#include "rtl.h"
31#include "tree.h"
32#include "gimple.h"
33#include "alloc-pool.h"
34#include "timevar.h"
35#include "memmodel.h"
36#include "tm_p.h"
37#include "optabs-libfuncs.h"
38#include "insn-config.h"
39#include "ira.h"
40#include "recog.h"
41#include "cgraph.h"
42#include "coverage.h"
43#include "diagnostic.h"
44#include "varasm.h"
45#include "tree-inline.h"
46#include "realmpfr.h" /* For GMP/MPFR/MPC versions, in print_version. */
47#include "version.h"
48#include "flags.h"
49#include "insn-attr.h"
50#include "output.h"
51#include "toplev.h"
52#include "expr.h"
53#include "intl.h"
54#include "tree-diagnostic.h"
55#include "reload.h"
56#include "lra.h"
57#include "dwarf2asm.h"
58#include "debug.h"
59#include "common/common-target.h"
60#include "langhooks.h"
61#include "cfgloop.h" /* for init_set_costs */
62#include "hosthooks.h"
63#include "opts.h"
64#include "opts-diagnostic.h"
65#include "stringpool.h"
66#include "attribs.h"
67#include "asan.h"
68#include "tsan.h"
69#include "plugin.h"
70#include "context.h"
71#include "pass_manager.h"
72#include "auto-profile.h"
73#include "dwarf2out.h"
74#include "ipa-reference.h"
75#include "symbol-summary.h"
76#include "tree-vrp.h"
77#include "ipa-prop.h"
78#include "gcse.h"
79#include "omp-offload.h"
80#include "edit-context.h"
81#include "tree-pass.h"
82#include "dumpfile.h"
83#include "ipa-fnsummary.h"
84#include "dump-context.h"
85#include "print-tree.h"
86#include "optinfo-emit-json.h"
87#include "ipa-modref-tree.h"
88#include "ipa-modref.h"
89#include "dbgcnt.h"
90
91#if defined(DBX_DEBUGGING_INFO1) || defined(XCOFF_DEBUGGING_INFO)
92#include "dbxout.h"
93#endif
94
95#ifdef XCOFF_DEBUGGING_INFO
96#include "xcoffout.h" /* Needed for external data declarations. */
97#endif
98
99#include "selftest.h"
100
101#ifdef HAVE_isl1
102#include <isl/version.h>
103#endif
104
105static void general_init (const char *, bool);
106static void do_compile ();
107static void process_options (void);
108static void backend_init (void);
109static int lang_dependent_init (const char *);
110static void init_asm_output (const char *);
111static void finalize (bool);
112
113static void crash_signal (int) ATTRIBUTE_NORETURN__attribute__ ((__noreturn__));
114static void compile_file (void);
115
116/* True if we don't need a backend (e.g. preprocessing only). */
117static bool no_backend;
118
119/* Decoded options, and number of such options. */
120struct cl_decoded_option *save_decoded_options;
121unsigned int save_decoded_options_count;
122
123/* Used to enable -fvar-tracking, -fweb and -frename-registers according
124 to optimize in process_options (). */
125#define AUTODETECT_VALUE2 2
126
127/* Debug hooks - dependent upon command line options. */
128
129const struct gcc_debug_hooks *debug_hooks;
130
131/* The FUNCTION_DECL for the function currently being compiled,
132 or 0 if between functions. */
133tree current_function_decl;
134
135/* Set to the FUNC_BEGIN label of the current function, or NULL
136 if none. */
137const char * current_function_func_begin_label;
138
139/* A random sequence of characters, unless overridden by user. */
140static const char *flag_random_seed;
141
142/* A local time stamp derived from the time of compilation. It will be
143 zero if the system cannot provide a time. It will be -1u, if the
144 user has specified a particular random seed. */
145unsigned local_tick;
146
147/* Random number for this compilation */
148HOST_WIDE_INTlong random_seed;
149
150/* -f flags. */
151
152/* When non-NULL, indicates that whenever space is allocated on the
153 stack, the resulting stack pointer must not pass this
154 address---that is, for stacks that grow downward, the stack pointer
155 must always be greater than or equal to this address; for stacks
156 that grow upward, the stack pointer must be less than this address.
157 At present, the rtx may be either a REG or a SYMBOL_REF, although
158 the support provided depends on the backend. */
159rtx stack_limit_rtx;
160
161class target_flag_state default_target_flag_state;
162#if SWITCHABLE_TARGET1
163class target_flag_state *this_target_flag_state = &default_target_flag_state;
164#else
165#define this_target_flag_state (&default_target_flag_state)
166#endif
167
168/* The user symbol prefix after having resolved same. */
169const char *user_label_prefix;
170
171/* Output files for assembler code (real compiler output)
172 and debugging dumps. */
173
174FILE *asm_out_file;
175FILE *aux_info_file;
176FILE *callgraph_info_file = NULL__null;
177static bitmap callgraph_info_external_printed;
178FILE *stack_usage_file = NULL__null;
179
180/* The current working directory of a translation. It's generally the
181 directory from which compilation was initiated, but a preprocessed
182 file may specify the original directory in which it was
183 created. */
184
185static const char *src_pwd;
186
187/* Initialize src_pwd with the given string, and return true. If it
188 was already initialized, return false. As a special case, it may
189 be called with a NULL argument to test whether src_pwd has NOT been
190 initialized yet. */
191
192bool
193set_src_pwd (const char *pwd)
194{
195 if (src_pwd)
196 {
197 if (strcmp (src_pwd, pwd) == 0)
198 return true;
199 else
200 return false;
201 }
202
203 src_pwd = xstrdup (pwd);
204 return true;
205}
206
207/* Return the directory from which the translation unit was initiated,
208 in case set_src_pwd() was not called before to assign it a
209 different value. */
210
211const char *
212get_src_pwd (void)
213{
214 if (! src_pwd)
215 {
216 src_pwd = getpwd ();
217 if (!src_pwd)
218 src_pwd = ".";
219 }
220
221 return src_pwd;
222}
223
224/* Called when the start of a function definition is parsed,
225 this function prints on stderr the name of the function. */
226void
227announce_function (tree decl)
228{
229 if (!quiet_flagglobal_options.x_quiet_flag)
230 {
231 if (rtl_dump_and_exitglobal_options.x_rtl_dump_and_exit)
232 fprintf (stderrstderr, "%s ",
233 identifier_to_locale (IDENTIFIER_POINTER (DECL_NAME (decl))((const char *) (tree_check ((((contains_struct_check ((decl)
, (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/toplev.c"
, 233, __FUNCTION__))->decl_minimal.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/toplev.c"
, 233, __FUNCTION__, (IDENTIFIER_NODE)))->identifier.id.str
)
));
234 else
235 fprintf (stderrstderr, " %s",
236 identifier_to_locale (lang_hooks.decl_printable_name (decl, 2)));
237 fflush (stderrstderr);
238 pp_needs_newline (global_dc->printer)(global_dc->printer)->need_newline = true;
239 diagnostic_set_last_function (global_dc, (diagnostic_info *) NULL)(global_dc)->x_data = ((((diagnostic_info *) __null) &&
((tree) ((diagnostic_info *) __null)->x_data)) ? ((tree) (
(diagnostic_info *) __null)->x_data) : current_function_decl
)
;
240 }
241}
242
243/* Initialize local_tick with the time of day, or -1 if
244 flag_random_seed is set. */
245
246static void
247init_local_tick (void)
248{
249 if (!flag_random_seed)
250 {
251#ifdef HAVE_GETTIMEOFDAY1
252 {
253 struct timeval tv;
254
255 gettimeofday (&tv, NULL__null);
256 local_tick = (unsigned) tv.tv_sec * 1000 + tv.tv_usec / 1000;
257 }
258#else
259 {
260 time_t now = time (NULL__null);
261
262 if (now != (time_t)-1)
263 local_tick = (unsigned) now;
264 }
265#endif
266 }
267 else
268 local_tick = -1;
269}
270
271/* Obtain the random_seed. Unless NOINIT, initialize it if
272 it's not provided in the command line. */
273
274HOST_WIDE_INTlong
275get_random_seed (bool noinit)
276{
277 if (!random_seed && !noinit)
278 {
279 int fd = open ("/dev/urandom", O_RDONLY00);
280 if (fd >= 0)
281 {
282 if (read (fd, &random_seed, sizeof (random_seed))
283 != sizeof (random_seed))
284 random_seed = 0;
285 close (fd);
286 }
287 if (!random_seed)
288 random_seed = local_tick ^ getpid ();
289 }
290 return random_seed;
291}
292
293/* Set flag_random_seed to VAL, and if non-null, reinitialize random_seed. */
294
295void
296set_random_seed (const char *val)
297{
298 flag_random_seed = val;
299 if (flag_random_seed)
300 {
301 char *endp;
302
303 /* When the driver passed in a hex number don't crc it again */
304 random_seed = strtoul (flag_random_seed, &endp, 0);
305 if (!(endp > flag_random_seed && *endp == 0))
306 random_seed = crc32_string (0, flag_random_seed);
307 }
308}
309
310/* Handler for fatal signals, such as SIGSEGV. These are transformed
311 into ICE messages, which is much more user friendly. In case the
312 error printer crashes, reset the signal to prevent infinite recursion. */
313
314static void
315crash_signal (int signo)
316{
317 signal (signo, SIG_DFL((__sighandler_t) 0));
318
319 /* If we crashed while processing an ASM statement, then be a little more
320 graceful. It's most likely the user's fault. */
321 if (this_is_asm_operands)
322 {
323 output_operand_lossage ("unrecoverable error");
324 exit (FATAL_EXIT_CODE1);
325 }
326
327 internal_error ("%s", strsignal (signo));
328}
329
330/* A subroutine of wrapup_global_declarations. We've come to the end of
331 the compilation unit. All deferred variables should be undeferred,
332 and all incomplete decls should be finalized. */
333
334void
335wrapup_global_declaration_1 (tree decl)
336{
337 /* We're not deferring this any longer. Assignment is conditional to
338 avoid needlessly dirtying PCH pages. */
339 if (CODE_CONTAINS_STRUCT (TREE_CODE (decl), TS_DECL_WITH_VIS)(tree_contains_struct[(((enum tree_code) (decl)->base.code
))][(TS_DECL_WITH_VIS)])
340 && DECL_DEFER_OUTPUT (decl)((contains_struct_check ((decl), (TS_DECL_WITH_VIS), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/toplev.c"
, 340, __FUNCTION__))->decl_with_vis.defer_output)
!= 0)
341 DECL_DEFER_OUTPUT (decl)((contains_struct_check ((decl), (TS_DECL_WITH_VIS), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/toplev.c"
, 341, __FUNCTION__))->decl_with_vis.defer_output)
= 0;
342
343 if (VAR_P (decl)(((enum tree_code) (decl)->base.code) == VAR_DECL) && DECL_SIZE (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/toplev.c"
, 343, __FUNCTION__))->decl_common.size)
== 0)
344 lang_hooks.finish_incomplete_decl (decl);
345}
346
347/* A subroutine of wrapup_global_declarations. Decide whether or not DECL
348 needs to be output. Return true if it is output. */
349
350bool
351wrapup_global_declaration_2 (tree decl)
352{
353 if (TREE_ASM_WRITTEN (decl)((decl)->base.asm_written_flag) || DECL_EXTERNAL (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/toplev.c"
, 353, __FUNCTION__))->decl_common.decl_flag_1)
354 || (VAR_P (decl)(((enum tree_code) (decl)->base.code) == VAR_DECL) && DECL_HAS_VALUE_EXPR_P (decl)((tree_check3 ((decl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/toplev.c"
, 354, __FUNCTION__, (VAR_DECL), (PARM_DECL), (RESULT_DECL)))
->decl_common.decl_flag_2)
))
355 return false;
356
357 /* Don't write out static consts, unless we still need them.
358
359 We also keep static consts if not optimizing (for debugging),
360 unless the user specified -fno-keep-static-consts.
361 ??? They might be better written into the debug information.
362 This is possible when using DWARF.
363
364 A language processor that wants static constants to be always
365 written out (even if it is not used) is responsible for
366 calling rest_of_decl_compilation itself. E.g. the C front-end
367 calls rest_of_decl_compilation from finish_decl.
368 One motivation for this is that is conventional in some
369 environments to write things like:
370 static const char rcsid[] = "... version string ...";
371 intending to force the string to be in the executable.
372
373 A language processor that would prefer to have unneeded
374 static constants "optimized away" would just defer writing
375 them out until here. E.g. C++ does this, because static
376 constants are often defined in header files.
377
378 ??? A tempting alternative (for both C and C++) would be
379 to force a constant to be written if and only if it is
380 defined in a main file, as opposed to an include file. */
381
382 if (VAR_P (decl)(((enum tree_code) (decl)->base.code) == VAR_DECL) && TREE_STATIC (decl)((decl)->base.static_flag))
383 {
384 varpool_node *node;
385 bool needed = true;
386 node = varpool_node::get (decl);
387
388 if (!node && flag_ltransglobal_options.x_flag_ltrans)
389 needed = false;
390 else if (node && node->definition)
391 needed = false;
392 else if (node && node->alias)
393 needed = false;
394 else if (!symtab->global_info_ready
395 && (TREE_USED (decl)((decl)->base.used_flag)
396 || TREE_USED (DECL_ASSEMBLER_NAME (decl))((decl_assembler_name (decl))->base.used_flag)))
397 /* needed */;
398 else if (node && node->analyzed)
399 /* needed */;
400 else if (DECL_COMDAT (decl)((contains_struct_check ((decl), (TS_DECL_WITH_VIS), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/toplev.c"
, 400, __FUNCTION__))->decl_with_vis.comdat_flag)
)
401 needed = false;
402 else if (TREE_READONLY (decl)((non_type_check ((decl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/toplev.c"
, 402, __FUNCTION__))->base.readonly_flag)
&& !TREE_PUBLIC (decl)((decl)->base.public_flag)
403 && (optimizeglobal_options.x_optimize || !flag_keep_static_constsglobal_options.x_flag_keep_static_consts
404 || DECL_ARTIFICIAL (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/toplev.c"
, 404, __FUNCTION__))->decl_common.artificial_flag)
))
405 needed = false;
406
407 if (needed)
408 {
409 rest_of_decl_compilation (decl, 1, 1);
410 return true;
411 }
412 }
413
414 return false;
415}
416
417/* Do any final processing required for the declarations in VEC, of
418 which there are LEN. We write out inline functions and variables
419 that have been deferred until this point, but which are required.
420 Returns nonzero if anything was put out. */
421
422bool
423wrapup_global_declarations (tree *vec, int len)
424{
425 bool reconsider, output_something = false;
426 int i;
427
428 for (i = 0; i < len; i++)
429 wrapup_global_declaration_1 (vec[i]);
430
431 /* Now emit any global variables or functions that we have been
432 putting off. We need to loop in case one of the things emitted
433 here references another one which comes earlier in the list. */
434 do
435 {
436 reconsider = false;
437 for (i = 0; i < len; i++)
438 reconsider |= wrapup_global_declaration_2 (vec[i]);
439 if (reconsider)
440 output_something = true;
441 }
442 while (reconsider);
443
444 return output_something;
445}
446
447/* Compile an entire translation unit. Write a file of assembly
448 output and various debugging dumps. */
449
450static void
451compile_file (void)
452{
453 timevar_start (TV_PHASE_PARSING);
454 timevar_push (TV_PARSE_GLOBAL);
455
456 /* Parse entire file and generate initial debug information. */
457 lang_hooks.parse_file ();
458
459 timevar_pop (TV_PARSE_GLOBAL);
460 timevar_stop (TV_PHASE_PARSING);
461
462 if (flag_dump_locationsglobal_options.x_flag_dump_locations)
463 dump_location_info (stderrstderr);
464
465 /* Compilation is now finished except for writing
466 what's left of the symbol table output. */
467
468 if (flag_syntax_onlyglobal_options.x_flag_syntax_only || flag_wpaglobal_options.x_flag_wpa)
469 return;
470
471 /* Reset maximum_field_alignment, it can be adjusted by #pragma pack
472 and this shouldn't influence any types built by the middle-end
473 from now on (like gcov_info_type). */
474 maximum_field_alignment = initial_max_fld_alignglobal_options.x_initial_max_fld_align * BITS_PER_UNIT(8);
475
476 ggc_protect_identifiers = false;
477
478 /* Run the actual compilation process. */
479 if (!in_lto_pglobal_options.x_in_lto_p)
480 {
481 timevar_start (TV_PHASE_OPT_GEN);
482 symtab->finalize_compilation_unit ();
483 timevar_stop (TV_PHASE_OPT_GEN);
484 }
485
486 /* Perform any post compilation-proper parser cleanups and
487 processing. This is currently only needed for the C++ parser,
488 which can be hopefully cleaned up so this hook is no longer
489 necessary. */
490 if (lang_hooks.decls.post_compilation_parsing_cleanups)
491 lang_hooks.decls.post_compilation_parsing_cleanups ();
492
493 dump_context::get ().finish_any_json_writer ();
494
495 if (seen_error ())
496 return;
497
498 timevar_start (TV_PHASE_LATE_ASM);
499
500 /* Compilation unit is finalized. When producing non-fat LTO object, we are
501 basically finished. */
502 if ((in_lto_pglobal_options.x_in_lto_p && flag_incremental_linkglobal_options.x_flag_incremental_link != INCREMENTAL_LINK_LTO)
503 || !flag_ltoglobal_options.x_flag_lto || flag_fat_lto_objectsglobal_options.x_flag_fat_lto_objects)
504 {
505 /* File-scope initialization for AddressSanitizer. */
506 if (flag_sanitizeglobal_options.x_flag_sanitize & SANITIZE_ADDRESS)
507 asan_finish_file ();
508
509 if (flag_sanitizeglobal_options.x_flag_sanitize & SANITIZE_THREAD)
510 tsan_finish_file ();
511
512 if (gate_hwasan ())
513 hwasan_finish_file ();
514
515 omp_finish_file ();
516
517 output_shared_constant_pool ();
518 output_object_blocks ();
519 finish_tm_clone_pairs ();
520
521 /* Write out any pending weak symbol declarations. */
522 weak_finish ();
523
524 /* This must be at the end before unwind and debug info.
525 Some target ports emit PIC setup thunks here. */
526 targetm.asm_out.code_end ();
527
528 /* Do dbx symbols. */
529 timevar_push (TV_SYMOUT);
530
531#if defined DWARF2_DEBUGGING_INFO1 || defined DWARF2_UNWIND_INFO1
532 dwarf2out_frame_finish ();
533#endif
534
535 debuginfo_start ();
536 (*debug_hooks->finish) (main_input_filenameglobal_options.x_main_input_filename);
537 debuginfo_stop ();
538 timevar_pop (TV_SYMOUT);
539
540 /* Output some stuff at end of file if nec. */
541
542 dw2_output_indirect_constants ();
543
544 /* Flush any pending external directives. */
545 process_pending_assemble_externals ();
546 }
547
548 /* Let linker plugin know that this is a slim object and must be LTOed
549 even when user did not ask for it. */
550 if (flag_generate_ltoglobal_options.x_flag_generate_lto && !flag_fat_lto_objectsglobal_options.x_flag_fat_lto_objects)
551 {
552#if defined ASM_OUTPUT_ALIGNED_DECL_COMMON
553 ASM_OUTPUT_ALIGNED_DECL_COMMON (asm_out_file, NULL_TREE, "__gnu_lto_slim",x86_elf_aligned_decl_common (asm_out_file, (tree) __null, "__gnu_lto_slim"
, 1UL, 8);
554 HOST_WIDE_INT_1U, 8)x86_elf_aligned_decl_common (asm_out_file, (tree) __null, "__gnu_lto_slim"
, 1UL, 8);
;
555#elif defined ASM_OUTPUT_ALIGNED_COMMON
556 ASM_OUTPUT_ALIGNED_COMMON (asm_out_file, "__gnu_lto_slim",do { fprintf ((asm_out_file), "%s", "\t.comm\t"); assemble_name
((asm_out_file), ("__gnu_lto_slim")); fprintf ((asm_out_file
), "," "%" "l" "u" ",%u\n", (1UL), (8) / (8)); } while (0)
557 HOST_WIDE_INT_1U, 8)do { fprintf ((asm_out_file), "%s", "\t.comm\t"); assemble_name
((asm_out_file), ("__gnu_lto_slim")); fprintf ((asm_out_file
), "," "%" "l" "u" ",%u\n", (1UL), (8) / (8)); } while (0)
;
558#else
559 ASM_OUTPUT_COMMON (asm_out_file, "__gnu_lto_slim",
560 HOST_WIDE_INT_1U1UL,
561 HOST_WIDE_INT_1U1UL);
562#endif
563 }
564
565 /* Attach a special .ident directive to the end of the file to identify
566 the version of GCC which compiled this code. The format of the .ident
567 string is patterned after the ones produced by native SVR4 compilers. */
568 if (!flag_no_identglobal_options.x_flag_no_ident)
569 {
570 const char *pkg_version = "(GNU) ";
571 char *ident_str;
572
573 if (strcmp ("(GCC) ", pkgversion_string))
574 pkg_version = pkgversion_string;
575
576 ident_str = ACONCAT (("GCC: ", pkg_version, version_string, NULL))(libiberty_concat_ptr = (char *) __builtin_alloca(concat_length
("GCC: ", pkg_version, version_string, __null) + 1), concat_copy2
("GCC: ", pkg_version, version_string, __null))
;
577 targetm.asm_out.output_ident (ident_str);
578 }
579
580 /* Auto profile finalization. */
581 if (flag_auto_profileglobal_options.x_flag_auto_profile)
582 end_auto_profile ();
583
584 /* Invoke registered plugin callbacks. */
585 invoke_plugin_callbacks (PLUGIN_FINISH_UNIT, NULL__null);
586
587 /* This must be at the end. Some target ports emit end of file directives
588 into the assembly file here, and hence we cannot output anything to the
589 assembly file after this point. */
590 targetm.asm_out.file_end ();
591
592 timevar_stop (TV_PHASE_LATE_ASM);
593}
594
595/* Print version information to FILE.
596 Each line begins with INDENT (for the case where FILE is the
597 assembler output file).
598
599 If SHOW_GLOBAL_STATE is true (for cc1 etc), we are within the compiler
600 proper and can print pertinent state (e.g. params and plugins).
601
602 If SHOW_GLOBAL_STATE is false (for use by libgccjit), we are outside the
603 compiler, and we don't hold the mutex on the compiler's global state:
604 we can't print params and plugins, since they might not be initialized,
605 or might be being manipulated by a compile running in another
606 thread. */
607
608void
609print_version (FILE *file, const char *indent, bool show_global_state)
610{
611 static const char fmt1[] =
612#ifdef __GNUC__4
613 N_("%s%s%s %sversion %s (%s)\n%s\tcompiled by GNU C version %s, ")"%s%s%s %sversion %s (%s)\n%s\tcompiled by GNU C version %s, "
614#else
615 N_("%s%s%s %sversion %s (%s) compiled by CC, ")"%s%s%s %sversion %s (%s) compiled by CC, "
616#endif
617 ;
618 static const char fmt2[] =
619 N_("GMP version %s, MPFR version %s, MPC version %s, isl version %s\n")"GMP version %s, MPFR version %s, MPC version %s, isl version %s\n";
620 static const char fmt3[] =
621 N_("%s%swarning: %s header version %s differs from library version %s.\n")"%s%swarning: %s header version %s differs from library version %s.\n";
622 static const char fmt4[] =
623 N_("%s%sGGC heuristics: --param ggc-min-expand=%d --param ggc-min-heapsize=%d\n")"%s%sGGC heuristics: --param ggc-min-expand=%d --param ggc-min-heapsize=%d\n";
624#ifndef __VERSION__"Clang 11.0.0"
625#define __VERSION__"Clang 11.0.0" "[?]"
626#endif
627 fprintf (file,
628 file == stderrstderr ? _(fmt1)gettext (fmt1) : fmt1,
629 indent, *indent != 0 ? " " : "",
630 lang_hooks.name, pkgversion_string, version_string, TARGET_NAME"x86_64-pc-linux-gnu",
631 indent, __VERSION__"Clang 11.0.0");
632
633 /* We need to stringify the GMP macro values. Ugh, gmp_version has
634 two string formats, "i.j.k" and "i.j" when k is zero. As of
635 gmp-4.3.0, GMP always uses the 3 number format. */
636#define GCC_GMP_STRINGIFY_VERSION3(X)"X" #X
637#define GCC_GMP_STRINGIFY_VERSION2(X)"X" GCC_GMP_STRINGIFY_VERSION3 (X)"X"
638#define GCC_GMP_VERSION_NUM(X,Y,Z)(((X) << 16L) | ((Y) << 8) | (Z)) (((X) << 16L) | ((Y) << 8) | (Z))
639#define GCC_GMP_VERSION(((6) << 16L) | ((2) << 8) | (1)) \
640 GCC_GMP_VERSION_NUM(__GNU_MP_VERSION, __GNU_MP_VERSION_MINOR, __GNU_MP_VERSION_PATCHLEVEL)(((6) << 16L) | ((2) << 8) | (1))
641#if GCC_GMP_VERSION(((6) << 16L) | ((2) << 8) | (1)) < GCC_GMP_VERSION_NUM(4,3,0)(((4) << 16L) | ((3) << 8) | (0)) && __GNU_MP_VERSION_PATCHLEVEL1 == 0
642#define GCC_GMP_STRINGIFY_VERSION"6" "." "2" "." "1" \
643 GCC_GMP_STRINGIFY_VERSION2 (__GNU_MP_VERSION)"6" "." \
644 GCC_GMP_STRINGIFY_VERSION2 (__GNU_MP_VERSION_MINOR)"2"
645#else
646#define GCC_GMP_STRINGIFY_VERSION"6" "." "2" "." "1" \
647 GCC_GMP_STRINGIFY_VERSION2 (__GNU_MP_VERSION)"6" "." \
648 GCC_GMP_STRINGIFY_VERSION2 (__GNU_MP_VERSION_MINOR)"2" "." \
649 GCC_GMP_STRINGIFY_VERSION2 (__GNU_MP_VERSION_PATCHLEVEL)"1"
650#endif
651 fprintf (file,
652 file == stderrstderr ? _(fmt2)gettext (fmt2) : fmt2,
653 GCC_GMP_STRINGIFY_VERSION"6" "." "2" "." "1", MPFR_VERSION_STRING"4.1.0", MPC_VERSION_STRING"1.2.1",
654#ifndef HAVE_isl1
655 "none"
656#else
657 isl_version ()
658#endif
659 );
660 if (strcmp (GCC_GMP_STRINGIFY_VERSION"6" "." "2" "." "1", gmp_version__gmp_version))
661 fprintf (file,
662 file == stderrstderr ? _(fmt3)gettext (fmt3) : fmt3,
663 indent, *indent != 0 ? " " : "",
664 "GMP", GCC_GMP_STRINGIFY_VERSION"6" "." "2" "." "1", gmp_version__gmp_version);
665 if (strcmp (MPFR_VERSION_STRING"4.1.0", mpfr_get_version ()))
666 fprintf (file,
667 file == stderrstderr ? _(fmt3)gettext (fmt3) : fmt3,
668 indent, *indent != 0 ? " " : "",
669 "MPFR", MPFR_VERSION_STRING"4.1.0", mpfr_get_version ());
670 if (strcmp (MPC_VERSION_STRING"1.2.1", mpc_get_version ()))
671 fprintf (file,
672 file == stderrstderr ? _(fmt3)gettext (fmt3) : fmt3,
673 indent, *indent != 0 ? " " : "",
674 "MPC", MPC_VERSION_STRING"1.2.1", mpc_get_version ());
675
676 if (show_global_state)
677 {
678 fprintf (file,
679 file == stderrstderr ? _(fmt4)gettext (fmt4) : fmt4,
680 indent, *indent != 0 ? " " : "",
681 param_ggc_min_expandglobal_options.x_param_ggc_min_expand, param_ggc_min_heapsizeglobal_options.x_param_ggc_min_heapsize);
682
683 print_plugins_versions (file, indent);
684 }
685}
686
687
688
689/* Open assembly code output file. Do this even if -fsyntax-only is
690 on, because then the driver will have provided the name of a
691 temporary file or bit bucket for us. NAME is the file specified on
692 the command line, possibly NULL. */
693static void
694init_asm_output (const char *name)
695{
696 if (name == NULL__null && asm_file_nameglobal_options.x_asm_file_name == 0)
697 asm_out_file = stdoutstdout;
698 else
699 {
700 if (asm_file_nameglobal_options.x_asm_file_name == 0)
701 {
702 int len = strlen (dump_base_nameglobal_options.x_dump_base_name);
703 char *dumpname = XNEWVEC (char, len + 6)((char *) xmalloc (sizeof (char) * (len + 6)));
704
705 memcpy (dumpname, dump_base_nameglobal_options.x_dump_base_name, len + 1);
706 strip_off_ending (dumpname, len);
707 strcat (dumpname, ".s");
708 asm_file_nameglobal_options.x_asm_file_name = dumpname;
709 }
710 if (!strcmp (asm_file_nameglobal_options.x_asm_file_name, "-"))
711 asm_out_file = stdoutstdout;
712 else if (!canonical_filename_eq (asm_file_nameglobal_options.x_asm_file_name, name)
713 || !strcmp (asm_file_nameglobal_options.x_asm_file_name, HOST_BIT_BUCKET"/dev/null"))
714 asm_out_file = fopen (asm_file_nameglobal_options.x_asm_file_name, "w");
715 else
716 /* Use UNKOWN_LOCATION to prevent gcc from printing the first
717 line in the current file. */
718 fatal_error (UNKNOWN_LOCATION((location_t) 0),
719 "input file %qs is the same as output file",
720 asm_file_nameglobal_options.x_asm_file_name);
721 if (asm_out_file == 0)
722 fatal_error (UNKNOWN_LOCATION((location_t) 0),
723 "cannot open %qs for writing: %m", asm_file_nameglobal_options.x_asm_file_name);
724 }
725
726 if (!flag_syntax_onlyglobal_options.x_flag_syntax_only)
727 {
728 targetm.asm_out.file_start ();
729
730 if (flag_record_gcc_switchesglobal_options.x_flag_record_gcc_switches)
731 {
732 if (targetm.asm_out.record_gcc_switches)
733 {
734 const char *str
735 = gen_producer_string (lang_hooks.name,
736 save_decoded_options,
737 save_decoded_options_count);
738 targetm.asm_out.record_gcc_switches (str);
739 }
740 else
741 inform (UNKNOWN_LOCATION((location_t) 0),
742 "%<-frecord-gcc-switches%> is not supported by "
743 "the current target");
744 }
745
746 if (flag_verbose_asmglobal_options.x_flag_verbose_asm)
747 {
748 print_version (asm_out_file, ASM_COMMENT_START"#", true);
749 fputs (ASM_COMMENT_START"#", asm_out_file);
750 fputs (" options passed: ", asm_out_file);
751 fputs (gen_command_line_string (save_decoded_options,
752 save_decoded_options_count),
753 asm_out_file);
754 fputc ('\n', asm_out_file);
755 }
756 }
757}
758
759/* A helper function; used as the reallocator function for cpp's line
760 table. */
761static void *
762realloc_for_line_map (void *ptr, size_t len)
763{
764 return ggc_realloc (ptr, len);
765}
766
767/* A helper function: used as the allocator function for
768 identifier_to_locale. */
769static void *
770alloc_for_identifier_to_locale (size_t len)
771{
772 return ggc_alloc_atomic (len);
773}
774
775/* Output stack usage information. */
776static void
777output_stack_usage_1 (FILE *cf)
778{
779 static bool warning_issued = false;
780 enum stack_usage_kind_type { STATIC = 0, DYNAMIC, DYNAMIC_BOUNDED };
781 const char *stack_usage_kind_str[] = {
782 "static",
783 "dynamic",
784 "dynamic,bounded"
785 };
786 HOST_WIDE_INTlong stack_usage = current_function_static_stack_size((cfun + 0)->su->static_stack_size);
787 enum stack_usage_kind_type stack_usage_kind;
788
789 if (stack_usage < 0)
790 {
791 if (!warning_issued)
792 {
793 warning (0, "stack usage computation not supported for this target");
794 warning_issued = true;
795 }
796 return;
797 }
798
799 stack_usage_kind = STATIC;
800
801 /* Add the maximum amount of space pushed onto the stack. */
802 if (maybe_ne (current_function_pushed_stack_size((cfun + 0)->su->pushed_stack_size), 0))
803 {
804 HOST_WIDE_INTlong extra;
805 if (current_function_pushed_stack_size((cfun + 0)->su->pushed_stack_size).is_constant (&extra))
806 {
807 stack_usage += extra;
808 stack_usage_kind = DYNAMIC_BOUNDED;
809 }
810 else
811 {
812 extra = constant_lower_bound (current_function_pushed_stack_size((cfun + 0)->su->pushed_stack_size));
813 stack_usage += extra;
814 stack_usage_kind = DYNAMIC;
815 }
816 }
817
818 /* Now on to the tricky part: dynamic stack allocation. */
819 if (current_function_allocates_dynamic_stack_space(((cfun + 0)->su->dynamic_stack_size) != 0 || ((cfun + 0
)->su->has_unbounded_dynamic_stack_size))
)
820 {
821 if (stack_usage_kind != DYNAMIC)
822 {
823 if (current_function_has_unbounded_dynamic_stack_size((cfun + 0)->su->has_unbounded_dynamic_stack_size))
824 stack_usage_kind = DYNAMIC;
825 else
826 stack_usage_kind = DYNAMIC_BOUNDED;
827 }
828
829 /* Add the size even in the unbounded case, this can't hurt. */
830 stack_usage += current_function_dynamic_stack_size((cfun + 0)->su->dynamic_stack_size);
831 }
832
833 if (cf && flag_callgraph_infoglobal_options.x_flag_callgraph_info & CALLGRAPH_INFO_STACK_USAGE)
834 fprintf (cf, "\\n" HOST_WIDE_INT_PRINT_DEC"%" "l" "d" " bytes (%s)",
835 stack_usage,
836 stack_usage_kind_str[stack_usage_kind]);
837
838 if (stack_usage_file)
839 {
840 print_decl_identifier (stack_usage_file, current_function_decl,
841 PRINT_DECL_ORIGIN0x1 | PRINT_DECL_NAME0x2);
842 fprintf (stack_usage_file, "\t" HOST_WIDE_INT_PRINT_DEC"%" "l" "d""\t%s\n",
843 stack_usage, stack_usage_kind_str[stack_usage_kind]);
844 }
845
846 if (warn_stack_usageglobal_options.x_warn_stack_usage >= 0 && warn_stack_usageglobal_options.x_warn_stack_usage < HOST_WIDE_INT_MAX(~((long) (1UL << (64 - 1)))))
847 {
848 const location_t loc = DECL_SOURCE_LOCATION (current_function_decl)((contains_struct_check ((current_function_decl), (TS_DECL_MINIMAL
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/toplev.c"
, 848, __FUNCTION__))->decl_minimal.locus)
;
849
850 if (stack_usage_kind == DYNAMIC)
851 warning_at (loc, OPT_Wstack_usage_, "stack usage might be unbounded");
852 else if (stack_usage > warn_stack_usageglobal_options.x_warn_stack_usage)
853 {
854 if (stack_usage_kind == DYNAMIC_BOUNDED)
855 warning_at (loc,
856 OPT_Wstack_usage_, "stack usage might be %wu bytes",
857 stack_usage);
858 else
859 warning_at (loc, OPT_Wstack_usage_, "stack usage is %wu bytes",
860 stack_usage);
861 }
862 }
863}
864
865/* Dump placeholder node for indirect calls in VCG format. */
866
867#define INDIRECT_CALL_NAME"__indirect_call" "__indirect_call"
868
869static void
870dump_final_node_vcg_start (FILE *f, tree decl)
871{
872 fputs ("node: { title: \"", f);
873 if (decl)
874 print_decl_identifier (f, decl, PRINT_DECL_UNIQUE_NAME0x4);
875 else
876 fputs (INDIRECT_CALL_NAME"__indirect_call", f);
877 fputs ("\" label: \"", f);
878 if (decl)
879 {
880 print_decl_identifier (f, decl, PRINT_DECL_NAME0x2);
881 fputs ("\\n", f);
882 print_decl_identifier (f, decl, PRINT_DECL_ORIGIN0x1);
883 }
884 else
885 fputs ("Indirect Call Placeholder", f);
886}
887
888/* Dump final cgraph edge in VCG format. */
889
890static void
891dump_final_callee_vcg (FILE *f, location_t location, tree callee)
892{
893 if ((!callee || DECL_EXTERNAL (callee)((contains_struct_check ((callee), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/toplev.c"
, 893, __FUNCTION__))->decl_common.decl_flag_1)
)
894 && bitmap_set_bit (callgraph_info_external_printed,
895 callee ? DECL_UID (callee)((contains_struct_check ((callee), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/toplev.c"
, 895, __FUNCTION__))->decl_minimal.uid)
+ 1 : 0))
896 {
897 dump_final_node_vcg_start (f, callee);
898 fputs ("\" shape : ellipse }\n", f);
899 }
900
901 fputs ("edge: { sourcename: \"", f);
902 print_decl_identifier (f, current_function_decl, PRINT_DECL_UNIQUE_NAME0x4);
903 fputs ("\" targetname: \"", f);
904 if (callee)
905 print_decl_identifier (f, callee, PRINT_DECL_UNIQUE_NAME0x4);
906 else
907 fputs (INDIRECT_CALL_NAME"__indirect_call", f);
908 if (LOCATION_LOCUS (location)((IS_ADHOC_LOC (location)) ? get_location_from_adhoc_loc (line_table
, location) : (location))
!= UNKNOWN_LOCATION((location_t) 0))
909 {
910 expanded_location loc;
911 fputs ("\" label: \"", f);
912 loc = expand_location (location);
913 fprintf (f, "%s:%d:%d", loc.file, loc.line, loc.column);
914 }
915 fputs ("\" }\n", f);
916}
917
918/* Dump final cgraph node in VCG format. */
919
920static void
921dump_final_node_vcg (FILE *f)
922{
923 dump_final_node_vcg_start (f, current_function_decl);
924
925 if (flag_stack_usage_infoglobal_options.x_flag_stack_usage_info
926 || (flag_callgraph_infoglobal_options.x_flag_callgraph_info & CALLGRAPH_INFO_STACK_USAGE))
927 output_stack_usage_1 (f);
928
929 if (flag_callgraph_infoglobal_options.x_flag_callgraph_info & CALLGRAPH_INFO_DYNAMIC_ALLOC)
930 {
931 fprintf (f, "\\n%u dynamic objects", vec_safe_length (cfun(cfun + 0)->su->dallocs));
932
933 unsigned i;
934 callinfo_dalloc *cda;
935 FOR_EACH_VEC_SAFE_ELT (cfun->su->dallocs, i, cda)for (i = 0; vec_safe_iterate (((cfun + 0)->su->dallocs)
, (i), &(cda)); ++(i))
936 {
937 expanded_location loc = expand_location (cda->location);
938 fprintf (f, "\\n %s", cda->name);
939 fprintf (f, " %s:%d:%d", loc.file, loc.line, loc.column);
940 }
941
942 vec_free (cfun(cfun + 0)->su->dallocs);
943 cfun(cfun + 0)->su->dallocs = NULL__null;
944 }
945
946 fputs ("\" }\n", f);
947
948 unsigned i;
949 callinfo_callee *c;
950 FOR_EACH_VEC_SAFE_ELT (cfun->su->callees, i, c)for (i = 0; vec_safe_iterate (((cfun + 0)->su->callees)
, (i), &(c)); ++(i))
951 dump_final_callee_vcg (f, c->location, c->decl);
952 vec_free (cfun(cfun + 0)->su->callees);
953 cfun(cfun + 0)->su->callees = NULL__null;
954}
955
956/* Output stack usage and callgraph info, as requested. */
957void
958output_stack_usage (void)
959{
960 if (flag_callgraph_infoglobal_options.x_flag_callgraph_info)
961 dump_final_node_vcg (callgraph_info_file);
962 else
963 output_stack_usage_1 (NULL__null);
964}
965
966/* Open an auxiliary output file. */
967static FILE *
968open_auxiliary_file (const char *ext)
969{
970 char *filename;
971 FILE *file;
972
973 filename = concat (aux_base_nameglobal_options.x_aux_base_name, ".", ext, NULL__null);
974 file = fopen (filename, "w");
975 if (!file)
976 fatal_error (input_location, "cannot open %s for writing: %m", filename);
977 free (filename);
978 return file;
979}
980
981/* Alternative diagnostics callback for reentered ICE reporting. */
982
983static void
984internal_error_reentered (diagnostic_context *, const char *, va_list *)
985{
986 /* Flush the dump file if emergency_dump_function itself caused an ICE. */
987 if (dump_file)
988 fflush (dump_file);
989}
990
991/* Auxiliary callback for the diagnostics code. */
992
993static void
994internal_error_function (diagnostic_context *, const char *, va_list *)
995{
996 global_dc->internal_error = internal_error_reentered;
997 warn_if_plugins ();
998 emergency_dump_function ();
999}
1000
1001/* Initialization of the front end environment, before command line
1002 options are parsed. Signal handlers, internationalization etc.
1003 ARGV0 is main's argv[0]. */
1004static void
1005general_init (const char *argv0, bool init_signals)
1006{
1007 const char *p;
1008
1009 p = argv0 + strlen (argv0);
1010 while (p != argv0 && !IS_DIR_SEPARATOR (p[-1])(((p[-1]) == '/') || (((p[-1]) == '\\') && (0))))
1011 --p;
1012 progname = p;
1013
1014 xmalloc_set_program_name (progname);
1015
1016 hex_init ();
1017
1018 /* Unlock the stdio streams. */
1019 unlock_std_streams ();
1020
1021 gcc_init_libintl ();
1022
1023 identifier_to_locale_alloc = alloc_for_identifier_to_locale;
1024 identifier_to_locale_free = ggc_free;
1025
1026 /* Initialize the diagnostics reporting machinery, so option parsing
1027 can give warnings and errors. */
1028 diagnostic_initialize (global_dc, N_OPTS);
1029 global_dc->lang_mask = lang_hooks.option_lang_mask ();
1030 /* Set a default printer. Language specific initializations will
1031 override it later. */
1032 tree_diagnostics_defaults (global_dc);
1033
1034 global_dc->show_caret
1035 = global_options_init.x_flag_diagnostics_show_caret;
1036 global_dc->show_labels_p
1037 = global_options_init.x_flag_diagnostics_show_labels;
1038 global_dc->show_line_numbers_p
1039 = global_options_init.x_flag_diagnostics_show_line_numbers;
1040 global_dc->show_cwe
1041 = global_options_init.x_flag_diagnostics_show_cwe;
1042 global_dc->path_format
1043 = (enum diagnostic_path_format)global_options_init.x_flag_diagnostics_path_format;
1044 global_dc->show_path_depths
1045 = global_options_init.x_flag_diagnostics_show_path_depths;
1046 global_dc->show_option_requested
1047 = global_options_init.x_flag_diagnostics_show_option;
1048 global_dc->min_margin_width
1049 = global_options_init.x_diagnostics_minimum_margin_width;
1050 global_dc->show_column
1051 = global_options_init.x_flag_show_column;
1052 global_dc->internal_error = internal_error_function;
1053 global_dc->option_enabled = option_enabled;
1054 global_dc->option_state = &global_options;
1055 global_dc->option_name = option_name;
1056 global_dc->get_option_url = get_option_url;
1057
1058 if (init_signals)
1059 {
1060 /* Trap fatal signals, e.g. SIGSEGV, and convert them to ICE messages. */
1061#ifdef SIGSEGV11
1062 signal (SIGSEGV11, crash_signal);
1063#endif
1064#ifdef SIGILL4
1065 signal (SIGILL4, crash_signal);
1066#endif
1067#ifdef SIGBUS7
1068 signal (SIGBUS7, crash_signal);
1069#endif
1070#ifdef SIGABRT6
1071 signal (SIGABRT6, crash_signal);
1072#endif
1073#if defined SIGIOT6 && (!defined SIGABRT6 || SIGABRT6 != SIGIOT6)
1074 signal (SIGIOT6, crash_signal);
1075#endif
1076#ifdef SIGFPE8
1077 signal (SIGFPE8, crash_signal);
1078#endif
1079
1080 /* Other host-specific signal setup. */
1081 (*host_hooks.extra_signals)();
1082 }
1083
1084 /* Initialize the garbage-collector, string pools and tree type hash
1085 table. */
1086 init_ggc ();
1087 init_stringpool ();
1088 input_location = UNKNOWN_LOCATION((location_t) 0);
1089 line_table = ggc_alloc<line_maps> ();
1090 linemap_init (line_table, BUILTINS_LOCATION((location_t) 1));
1091 line_table->reallocator = realloc_for_line_map;
1092 line_table->round_alloc_size = ggc_round_alloc_size;
1093 line_table->default_range_bits = 5;
1094 init_ttree ();
1095
1096 /* Initialize register usage now so switches may override. */
1097 init_reg_sets ();
1098
1099 /* Create the singleton holder for global state. This creates the
1100 dump manager. */
1101 g = new gcc::context ();
1102
1103 /* Allow languages and middle-end to register their dumps before the
1104 optimization passes. */
1105 g->get_dumps ()->register_dumps ();
1106
1107 /* Create the passes. */
1108 g->set_passes (new gcc::pass_manager (g));
1109
1110 symtab = new (ggc_alloc <symbol_table> ()) symbol_table ();
1111
1112 statistics_early_init ();
1113 debuginfo_early_init ();
1114}
1115
1116/* Return true if the current target supports -fsection-anchors. */
1117
1118static bool
1119target_supports_section_anchors_p (void)
1120{
1121 if (targetm.min_anchor_offset == 0 && targetm.max_anchor_offset == 0)
1122 return false;
1123
1124 if (targetm.asm_out.output_anchor == NULL__null)
1125 return false;
1126
1127 return true;
1128}
1129
1130/* Parse "N[:M][:...]" into struct align_flags A.
1131 VALUES contains parsed values (in reverse order), all processed
1132 values are popped. */
1133
1134static void
1135read_log_maxskip (auto_vec<unsigned> &values, align_flags_tuple *a)
1136{
1137 unsigned n = values.pop ();
1138 if (n != 0)
9
Assuming 'n' is not equal to 0
10
Taking true branch
1139 a->log = floor_log2 (n * 2 - 1);
11
Calling 'floor_log2'
13
Returning from 'floor_log2'
14
The value -1 is assigned to field 'log'
1140
1141 if (values.is_empty ())
15
Assuming the condition is true
16
Taking true branch
1142 a->maxskip = n
16.1
'n' is not equal to 0
16.1
'n' is not equal to 0
16.1
'n' is not equal to 0
? n - 1 : 0;
17
'?' condition is true
1143 else
1144 {
1145 unsigned m = values.pop ();
1146 /* -falign-foo=N:M means M-1 max bytes of padding, not M. */
1147 if (m > 0)
1148 m--;
1149 a->maxskip = m;
1150 }
1151
1152 /* Normalize the tuple. */
1153 a->normalize ();
18
Calling 'align_flags_tuple::normalize'
1154}
1155
1156/* Parse "N[:M[:N2[:M2]]]" string FLAG into a pair of struct align_flags. */
1157
1158static void
1159parse_N_M (const char *flag, align_flags &a)
1160{
1161 if (flag)
2
Assuming 'flag' is non-null
3
Taking true branch
1162 {
1163 static hash_map <nofree_string_hash, align_flags> cache;
1164 align_flags *entry = cache.get (flag);
1165 if (entry)
4
Assuming 'entry' is null
5
Taking false branch
1166 {
1167 a = *entry;
1168 return;
1169 }
1170
1171 auto_vec<unsigned> result_values;
1172 bool r = parse_and_check_align_values (flag, NULL__null, result_values, false,
1173 UNKNOWN_LOCATION((location_t) 0));
1174 if (!r)
6
Assuming 'r' is true
7
Taking false branch
1175 return;
1176
1177 /* Reverse values for easier manipulation. */
1178 result_values.reverse ();
1179
1180 read_log_maxskip (result_values, &a.levels[0]);
8
Calling 'read_log_maxskip'
1181 if (!result_values.is_empty ())
1182 read_log_maxskip (result_values, &a.levels[1]);
1183#ifdef SUBALIGN_LOG3
1184 else
1185 {
1186 /* N2[:M2] is not specified. This arch has a default for N2.
1187 Before -falign-foo=N:M:N2:M2 was introduced, x86 had a tweak.
1188 -falign-functions=N with N > 8 was adding secondary alignment.
1189 -falign-functions=10 was emitting this before every function:
1190 .p2align 4,,9
1191 .p2align 3
1192 Now this behavior (and more) can be explicitly requested:
1193 -falign-functions=16:10:8
1194 Retain old behavior if N2 is missing: */
1195
1196 int align = 1 << a.levels[0].log;
1197 int subalign = 1 << SUBALIGN_LOG3;
1198
1199 if (a.levels[0].log > SUBALIGN_LOG3
1200 && a.levels[0].maxskip >= subalign - 1)
1201 {
1202 /* Set N2 unless subalign can never have any effect. */
1203 if (align > a.levels[0].maxskip + 1)
1204 {
1205 a.levels[1].log = SUBALIGN_LOG3;
1206 a.levels[1].normalize ();
1207 }
1208 }
1209 }
1210#endif
1211
1212 /* Cache seen value. */
1213 cache.put (flag, a);
1214 }
1215}
1216
1217/* Process -falign-foo=N[:M[:N2[:M2]]] options. */
1218
1219void
1220parse_alignment_opts (void)
1221{
1222 parse_N_M (str_align_loopsglobal_options.x_str_align_loops, align_loops(this_target_flag_state->x_align_loops));
1
Calling 'parse_N_M'
1223 parse_N_M (str_align_jumpsglobal_options.x_str_align_jumps, align_jumps(this_target_flag_state->x_align_jumps));
1224 parse_N_M (str_align_labelsglobal_options.x_str_align_labels, align_labels(this_target_flag_state->x_align_labels));
1225 parse_N_M (str_align_functionsglobal_options.x_str_align_functions, align_functions(this_target_flag_state->x_align_functions));
1226}
1227
1228/* Process the options that have been parsed. */
1229static void
1230process_options (void)
1231{
1232 /* Just in case lang_hooks.post_options ends up calling a debug_hook.
1233 This can happen with incorrect pre-processed input. */
1234 debug_hooks = &do_nothing_debug_hooks;
1235
1236 maximum_field_alignment = initial_max_fld_alignglobal_options.x_initial_max_fld_align * BITS_PER_UNIT(8);
1237
1238 /* Allow the front end to perform consistency checks and do further
1239 initialization based on the command line options. This hook also
1240 sets the original filename if appropriate (e.g. foo.i -> foo.c)
1241 so we can correctly initialize debug output. */
1242 no_backend = lang_hooks.post_options (&main_input_filenameglobal_options.x_main_input_filename);
1243
1244 /* Some machines may reject certain combinations of options. */
1245 location_t saved_location = input_location;
1246 input_location = UNKNOWN_LOCATION((location_t) 0);
1247 targetm.target_option.override ();
1248 input_location = saved_location;
1249
1250 if (flag_diagnostics_generate_patchglobal_options.x_flag_diagnostics_generate_patch)
1251 global_dc->edit_context_ptr = new edit_context ();
1252
1253 /* Avoid any informative notes in the second run of -fcompare-debug. */
1254 if (flag_compare_debugglobal_options.x_flag_compare_debug)
1255 diagnostic_inhibit_notes (global_dc);
1256
1257 if (flag_section_anchorsglobal_options.x_flag_section_anchors && !target_supports_section_anchors_p ())
1258 {
1259 warning_at (UNKNOWN_LOCATION((location_t) 0), OPT_fsection_anchors,
1260 "this target does not support %qs",
1261 "-fsection-anchors");
1262 flag_section_anchorsglobal_options.x_flag_section_anchors = 0;
1263 }
1264
1265 if (flag_short_enumsglobal_options.x_flag_short_enums == 2)
1266 flag_short_enumsglobal_options.x_flag_short_enums = targetm.default_short_enums ();
1267
1268 /* Set aux_base_name if not already set. */
1269 if (aux_base_nameglobal_options.x_aux_base_name)
1270 ;
1271 else if (dump_base_nameglobal_options.x_dump_base_name)
1272 {
1273 const char *name = dump_base_nameglobal_options.x_dump_base_name;
1274 int nlen, len;
1275
1276 if (dump_base_extglobal_options.x_dump_base_ext && (len = strlen (dump_base_extglobal_options.x_dump_base_ext))
1277 && (nlen = strlen (name)) && nlen > len
1278 && strcmp (name + nlen - len, dump_base_extglobal_options.x_dump_base_ext) == 0)
1279 {
1280 char *p = xstrndup (name, nlen - len);
1281 name = p;
1282 }
1283
1284 aux_base_nameglobal_options.x_aux_base_name = name;
1285 }
1286 else
1287 aux_base_nameglobal_options.x_aux_base_name = "gccaux";
1288
1289#ifndef HAVE_isl1
1290 if (flag_graphiteglobal_options.x_flag_graphite
1291 || flag_loop_nest_optimizeglobal_options.x_flag_loop_nest_optimize
1292 || flag_graphite_identityglobal_options.x_flag_graphite_identity
1293 || flag_loop_parallelize_allglobal_options.x_flag_loop_parallelize_all)
1294 sorry ("Graphite loop optimizations cannot be used (isl is not available) "
1295 "(%<-fgraphite%>, %<-fgraphite-identity%>, "
1296 "%<-floop-nest-optimize%>, %<-floop-parallelize-all%>)");
1297#endif
1298
1299 if (flag_cf_protectionglobal_options.x_flag_cf_protection != CF_NONE
1300 && !(flag_cf_protectionglobal_options.x_flag_cf_protection & CF_SET))
1301 {
1302 if (flag_cf_protectionglobal_options.x_flag_cf_protection == CF_FULL)
1303 {
1304 error_at (UNKNOWN_LOCATION((location_t) 0),
1305 "%<-fcf-protection=full%> is not supported for this "
1306 "target");
1307 flag_cf_protectionglobal_options.x_flag_cf_protection = CF_NONE;
1308 }
1309 if (flag_cf_protectionglobal_options.x_flag_cf_protection == CF_BRANCH)
1310 {
1311 error_at (UNKNOWN_LOCATION((location_t) 0),
1312 "%<-fcf-protection=branch%> is not supported for this "
1313 "target");
1314 flag_cf_protectionglobal_options.x_flag_cf_protection = CF_NONE;
1315 }
1316 if (flag_cf_protectionglobal_options.x_flag_cf_protection == CF_RETURN)
1317 {
1318 error_at (UNKNOWN_LOCATION((location_t) 0),
1319 "%<-fcf-protection=return%> is not supported for this "
1320 "target");
1321 flag_cf_protectionglobal_options.x_flag_cf_protection = CF_NONE;
1322 }
1323 }
1324
1325 /* One region RA really helps to decrease the code size. */
1326 if (flag_ira_regionglobal_options.x_flag_ira_region == IRA_REGION_AUTODETECT)
1327 flag_ira_regionglobal_options.x_flag_ira_region
1328 = optimize_sizeglobal_options.x_optimize_size || !optimizeglobal_options.x_optimize ? IRA_REGION_ONE : IRA_REGION_MIXED;
1329
1330 if (!abi_version_at_least (2)(global_options.x_flag_abi_version == 0 || global_options.x_flag_abi_version
>= (2))
)
1331 {
1332 /* -fabi-version=1 support was removed after GCC 4.9. */
1333 error_at (UNKNOWN_LOCATION((location_t) 0),
1334 "%<-fabi-version=1%> is no longer supported");
1335 flag_abi_versionglobal_options.x_flag_abi_version = 2;
1336 }
1337
1338 /* web and rename-registers help when run after loop unrolling. */
1339 if (flag_webglobal_options.x_flag_web == AUTODETECT_VALUE2)
1340 flag_webglobal_options.x_flag_web = flag_unroll_loopsglobal_options.x_flag_unroll_loops;
1341
1342 if (flag_rename_registersglobal_options.x_flag_rename_registers == AUTODETECT_VALUE2)
1343 flag_rename_registersglobal_options.x_flag_rename_registers = flag_unroll_loopsglobal_options.x_flag_unroll_loops;
1344
1345 if (flag_non_call_exceptionsglobal_options.x_flag_non_call_exceptions)
1346 flag_asynchronous_unwind_tablesglobal_options.x_flag_asynchronous_unwind_tables = 1;
1347 if (flag_asynchronous_unwind_tablesglobal_options.x_flag_asynchronous_unwind_tables)
1348 flag_unwind_tablesglobal_options.x_flag_unwind_tables = 1;
1349
1350 if (flag_value_profile_transformationsglobal_options.x_flag_value_profile_transformations)
1351 flag_profile_valuesglobal_options.x_flag_profile_values = 1;
1352
1353 /* Warn about options that are not supported on this machine. */
1354#ifndef INSN_SCHEDULING
1355 if (flag_schedule_insnsglobal_options.x_flag_schedule_insns || flag_schedule_insns_after_reloadglobal_options.x_flag_schedule_insns_after_reload)
1356 warning_at (UNKNOWN_LOCATION((location_t) 0), 0,
1357 "instruction scheduling not supported on this target machine");
1358#endif
1359 if (!DELAY_SLOTS0 && flag_delayed_branchglobal_options.x_flag_delayed_branch)
1360 warning_at (UNKNOWN_LOCATION((location_t) 0), 0,
1361 "this target machine does not have delayed branches");
1362
1363 user_label_prefix = USER_LABEL_PREFIX"";
1364 if (flag_leading_underscoreglobal_options.x_flag_leading_underscore != -1)
1365 {
1366 /* If the default prefix is more complicated than "" or "_",
1367 issue a warning and ignore this option. */
1368 if (user_label_prefix[0] == 0 ||
1369 (user_label_prefix[0] == '_' && user_label_prefix[1] == 0))
1370 {
1371 user_label_prefix = flag_leading_underscoreglobal_options.x_flag_leading_underscore ? "_" : "";
1372 }
1373 else
1374 warning_at (UNKNOWN_LOCATION((location_t) 0), 0,
1375 "%<-f%sleading-underscore%> not supported on this "
1376 "target machine", flag_leading_underscoreglobal_options.x_flag_leading_underscore ? "" : "no-");
1377 }
1378
1379 /* If we are in verbose mode, write out the version and maybe all the
1380 option flags in use. */
1381 if (version_flagglobal_options.x_version_flag)
1382 {
1383 print_version (stderrstderr, "", true);
1384 if (!quiet_flagglobal_options.x_quiet_flag)
1385 {
1386 fputs ("options passed: ", stderrstderr);
1387 fputs (gen_command_line_string (save_decoded_options,
1388 save_decoded_options_count), stderrstderr);
1389 fputc ('\n', stderrstderr);
1390 }
1391 }
1392
1393 if (flag_syntax_onlyglobal_options.x_flag_syntax_only)
1394 {
1395 write_symbolsglobal_options.x_write_symbols = NO_DEBUG;
1396 profile_flagglobal_options.x_profile_flag = 0;
1397 }
1398
1399 if (flag_gtoggleglobal_options.x_flag_gtoggle)
1400 {
1401 if (debug_info_levelglobal_options.x_debug_info_level == DINFO_LEVEL_NONE)
1402 {
1403 debug_info_levelglobal_options.x_debug_info_level = DINFO_LEVEL_NORMAL;
1404
1405 if (write_symbolsglobal_options.x_write_symbols == NO_DEBUG)
1406 write_symbolsglobal_options.x_write_symbols = PREFERRED_DEBUGGING_TYPEDWARF2_DEBUG;
1407 }
1408 else
1409 debug_info_levelglobal_options.x_debug_info_level = DINFO_LEVEL_NONE;
1410 }
1411
1412 if (flag_dump_final_insnsglobal_options.x_flag_dump_final_insns && !flag_syntax_onlyglobal_options.x_flag_syntax_only && !no_backend)
1413 {
1414 FILE *final_output = fopen (flag_dump_final_insnsglobal_options.x_flag_dump_final_insns, "w");
1415 if (!final_output)
1416 {
1417 error_at (UNKNOWN_LOCATION((location_t) 0),
1418 "could not open final insn dump file %qs: %m",
1419 flag_dump_final_insnsglobal_options.x_flag_dump_final_insns);
1420 flag_dump_final_insnsglobal_options.x_flag_dump_final_insns = NULL__null;
1421 }
1422 else if (fclose (final_output))
1423 {
1424 error_at (UNKNOWN_LOCATION((location_t) 0),
1425 "could not close zeroed insn dump file %qs: %m",
1426 flag_dump_final_insnsglobal_options.x_flag_dump_final_insns);
1427 flag_dump_final_insnsglobal_options.x_flag_dump_final_insns = NULL__null;
1428 }
1429 }
1430
1431 /* A lot of code assumes write_symbols == NO_DEBUG if the debugging
1432 level is 0. */
1433 if (debug_info_levelglobal_options.x_debug_info_level == DINFO_LEVEL_NONE)
1434 write_symbolsglobal_options.x_write_symbols = NO_DEBUG;
1435
1436 if (write_symbolsglobal_options.x_write_symbols == NO_DEBUG)
1437 ;
1438#if defined(DBX_DEBUGGING_INFO1)
1439 else if (write_symbolsglobal_options.x_write_symbols == DBX_DEBUG)
1440 debug_hooks = &dbx_debug_hooks;
1441#endif
1442#if defined(XCOFF_DEBUGGING_INFO)
1443 else if (write_symbolsglobal_options.x_write_symbols == XCOFF_DEBUG)
1444 debug_hooks = &xcoff_debug_hooks;
1445#endif
1446#ifdef DWARF2_DEBUGGING_INFO1
1447 else if (write_symbolsglobal_options.x_write_symbols == DWARF2_DEBUG)
1448 debug_hooks = &dwarf2_debug_hooks;
1449#endif
1450#ifdef VMS_DEBUGGING_INFO
1451 else if (write_symbolsglobal_options.x_write_symbols == VMS_DEBUG || write_symbolsglobal_options.x_write_symbols == VMS_AND_DWARF2_DEBUG)
1452 debug_hooks = &vmsdbg_debug_hooks;
1453#endif
1454#ifdef DWARF2_LINENO_DEBUGGING_INFO
1455 else if (write_symbolsglobal_options.x_write_symbols == DWARF2_DEBUG)
1456 debug_hooks = &dwarf2_lineno_debug_hooks;
1457#endif
1458 else
1459 error_at (UNKNOWN_LOCATION((location_t) 0),
1460 "target system does not support the %qs debug format",
1461 debug_type_names[write_symbolsglobal_options.x_write_symbols]);
1462
1463 /* We know which debug output will be used so we can set flag_var_tracking
1464 and flag_var_tracking_uninit if the user has not specified them. */
1465 if (debug_info_levelglobal_options.x_debug_info_level < DINFO_LEVEL_NORMAL
1466 || debug_hooks->var_location == do_nothing_debug_hooks.var_location)
1467 {
1468 if (flag_var_trackingglobal_options.x_flag_var_tracking == 1
1469 || flag_var_tracking_uninitglobal_options.x_flag_var_tracking_uninit == 1)
1470 {
1471 if (debug_info_levelglobal_options.x_debug_info_level < DINFO_LEVEL_NORMAL)
1472 warning_at (UNKNOWN_LOCATION((location_t) 0), 0,
1473 "variable tracking requested, but useless unless "
1474 "producing debug info");
1475 else
1476 warning_at (UNKNOWN_LOCATION((location_t) 0), 0,
1477 "variable tracking requested, but not supported "
1478 "by this debug format");
1479 }
1480 flag_var_trackingglobal_options.x_flag_var_tracking = 0;
1481 flag_var_tracking_uninitglobal_options.x_flag_var_tracking_uninit = 0;
1482 }
1483
1484 /* The debug hooks are used to implement -fdump-go-spec because it
1485 gives a simple and stable API for all the information we need to
1486 dump. */
1487 if (flag_dump_go_specglobal_options.x_flag_dump_go_spec != NULL__null)
1488 debug_hooks = dump_go_spec_init (flag_dump_go_specglobal_options.x_flag_dump_go_spec, debug_hooks);
1489
1490 /* If the user specifically requested variable tracking with tagging
1491 uninitialized variables, we need to turn on variable tracking.
1492 (We already determined above that variable tracking is feasible.) */
1493 if (flag_var_tracking_uninitglobal_options.x_flag_var_tracking_uninit == 1)
1494 flag_var_trackingglobal_options.x_flag_var_tracking = 1;
1495
1496 if (flag_var_trackingglobal_options.x_flag_var_tracking == AUTODETECT_VALUE2)
1497 flag_var_trackingglobal_options.x_flag_var_tracking = optimizeglobal_options.x_optimize >= 1;
1498
1499 if (flag_var_tracking_uninitglobal_options.x_flag_var_tracking_uninit == AUTODETECT_VALUE2)
1500 flag_var_tracking_uninitglobal_options.x_flag_var_tracking_uninit = flag_var_trackingglobal_options.x_flag_var_tracking;
1501
1502 if (flag_var_tracking_assignmentsglobal_options.x_flag_var_tracking_assignments == AUTODETECT_VALUE2)
1503 flag_var_tracking_assignmentsglobal_options.x_flag_var_tracking_assignments
1504 = (flag_var_trackingglobal_options.x_flag_var_tracking
1505 && !(flag_selective_schedulingglobal_options.x_flag_selective_scheduling || flag_selective_scheduling2global_options.x_flag_selective_scheduling2));
1506
1507 if (flag_var_tracking_assignments_toggleglobal_options.x_flag_var_tracking_assignments_toggle)
1508 flag_var_tracking_assignmentsglobal_options.x_flag_var_tracking_assignments = !flag_var_tracking_assignmentsglobal_options.x_flag_var_tracking_assignments;
1509
1510 if (flag_var_tracking_assignmentsglobal_options.x_flag_var_tracking_assignments && !flag_var_trackingglobal_options.x_flag_var_tracking)
1511 flag_var_trackingglobal_options.x_flag_var_tracking = flag_var_tracking_assignmentsglobal_options.x_flag_var_tracking_assignments = -1;
1512
1513 if (flag_var_tracking_assignmentsglobal_options.x_flag_var_tracking_assignments
1514 && (flag_selective_schedulingglobal_options.x_flag_selective_scheduling || flag_selective_scheduling2global_options.x_flag_selective_scheduling2))
1515 warning_at (UNKNOWN_LOCATION((location_t) 0), 0,
1516 "var-tracking-assignments changes selective scheduling");
1517
1518 if (debug_nonbind_markers_pglobal_options.x_debug_nonbind_markers_p == AUTODETECT_VALUE2)
1519 debug_nonbind_markers_pglobal_options.x_debug_nonbind_markers_p
1520 = (optimizeglobal_options.x_optimize
1521 && debug_info_levelglobal_options.x_debug_info_level >= DINFO_LEVEL_NORMAL
1522 && (write_symbolsglobal_options.x_write_symbols == DWARF2_DEBUG
1523 || write_symbolsglobal_options.x_write_symbols == VMS_AND_DWARF2_DEBUG)
1524 && !(flag_selective_schedulingglobal_options.x_flag_selective_scheduling || flag_selective_scheduling2global_options.x_flag_selective_scheduling2));
1525
1526 if (dwarf2out_as_loc_supportglobal_options.x_dwarf2out_as_loc_support == AUTODETECT_VALUE2)
1527 dwarf2out_as_loc_supportglobal_options.x_dwarf2out_as_loc_support
1528 = dwarf2out_default_as_loc_support ();
1529 if (dwarf2out_as_locview_supportglobal_options.x_dwarf2out_as_locview_support == AUTODETECT_VALUE2)
1530 dwarf2out_as_locview_supportglobal_options.x_dwarf2out_as_locview_support
1531 = dwarf2out_default_as_locview_support ();
1532
1533 if (debug_variable_location_viewsglobal_options.x_debug_variable_location_views == AUTODETECT_VALUE2)
1534 {
1535 debug_variable_location_viewsglobal_options.x_debug_variable_location_views
1536 = (flag_var_trackingglobal_options.x_flag_var_tracking
1537 && debug_info_levelglobal_options.x_debug_info_level >= DINFO_LEVEL_NORMAL
1538 && (write_symbolsglobal_options.x_write_symbols == DWARF2_DEBUG
1539 || write_symbolsglobal_options.x_write_symbols == VMS_AND_DWARF2_DEBUG)
1540 && !dwarf_strictglobal_options.x_dwarf_strict
1541 && dwarf2out_as_loc_supportglobal_options.x_dwarf2out_as_loc_support
1542 && dwarf2out_as_locview_supportglobal_options.x_dwarf2out_as_locview_support);
1543 }
1544 else if (debug_variable_location_viewsglobal_options.x_debug_variable_location_views == -1 && dwarf_versionglobal_options.x_dwarf_version != 5)
1545 {
1546 warning_at (UNKNOWN_LOCATION((location_t) 0), 0,
1547 "without %<-gdwarf-5%>, "
1548 "%<-gvariable-location-views=incompat5%> "
1549 "is equivalent to %<-gvariable-location-views%>");
1550 debug_variable_location_viewsglobal_options.x_debug_variable_location_views = 1;
1551 }
1552
1553 if (debug_internal_reset_location_viewsglobal_options.x_debug_internal_reset_location_views == 2)
1554 {
1555 debug_internal_reset_location_viewsglobal_options.x_debug_internal_reset_location_views
1556 = (debug_variable_location_viewsglobal_options.x_debug_variable_location_views
1557 && targetm.reset_location_view);
1558 }
1559 else if (debug_internal_reset_location_viewsglobal_options.x_debug_internal_reset_location_views
1560 && !debug_variable_location_viewsglobal_options.x_debug_variable_location_views)
1561 {
1562 warning_at (UNKNOWN_LOCATION((location_t) 0), 0,
1563 "%<-ginternal-reset-location-views%> is forced disabled "
1564 "without %<-gvariable-location-views%>");
1565 debug_internal_reset_location_viewsglobal_options.x_debug_internal_reset_location_views = 0;
1566 }
1567
1568 if (debug_inline_pointsglobal_options.x_debug_inline_points == AUTODETECT_VALUE2)
1569 debug_inline_pointsglobal_options.x_debug_inline_points = debug_variable_location_viewsglobal_options.x_debug_variable_location_views;
1570 else if (debug_inline_pointsglobal_options.x_debug_inline_points && !debug_nonbind_markers_pglobal_options.x_debug_nonbind_markers_p)
1571 {
1572 warning_at (UNKNOWN_LOCATION((location_t) 0), 0,
1573 "%<-ginline-points%> is forced disabled without "
1574 "%<-gstatement-frontiers%>");
1575 debug_inline_pointsglobal_options.x_debug_inline_points = 0;
1576 }
1577
1578 if (flag_tree_cselimglobal_options.x_flag_tree_cselim == AUTODETECT_VALUE2)
1579 {
1580 if (HAVE_conditional_move1)
1581 flag_tree_cselimglobal_options.x_flag_tree_cselim = 1;
1582 else
1583 flag_tree_cselimglobal_options.x_flag_tree_cselim = 0;
1584 }
1585
1586 /* If auxiliary info generation is desired, open the output file.
1587 This goes in the same directory as the source file--unlike
1588 all the other output files. */
1589 if (flag_gen_aux_infoglobal_options.x_flag_gen_aux_info)
1590 {
1591 aux_info_file = fopen (aux_info_file_nameglobal_options.x_aux_info_file_name, "w");
1592 if (aux_info_file == 0)
1593 fatal_error (UNKNOWN_LOCATION((location_t) 0),
1594 "cannot open %s: %m", aux_info_file_nameglobal_options.x_aux_info_file_name);
1595 }
1596
1597 if (!targetm_common.have_named_sections)
1598 {
1599 if (flag_function_sectionsglobal_options.x_flag_function_sections)
1600 {
1601 warning_at (UNKNOWN_LOCATION((location_t) 0), 0,
1602 "%<-ffunction-sections%> not supported for this target");
1603 flag_function_sectionsglobal_options.x_flag_function_sections = 0;
1604 }
1605 if (flag_data_sectionsglobal_options.x_flag_data_sections)
1606 {
1607 warning_at (UNKNOWN_LOCATION((location_t) 0), 0,
1608 "%<-fdata-sections%> not supported for this target");
1609 flag_data_sectionsglobal_options.x_flag_data_sections = 0;
1610 }
1611 }
1612
1613 if (flag_prefetch_loop_arraysglobal_options.x_flag_prefetch_loop_arrays > 0 && !targetm.code_for_prefetch)
1614 {
1615 warning_at (UNKNOWN_LOCATION((location_t) 0), 0,
1616 "%<-fprefetch-loop-arrays%> not supported for this target");
1617 flag_prefetch_loop_arraysglobal_options.x_flag_prefetch_loop_arrays = 0;
1618 }
1619 else if (flag_prefetch_loop_arraysglobal_options.x_flag_prefetch_loop_arrays > 0 && !targetm.have_prefetch ())
1620 {
1621 warning_at (UNKNOWN_LOCATION((location_t) 0), 0,
1622 "%<-fprefetch-loop-arrays%> not supported for this target "
1623 "(try %<-march%> switches)");
1624 flag_prefetch_loop_arraysglobal_options.x_flag_prefetch_loop_arrays = 0;
1625 }
1626
1627 /* This combination of options isn't handled for i386 targets and doesn't
1628 make much sense anyway, so don't allow it. */
1629 if (flag_prefetch_loop_arraysglobal_options.x_flag_prefetch_loop_arrays > 0 && optimize_sizeglobal_options.x_optimize_size)
1630 {
1631 warning_at (UNKNOWN_LOCATION((location_t) 0), 0,
1632 "%<-fprefetch-loop-arrays%> is not supported with %<-Os%>");
1633 flag_prefetch_loop_arraysglobal_options.x_flag_prefetch_loop_arrays = 0;
1634 }
1635
1636 /* The presence of IEEE signaling NaNs, implies all math can trap. */
1637 if (flag_signaling_nansglobal_options.x_flag_signaling_nans)
1638 flag_trapping_mathglobal_options.x_flag_trapping_math = 1;
1639
1640 /* We cannot reassociate if we want traps or signed zeros. */
1641 if (flag_associative_mathglobal_options.x_flag_associative_math && (flag_trapping_mathglobal_options.x_flag_trapping_math || flag_signed_zerosglobal_options.x_flag_signed_zeros))
1642 {
1643 warning_at (UNKNOWN_LOCATION((location_t) 0), 0,
1644 "%<-fassociative-math%> disabled; other options take "
1645 "precedence");
1646 flag_associative_mathglobal_options.x_flag_associative_math = 0;
1647 }
1648
1649 /* -fstack-clash-protection is not currently supported on targets
1650 where the stack grows up. */
1651 if (flag_stack_clash_protectionglobal_options.x_flag_stack_clash_protection && !STACK_GROWS_DOWNWARD1)
1652 {
1653 warning_at (UNKNOWN_LOCATION((location_t) 0), 0,
1654 "%<-fstack-clash-protection%> is not supported on targets "
1655 "where the stack grows from lower to higher addresses");
1656 flag_stack_clash_protectionglobal_options.x_flag_stack_clash_protection = 0;
1657 }
1658
1659 /* We cannot support -fstack-check= and -fstack-clash-protection at
1660 the same time. */
1661 if (flag_stack_checkglobal_options.x_flag_stack_check != NO_STACK_CHECK && flag_stack_clash_protectionglobal_options.x_flag_stack_clash_protection)
1662 {
1663 warning_at (UNKNOWN_LOCATION((location_t) 0), 0,
1664 "%<-fstack-check=%> and %<-fstack-clash_protection%> are "
1665 "mutually exclusive; disabling %<-fstack-check=%>");
1666 flag_stack_checkglobal_options.x_flag_stack_check = NO_STACK_CHECK;
1667 }
1668
1669 /* With -fcx-limited-range, we do cheap and quick complex arithmetic. */
1670 if (flag_cx_limited_rangeglobal_options.x_flag_cx_limited_range)
1671 flag_complex_methodglobal_options.x_flag_complex_method = 0;
1672
1673 /* With -fcx-fortran-rules, we do something in-between cheap and C99. */
1674 if (flag_cx_fortran_rulesglobal_options.x_flag_cx_fortran_rules)
1675 flag_complex_methodglobal_options.x_flag_complex_method = 1;
1676
1677 /* Targets must be able to place spill slots at lower addresses. If the
1678 target already uses a soft frame pointer, the transition is trivial. */
1679 if (!FRAME_GROWS_DOWNWARD1 && flag_stack_protectglobal_options.x_flag_stack_protect)
1680 {
1681 warning_at (UNKNOWN_LOCATION((location_t) 0), 0,
1682 "%<-fstack-protector%> not supported for this target");
1683 flag_stack_protectglobal_options.x_flag_stack_protect = 0;
1684 }
1685 if (!flag_stack_protectglobal_options.x_flag_stack_protect)
1686 warn_stack_protectglobal_options.x_warn_stack_protect = 0;
1687
1688 /* Address Sanitizer needs porting to each target architecture. */
1689
1690 if ((flag_sanitizeglobal_options.x_flag_sanitize & SANITIZE_ADDRESS)
1691 && !FRAME_GROWS_DOWNWARD1)
1692 {
1693 warning_at (UNKNOWN_LOCATION((location_t) 0), 0,
1694 "%<-fsanitize=address%> and %<-fsanitize=kernel-address%> "
1695 "are not supported for this target");
1696 flag_sanitizeglobal_options.x_flag_sanitize &= ~SANITIZE_ADDRESS;
1697 }
1698
1699 if ((flag_sanitizeglobal_options.x_flag_sanitize & SANITIZE_USER_ADDRESS)
1700 && ((targetm.asan_shadow_offset == NULL__null)
1701 || (targetm.asan_shadow_offset () == 0)))
1702 {
1703 warning_at (UNKNOWN_LOCATION((location_t) 0), 0,
1704 "%<-fsanitize=address%> not supported for this target");
1705 flag_sanitizeglobal_options.x_flag_sanitize &= ~SANITIZE_ADDRESS;
1706 }
1707
1708 if ((flag_sanitizeglobal_options.x_flag_sanitize & SANITIZE_KERNEL_ADDRESS)
1709 && (targetm.asan_shadow_offset == NULL__null
1710 && !asan_shadow_offset_set_p ()))
1711 {
1712 warning_at (UNKNOWN_LOCATION((location_t) 0), 0,
1713 "%<-fsanitize=kernel-address%> with stack protection "
1714 "is not supported without %<-fasan-shadow-offset=%> "
1715 "for this target");
1716 flag_sanitizeglobal_options.x_flag_sanitize &= ~SANITIZE_ADDRESS;
1717 }
1718
1719 /* HWAsan requires top byte ignore feature in the backend. */
1720 if (flag_sanitizeglobal_options.x_flag_sanitize & SANITIZE_HWADDRESS
1721 && ! targetm.memtag.can_tag_addresses ())
1722 {
1723 warning_at (UNKNOWN_LOCATION((location_t) 0), 0, "%qs is not supported for this target",
1724 "-fsanitize=hwaddress");
1725 flag_sanitizeglobal_options.x_flag_sanitize &= ~SANITIZE_HWADDRESS;
1726 }
1727
1728 /* Do not use IPA optimizations for register allocation if profiler is active
1729 or patchable function entries are inserted for run-time instrumentation
1730 or port does not emit prologue and epilogue as RTL. */
1731 if (profile_flagglobal_options.x_profile_flag || function_entry_patch_area_sizeglobal_options.x_function_entry_patch_area_size
1732 || !targetm.have_prologue () || !targetm.have_epilogue ())
1733 flag_ipa_raglobal_options.x_flag_ipa_ra = 0;
1734
1735 /* Enable -Werror=coverage-mismatch when -Werror and -Wno-error
1736 have not been set. */
1737 if (!global_options_set.x_warnings_are_errors
1738 && warn_coverage_mismatchglobal_options.x_warn_coverage_mismatch
1739 && (global_dc->classify_diagnostic[OPT_Wcoverage_mismatch] ==
1740 DK_UNSPECIFIED))
1741 diagnostic_classify_diagnostic (global_dc, OPT_Wcoverage_mismatch,
1742 DK_ERROR, UNKNOWN_LOCATION((location_t) 0));
1743
1744 /* Save the current optimization options. */
1745 optimization_default_nodeglobal_trees[TI_OPTIMIZATION_DEFAULT]
1746 = build_optimization_node (&global_options, &global_options_set);
1747 optimization_current_nodeglobal_trees[TI_OPTIMIZATION_CURRENT] = optimization_default_nodeglobal_trees[TI_OPTIMIZATION_DEFAULT];
1748
1749 if (flag_checkingglobal_options.x_flag_checking >= 2)
1750 hash_table_sanitize_eq_limit
1751 = param_hash_table_verification_limitglobal_options.x_param_hash_table_verification_limit;
1752
1753 if (flag_large_source_filesglobal_options.x_flag_large_source_files)
1754 line_table->default_range_bits = 0;
1755
1756 /* Please don't change global_options after this point, those changes won't
1757 be reflected in optimization_{default,current}_node. */
1758}
1759
1760/* This function can be called multiple times to reinitialize the compiler
1761 back end when register classes or instruction sets have changed,
1762 before each function. */
1763static void
1764backend_init_target (void)
1765{
1766 /* This depends on stack_pointer_rtx. */
1767 init_fake_stack_mems ();
1768
1769 /* Sets static_base_value[HARD_FRAME_POINTER_REGNUM], which is
1770 mode-dependent. */
1771 init_alias_target ();
1772
1773 /* Depends on HARD_FRAME_POINTER_REGNUM. */
1774 if (!ira_use_lra_p)
1775 init_reload ();
1776
1777 /* Depends on the enabled attribute. */
1778 recog_init ();
1779
1780 /* The following initialization functions need to generate rtl, so
1781 provide a dummy function context for them. */
1782 init_dummy_function_start ();
1783
1784 /* rtx_cost is mode-dependent, so cached values need to be recomputed
1785 on a mode change. */
1786 init_expmed ();
1787 init_lower_subreg ();
1788 init_set_costs ();
1789
1790 init_expr_target ();
1791 ira_init ();
1792
1793 /* We may need to recompute regno_save_code[] and regno_restore_code[]
1794 after a mode change as well. */
1795 caller_save_initialized_p(this_target_reload->x_caller_save_initialized_p) = false;
1796
1797 expand_dummy_function_end ();
1798}
1799
1800/* Initialize the compiler back end. This function is called only once,
1801 when starting the compiler. */
1802static void
1803backend_init (void)
1804{
1805 init_emit_once ();
1806
1807 init_rtlanal ();
1808 init_inline_once ();
1809 init_varasm_once ();
1810 save_register_info ();
1811
1812 /* Middle end needs this initialization for default mem attributes
1813 used by early calls to make_decl_rtl. */
1814 init_emit_regs ();
1815
1816 /* Middle end needs this initialization for mode tables used to assign
1817 modes to vector variables. */
1818 init_regs ();
1819}
1820
1821/* Initialize things that are both lang-dependent and target-dependent.
1822 This function can be called more than once if target parameters change. */
1823static void
1824lang_dependent_init_target (void)
1825{
1826 /* This creates various _DECL nodes, so needs to be called after the
1827 front end is initialized. It also depends on the HAVE_xxx macros
1828 generated from the target machine description. */
1829 init_optabs ();
1830
1831 gcc_assert (!this_target_rtl->target_specific_initialized)((void)(!(!this_target_rtl->target_specific_initialized) ?
fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/toplev.c"
, 1831, __FUNCTION__), 0 : 0))
;
1832}
1833
1834/* Perform initializations that are lang-dependent or target-dependent.
1835 but matters only for late optimizations and RTL generation. */
1836
1837static int rtl_initialized;
1838
1839void
1840initialize_rtl (void)
1841{
1842 auto_timevar tv (g_timer, TV_INITIALIZE_RTL);
1843
1844 /* Initialization done just once per compilation, but delayed
1845 till code generation. */
1846 if (!rtl_initialized)
1847 ira_init_once ();
1848 rtl_initialized = true;
1849
1850 /* Target specific RTL backend initialization. */
1851 if (!this_target_rtl->target_specific_initialized)
1852 {
1853 backend_init_target ();
1854 this_target_rtl->target_specific_initialized = true;
1855 }
1856}
1857
1858/* Language-dependent initialization. Returns nonzero on success. */
1859static int
1860lang_dependent_init (const char *name)
1861{
1862 location_t save_loc = input_location;
1863 if (!dump_base_nameglobal_options.x_dump_base_name)
1864 {
1865 dump_base_nameglobal_options.x_dump_base_name = name && name[0] ? name : "gccdump";
1866
1867 /* We do not want to derive a non-empty dumpbase-ext from an
1868 explicit -dumpbase argument, only from a defaulted
1869 dumpbase. */
1870 if (!dump_base_extglobal_options.x_dump_base_ext)
1871 {
1872 const char *base = lbasename (dump_base_nameglobal_options.x_dump_base_name);
1873 const char *ext = strrchr (base, '.');
1874 if (ext)
1875 dump_base_extglobal_options.x_dump_base_ext = ext;
1876 }
1877 }
1878
1879 /* Other front-end initialization. */
1880 input_location = BUILTINS_LOCATION((location_t) 1);
1881 if (lang_hooks.init () == 0)
1882 return 0;
1883 input_location = save_loc;
1884
1885 if (!flag_wpaglobal_options.x_flag_wpa)
1886 {
1887 init_asm_output (name);
1888
1889 if (!flag_generate_ltoglobal_options.x_flag_generate_lto && !flag_compare_debugglobal_options.x_flag_compare_debug)
1890 {
1891 /* If stack usage information is desired, open the output file. */
1892 if (flag_stack_usageglobal_options.x_flag_stack_usage)
1893 stack_usage_file = open_auxiliary_file ("su");
1894
1895 /* If call graph information is desired, open the output file. */
1896 if (flag_callgraph_infoglobal_options.x_flag_callgraph_info)
1897 {
1898 callgraph_info_file = open_auxiliary_file ("ci");
1899 /* Write the file header. */
1900 fprintf (callgraph_info_file,
1901 "graph: { title: \"%s\"\n", main_input_filenameglobal_options.x_main_input_filename);
1902 bitmap_obstack_initialize (NULL__null);
1903 callgraph_info_external_printed = BITMAP_ALLOCbitmap_alloc (NULL__null);
1904 }
1905 }
1906 else
1907 flag_stack_usageglobal_options.x_flag_stack_usage = flag_callgraph_infoglobal_options.x_flag_callgraph_info = false;
1908 }
1909
1910 /* This creates various _DECL nodes, so needs to be called after the
1911 front end is initialized. */
1912 init_eh ();
1913
1914 /* Do the target-specific parts of the initialization. */
1915 lang_dependent_init_target ();
1916
1917 if (!flag_wpaglobal_options.x_flag_wpa)
1918 {
1919 /* If dbx symbol table desired, initialize writing it and output the
1920 predefined types. */
1921 timevar_push (TV_SYMOUT);
1922
1923 /* Now we have the correct original filename, we can initialize
1924 debug output. */
1925 (*debug_hooks->init) (name);
1926
1927 timevar_pop (TV_SYMOUT);
1928 }
1929
1930 return 1;
1931}
1932
1933
1934/* Reinitialize everything when target parameters, such as register usage,
1935 have changed. */
1936void
1937target_reinit (void)
1938{
1939 struct rtl_data saved_x_rtl;
1940 rtx *saved_regno_reg_rtx;
1941 tree saved_optimization_current_node;
1942 struct target_optabs *saved_this_fn_optabs;
1943
1944 /* Temporarily switch to the default optimization node, so that
1945 *this_target_optabs is set to the default, not reflecting
1946 whatever a previous function used for the optimize
1947 attribute. */
1948 saved_optimization_current_node = optimization_current_nodeglobal_trees[TI_OPTIMIZATION_CURRENT];
1949 saved_this_fn_optabs = this_fn_optabs;
1950 if (saved_optimization_current_node != optimization_default_nodeglobal_trees[TI_OPTIMIZATION_DEFAULT])
1951 {
1952 optimization_current_nodeglobal_trees[TI_OPTIMIZATION_CURRENT] = optimization_default_nodeglobal_trees[TI_OPTIMIZATION_DEFAULT];
1953 cl_optimization_restore
1954 (&global_options, &global_options_set,
1955 TREE_OPTIMIZATION (optimization_default_node)((tree_check ((global_trees[TI_OPTIMIZATION_DEFAULT]), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/toplev.c"
, 1955, __FUNCTION__, (OPTIMIZATION_NODE)))->optimization.
opts)
);
1956 }
1957 this_fn_optabs = this_target_optabs;
1958
1959 /* Save *crtl and regno_reg_rtx around the reinitialization
1960 to allow target_reinit being called even after prepare_function_start. */
1961 saved_regno_reg_rtx = regno_reg_rtx;
1962 if (saved_regno_reg_rtx)
1963 {
1964 saved_x_rtl = *crtl(&x_rtl);
1965 memset (crtl(&x_rtl), '\0', sizeof (*crtl(&x_rtl)));
1966 regno_reg_rtx = NULL__null;
1967 }
1968
1969 this_target_rtl->target_specific_initialized = false;
1970
1971 /* This initializes hard_frame_pointer, and calls init_reg_modes_target()
1972 to initialize reg_raw_mode[]. */
1973 init_emit_regs ();
1974
1975 /* This invokes target hooks to set fixed_reg[] etc, which is
1976 mode-dependent. */
1977 init_regs ();
1978
1979 /* Reinitialize lang-dependent parts. */
1980 lang_dependent_init_target ();
1981
1982 /* Restore the original optimization node. */
1983 if (saved_optimization_current_node != optimization_default_nodeglobal_trees[TI_OPTIMIZATION_DEFAULT])
1984 {
1985 optimization_current_nodeglobal_trees[TI_OPTIMIZATION_CURRENT] = saved_optimization_current_node;
1986 cl_optimization_restore (&global_options, &global_options_set,
1987 TREE_OPTIMIZATION (optimization_current_node)((tree_check ((global_trees[TI_OPTIMIZATION_CURRENT]), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/toplev.c"
, 1987, __FUNCTION__, (OPTIMIZATION_NODE)))->optimization.
opts)
);
1988 }
1989 this_fn_optabs = saved_this_fn_optabs;
1990
1991 /* Restore regno_reg_rtx at the end, as free_after_compilation from
1992 expand_dummy_function_end clears it. */
1993 if (saved_regno_reg_rtx)
1994 {
1995 *crtl(&x_rtl) = saved_x_rtl;
1996 regno_reg_rtx = saved_regno_reg_rtx;
1997 saved_regno_reg_rtx = NULL__null;
1998 }
1999}
2000
2001void
2002dump_memory_report (const char *header)
2003{
2004 /* Print significant header. */
2005 fputc ('\n', stderrstderr);
2006 for (unsigned i = 0; i < 80; i++)
2007 fputc ('#', stderrstderr);
2008 fprintf (stderrstderr, "\n# %-77s#\n", header);
2009 for (unsigned i = 0; i < 80; i++)
2010 fputc ('#', stderrstderr);
2011 fputs ("\n\n", stderrstderr);
2012
2013 dump_line_table_statistics ();
2014 ggc_print_statistics ();
2015 stringpool_statistics ();
2016 dump_tree_statistics ();
2017 dump_gimple_statistics ();
2018 dump_rtx_statistics ();
2019 dump_alloc_pool_statistics ();
2020 dump_bitmap_statistics ();
2021 dump_hash_table_loc_statistics ();
2022 dump_vec_loc_statistics ();
2023 dump_ggc_loc_statistics ();
2024 dump_alias_stats (stderrstderr);
2025 dump_pta_stats (stderrstderr);
2026}
2027
2028/* Clean up: close opened files, etc. */
2029
2030static void
2031finalize (bool no_backend)
2032{
2033 /* Close the dump files. */
2034 if (flag_gen_aux_infoglobal_options.x_flag_gen_aux_info)
2035 {
2036 fclose (aux_info_file);
2037 aux_info_file = NULL__null;
2038 if (seen_error ())
2039 unlink (aux_info_file_nameglobal_options.x_aux_info_file_name);
2040 }
2041
2042 /* Close non-debugging input and output files. Take special care to note
2043 whether fclose returns an error, since the pages might still be on the
2044 buffer chain while the file is open. */
2045
2046 if (asm_out_file)
2047 {
2048 if (ferror (asm_out_file) != 0)
2049 fatal_error (input_location, "error writing to %s: %m", asm_file_nameglobal_options.x_asm_file_name);
2050 if (fclose (asm_out_file) != 0)
2051 fatal_error (input_location, "error closing %s: %m", asm_file_nameglobal_options.x_asm_file_name);
2052 asm_out_file = NULL__null;
2053 }
2054
2055 if (stack_usage_file)
2056 {
2057 fclose (stack_usage_file);
2058 stack_usage_file = NULL__null;
2059 }
2060
2061 if (callgraph_info_file)
2062 {
2063 fputs ("}\n", callgraph_info_file);
2064 fclose (callgraph_info_file);
2065 callgraph_info_file = NULL__null;
2066 BITMAP_FREE (callgraph_info_external_printed)((void) (bitmap_obstack_free ((bitmap) callgraph_info_external_printed
), (callgraph_info_external_printed) = (bitmap) __null))
;
2067 bitmap_obstack_release (NULL__null);
2068 }
2069
2070 if (seen_error ())
2071 coverage_remove_note_file ();
2072
2073 if (!no_backend)
2074 {
2075 statistics_fini ();
2076 debuginfo_fini ();
2077
2078 g->get_passes ()->finish_optimization_passes ();
2079
2080 lra_finish_once ();
2081 }
2082
2083 if (mem_reportglobal_options.x_mem_report)
2084 dump_memory_report ("Final");
2085
2086 if (profile_reportglobal_options.x_profile_report)
2087 dump_profile_report ();
2088
2089 if (flag_dbg_cnt_listglobal_options.x_flag_dbg_cnt_list)
2090 dbg_cnt_list_all_counters ();
2091
2092 /* Language-specific end of compilation actions. */
2093 lang_hooks.finish ();
2094}
2095
2096static bool
2097standard_type_bitsize (int bitsize)
2098{
2099 /* As a special exception, we always want __int128 enabled if possible. */
2100 if (bitsize == 128)
2101 return false;
2102 if (bitsize == CHAR_TYPE_SIZE(8)
2103 || bitsize == SHORT_TYPE_SIZE16
2104 || bitsize == INT_TYPE_SIZE32
2105 || bitsize == LONG_TYPE_SIZE(((global_options.x_ix86_isa_flags & (1UL << 58)) !=
0) ? 32 : ((8) * (((global_options.x_ix86_isa_flags & (1UL
<< 1)) != 0) ? 8 : 4)))
2106 || bitsize == LONG_LONG_TYPE_SIZE64)
2107 return true;
2108 return false;
2109}
2110
2111/* Initialize the compiler, and compile the input file. */
2112static void
2113do_compile ()
2114{
2115 process_options ();
2116
2117 /* Don't do any more if an error has already occurred. */
2118 if (!seen_error ())
2119 {
2120 int i;
2121
2122 timevar_start (TV_PHASE_SETUP);
2123
2124 if (flag_save_optimization_recordglobal_options.x_flag_save_optimization_record)
2125 {
2126 dump_context::get ().set_json_writer (new optrecord_json_writer ());
2127 }
2128
2129 /* This must be run always, because it is needed to compute the FP
2130 predefined macros, such as __LDBL_MAX__, for targets using non
2131 default FP formats. */
2132 init_adjust_machine_modes ();
2133 init_derived_machine_modes ();
2134
2135 /* This must happen after the backend has a chance to process
2136 command line options, but before the parsers are
2137 initialized. */
2138 for (i = 0; i < NUM_INT_N_ENTS1; i ++)
2139 if (targetm.scalar_mode_supported_p (int_n_data[i].m)
2140 && ! standard_type_bitsize (int_n_data[i].bitsize))
2141 int_n_enabled_p[i] = true;
2142 else
2143 int_n_enabled_p[i] = false;
2144
2145 /* Initialize mpfrs exponent range. This is important to get
2146 underflow/overflow in a reasonable timeframe. */
2147 machine_mode mode;
2148 int min_exp = -1;
2149 int max_exp = 1;
2150 FOR_EACH_MODE_IN_CLASS (mode, MODE_FLOAT)for (mode_iterator::start (&(mode), MODE_FLOAT); mode_iterator
::iterate_p (&(mode)); mode_iterator::get_wider (&(mode
)))
2151 if (SCALAR_FLOAT_MODE_P (mode)(((enum mode_class) mode_class[mode]) == MODE_FLOAT || ((enum
mode_class) mode_class[mode]) == MODE_DECIMAL_FLOAT)
)
2152 {
2153 const real_format *fmt = REAL_MODE_FORMAT (mode)(real_format_for_mode[(((enum mode_class) mode_class[mode]) ==
MODE_DECIMAL_FLOAT) ? (((mode) - MIN_MODE_DECIMAL_FLOAT) + (
MAX_MODE_FLOAT - MIN_MODE_FLOAT + 1)) : ((enum mode_class) mode_class
[mode]) == MODE_FLOAT ? ((mode) - MIN_MODE_FLOAT) : ((fancy_abort
("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/toplev.c"
, 2153, __FUNCTION__)), 0)])
;
2154 if (fmt)
2155 {
2156 /* fmt->emin - fmt->p + 1 should be enough but the
2157 back-and-forth dance in real_to_decimal_for_mode we
2158 do for checking fails due to rounding effects then. */
2159 if ((fmt->emin - fmt->p) < min_exp)
2160 min_exp = fmt->emin - fmt->p;
2161 if (fmt->emax > max_exp)
2162 max_exp = fmt->emax;
2163 }
2164 }
2165 /* E.g. mpc_norm assumes it can square a number without bothering with
2166 with range scaling, so until that is fixed, double the minimum
2167 and maximum exponents, plus add some buffer for arithmetics
2168 on the squared numbers. */
2169 if (mpfr_set_emin (2 * (min_exp - 1))
2170 || mpfr_set_emax (2 * (max_exp + 1)))
2171 sorry ("mpfr not configured to handle all floating modes");
2172
2173 /* Set up the back-end if requested. */
2174 if (!no_backend)
2175 backend_init ();
2176
2177 /* Language-dependent initialization. Returns true on success. */
2178 if (lang_dependent_init (main_input_filenameglobal_options.x_main_input_filename))
2179 {
2180 /* Initialize yet another pass. */
2181
2182 ggc_protect_identifiers = true;
2183
2184 symtab->initialize ();
2185 init_final (main_input_filenameglobal_options.x_main_input_filename);
2186 coverage_init (aux_base_nameglobal_options.x_aux_base_name);
2187 statistics_init ();
2188 debuginfo_init ();
2189 invoke_plugin_callbacks (PLUGIN_START_UNIT, NULL__null);
2190
2191 timevar_stop (TV_PHASE_SETUP);
2192
2193 compile_file ();
2194 }
2195 else
2196 {
2197 timevar_stop (TV_PHASE_SETUP);
2198 }
2199
2200 timevar_start (TV_PHASE_FINALIZE);
2201
2202 finalize (no_backend);
2203
2204 timevar_stop (TV_PHASE_FINALIZE);
2205 }
2206}
2207
2208toplev::toplev (timer *external_timer,
2209 bool init_signals)
2210 : m_use_TV_TOTAL (external_timer == NULL__null),
2211 m_init_signals (init_signals)
2212{
2213 if (external_timer)
2214 g_timer = external_timer;
2215}
2216
2217toplev::~toplev ()
2218{
2219 if (g_timer && m_use_TV_TOTAL)
2220 {
2221 g_timer->stop (TV_TOTAL);
2222 g_timer->print (stderrstderr);
2223 delete g_timer;
2224 g_timer = NULL__null;
2225 }
2226}
2227
2228/* Potentially call timevar_init (which will create g_timevars if it
2229 doesn't already exist). */
2230
2231void
2232toplev::start_timevars ()
2233{
2234 if (time_reportglobal_options.x_time_report || !quiet_flagglobal_options.x_quiet_flag || flag_detailed_statisticsglobal_options.x_flag_detailed_statistics)
2235 timevar_init ();
2236
2237 timevar_start (TV_TOTAL);
2238}
2239
2240/* Handle -fself-test. */
2241
2242void
2243toplev::run_self_tests ()
2244{
2245 if (no_backend)
2246 {
2247 error_at (UNKNOWN_LOCATION((location_t) 0), "self-tests incompatible with %<-E%>");
2248 return;
2249 }
2250#if CHECKING_P1
2251 /* Reset some state. */
2252 input_location = UNKNOWN_LOCATION((location_t) 0);
2253 bitmap_obstack_initialize (NULL__null);
2254
2255 /* Run the tests; any failures will lead to an abort of the process.
2256 Use "make selftests-gdb" to run under the debugger. */
2257 ::selftest::run_tests ();
2258
2259 /* Cleanup. */
2260 bitmap_obstack_release (NULL__null);
2261#else
2262 inform (UNKNOWN_LOCATION((location_t) 0), "self-tests are not enabled in this build");
2263#endif /* #if CHECKING_P */
2264}
2265
2266/* Entry point of cc1, cc1plus, jc1, f771, etc.
2267 Exit code is FATAL_EXIT_CODE if can't open files or if there were
2268 any errors, or SUCCESS_EXIT_CODE if compilation succeeded.
2269
2270 It is not safe to call this function more than once. */
2271
2272int
2273toplev::main (int argc, char **argv)
2274{
2275 /* Parsing and gimplification sometimes need quite large stack.
2276 Increase stack size limits if possible. */
2277 stack_limit_increase (64 * 1024 * 1024);
2278
2279 expandargv (&argc, &argv);
2280
2281 /* Initialization of GCC's environment, and diagnostics. */
2282 general_init (argv[0], m_init_signals);
2283
2284 /* One-off initialization of options that does not need to be
2285 repeated when options are added for particular functions. */
2286 init_options_once ();
2287 init_opts_obstack ();
2288
2289 /* Initialize global options structures; this must be repeated for
2290 each structure used for parsing options. */
2291 init_options_struct (&global_options, &global_options_set);
2292 lang_hooks.init_options_struct (&global_options);
2293
2294 /* Init GGC heuristics must be caller after we initialize
2295 options. */
2296 init_ggc_heuristics ();
2297
2298 /* Convert the options to an array. */
2299 decode_cmdline_options_to_array_default_mask (argc,
2300 CONST_CAST2 (const char **,(const_cast<const char **> (argv))
2301 char **, argv)(const_cast<const char **> (argv)),
2302 &save_decoded_options,
2303 &save_decoded_options_count);
2304
2305 /* Perform language-specific options initialization. */
2306 lang_hooks.init_options (save_decoded_options_count, save_decoded_options);
2307
2308 /* Parse the options and do minimal processing; basically just
2309 enough to default flags appropriately. */
2310 decode_options (&global_options, &global_options_set,
2311 save_decoded_options, save_decoded_options_count,
2312 UNKNOWN_LOCATION((location_t) 0), global_dc,
2313 targetm.target_option.override);
2314
2315 handle_common_deferred_options ();
2316
2317 init_local_tick ();
2318
2319 initialize_plugins ();
2320
2321 if (version_flagglobal_options.x_version_flag)
2322 print_version (stderrstderr, "", true);
2323
2324 if (help_flagglobal_options.x_help_flag)
2325 print_plugins_help (stderrstderr, "");
2326
2327 /* Exit early if we can (e.g. -help). */
2328 if (!exit_after_optionsglobal_options.x_exit_after_options)
2329 {
2330 if (m_use_TV_TOTAL)
2331 start_timevars ();
2332 do_compile ();
2333 }
2334
2335 if (warningcount(global_dc)->diagnostic_count[(int) (DK_WARNING)] || errorcount(global_dc)->diagnostic_count[(int) (DK_ERROR)] || werrorcount(global_dc)->diagnostic_count[(int) (DK_WERROR)])
2336 print_ignored_options ();
2337
2338 if (flag_self_testglobal_options.x_flag_self_test)
2339 run_self_tests ();
2340
2341 /* Invoke registered plugin callbacks if any. Some plugins could
2342 emit some diagnostics here. */
2343 invoke_plugin_callbacks (PLUGIN_FINISH, NULL__null);
2344
2345 if (flag_diagnostics_generate_patchglobal_options.x_flag_diagnostics_generate_patch)
2346 {
2347 gcc_assert (global_dc->edit_context_ptr)((void)(!(global_dc->edit_context_ptr) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/toplev.c"
, 2347, __FUNCTION__), 0 : 0))
;
2348
2349 pretty_printer pp;
2350 pp_show_color (&pp)(&pp)->show_color = pp_show_color (global_dc->printer)(global_dc->printer)->show_color;
2351 global_dc->edit_context_ptr->print_diff (&pp, true);
2352 pp_flush (&pp);
2353 }
2354
2355 diagnostic_finish (global_dc);
2356
2357 finalize_plugins ();
2358
2359 after_memory_report = true;
2360
2361 if (seen_error () || werrorcount(global_dc)->diagnostic_count[(int) (DK_WERROR)])
2362 return (FATAL_EXIT_CODE1);
2363
2364 return (SUCCESS_EXIT_CODE0);
2365}
2366
2367/* For those that want to, this function aims to clean up enough state that
2368 you can call toplev::main again. */
2369void
2370toplev::finalize (void)
2371{
2372 rtl_initialized = false;
2373 this_target_rtl->target_specific_initialized = false;
2374
2375 /* Needs to be called before cgraph_c_finalize since it uses symtab. */
2376 ipa_reference_c_finalize ();
2377 ipa_fnsummary_c_finalize ();
2378 ipa_modref_c_finalize ();
2379
2380 cgraph_c_finalize ();
2381 cgraphunit_c_finalize ();
2382 symtab_thunks_cc_finalize ();
2383 dwarf2out_c_finalize ();
2384 gcse_c_finalize ();
2385 ipa_cp_c_finalize ();
2386 ira_costs_c_finalize ();
2387
2388 /* save_decoded_options uses opts_obstack, so these must
2389 be cleaned up together. */
2390 obstack_free (&opts_obstack, NULL)__extension__ ({ struct obstack *__o = (&opts_obstack); void
*__obj = (void *) (__null); if (__obj > (void *) __o->
chunk && __obj < (void *) __o->chunk_limit) __o
->next_free = __o->object_base = (char *) __obj; else _obstack_free
(__o, __obj); })
;
2391 XDELETEVEC (save_decoded_options)free ((void*) (save_decoded_options));
2392 save_decoded_options = NULL__null;
2393 save_decoded_options_count = 0;
2394
2395 /* Clean up the context (and pass_manager etc). */
2396 delete g;
2397 g = NULL__null;
2398
2399}

/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/hwint.h

1/* HOST_WIDE_INT definitions for the GNU compiler.
2 Copyright (C) 1998-2021 Free Software Foundation, Inc.
3
4 This file is part of GCC.
5
6 Provide definitions for macros which depend on HOST_BITS_PER_INT
7 and HOST_BITS_PER_LONG. */
8
9#ifndef GCC_HWINT_H
10#define GCC_HWINT_H
11
12/* This describes the machine the compiler is hosted on. */
13#define HOST_BITS_PER_CHAR8 CHAR_BIT8
14#define HOST_BITS_PER_SHORT(8 * 2) (CHAR_BIT8 * SIZEOF_SHORT2)
15#define HOST_BITS_PER_INT(8 * 4) (CHAR_BIT8 * SIZEOF_INT4)
16#define HOST_BITS_PER_LONG(8 * 8) (CHAR_BIT8 * SIZEOF_LONG8)
17#define HOST_BITS_PER_PTR(8 * 8) (CHAR_BIT8 * SIZEOF_VOID_P8)
18
19/* The string that should be inserted into a printf style format to
20 indicate a "long" operand. */
21#ifndef HOST_LONG_FORMAT"l"
22#define HOST_LONG_FORMAT"l" "l"
23#endif
24
25/* The string that should be inserted into a printf style format to
26 indicate a "long long" operand. */
27#ifndef HOST_LONG_LONG_FORMAT"ll"
28#define HOST_LONG_LONG_FORMAT"ll" "ll"
29#endif
30
31/* If HAVE_LONG_LONG and SIZEOF_LONG_LONG aren't defined, but
32 GCC_VERSION >= 3000, assume this is the second or later stage of a
33 bootstrap, we do have long long, and it's 64 bits. (This is
34 required by C99; we do have some ports that violate that assumption
35 but they're all cross-compile-only.) Just in case, force a
36 constraint violation if that assumption is incorrect. */
37#if !defined HAVE_LONG_LONG1
38# if GCC_VERSION(4 * 1000 + 2) >= 3000
39# define HAVE_LONG_LONG1 1
40# define SIZEOF_LONG_LONG8 8
41extern char sizeof_long_long_must_be_8[sizeof (long long) == 8 ? 1 : -1];
42# endif
43#endif
44
45#ifdef HAVE_LONG_LONG1
46# define HOST_BITS_PER_LONGLONG(8 * 8) (CHAR_BIT8 * SIZEOF_LONG_LONG8)
47#endif
48
49/* Set HOST_WIDE_INT, this should be always 64 bits.
50 The underlying type is matched to that of int64_t and assumed
51 to be either long or long long. */
52
53#define HOST_BITS_PER_WIDE_INT64 64
54#if INT64_T_IS_LONG1
55# define HOST_WIDE_INTlong long
56# define HOST_WIDE_INT_C(X)XL X ## L
57#else
58# if HOST_BITS_PER_LONGLONG(8 * 8) == 64
59# define HOST_WIDE_INTlong long long
60# define HOST_WIDE_INT_C(X)XL X ## LL
61# else
62 #error "Unable to find a suitable type for HOST_WIDE_INT"
63# endif
64#endif
65
66#define HOST_WIDE_INT_UC(X)XUL HOST_WIDE_INT_C (X ## U)X ## UL
67#define HOST_WIDE_INT_00L HOST_WIDE_INT_C (0)0L
68#define HOST_WIDE_INT_0U0UL HOST_WIDE_INT_UC (0)0UL
69#define HOST_WIDE_INT_11L HOST_WIDE_INT_C (1)1L
70#define HOST_WIDE_INT_1U1UL HOST_WIDE_INT_UC (1)1UL
71#define HOST_WIDE_INT_M1-1L HOST_WIDE_INT_C (-1)-1L
72#define HOST_WIDE_INT_M1U-1UL HOST_WIDE_INT_UC (-1)-1UL
73
74/* This is a magic identifier which allows GCC to figure out the type
75 of HOST_WIDE_INT for %wd specifier checks. You must issue this
76 typedef before using the __asm_fprintf__ format attribute. */
77typedef HOST_WIDE_INTlong __gcc_host_wide_int__;
78
79/* Provide C99 <inttypes.h> style format definitions for 64bits. */
80#ifndef HAVE_INTTYPES_H1
81#if INT64_T_IS_LONG1
82# define GCC_PRI64 HOST_LONG_FORMAT"l"
83#else
84# define GCC_PRI64 HOST_LONG_LONG_FORMAT"ll"
85#endif
86#undef PRId64"l" "d"
87#define PRId64"l" "d" GCC_PRI64 "d"
88#undef PRIi64"l" "i"
89#define PRIi64"l" "i" GCC_PRI64 "i"
90#undef PRIo64"l" "o"
91#define PRIo64"l" "o" GCC_PRI64 "o"
92#undef PRIu64"l" "u"
93#define PRIu64"l" "u" GCC_PRI64 "u"
94#undef PRIx64"l" "x"
95#define PRIx64"l" "x" GCC_PRI64 "x"
96#undef PRIX64"l" "X"
97#define PRIX64"l" "X" GCC_PRI64 "X"
98#endif
99
100/* Various printf format strings for HOST_WIDE_INT. */
101
102#if INT64_T_IS_LONG1
103# define HOST_WIDE_INT_PRINT"l" HOST_LONG_FORMAT"l"
104# define HOST_WIDE_INT_PRINT_C"L" "L"
105#else
106# define HOST_WIDE_INT_PRINT"l" HOST_LONG_LONG_FORMAT"ll"
107# define HOST_WIDE_INT_PRINT_C"L" "LL"
108#endif
109
110#define HOST_WIDE_INT_PRINT_DEC"%" "l" "d" "%" PRId64"l" "d"
111#define HOST_WIDE_INT_PRINT_DEC_C"%" "l" "d" "L" "%" PRId64"l" "d" HOST_WIDE_INT_PRINT_C"L"
112#define HOST_WIDE_INT_PRINT_UNSIGNED"%" "l" "u" "%" PRIu64"l" "u"
113#define HOST_WIDE_INT_PRINT_HEX"%#" "l" "x" "%#" PRIx64"l" "x"
114#define HOST_WIDE_INT_PRINT_HEX_PURE"%" "l" "x" "%" PRIx64"l" "x"
115#define HOST_WIDE_INT_PRINT_DOUBLE_HEX"0x%" "l" "x" "%016" "l" "x" "0x%" PRIx64"l" "x" "%016" PRIx64"l" "x"
116#define HOST_WIDE_INT_PRINT_PADDED_HEX"%016" "l" "x" "%016" PRIx64"l" "x"
117
118/* Define HOST_WIDEST_FAST_INT to the widest integer type supported
119 efficiently in hardware. (That is, the widest integer type that fits
120 in a hardware register.) Normally this is "long" but on some hosts it
121 should be "long long" or "__int64". This is no convenient way to
122 autodetect this, so such systems must set a flag in config.host; see there
123 for details. */
124
125#ifdef USE_LONG_LONG_FOR_WIDEST_FAST_INT
126# ifdef HAVE_LONG_LONG1
127# define HOST_WIDEST_FAST_INTlong long long
128# define HOST_BITS_PER_WIDEST_FAST_INT(8 * 8) HOST_BITS_PER_LONGLONG(8 * 8)
129# else
130# error "Your host said it wanted to use long long but that does not exist"
131# endif
132#else
133# define HOST_WIDEST_FAST_INTlong long
134# define HOST_BITS_PER_WIDEST_FAST_INT(8 * 8) HOST_BITS_PER_LONG(8 * 8)
135#endif
136
137/* Inline functions operating on HOST_WIDE_INT. */
138
139/* Return X with all but the lowest bit masked off. */
140
141static inline unsigned HOST_WIDE_INTlong
142least_bit_hwi (unsigned HOST_WIDE_INTlong x)
143{
144 return (x & -x);
145}
146
147/* True if X is zero or a power of two. */
148
149static inline bool
150pow2_or_zerop (unsigned HOST_WIDE_INTlong x)
151{
152 return least_bit_hwi (x) == x;
153}
154
155/* True if X is a power of two. */
156
157static inline bool
158pow2p_hwi (unsigned HOST_WIDE_INTlong x)
159{
160 return x && pow2_or_zerop (x);
161}
162
163#if GCC_VERSION(4 * 1000 + 2) < 3004
164
165extern int clz_hwi (unsigned HOST_WIDE_INTlong x);
166extern int ctz_hwi (unsigned HOST_WIDE_INTlong x);
167extern int ffs_hwi (unsigned HOST_WIDE_INTlong x);
168
169/* Return the number of set bits in X. */
170extern int popcount_hwi (unsigned HOST_WIDE_INTlong x);
171
172/* Return log2, or -1 if not exact. */
173extern int exact_log2 (unsigned HOST_WIDE_INTlong);
174
175/* Return floor of log2, with -1 for zero. */
176extern int floor_log2 (unsigned HOST_WIDE_INTlong);
177
178/* Return the smallest n such that 2**n >= X. */
179extern int ceil_log2 (unsigned HOST_WIDE_INTlong);
180
181#else /* GCC_VERSION >= 3004 */
182
183/* For convenience, define 0 -> word_size. */
184static inline int
185clz_hwi (unsigned HOST_WIDE_INTlong x)
186{
187 if (x == 0)
188 return HOST_BITS_PER_WIDE_INT64;
189# if HOST_BITS_PER_WIDE_INT64 == HOST_BITS_PER_LONG(8 * 8)
190 return __builtin_clzl (x);
191# elif HOST_BITS_PER_WIDE_INT64 == HOST_BITS_PER_LONGLONG(8 * 8)
192 return __builtin_clzll (x);
193# else
194 return __builtin_clz (x);
195# endif
196}
197
198static inline int
199ctz_hwi (unsigned HOST_WIDE_INTlong x)
200{
201 if (x == 0)
202 return HOST_BITS_PER_WIDE_INT64;
203# if HOST_BITS_PER_WIDE_INT64 == HOST_BITS_PER_LONG(8 * 8)
204 return __builtin_ctzl (x);
205# elif HOST_BITS_PER_WIDE_INT64 == HOST_BITS_PER_LONGLONG(8 * 8)
206 return __builtin_ctzll (x);
207# else
208 return __builtin_ctz (x);
209# endif
210}
211
212static inline int
213ffs_hwi (unsigned HOST_WIDE_INTlong x)
214{
215# if HOST_BITS_PER_WIDE_INT64 == HOST_BITS_PER_LONG(8 * 8)
216 return __builtin_ffsl (x);
217# elif HOST_BITS_PER_WIDE_INT64 == HOST_BITS_PER_LONGLONG(8 * 8)
218 return __builtin_ffsll (x);
219# else
220 return __builtin_ffs (x);
221# endif
222}
223
224static inline int
225popcount_hwi (unsigned HOST_WIDE_INTlong x)
226{
227# if HOST_BITS_PER_WIDE_INT64 == HOST_BITS_PER_LONG(8 * 8)
228 return __builtin_popcountl (x);
229# elif HOST_BITS_PER_WIDE_INT64 == HOST_BITS_PER_LONGLONG(8 * 8)
230 return __builtin_popcountll (x);
231# else
232 return __builtin_popcount (x);
233# endif
234}
235
236static inline int
237floor_log2 (unsigned HOST_WIDE_INTlong x)
238{
239 return HOST_BITS_PER_WIDE_INT64 - 1 - clz_hwi (x);
12
Returning the value -1
240}
241
242static inline int
243ceil_log2 (unsigned HOST_WIDE_INTlong x)
244{
245 return x == 0 ? 0 : floor_log2 (x - 1) + 1;
246}
247
248static inline int
249exact_log2 (unsigned HOST_WIDE_INTlong x)
250{
251 return pow2p_hwi (x) ? ctz_hwi (x) : -1;
252}
253
254#endif /* GCC_VERSION >= 3004 */
255
256#define HOST_WIDE_INT_MIN(long) (1UL << (64 - 1)) (HOST_WIDE_INTlong) \
257 (HOST_WIDE_INT_1U1UL << (HOST_BITS_PER_WIDE_INT64 - 1))
258#define HOST_WIDE_INT_MAX(~((long) (1UL << (64 - 1)))) (~(HOST_WIDE_INT_MIN(long) (1UL << (64 - 1))))
259
260extern HOST_WIDE_INTlong abs_hwi (HOST_WIDE_INTlong);
261extern unsigned HOST_WIDE_INTlong absu_hwi (HOST_WIDE_INTlong);
262extern HOST_WIDE_INTlong gcd (HOST_WIDE_INTlong, HOST_WIDE_INTlong);
263extern HOST_WIDE_INTlong pos_mul_hwi (HOST_WIDE_INTlong, HOST_WIDE_INTlong);
264extern HOST_WIDE_INTlong mul_hwi (HOST_WIDE_INTlong, HOST_WIDE_INTlong);
265extern HOST_WIDE_INTlong least_common_multiple (HOST_WIDE_INTlong, HOST_WIDE_INTlong);
266
267/* Like ctz_hwi, except 0 when x == 0. */
268
269static inline int
270ctz_or_zero (unsigned HOST_WIDE_INTlong x)
271{
272 return ffs_hwi (x) - 1;
273}
274
275/* Sign extend SRC starting from PREC. */
276
277static inline HOST_WIDE_INTlong
278sext_hwi (HOST_WIDE_INTlong src, unsigned int prec)
279{
280 if (prec == HOST_BITS_PER_WIDE_INT64)
281 return src;
282 else
283#if defined (__GNUC__4)
284 {
285 /* Take the faster path if the implementation-defined bits it's relying
286 on are implemented the way we expect them to be. Namely, conversion
287 from unsigned to signed preserves bit pattern, and right shift of
288 a signed value propagates the sign bit.
289 We have to convert from signed to unsigned and back, because when left
290 shifting signed values, any overflow is undefined behavior. */
291 gcc_checking_assert (prec < HOST_BITS_PER_WIDE_INT)((void)(!(prec < 64) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/hwint.h"
, 291, __FUNCTION__), 0 : 0))
;
292 int shift = HOST_BITS_PER_WIDE_INT64 - prec;
293 return ((HOST_WIDE_INTlong) ((unsigned HOST_WIDE_INTlong) src << shift)) >> shift;
294 }
295#else
296 {
297 /* Fall back to the slower, well defined path otherwise. */
298 gcc_checking_assert (prec < HOST_BITS_PER_WIDE_INT)((void)(!(prec < 64) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/hwint.h"
, 298, __FUNCTION__), 0 : 0))
;
299 HOST_WIDE_INTlong sign_mask = HOST_WIDE_INT_11L << (prec - 1);
300 HOST_WIDE_INTlong value_mask = (HOST_WIDE_INT_1U1UL << prec) - HOST_WIDE_INT_1U1UL;
301 return (((src & value_mask) ^ sign_mask) - sign_mask);
302 }
303#endif
304}
305
306/* Zero extend SRC starting from PREC. */
307static inline unsigned HOST_WIDE_INTlong
308zext_hwi (unsigned HOST_WIDE_INTlong src, unsigned int prec)
309{
310 if (prec == HOST_BITS_PER_WIDE_INT64)
311 return src;
312 else
313 {
314 gcc_checking_assert (prec < HOST_BITS_PER_WIDE_INT)((void)(!(prec < 64) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/hwint.h"
, 314, __FUNCTION__), 0 : 0))
;
315 return src & ((HOST_WIDE_INT_1U1UL << prec) - 1);
316 }
317}
318
319/* Compute the absolute value of X. */
320
321inline HOST_WIDE_INTlong
322abs_hwi (HOST_WIDE_INTlong x)
323{
324 gcc_checking_assert (x != HOST_WIDE_INT_MIN)((void)(!(x != (long) (1UL << (64 - 1))) ? fancy_abort (
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/hwint.h"
, 324, __FUNCTION__), 0 : 0))
;
325 return x >= 0 ? x : -x;
326}
327
328/* Compute the absolute value of X as an unsigned type. */
329
330inline unsigned HOST_WIDE_INTlong
331absu_hwi (HOST_WIDE_INTlong x)
332{
333 return x >= 0 ? (unsigned HOST_WIDE_INTlong)x : -(unsigned HOST_WIDE_INTlong)x;
334}
335
336#endif /* ! GCC_HWINT_H */

/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/align.h

1/* Alignment-related classes.
2 Copyright (C) 2018-2021 Free Software Foundation, Inc.
3
4This file is part of GCC.
5
6GCC is free software; you can redistribute it and/or modify it under
7the terms of the GNU General Public License as published by the Free
8Software Foundation; either version 3, or (at your option) any later
9version.
10
11GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12WARRANTY; without even the implied warranty of MERCHANTABILITY or
13FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14for more details.
15
16You should have received a copy of the GNU General Public License
17along with GCC; see the file COPYING3. If not see
18<http://www.gnu.org/licenses/>. */
19
20/* Align flags tuple with alignment in log form and with a maximum skip. */
21
22struct align_flags_tuple
23{
24 /* Values of the -falign-* flags: how much to align labels in code.
25 log is "align to 2^log" (so 0 means no alignment).
26 maxskip is the maximum allowed amount of padding to insert. */
27 int log;
28 int maxskip;
29
30 /* Normalize filled values so that maxskip is not bigger than 1 << log. */
31 void normalize ()
32 {
33 int n = (1 << log);
19
The result of the left shift is undefined because the right operand is negative
34 if (maxskip > n)
35 maxskip = n - 1;
36 }
37
38 /* Return original value of an alignment flag. */
39 int get_value ()
40 {
41 return maxskip + 1;
42 }
43};
44
45/* Alignment flags is structure used as value of -align-* options.
46 It's used in target-dependant code. */
47
48class align_flags
49{
50public:
51 /* Default constructor. */
52 align_flags (int log0 = 0, int maxskip0 = 0, int log1 = 0, int maxskip1 = 0)
53 {
54 levels[0].log = log0;
55 levels[0].maxskip = maxskip0;
56 levels[1].log = log1;
57 levels[1].maxskip = maxskip1;
58 normalize ();
59 }
60
61 /* Normalize both components of align_flags. */
62 void normalize ()
63 {
64 for (unsigned i = 0; i < 2; i++)
65 levels[i].normalize ();
66 }
67
68 /* Get alignment that is common bigger alignment of alignments F0 and F1. */
69 static align_flags max (const align_flags f0, const align_flags f1)
70 {
71 int log0 = MAX (f0.levels[0].log, f1.levels[0].log)((f0.levels[0].log) > (f1.levels[0].log) ? (f0.levels[0].log
) : (f1.levels[0].log))
;
72 int maxskip0 = MAX (f0.levels[0].maxskip, f1.levels[0].maxskip)((f0.levels[0].maxskip) > (f1.levels[0].maxskip) ? (f0.levels
[0].maxskip) : (f1.levels[0].maxskip))
;
73 int log1 = MAX (f0.levels[1].log, f1.levels[1].log)((f0.levels[1].log) > (f1.levels[1].log) ? (f0.levels[1].log
) : (f1.levels[1].log))
;
74 int maxskip1 = MAX (f0.levels[1].maxskip, f1.levels[1].maxskip)((f0.levels[1].maxskip) > (f1.levels[1].maxskip) ? (f0.levels
[1].maxskip) : (f1.levels[1].maxskip))
;
75 return align_flags (log0, maxskip0, log1, maxskip1);
76 }
77
78 align_flags_tuple levels[2];
79};
80
81/* Define maximum supported code alignment. */
82#define MAX_CODE_ALIGN16 16
83#define MAX_CODE_ALIGN_VALUE(1 << 16) (1 << MAX_CODE_ALIGN16)