aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.misc-tests
AgeCommit message (Collapse)AuthorFilesLines
6 daystestsuite: Require effective target sigsetjmp for gcov-31/32Dimitar Dimitrov2-0/+2
The tests call sigsetjmp and use sigjmp_buf type. Thus the tests cannot be compiled on baremetal newlib targets which do not have sigsetjmp. gcc/testsuite/ChangeLog: * gcc.misc-tests/gcov-31.c: Require effective target sigsetjmp. * gcc.misc-tests/gcov-32.c: Ditto. Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
7 daysAdd prime path coverage to gcc/gcovJørgen Kvalsvik6-0/+1853
This patch adds prime path coverage to gcc/gcov. First, a quick introduction to path coverage, before I explain a bit on the pieces of the patch. PRIME PATHS Path coverage is recording the paths taken through the program. Here is a simple example: if (cond1) BB 1 then1 () BB 2 else else1 () BB 3 if (cond2) BB 4 then2 () BB 5 else else2 () BB 6 _ BB 7 To cover all paths you must run {then1 then2}, {then1 else2}, {else1 then1}, {else1 else2}. This is in contrast with line/statement coverage where it is sufficient to execute then2, and it does not matter if it was reached through then1 or else1. 1 2 4 5 7 1 2 4 6 7 1 3 4 5 7 1 3 4 6 7 This gets more complicated with loops, because 0, 1, 2, ..., N iterations are all different paths. There are different ways of addressing this, a promising one being prime paths. A prime path is a maximal simple path (a path with no repeated vertices) or simple cycle (no repeated vertices except for the first/last) Prime paths strike a decent balance between number of tests, path growth, and loop coverage, requiring loops to be both taken and skipped. Of course, the number of paths still grows very fast with program complexity - for example, this program has 14 prime paths: while (a) { if (b) return; while (c--) a++; } -- ALGORITHM Since the numbers of paths grows so fast, we need a good algorithm. The naive approach of generating all paths and discarding redundancies (see reference_prime_paths in the diff) simply doesn't complete for even pretty simple functions with a few ten thousand paths (granted, the implementation is also poor, but only serves as a reference). Fazli & Afsharchi in their paper "Time and Space-Efficient Compositional Method for Prime and Test Paths Generation" describe a neat algorithm which drastically improves on for most programs, and brings complexity down to something managable. This patch implements that algorithm with a few minor tweaks. The algorithm first finds the strongly connected components (SCC) of the graph and creates a new graph where the vertices are the SCCs of the CFG. Within these vertices different paths are found - regular prime paths, paths that start in the SCCs entries, and paths that end in the SCCs exits. These per-SCC paths are combined with paths through the CFG which greatly reduces of paths needed to be evaluated just to be thrown away. Using this algorithm we can find the prime paths for somewhat complicated functions in a reasonable time. Please note that some programs don't benefit from this at all. We need to find the prime paths within a SCC, so if a single SCC is very large the function degenerates to the naive implementation. This can probably be much improved on, but is an exercise for later. -- OVERALL ARCHITECTURE Like the other coverages in gcc, this operates on the CFG in the profiling phase, just after branch and condition coverage, in phases: 1. All prime paths are generated, counted, and enumerated from the CFG 2. The paths are evaluted and counter instructions and accumulators are emitted 3. gcov reads the CFG and computes the prime paths (same as step 1) 4. gcov prints a report Simply writing out all the paths in the .gcno file is not really viable, the files would be too big. Additionally, there are limits to the practicality of measuring (and reporting) on millions of paths, so for most programs where coverage is feasible, computing paths should be plenty fast. As a result, path coverage really only adds 1 bit to the counter, rounded up to nearest 64 ("bucket"), so 64 paths takes up 8 bytes, 65 paths take up 16 bytes. Recording paths is really just massaging large bitsets. Per function, ceil(paths/64 or 32) buckets (gcov_type) are allocated. Paths are sorted, so the first path maps to the lowest bit, the second path to the second lowest bit, and so on. On taking an edge and entering a basic block, a few bitmasks are applied to unset the bits corresponding to the paths outside the block and set the bits of the paths that start in that block. Finally, the right buckets are masked and written to the global accumulators for the paths that end in the block. Full coverage is achieved when all bits are set. gcc does not really inform gcov of abnormal paths, so paths with abnormal edges are ignored. This probably possible, but requires some changes to the graph gcc writes to the .gcno file. -- IMPLEMENTATION In order to remove non-prime paths (subpaths) we use a suffix tree. Fazli & Afsharchi do not discuss how duplicates or subpaths are removed, and using the suffix works really well -- insertion time is a function of the length of the (longest) paths, not the number of paths. The paths are usually quite short, but there are many of them. The same prime_paths function is used both in gcc and in gcov. As for speed, I would say that it is acceptable. Path coverage is a problem that is exponential in its very nature, so if you enable this feature you can reasonably expect it to take a while. To combat the effects of path explosion there is a limit at which point gcc will give up and refuse to instrument a function, set with -fpath-coverage-limit. Since estimating the number of prime paths is pretty much is counting them, gcc maintains a pessimistic running count which slightly overestimates the number of paths found so far. When that count exceeds the limit, the function aborts and gcc prints a warning. This is a blunt instrument meant to not get stuck on the occasional large function, not fine-grained control over when to skip instrumentation. My main benchmark has been tree-2.1.3/tree.c which generates approx 2M paths across the 20 functions or so in it. Most functions have less than 1500 paths, and 2 around a million each. Finding the paths takes 3.5-4s, but the instrumentation phase takes approx. 2.5 minutes and generates a 32M binary. Not bad for a 1429 line source file. There are some selftests which deconstruct the algorithm, so it can be easily referenced with the Fazli & Afsharchi. I hope that including them both help to catch regression, clarify the assumptions, and help understanding the algorithm by breaking up the phases. DEMO This is the denser line-aware (grep-friendlier) output. Every missing path is summarized as the lines you need to run in what order, annotated with the true/false/throw decision. $ gcc -fpath-coverage --coverage bs.c -c -o bs $ gcov -e --prime-paths-lines bs.o bs.gcda:cannot open data file, assuming not executed -: 0:Source:bs.c -: 0:Graph:bs.gcno -: 0:Data:- -: 0:Runs:0 paths covered 0 of 17 path 0 not covered: lines 6 6(true) 11(true) 12 path 1 not covered: lines 6 6(true) 11(false) 13(true) 14 path 2 not covered: lines 6 6(true) 11(false) 13(false) 16 path 3 not covered: lines 6 6(false) 18 path 4 not covered: lines 11(true) 12 6(true) 11 path 5 not covered: lines 11(true) 12 6(false) 18 path 6 not covered: lines 11(false) 13(true) 14 6(true) 11 path 7 not covered: lines 11(false) 13(true) 14 6(false) 18 path 8 not covered: lines 12 6(true) 11(true) 12 path 9 not covered: lines 12 6(true) 11(false) 13(true) 14 path 10 not covered: lines 12 6(true) 11(false) 13(false) 16 path 11 not covered: lines 13(true) 14 6(true) 11(true) 12 path 12 not covered: lines 13(true) 14 6(true) 11(false) 13 path 13 not covered: lines 14 6(true) 11(false) 13(true) 14 path 14 not covered: lines 14 6(true) 11(false) 13(false) 16 path 15 not covered: lines 6(true) 11(true) 12 6 path 16 not covered: lines 6(true) 11(false) 13(true) 14 6 #####: 1:int binary_search(int a[], int len, int from, int to, int key) -: 2:{ #####: 3: int low = from; #####: 4: int high = to - 1; -: 5: #####: 6: while (low <= high) -: 7: { #####: 8: int mid = (low + high) >> 1; #####: 9: long midVal = a[mid]; -: 10: #####: 11: if (midVal < key) #####: 12: low = mid + 1; #####: 13: else if (midVal > key) #####: 14: high = mid - 1; -: 15: else #####: 16: return mid; // key found -: 17: } #####: 18: return -1; -: 19:} Then there's the human-oriented source mode. Because it is so verbose I have limited the demo to 2 paths. In this mode gcov will print the sequence of *lines* through the program and in what order to cover the path, including what basic block the line is a part of. Like its denser sibling, this also prints the true/false/throw decision, if there is one. $ gcov -t --prime-paths-source bs.o bs.gcda:cannot open data file, assuming not executed -: 0:Source:bs.c -: 0:Graph:bs.gcno -: 0:Data:- -: 0:Runs:0 paths covered 0 of 17 path 0: BB 2: 1:int binary_search(int a[], int len, int from, int to, int key) BB 2: 3: int low = from; BB 2: 4: int high = to - 1; BB 2: 6: while (low <= high) BB 8: (true) 6: while (low <= high) BB 3: 8: int mid = (low + high) >> 1; BB 3: 9: long midVal = a[mid]; BB 3: (true) 11: if (midVal < key) BB 4: 12: low = mid + 1; path 1: BB 2: 1:int binary_search(int a[], int len, int from, int to, int key) BB 2: 3: int low = from; BB 2: 4: int high = to - 1; BB 2: 6: while (low <= high) BB 8: (true) 6: while (low <= high) BB 3: 8: int mid = (low + high) >> 1; BB 3: 9: long midVal = a[mid]; BB 3: (false) 11: if (midVal < key) BB 5: (true) 13: else if (midVal > key) BB 6: 14: high = mid - 1; The listing is also aware of inlining: hello.c: #include <stdio.h> #include "hello.h" int notmain(const char *entity) { return hello (entity); } #include <stdio.h> inline __attribute__((always_inline)) int hello (const char *s) { if (s) printf ("hello, %s!\n", s); else printf ("hello, world!\n"); return 0; } $ gcov -t --prime-paths-source hello paths covered 0 of 2 path 0: BB 2: (true) 4:int notmain(const char *entity) == inlined from hello.h == BB 2: (true) 6: if (s) BB 3: 7: printf ("hello, %s!\n", s); BB 5: 10: return 0; ------------------------- BB 7: 6: return hello (entity); BB 8: 6: return hello (entity); path 1: BB 2: (false) 4:int notmain(const char *entity) == inlined from hello.h == BB 2: (false) 6: if (s) BB 4: 9: printf ("hello, world!\n"); BB 5: 10: return 0; ------------------------- BB 7: 6: return hello (entity); BB 8: 6: return hello (entity); --prime-paths-{lines,source} take an optional argument type, which can be 'covered', 'uncovered', or 'both', which defaults to 'uncovered'. The flag controls if the covered or uncovered paths are printed, and while uncovered is generally the most useful one, it is sometimes nice to be able to see only the covered paths. And finally, JSON (abbreviated). It is quite sparse and very nested, but is mostly a JSON version of the source listing. It has to be this nested in order to consistently capture multiple locations. It is always includes the file name per location for consistency, even though this is very much redundant in almost all cases. This format is in no way set in stone, and without targeting it with other tooling I am not sure if it does the job well. "gcc_version": "15.0.0 20240704 (experimental)", "current_working_directory": "dir", "data_file": "hello.o", "files": [ { "file": "hello.c", "functions": [ { "name": "notmain", "demangled_name": "notmain", "start_line": 4, "start_column": 5, "end_line": 7, "end_column": 1, "blocks": 7, "blocks_executed": 0, "execution_count": 0, "total_prime_paths": 2, "covered_prime_paths": 0, "prime_path_coverage": [ { "id": 0, "sequence": [ { "block_id": 2, "locations": [ { "file": "hello.c", "line_numbers": [ 4 ] }, { "file": "hello.h", "line_numbers": [ 6 ] } ], "edge_kind": "fallthru" }, ... gcc/ChangeLog: * Makefile.in (OBJS): Add prime-paths.o, path-coverage.o. (GTFILES): Add prime-paths.cc, path-coverage.cc (GCOV_OBJS): Add graphds.o, prime-paths.o, bitmap.o * builtins.cc (expand_builtin_fork_or_exec): Check path_coverage_flag. * collect2.cc (main): Add -fno-path-coverage to OBSTACK. * common.opt: Add new options -fpath-coverage, -fpath-coverage-limit, -Wcoverage-too-many-paths * doc/gcov.texi: Add --prime-paths, --prime-paths-lines, --prime-paths-source documentation. * doc/invoke.texi: Add -fpath-coverage, -fpath-coverage-limit, -Wcoverage-too-many-paths documentation. * gcc.cc: Link gcov on -fpath-coverage. * gcov-counter.def (GCOV_COUNTER_PATHS): New. * gcov-io.h (GCOV_TAG_PATHS): New. (GCOV_TAG_PATHS_LENGTH): New. (GCOV_TAG_PATHS_NUM): New. * gcov.cc (class path_info): New. (struct coverage_info): Add paths, paths_covered. (find_prime_paths): New. (add_path_counts): New. (find_arc): New. (print_usage): Add -e, --prime-paths, --prime-paths-lines, --prime-paths-source. (process_args): Likewise. (json_set_prime_path_coverage): New. (output_json_intermediate_file): Call json_set_prime_path_coverage. (process_all_functions): Call find_prime_paths. (generate_results): Call add_path_counts. (read_graph_file): Read path counters. (read_count_file): Likewise. (function_summary): Print path counts. (file_summary): Likewise. (print_source_line): New. (print_prime_path_lines): New. (print_inlined_separator): New. (print_prime_path_source): New. (output_path_coverage): New. (output_lines): Print path coverage. * ipa-inline.cc (can_early_inline_edge_p): Check path_coverage_flag. * passes.cc (finish_optimization_passes): Likewise. * profile.cc (branch_prob): Likewise. * selftest-run-tests.cc (selftest::run_tests): Run path coverage tests. * selftest.h (path_coverage_cc_tests): New declaration. * tree-profile.cc (tree_profiling): Check path_coverage_flag. (pass_ipa_tree_profile::gate): Likewise. * path-coverage.cc: New file. * prime-paths.cc: New file. gcc/testsuite/ChangeLog: * lib/gcov.exp: Add prime paths test function. * g++.dg/gcov/gcov-22.C: New test. * g++.dg/gcov/gcov-23-1.h: New test. * g++.dg/gcov/gcov-23-2.h: New test. * g++.dg/gcov/gcov-23.C: New test. * gcc.misc-tests/gcov-29.c: New test. * gcc.misc-tests/gcov-30.c: New test. * gcc.misc-tests/gcov-31.c: New test. * gcc.misc-tests/gcov-32.c: New test. * gcc.misc-tests/gcov-33.c: New test. * gcc.misc-tests/gcov-34.c: New test.
2025-01-02Update copyright years.Jakub Jelinek18-18/+18
2024-10-07nvptx: Re-enable 'gcc.misc-tests/options.exp'Thomas Schwinge1-7/+3
..., just conditionalize its profiling test (as done elsewhere). The re-enabled test cases all PASS. For the record, for example for GCN target, this causes: Running [...]/gcc/testsuite/gcc.misc-tests/options.exp ... -PASS: compiler driver --coverage option(s) PASS: compiler driver -fdump-ipa-all-address option(s) PASS: compiler driver -fdump-ipa-all-alias option(s) PASS: compiler driver -fdump-ipa-all-all option(s) That was: Running [...]/gcc/testsuite/gcc.misc-tests/options.exp ... Executing on host: [xgcc] [...] --coverage [...] [...] ld: error: undefined symbol: __gcov_exit >>> referenced by /tmp/ccRGdqjA.o:(_sub_D_00100_1) >>> referenced by /tmp/ccRGdqjA.o:(_sub_D_00100_1) collect2: error: ld returned 1 exit status compiler exited with status 1 output is: [...] PASS: compiler driver --coverage option(s) ..., so that's nothing to worry about. gcc/testsuite/ * gcc.misc-tests/options.exp: Re-enable for nvptx.
2024-09-08testsuite: Use dg-compile, not gcc -cJørgen Kvalsvik1-1/+2
Since this is a pure compile test it makes sense to inform dejagnu of it. gcc/testsuite/ChangeLog: * gcc.misc-tests/gcov-23.c: Use dg-compile, not gcc -c
2024-07-11Add function filtering to gcovJørgen Kvalsvik4-0/+96
Add the --include and --exclude flags to gcov to control what functions to report on. This is meant to make gcov more practical as an when writing test suites or performing other coverage experiments, which tends to focus on a few functions at the time. This really shines in combination with the -t/--stdout flag. With support for more expansive metrics in gcov like modified condition/decision coverage (MC/DC) and path coverage, output quickly gets overwhelming without filtering. The approach is quite simple: filters are egrep regexes and are evaluated left-to-right, and the last filter "wins", that is, if a function matches an --include and a subsequent --exclude, it should not be included in the output. All of the output machinery works on the function table, so by optionally (not) adding function makes the even the json output work as expected, and only minor changes are needed to suppress the filtered-out functions. Demo: math.c int mul (int a, int b) { return a * b; } int sub (int a, int b) { return a - b; } int sum (int a, int b) { return a + b; } Plain matches: $ gcov -t math --include=sum -: 0:Source:math.c -: 0:Graph:math.gcno -: 0:Data:- -: 0:Runs:0 #####: 9:int sum (int a, int b) { #####: 10: return a + b; -: 11:} $ gcov -t math --include=mul -: 0:Source:math.c -: 0:Graph:math.gcno -: 0:Data:- -: 0:Runs:0 #####: 1:int mul (int a, int b) { #####: 2: return a * b; -: 3:} Regex match: $ gcov -t math --include=su -: 0:Source:math.c -: 0:Graph:math.gcno -: 0:Data:- -: 0:Runs:0 #####: 5:int sub (int a, int b) { #####: 6: return a - b; -: 7:} #####: 9:int sum (int a, int b) { #####: 10: return a + b; -: 11:} And similar for exclude: $ gcov -t math --exclude=sum -: 0:Source:math.c -: 0:Graph:math.gcno -: 0:Data:- -: 0:Runs:0 #####: 1:int mul (int a, int b) { #####: 2: return a * b; -: 3:} #####: 5:int sub (int a, int b) { #####: 6: return a - b; -: 7:} And json, for good measure: $ gcov -t math --include=sum --json | jq ".files[].lines[]" { "line_number": 9, "function_name": "sum", "count": 0, "unexecuted_block": true, "block_ids": [], "branches": [], "calls": [] } { "line_number": 10, "function_name": "sum", "count": 0, "unexecuted_block": true, "block_ids": [ 2 ], "branches": [], "calls": [] } Matching generally work well for mangled names, as the mangled names also have the base symbol name in it. By default, functions are matched by the mangled name, which means matching on base names always work as expected. The -M flag makes the matching work on the demangled name which is quite useful when you only want to report on specific overloads and can use the full type names. Why not just use grep? grep is not really sufficient as grep is very line oriented, and the reports that benefit the most from filtering often unpredictably span multiple lines based on the state of coverage. For example, a condition coverage report for 3 terms/6 outcomes only outputs 1 line when all conditions are covered, and 7 with no lines covered. gcc/ChangeLog: * doc/gcov.texi: Add --include, --exclude, --match-on-demangled documentation. * gcov.cc (struct fnfilter): New. (print_usage): Add --include, --exclude, -M, --match-on-demangled. (process_args): Likewise. (release_structures): Release filters. (read_graph_file): Only add function_infos matching filters. (output_lines): Likewise. gcc/testsuite/ChangeLog: * lib/gcov.exp: Add filtering test function. * g++.dg/gcov/gcov-19.C: New test. * g++.dg/gcov/gcov-20.C: New test. * g++.dg/gcov/gcov-21.C: New test. * gcc.misc-tests/gcov-25.c: New test. * gcc.misc-tests/gcov-26.c: New test. * gcc.misc-tests/gcov-27.c: New test. * gcc.misc-tests/gcov-28.c: New test.
2024-04-15Guard longjmp in test to not inf loop [PR114720]Jørgen Kvalsvik1-1/+13
Guard the longjmp to not infinitely loop. The longjmp (jump) function is called unconditionally to make test flow simpler, but the jump destination would return to a point in main that would call longjmp again. The longjmp is really there to exercise the then-branch of setjmp, to verify coverage is accurately counted in the presence of complex edges. PR gcov-profile/114720 gcc/testsuite/ChangeLog: * gcc.misc-tests/gcov-22.c: Guard longjmp to not loop.
2024-04-15gcov-profile/114715 - missing coverage for switchRichard Biener1-0/+30
The following avoids missing coverage for the line of a switch statement which happens when gimplification emits a BIND_EXPR wrapping the switch as that prevents us from setting locations on the containing statements via annotate_all_with_location. Instead set the location of the GIMPLE switch directly. PR gcov-profile/114715 * gimplify.cc (gimplify_switch_expr): Set the location of the GIMPLE switch. * gcc.misc-tests/gcov-24.c: New testcase.
2024-04-11middle-end/114681 - condition coverage and inliningRichard Biener1-0/+18
When inlining a gcond it can map to multiple stmts, esp. with non-call EH. The following makes sure to pick up the remapped condition when dealing with condition coverage. PR middle-end/114681 * tree-inline.cc (copy_bb): Key on the remapped stmt to identify gconds to have condition coverage data remapped. * gcc.misc-tests/gcov-pr114681.c: New testcase.
2024-04-09Guard function->cond_uids access [PR114601]Jørgen Kvalsvik1-0/+11
PR114601 shows that it is possible to reach the condition_uid lookup without having also created the fn->cond_uids, through compiler-generated conditionals. Consider all lookups on non-existing maps misses, which they are from the perspective of the source code, to avoid the NULL access. PR gcov-profile/114601 gcc/ChangeLog: * tree-profile.cc (condition_uid): Guard fn->cond_uids access. gcc/testsuite/ChangeLog: * gcc.misc-tests/gcov-pr114601.c: New test.
2024-04-09Add tree-inlined gconds to caller cond->expr mapJørgen Kvalsvik1-0/+52
Properly add the condition -> expression mapping of inlined gconds from the caller into the callee map. This is a fix for PR114599 that works beyond fixing the segfault, as the previous fixed copied references to the source gconds, not the deep copied ones that end up in the calle body. The new tests checks this, both in the case of a calle without conditions (which triggered the segfault), and a test that shows that conditions are properly mapped, and not mixed. PR middle-end/114599 gcc/ChangeLog: * tree-inline.cc (copy_bb): Copy cond_uids into callee. (prepend_lexical_block): Remove outdated comment. (add_local_variables): Remove bad cond_uids copy. gcc/testsuite/ChangeLog: * gcc.misc-tests/gcov-19.c: New test.
2024-04-08testsuite: Add profile_update_atomic check to gcov-20.c [PR114614]Kewen Lin1-0/+1
As PR114614 shows, the newly added test case gcov-20.c by commit r14-9789-g08a52331803f66 failed on targets which do not support atomic profile update, there would be a message like: warning: target does not support atomic profile update, single mode is selected Since the test case adopts -fprofile-update=atomic, it requires effective target check profile_update_atomic, this patch is to add the check accordingly. PR testsuite/114614 gcc/testsuite/ChangeLog: * gcc.misc-tests/gcov-20.c: Add effective target check profile_update_atomic.
2024-04-06Copy condition->expr map when inlining [PR114599]Jørgen Kvalsvik1-0/+25
When a function is tree-inlined, copy the condition -> expression mapping from the inlined function into the caller, shifted so uids are not mixed. Tree inlining was always problematic under condition coverage - either through a nullptr dereference (triggered by the test case), or through quietly mixing caller conditions with the callee conditions. PR middle-end/114599 gcc/ChangeLog: * tree-inline.cc (add_local_variables): Copy cond_uids mappings. gcc/testsuite/ChangeLog: * gcc.misc-tests/gcov-pr114599.c: New test.
2024-04-06Remove unecessary and broken MC/DC compile testJørgen Kvalsvik1-11/+0
The __sigsetjmp test was added as a regression test in an early iteration of the MC/DC support, as it caused an internal compiler error. This was triggered by a code path which did not make it through to the final revision. Since this test really only worked on systems with __sigsetjmp, and does not serve a purpose any more it can be removed. gcc/testsuite/ChangeLog: * gcc.misc-tests/gcov-19.c: Remove test.
2024-04-04Add condition coverage (MC/DC)Jørgen Kvalsvik5-0/+2239
This patch adds support in gcc+gcov for modified condition/decision coverage (MC/DC) with the -fcondition-coverage flag. MC/DC is a type of test/code coverage and it is particularly important for safety-critical applicaitons in industries like aviation and automotive. Notably, MC/DC is required or recommended by: * DO-178C for the most critical software (Level A) in avionics. * IEC 61508 for SIL 4. * ISO 26262-6 for ASIL D. From the SQLite webpage: Two methods of measuring test coverage were described above: "statement" and "branch" coverage. There are many other test coverage metrics besides these two. Another popular metric is "Modified Condition/Decision Coverage" or MC/DC. Wikipedia defines MC/DC as follows: * Each decision tries every possible outcome. * Each condition in a decision takes on every possible outcome. * Each entry and exit point is invoked. * Each condition in a decision is shown to independently affect the outcome of the decision. In the C programming language where && and || are "short-circuit" operators, MC/DC and branch coverage are very nearly the same thing. The primary difference is in boolean vector tests. One can test for any of several bits in bit-vector and still obtain 100% branch test coverage even though the second element of MC/DC - the requirement that each condition in a decision take on every possible outcome - might not be satisfied. https://sqlite.org/testing.html#mcdc MC/DC comes in different flavors, the most important being unique cause MC/DC and masking MC/DC. This patch implements masking MC/DC, which is works well with short circuiting semantics, and according to John Chilenski's "An Investigation of Three Forms of the Modified Condition Decision Coverage (MCDC) Criterion" (2001) is as good as unique cause at catching bugs. Whalen, Heimdahl, and De Silva "Efficient Test Coverage Measurement for MC/DC" describes an algorithm for finding the masking table from an AST walk, but my algorithm figures this out by analyzing the control flow graph. The CFG is considered a reduced ordered binary decision diagram and an input vector a path through the BDD, which is recorded. Specific edges will mask ("null out") the contribution from earlier path segments, which can be determined by finding short circuit endpoints. Masking is most easily understood as circuiting of terms in the reverse-ordered Boolean function, and the masked conditions do not affect the decision like short-circuited conditions do not affect the decision. A tag/discriminator mapping from gcond->uid is created during gimplification and made available through the function struct. The values are unimportant as long as basic conditions constructed from a single Boolean expression are given the same identifier. This happens in the breaking down of ANDIF/ORIF trees, so the coverage generally works well for frontends that create such trees. Like Whalen et al this implementation records coverage in fixed-size bitsets which gcov knows how to interpret. Recording conditions only requires a few bitwise operations per condition and is very fast, but comes with a limit on the number of terms in a single boolean expression; the number of bits in a gcov_unsigned_type (which is usually typedef'd to uint64_t). For most practical purposes this is acceptable, and by default a warning will be issued if gcc cannot instrument the expression. This is a practical limitation in the implementation, and not a limitation of the algorithm, so support for more conditions can be supported by introducing arbitrary-sized bitsets. In action it looks pretty similar to the branch coverage. The -g short opt carries no significance, but was chosen because it was an available option with the upper-case free too. gcov --conditions: 3: 17:void fn (int a, int b, int c, int d) { 3: 18: if ((a && (b || c)) && d) conditions covered 3/8 condition 0 not covered (true false) condition 1 not covered (true) condition 2 not covered (true) condition 3 not covered (true) 1: 19: x = 1; -: 20: else 2: 21: x = 2; 3: 22:} gcov --conditions --json-format: "conditions": [ { "not_covered_false": [ 0 ], "count": 8, "covered": 3, "not_covered_true": [ 0, 1, 2, 3 ] } ], Expressions with constants may be heavily rewritten before it reaches the gimplification, so constructs like int x = a ? 0 : 1 becomes _x = (_a == 0). From source you would expect coverage, but it gets neither branch nor condition coverage. The same applies to expressions like int x = 1 || a which are simply replaced by a constant. The test suite contains a lot of small programs and functions. Some of these were designed by hand to test for specific behaviours and graph shapes, and some are previously-failed test cases in other programs adapted into the test suite. gcc/ChangeLog: * builtins.cc (expand_builtin_fork_or_exec): Check condition_coverage_flag. * collect2.cc (main): Add -fno-condition-coverage to OBSTACK. * common.opt: Add new options -fcondition-coverage and -Wcoverage-too-many-conditions. * doc/gcov.texi: Add --conditions documentation. * doc/invoke.texi: Add -fcondition-coverage documentation. * function.cc (free_after_compilation): Free cond_uids. * function.h (struct function): Add cond_uids. * gcc.cc: Link gcov on -fcondition-coverage. * gcov-counter.def (GCOV_COUNTER_CONDS): New. * gcov-dump.cc (tag_conditions): New. * gcov-io.h (GCOV_TAG_CONDS): New. (GCOV_TAG_CONDS_LENGTH): New. (GCOV_TAG_CONDS_NUM): New. * gcov.cc (class condition_info): New. (condition_info::condition_info): New. (condition_info::popcount): New. (struct coverage_info): New. (add_condition_counts): New. (output_conditions): New. (print_usage): Add -g, --conditions. (process_args): Likewise. (output_intermediate_json_line): Output conditions. (read_graph_file): Read condition counters. (read_count_file): Likewise. (file_summary): Print conditions. (accumulate_line_info): Accumulate conditions. (output_line_details): Print conditions. * gimplify.cc (next_cond_uid): New. (reset_cond_uid): New. (shortcut_cond_r): Set condition discriminator. (tag_shortcut_cond): New. (gimple_associate_condition_with_expr): New. (shortcut_cond_expr): Set condition discriminator. (gimplify_cond_expr): Likewise. (gimplify_function_tree): Call reset_cond_uid. * ipa-inline.cc (can_early_inline_edge_p): Check condition_coverage_flag. * ipa-split.cc (pass_split_functions::gate): Likewise. * passes.cc (finish_optimization_passes): Likewise. * profile.cc (struct condcov): New declaration. (cov_length): Likewise. (cov_blocks): Likewise. (cov_masks): Likewise. (cov_maps): Likewise. (cov_free): Likewise. (instrument_decisions): New. (read_thunk_profile): Control output to file. (branch_prob): Call find_conditions, instrument_decisions. (init_branch_prob): Add total_num_conds. (end_branch_prob): Likewise. * tree-core.h (struct tree_exp): Add condition_uid. * tree-profile.cc (struct conds_ctx): New. (CONDITIONS_MAX_TERMS): New. (EDGE_CONDITION): New. (topological_cmp): New. (index_of): New. (single_p): New. (single_edge): New. (contract_edge_up): New. (struct outcomes): New. (conditional_succs): New. (condition_index): New. (condition_uid): New. (masking_vectors): New. (emit_assign): New. (emit_bitwise_op): New. (make_top_index_visit): New. (make_top_index): New. (paths_between): New. (struct condcov): New. (cov_length): New. (cov_blocks): New. (cov_masks): New. (cov_maps): New. (cov_free): New. (find_conditions): New. (struct counters): New. (find_counters): New. (resolve_counter): New. (resolve_counters): New. (instrument_decisions): New. (tree_profiling): Check condition_coverage_flag. (pass_ipa_tree_profile::gate): Likewise. * tree.h (SET_EXPR_UID): New. (EXPR_COND_UID): New. libgcc/ChangeLog: * libgcov-merge.c (__gcov_merge_ior): New. gcc/testsuite/ChangeLog: * lib/gcov.exp: Add condition coverage test function. * g++.dg/gcov/gcov-18.C: New test. * gcc.misc-tests/gcov-19.c: New test. * gcc.misc-tests/gcov-20.c: New test. * gcc.misc-tests/gcov-21.c: New test. * gcc.misc-tests/gcov-22.c: New test. * gcc.misc-tests/gcov-23.c: New test.
2024-04-02testsuite, Darwin: Allow for an undefined symbol [PR114036].Iain Sandoe1-1/+1
Darwin's linker defaults to requiring all symbols to be defined at static link time (unless specifically noted or dynamic lookuo is enabled). For this test, we just need to note that the symbol is expected to be undefined. PR testsuite/114036 gcc/testsuite/ChangeLog: * gcc.misc-tests/gcov-14.c: Allow for 'Foo' to be undefined on Darwin link lines. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2024-02-09testsuite: Pattern does not match when using --specs=nano.specsTorbjörn SVENSSON1-1/+1
When running the testsuite for newlib nano, the --specs=nano.specs option is used. This option prepends cpp_unique_options with "-isystem =/include/newlib-nano" so that the newlib nano header files override the newlib standard ones. As the -isystem option is prepended, the -quiet option is no longer the first option to cc1. Adjust the test accordingly. Patch has been verified on Windows and Linux. gcc/testsuite/ChangeLog: * gcc.misc-tests/options.exp: Allow other options before the -quite option for cc1. Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
2024-01-03Update copyright years.Jakub Jelinek18-18/+18
2023-12-11Fix regression causing ICE for structs with VLAs [PR 112488]Martin Uecker1-1/+1
A previous patch that fixed several ICEs related to size expressions of VM types (PR c/70418, ...) caused a regression for structs where a DECL_EXPR is not generated anymore although reqired. We now call add_decl_expr introduced by the previous patch from finish_struct. The function is revised with a new argument to not set the TYPE_NAME for the type to the DECL_EXPR in this specific case. PR c/112488 gcc/c * c-decl.cc (add_decl_expr): Revise. (finish_struct): Create DECL_EXPR. * c-parser.cc (c_parser_struct_or_union_specifier): Call finish_struct with expression for VLA sizes. * c-tree.h (finish_struct): Add argument. gcc/testsuite * gcc.dg/pr112488-1.c: New test. * gcc.dg/pr112488-2.c: New test. * gcc.dg/pr112898.c: New test. * gcc.misc-tests/gcov-pr85350.c: Adapt.
2023-11-23gcc: Introduce -fhardenedMarek Polacek1-0/+2
In <https://gcc.gnu.org/pipermail/gcc-patches/2023-August/628748.html> I proposed -fhardened, a new umbrella option that enables a reasonable set of hardening flags. The read of the room seems to be that the option would be useful. So here's a patch implementing that option. Currently, -fhardened enables: -D_FORTIFY_SOURCE=3 (or =2 for older glibcs) -D_GLIBCXX_ASSERTIONS -ftrivial-auto-var-init=zero -fPIE -pie -Wl,-z,relro,-z,now -fstack-protector-strong -fstack-clash-protection -fcf-protection=full (x86 GNU/Linux only) -fhardened will not override options that were specified on the command line (before or after -fhardened). For example, -D_FORTIFY_SOURCE=1 -fhardened means that _FORTIFY_SOURCE=1 will be used. Similarly, -fhardened -fstack-protector will not enable -fstack-protector-strong. Currently, -fhardened is only supported on GNU/Linux. In DW_AT_producer it is reflected only as -fhardened; it doesn't expand to anything. This patch provides -Whardened, enabled by default, which warns when -fhardened couldn't enable a particular option. I think most often it will say that _FORTIFY_SOURCE wasn't enabled because optimization were not enabled. gcc/c-family/ChangeLog: * c-opts.cc: Include "target.h". (c_finish_options): Maybe cpp_define _FORTIFY_SOURCE and _GLIBCXX_ASSERTIONS. gcc/ChangeLog: * common.opt (Whardened, fhardened): New options. * config.in: Regenerate. * config/bpf/bpf.cc: Include "opts.h". (bpf_option_override): If flag_stack_protector_set_by_fhardened_p, do not inform that -fstack-protector does not work. * config/i386/i386-options.cc (ix86_option_override_internal): When -fhardened, maybe enable -fcf-protection=full. * config/linux-protos.h (linux_fortify_source_default_level): Declare. * config/linux.cc (linux_fortify_source_default_level): New. * config/linux.h (TARGET_FORTIFY_SOURCE_DEFAULT_LEVEL): Redefine. * configure: Regenerate. * configure.ac: Check if the linker supports '-z now' and '-z relro'. Check if -fhardened is supported on $target_os. * doc/invoke.texi: Document -fhardened and -Whardened. * doc/tm.texi: Regenerate. * doc/tm.texi.in (TARGET_FORTIFY_SOURCE_DEFAULT_LEVEL): Add. * gcc.cc (driver_handle_option): Remember if any link options or -static were specified on the command line. (process_command): When -fhardened, maybe enable -pie and -Wl,-z,relro,-z,now. * opts.cc (flag_stack_protector_set_by_fhardened_p): New global. (finish_options): When -fhardened, enable -ftrivial-auto-var-init=zero and -fstack-protector-strong. (print_help_hardened): New. (print_help): Call it. * opts.h (flag_stack_protector_set_by_fhardened_p): Declare. * target.def (fortify_source_default_level): New target hook. * targhooks.cc (default_fortify_source_default_level): New. * targhooks.h (default_fortify_source_default_level): Declare. * toplev.cc (process_options): When -fhardened, enable -fstack-clash-protection. If flag_stack_protector_set_by_fhardened_p, do not warn that -fstack-protector not supported for this target. Don't enable -fhardened when !HAVE_FHARDENED_SUPPORT. gcc/testsuite/ChangeLog: * gcc.misc-tests/help.exp: Test -fhardened. * c-c++-common/fhardened-1.S: New test. * c-c++-common/fhardened-1.c: New test. * c-c++-common/fhardened-10.c: New test. * c-c++-common/fhardened-11.c: New test. * c-c++-common/fhardened-12.c: New test. * c-c++-common/fhardened-13.c: New test. * c-c++-common/fhardened-14.c: New test. * c-c++-common/fhardened-15.c: New test. * c-c++-common/fhardened-2.c: New test. * c-c++-common/fhardened-3.c: New test. * c-c++-common/fhardened-4.c: New test. * c-c++-common/fhardened-5.c: New test. * c-c++-common/fhardened-6.c: New test. * c-c++-common/fhardened-7.c: New test. * c-c++-common/fhardened-8.c: New test. * c-c++-common/fhardened-9.c: New test. * gcc.target/i386/cf_check-6.c: New test.
2023-11-22gcc.misc-tests/linkage-y.c: Compatibility with C99+ system compilersFlorian Weimer1-0/+3
This program is compiled with an installed "cc" compiler, not the built GCC compiler, so it should be as compatible as possible across a wide range of compilers. gcc/testsuite/ * gcc.misc-tests/linkage-y.c (puts): Declare. (main): Add int return type and return 0.
2023-10-26testsuite: Fix _BitInt in gcc.misc-tests/godump-1.cStefan Schulze Frielinghaus2-12/+18
Currently _BitInt is only supported on x86_64 which means that for other targets all tests fail with e.g. gcc.misc-tests/godump-1.c:237:1: sorry, unimplemented: '_BitInt(32)' is not supported on this target 237 | _BitInt(32) b32_v; | ^~~~~~~ Instead of requiring _BitInt support for godump-1.c, move _BitInt tests into godump-2.c such that all other tests in godump-1.c are still executed in case of missing _BitInt support. gcc/testsuite/ChangeLog: * gcc.misc-tests/godump-1.c: Move _BitInt tests into godump-2.c. * gcc.misc-tests/godump-2.c: New test.
2023-09-06-fgo-dump-spec: support _BitIntIan Lance Taylor1-0/+11
gcc/ PR go/111310 * godump.cc (go_format_type): Handle BITINT_TYPE. gcc/testsuite/ PR go/111310 * gcc.misc-tests/godump-1.c: Add _BitInt test cases.
2023-06-28[testsuite] note pitfall in how outputs.exp sets gldAlexandre Oliva1-1/+9
This patch documents a glitch in gcc.misc-tests/outputs.exp: it checks whether the linker is GNU ld, and uses that to decide whether to expect collect2 to create .ld1_args files under -save-temps, but collect2 bases that decision on whether HAVE_GNU_LD is set, which may be false zero if the linker in use is GNU ld. Configuring --with-gnu-ld fixes this misalignment. Without that, atsave tests are likely to fail, because without HAVE_GNU_LD, collect2 won't use @file syntax to run the linker (so it won't create .ld1_args files). Long version: HAVE_GNU_LD is set when (i) DEFAULT_LINKER is set during configure, pointing at GNU ld; (ii) --with-gnu-ld is passed to configure; or (iii) config.gcc sets gnu_ld=yes. If a port doesn't set gnu_ld, and the toolchain isn't configured so as to assume GNU ld, configure and thus collect2 conservatively assume the linker doesn't support @file arguments. But outputs.exp can't see how configure set HAVE_GNU_LD (it may be used to test an installed compiler), and upon finding that the linker used by the compiler is GNU ld, it will expect collect2 to use @file arguments when running the linker. If that assumption doesn't hold, atsave tests will fail. for gcc/testsuite/ChangeLog * gcc.misc-tests/outputs.exp (gld): Note a known mismatch and record a workaround.
2023-06-01testsuite: Unbork multilib setups using -march flags (RISC-V)Vineet Gupta1-7/+7
RISC-V multilib testing is currently busted with follow splat all over: | Schedule of variations: | riscv-sim/-march=rv64imafdc/-mabi=lp64d/-mcmodel=medlow | riscv-sim/-march=rv32imafdc/-mabi=ilp32d/-mcmodel=medlow | riscv-sim/-march=rv32imac/-mabi=ilp32/-mcmodel=medlow | riscv-sim/-march=rv64imac/-mabi=lp64/-mcmodel=medlow ... ... | ERROR: tcl error code NONE | ERROR: torture-init: torture_without_loops is not empty as expected causing insane amount of false failures. | ========= Summary of gcc testsuite ========= | | # of unexpected case / # of unique unexpected case | | gcc | g++ | gfortran | | rv64imafdc/ lp64d/ medlow | 5421 / 4 | 1 / 1 | 6 / 1 | | rv32imafdc/ ilp32d/ medlow | 5422 / 5 | 3 / 2 | 6 / 1 | | rv32imac/ ilp32/ medlow | 391 / 5 | 3 / 2 | 43 / 8 | | rv64imac/ lp64/ medlow | 5422 / 5 | 1 / 1 | 43 / 8 | The error splat itself is from recent test harness improvements for stricter checks for torture-{init,finish} pairing. But the real issue is a latent bug from 2009: commit 3dd1415dc88, ("i386-prefetch.exp: Skip tests when multilib flags contain -march") which added an "early exit" condition to i386-prefetch.exp which could potentially cause an unpaired torture-{init,finish}. The early exit only happens in a multlib setup using -march in flags which is what RISC-V happens to use, hence the reason this was only seen on RISC-V multilib testing. Moving the early exit outside of torture-{init,finish} bracket reinstates RISC-V testing. | rv64imafdc/ lp64d/ medlow | 3 / 2 | 1 / 1 | 6 / 1 | | rv32imafdc/ ilp32d/ medlow | 4 / 3 | 3 / 2 | 6 / 1 | | rv32imac/ ilp32/ medlow | 3 / 2 | 3 / 2 | 43 / 8 | | rv64imac/ lp64/ medlow | 5 / 4 | 1 / 1 | 43 / 8 | gcc/testsuite: * gcc.misc-tests/i386-prefetch.exp: Move early return outside the torture-{init,finish} Signed-off-by: Vineet Gupta <vineetg@rivosinc.com>
2023-05-23Fix ICEs related to VM types in C 1/2 [PR70418, PR107557, PR108423]Martin Uecker1-1/+1
Size expressions were sometimes lost and not gimplified correctly, leading to ICEs and incorrect evaluation order. Fix this by 1) not recursing into pointers when gimplifying parameters in the middle-end (the code is merged with gimplify_type_sizes), which is incorrect because it might access variables declared later for incomplete structs, and 2) tracking size expressions for struct/union members correctly, 3) emitting code to evaluate size expressions for missing cases (nested functions, empty declarations, and structs/unions). PR c/70418 PR c/106465 PR c/107557 PR c/108423 gcc/c/ * c-decl.cc (start_decl): Make sure size expression are evaluated only in correct context. (grokdeclarator): Size expression in fields may need a bind expression, make sure DECL_EXPR is always created. (grokfield, declspecs_add_type): Pass along size expressions. (finish_struct): Remove unneeded DECL_EXPR. (start_function): Evaluate size expressions for nested functions. * c-parser.cc (c_parser_struct_declarations, c_parser_struct_or_union_specifier): Pass along size expressions. (c_parser_declaration_or_fndef): Evaluate size expression. (c_parser_objc_at_property_declaration, c_parser_objc_class_instance_variables): Adapt. * c-tree.h (grokfield): Adapt declaration. gcc/testsuite/ * gcc.dg/nested-vla-1.c: New test. * gcc.dg/nested-vla-2.c: New test. * gcc.dg/nested-vla-3.c: New test. * gcc.dg/pr70418.c: New test. * gcc.dg/pr106465.c: New test. * gcc.dg/pr107557-1.c: New test. * gcc.dg/pr107557-2.c: New test. * gcc.dg/pr108423-1.c: New test. * gcc.dg/pr108423-2.c: New test. * gcc.dg/pr108423-3.c: New test. * gcc.dg/pr108423-4.c: New test. * gcc.dg/pr108423-5.c: New test. * gcc.dg/pr108423-6.c: New test. * gcc.dg/typename-vla-2.c: New test. * gcc.dg/typename-vla-3.c: New test. * gcc.dg/typename-vla-4.c: New test. * gcc.misc-tests/gcov-pr85350.c: Adapt.
2023-01-16Update copyright years.Jakub Jelinek18-18/+18
2022-11-16testsuite: Fix mistransformed gcovHans-Peter Nilsson1-2/+2
In commit r13-2619-g34b9a03353d3fd, [transform] was applied to all invocations of gcov, for both out-of-tree and in-tree testing. For in-tree cross builds, this means gcov was called as "/path/to/gccobj/gcc/target-tuple-gcov" gcov-pr94029.c which is incorrect, as it's there "/path/to/gccobj/gcc/gcov" until it's installed. This caused a testsuite failure, like: Running /x/gcc/gcc/testsuite/gcc.misc-tests/gcov.exp ... FAIL: gcc.misc-tests/gcov-pr94029.c gcov failed: spawn failed To avoid cumbersome conditionals, use a dedicated new helper function. gcc/testsuite: * lib/gcc-dg.exp (gcc-transform-out-of-tree): New proc. * g++.dg/gcov/gcov.exp, gcc.misc-tests/gcov.exp: Call gcc-transform-out-of-tree instead of transform.
2022-10-14gcov: test line count for label in then/else blockJørgen Kvalsvik1-1/+25
Add a test to catch regression in line counts for labels on top of then/else blocks. Only the 'goto <label>' should contribute to the line counter for the label, not the if. gcc/testsuite/ChangeLog: * gcc.misc-tests/gcov-4.c: New testcase.
2022-10-14gcov: test switch/break line countsJørgen Kvalsvik1-2/+2
The coverage support will under some conditions decide to split edges to accurately report coverage. By running the test suite with/without this edge splitting a small diff shows up, addressed by this patch, which should catch future regressions. Removing the edge splitting: $ diff --git a/gcc/profile.cc b/gcc/profile.cc --- a/gcc/profile.cc +++ b/gcc/profile.cc @@ -1244,19 +1244,7 @@ branch_prob (bool thunk) Don't do that when the locuses match, so if (blah) goto something; is not computed twice. */ - if (last - && gimple_has_location (last) - && !RESERVED_LOCATION_P (e->goto_locus) - && !single_succ_p (bb) - && (LOCATION_FILE (e->goto_locus) - != LOCATION_FILE (gimple_location (last)) - || (LOCATION_LINE (e->goto_locus) - != LOCATION_LINE (gimple_location (last))))) - { - basic_block new_bb = split_edge (e); - edge ne = single_succ_edge (new_bb); - ne->goto_locus = e->goto_locus; - } + if ((e->flags & (EDGE_ABNORMAL | EDGE_ABNORMAL_CALL)) && e->dest != EXIT_BLOCK_PTR_FOR_FN (cfun)) need_exit_edge = 1; Assuming the .gcov files from make chec-gcc RUNTESTFLAGS=gcov.exp are kept: $ diff -r no-split-edge with-split-edge | grep -C 2 -E "^[<>]\s\s" diff -r sans-split-edge/gcc/gcov-4.c.gcov with-split-edge/gcc/gcov-4.c.gcov 228c228 < -: 224: break; --- > 1: 224: break; 231c231 < -: 227: break; --- > #####: 227: break; 237c237 < -: 233: break; --- > 2: 233: break; gcc/testsuite/ChangeLog: * g++.dg/gcov/gcov-1.C: Add line count check. * gcc.misc-tests/gcov-4.c: Likewise.
2022-10-05testsuite: /dev/null is not accessible on WindowsTorbjörn SVENSSON1-5/+12
When running the DejaGNU testsuite on a toolchain built for native Windows, the path /dev/null can't be used to open a stream to void. On native Windows, the resource is instead named "nul". The error would look like this: c:/arm-11.3.rel1/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld.exe: cannot find @/dev/null: No such file or directory Patch has been verified on Windows and Linux. gcc/testsuite: * gcc.misc-tests/outputs.exp: Use "@nul" for Windows, "@/dev/null" for other environments. Co-Authored-By: Yvan ROUX <yvan.roux@foss.st.com> Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com> Signed-off-by: Jonathan Yong <10walls@gmail.com>
2022-09-12gcov: Respect triplet when looking for gcovTorbjörn SVENSSON1-2/+2
When testing a cross toolchain outside the build tree, the binary name for gcov is prefixed with the triplet. gcc/testsuite/ChangeLog: * g++.dg/gcov/gcov.exp: Respect triplet when looking for gcov. * gcc.misc-tests/gcov.exp: Likewise. Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
2022-06-25Remove long deprecated tilegx and tilepro portsJeff Law1-7/+0
/ * MAINTAINERS: Remove tilegx and tilepro entries. * configure.ac: Remove tilegx and tilepro stanzas. * configure: Rebuilt. contrib/ * config-list.mk: Remove tilegx and tilepro entries. * gcc_update: Remove tilegx and tilepro entries. gcc/ * common/config/tilegx/tilegx-common.cc: Removed. * common/config/tilepro/tilepro-common.cc: Removed. * config.gcc: Remove tilegx and tilepro entries. * config/tilegx/constraints.md: Removed. * config/tilegx/feedback.h: Removed. * config/tilegx/linux.h: Removed. * config/tilegx/mul-tables.cc: Removed. * config/tilegx/predicates.md: Removed. * config/tilegx/sync.md: Removed. * config/tilegx/t-tilegx: Removed. * config/tilegx/tilegx-builtins.h: Removed. * config/tilegx/tilegx-c.cc: Removed. * config/tilegx/tilegx-generic.md: Removed. * config/tilegx/tilegx-modes.def: Removed. * config/tilegx/tilegx-multiply.h: Removed. * config/tilegx/tilegx-opts.h: Removed. * config/tilegx/tilegx-protos.h: Removed. * config/tilegx/tilegx.cc: Removed. * config/tilegx/tilegx.h: Removed. * config/tilegx/tilegx.md: Removed. * config/tilegx/tilegx.opt: Removed. * config/tilepro/constraints.md: Removed. * config/tilepro/feedback.h: Removed. * config/tilepro/gen-mul-tables.cc: Removed. * config/tilepro/linux.h: Removed. * config/tilepro/mul-tables.cc: Removed. * config/tilepro/predicates.md: Removed. * config/tilepro/t-tilepro: Removed. * config/tilepro/tilepro-builtins.h: Removed. * config/tilepro/tilepro-c.cc: Removed. * config/tilepro/tilepro-generic.md: Removed. * config/tilepro/tilepro-modes.def: Removed. * config/tilepro/tilepro-multiply.h: Removed. * config/tilepro/tilepro-protos.h: Removed. * config/tilepro/tilepro.cc: Removed. * config/tilepro/tilepro.h: Removed. * config/tilepro/tilepro.md: Removed. * config/tilepro/tilepro.opt: Removed. * configure.ac: Remove tilegx and tilepro entries. * configure: Rebuilt. * doc/extend.texi: Remove tilegx and tilepro entries. * doc/install.texi: Remove tilegx and tilepro entries. * doc/invoke.texi: Remove tilegx and tilepro entries. * doc/md.texi: Remove tilegx and tilepro entries. gcc/testsuite/ * gcc.dg/lower-subreg-1.c: Remove tilegx and tilepro entries. * gcc.misc-tests/linkage.exp: Remove tilegx and tilepro entries. libgcc/ * config.host: Removed tilegx and tilepro entries. * config/tilegx/sfp-machine.h: Removed. * config/tilegx/sfp-machine32.h: Removed. * config/tilegx/sfp-machine64.h: Removed. * config/tilegx/t-crtstuff: Removed. * config/tilegx/t-softfp: Removed. * config/tilegx/t-tilegx: Removed. * config/tilepro/atomic.c: Removed. * config/tilepro/atomic.h: Removed. * config/tilepro/linux-unwind.h: Removed. * config/tilepro/sfp-machine.h: Removed. * config/tilepro/softdivide.c: Removed. * config/tilepro/softmpy.S: Removed. * config/tilepro/t-crtstuff: Removed. * config/tilepro/t-tilepro: Removed.
2022-06-21testsuite: outputs.exp: cleanup before running testsAlexandre Oliva1-0/+3
Use the just-added dry-run infrastructure to clean up files that may have been left over by interrupted runs of outputs.exp, which used to lead to spurious non-repeatable (self-fixing) failures. for gcc/testsuite/ChangeLog * gcc.misc-tests/outputs.exp: Clean up left-overs first.
2022-06-21testsuite: outputs.exp: test for skip_atsave more thoroughlyAlexandre Oliva1-7/+42
The presence of -I or -L flags in link command lines changes the driver's, and thus the linker's behavior, WRT naming files with command-line options. With such flags, the driver creates .args.0 and .args.1 files, whereas without them it's the linker (collect2, really) that creates .ld1_args. I've hit some fails on a target system that doesn't have -I or -L flags in the board config file, but it does add some of them implicitly with configured-in driver self specs. Alas, the test in outputs.exp doesn't catch that, so we proceed to run rather than skip_atsave tests. I've reworked the outest procedure to allow dry runs and to return would-have-been pass/fail results as lists, so we can now test whether certain files are created and use that to configure the actual test runs. for gcc/testsuite/ChangeLog * gcc.misc-tests/outputs.exp (outest): Introduce quiet mode, create and return lists of passes and fails. Use it to catch skip_atsave cases where -L flags are implicitly added by driver self specs.
2022-05-24gcc.misc-tests/outputs.exp: Use link test to check for -gsplit-dwarf supportJoel Brobecker1-2/+2
We have noticed that, when running the GCC testsuite on AArch64 RTEMS 6, we have about 150 tests failing due to a link failure. When investigating, we found that all the tests were failing due to the use of -gsplit-dwarf. On this platform, using -gsplit-dwarf currently causes an error during the link: | /[...]/ld: a.out section `.unexpected_sections' will not fit | in region `UNEXPECTED_SECTIONS' | /[...]/ld: region `UNEXPECTED_SECTIONS' overflowed by 56 bytes The error is a bit cryptic, but the source of the issue is that the linker does not currently support the sections generated by -gsplit-dwarf (.debug_gnu_pubnames, .debug_gnu_pubtypes). This means that the -gsplit-dwarf feature itself really isn't supported on this platform, at least for the moment. This commit enhances the -gsplit-dwarf support check to be a compile-and-link check, rather than just a compile check. This allows it to properly detect that this feature isn't supported on platforms such as AArch64 RTEMS where the compilation works, but not the link. Tested on aarch64-rtems, where a little over 150 tests are now passing, instead of failing, as well as on x86_64-linux, where the results are identical, and where the .log file was also manually inspected to make sure that the use of the -gsplit-dwarf option was preserved. gcc/testsuite/ChangeLog: * gcc.misc-tests/outputs.exp: Make the -gsplit-dwarf test a compile-and-link test rather than a compile-only test.
2022-02-09-fgo-dump-spec: really name alignment field "_"Ian Lance Taylor1-32/+32
* godump.cc (go_force_record_alignment): Really name the alignment field "_" (complete 2021-12-29 change). * gcc.misc-tests/godump-1.c: Adjust for alignment field rename.
2022-01-18Fix options.exp.Martin Liska1-1/+1
gcc/testsuite/ChangeLog: * gcc.misc-tests/options.exp: Include renamed file.
2022-01-03Update copyright years.Jakub Jelinek18-18/+18
2022-01-01testsuite: Adjust gcc.misc-tests/godump-1.c testcaseJakub Jelinek1-32/+32
On Wed, Dec 29, 2021 at 03:54:03PM -0800, Ian Lance Taylor via Gcc-patches wrote: > PR go/103847 > * godump.c (go_force_record_alignment): Name the alignment > field "_". > --- a/gcc/godump.c > +++ b/gcc/godump.c > @@ -651,7 +651,7 @@ go_force_record_alignment (struct obstack *ob, const char *type_string, > unsigned int index, const char *error_string) > { > index = go_append_artificial_name (ob, index); > - obstack_grow (ob, "_align ", 7); > + obstack_grow (ob, "_ ", 2); > if (type_string == NULL) > obstack_grow (ob, error_string, strlen (error_string)); > else This change caused +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _ts_nested struct { u struct { s int16; Godump_0_pad \\\\[2\\\\]byte; Godump_1_align \\\\[0\\\\]u?int32; }; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _ts_nested2 struct { u struct { Godump_0_pad \\\\[4\\\\]byte; Godump_1_pad \\\\[2\\\\]byte; s int16; c int8; Godump_2_pad +\\\\[1\\\\]byte; Godump_3_pad \\\\[2\\\\]byte; Godump_4_align \\\\[0\\\\]u?int32; }; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _tsbf_gaps struct { bf1 uint8; c uint8; bf2 uint8; Godump_0_pad \\\\[2\\\\]byte; s uint16; Godump_1_align \\\\[0\\\\]int32; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _tsbf_pad16_1 struct { Godump_0_pad \\\\[1\\\\]byte; c uint8; Godump_1_align \\\\[0\\\\]int16; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _tsbf_pad16_2 struct { Godump_0_pad \\\\[2\\\\]byte; c uint8; Godump_1_pad \\\\[.\\\\]byte; Godump_2_align \\\\[0\\\\]int16; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _tsbf_pad32_1 struct { Godump_0_pad \\\\[1\\\\]byte; c uint8; Godump_1_pad \\\\[.\\\\]byte; Godump_2_align \\\\[0\\\\]int32; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _tsbf_pad32_2 struct { Godump_0_pad \\\\[4\\\\]byte; c uint8; Godump_1_pad \\\\[.\\\\]byte; Godump_2_align \\\\[0\\\\]int32; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _tsbf_pad64_1 struct { Godump_0_pad \\\\[1\\\\]byte; c uint8; Godump_1_pad \\\\[.\\\\]byte; Godump_2_align \\\\[0\\\\]int64; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _tsbf_pad64_2 struct { Godump_0_pad \\\\[8\\\\]byte; c uint8; Godump_1_pad \\\\[.\\\\]byte; Godump_2_align \\\\[0\\\\]int64; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _tsn_anon struct { a uint8; s uint16; b uint8; Godump_0_pad \\\\[.\\\\]byte; Godump_1_align \\\\[0\\\\]int16; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _tsu_anon struct { c uint8; Godump_0_pad \\\\[7\\\\]byte; Godump_1_align \\\\[0\\\\]u?int64; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _tu1 struct { c uint8; Godump_0_pad \\\\[.\\\\]byte; Godump_1_align \\\\[0\\\\]u?int64; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _tu3_size struct { ca \\\\[4\\\\+1\\\\]uint8; Godump_0_pad \\\\[.\\\\]byte; Godump_1_align \\\\[0\\\\]u?int64; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _tu_nested struct { u struct { s int16; Godump_0_pad \\\\[2\\\\]byte; Godump_1_align \\\\[0\\\\]u?int32; }; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _tu_nested2 struct { u struct { Godump_0_pad \\\\[4\\\\]byte; Godump_1_pad \\\\[2\\\\]byte; s int16; c int8; Godump_2_pad +\\\\[1\\\\]byte; Godump_3_pad \\\\[2\\\\]byte; Godump_4_align \\\\[0\\\\]u?int32; }; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _tu_size struct { ca \\\\[4\\\\+1\\\\]uint8; Godump_0_pad \\\\[.\\\\]byte; Godump_1_align \\\\[0\\\\]u?int64; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _s_nested struct { u struct { s int16; Godump_0_pad \\\\[2\\\\]byte; Godump_1_align \\\\[0\\\\]u?int32; }; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _s_nested2 struct { u struct { Godump_0_pad \\\\[4\\\\]byte; Godump_1_pad \\\\[2\\\\]byte; s int16; c int8; Godump_2_pad +\\\\[1\\\\]byte; Godump_3_pad \\\\[2\\\\]byte; Godump_4_align \\\\[0\\\\]u?int32; }; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _sbf_gaps struct { bf1 uint8; c uint8; bf2 uint8; Godump_0_pad \\\\[2\\\\]byte; s uint16; Godump_1_align \\\\[0\\\\]int32; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _sbf_pad16_1 struct { Godump_0_pad \\\\[1\\\\]byte; c uint8; Godump_1_align \\\\[0\\\\]int16; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _sbf_pad16_2 struct { Godump_0_pad \\\\[2\\\\]byte; c uint8; Godump_1_pad \\\\[.\\\\]byte; Godump_2_align \\\\[0\\\\]int16; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _sbf_pad32_1 struct { Godump_0_pad \\\\[1\\\\]byte; c uint8; Godump_1_pad \\\\[.\\\\]byte; Godump_2_align \\\\[0\\\\]int32; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _sbf_pad32_2 struct { Godump_0_pad \\\\[4\\\\]byte; c uint8; Godump_1_pad \\\\[.\\\\]byte; Godump_2_align \\\\[0\\\\]int32; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _sbf_pad64_1 struct { Godump_0_pad \\\\[1\\\\]byte; c uint8; Godump_1_pad \\\\[.\\\\]byte; Godump_2_align \\\\[0\\\\]int64; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _sbf_pad64_2 struct { Godump_0_pad \\\\[8\\\\]byte; c uint8; Godump_1_pad \\\\[.\\\\]byte; Godump_2_align \\\\[0\\\\]int64; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _sn_anon struct { a uint8; s uint16; b uint8; Godump_0_pad \\\\[.\\\\]byte; Godump_1_align \\\\[0\\\\]int16; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _su_anon struct { c uint8; Godump_0_pad \\\\[7\\\\]byte; Godump_1_align \\\\[0\\\\]u?int64; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _u1 struct { c uint8; Godump_0_pad \\\\[.\\\\]byte; Godump_1_align \\\\[0\\\\]u?int64; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _u3_size struct { ca \\\\[4\\\\+1\\\\]uint8; Godump_0_pad \\\\[.\\\\]byte; Godump_1_align \\\\[0\\\\]u?int64; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _u_nested struct { u struct { s int16; Godump_0_pad \\\\[2\\\\]byte; Godump_1_align \\\\[0\\\\]u?int32; }; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _u_nested2 struct { u struct { Godump_0_pad \\\\[4\\\\]byte; Godump_1_pad \\\\[2\\\\]byte; s int16; c int8; Godump_2_pad +\\\\[1\\\\]byte; Godump_3_pad \\\\[2\\\\]byte; Godump_4_align \\\\[0\\\\]u?int32; }; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _u_size struct { ca \\\\[4\\\\+1\\\\]uint8; Godump_0_pad \\\\[.\\\\]byte; Godump_1_align \\\\[0\\\\]u?int64; }\$ on x86_64-linux. The following patch adjusts the testcase for the above change. 2022-01-01 Jakub Jelinek <jakub@redhat.com> * gcc.misc-tests/godump-1.c: Adjust for renaming of last field from _align suffix to _ suffix.
2021-10-08Enable auto-vectorization at O2 with very-cheap cost model.liuhongt1-1/+1
gcc/ChangeLog: * common.opt (ftree-vectorize): Add Var(flag_tree_vectorize). * doc/invoke.texi (Options That Control Optimization): Update documents. * opts.c (default_options_table): Enable auto-vectorization at O2 with very-cheap cost model. (finish_options): Use cheap cost model for explicit -ftree{,-loop}-vectorize. gcc/testsuite/ChangeLog: * c-c++-common/Wstringop-overflow-2.c: Adjust testcase. * g++.dg/tree-ssa/pr81408.C: Ditto. * g++.dg/warn/Wuninitialized-13.C: Ditto. * gcc.dg/Warray-bounds-51.c: Ditto. * gcc.dg/Warray-parameter-3.c: Ditto. * gcc.dg/Wstringop-overflow-14.c: Ditto. * gcc.dg/Wstringop-overflow-21.c: Ditto. * gcc.dg/Wstringop-overflow-68.c: Ditto. * gcc.dg/Wstringop-overflow-76.c: Ditto. * gcc.dg/gomp/pr46032-2.c: Ditto. * gcc.dg/gomp/pr46032-3.c: Ditto. * gcc.dg/gomp/simd-2.c: Ditto. * gcc.dg/gomp/simd-3.c: Ditto. * gcc.dg/graphite/fuse-1.c: Ditto. * gcc.dg/pr67089-6.c: Ditto. * gcc.dg/pr82929-2.c: Ditto. * gcc.dg/pr82929.c: Ditto. * gcc.dg/store_merging_1.c: Ditto. * gcc.dg/store_merging_11.c: Ditto. * gcc.dg/store_merging_13.c: Ditto. * gcc.dg/store_merging_15.c: Ditto. * gcc.dg/store_merging_16.c: Ditto. * gcc.dg/store_merging_19.c: Ditto. * gcc.dg/store_merging_24.c: Ditto. * gcc.dg/store_merging_25.c: Ditto. * gcc.dg/store_merging_28.c: Ditto. * gcc.dg/store_merging_30.c: Ditto. * gcc.dg/store_merging_5.c: Ditto. * gcc.dg/store_merging_7.c: Ditto. * gcc.dg/store_merging_8.c: Ditto. * gcc.dg/strlenopt-85.c: Ditto. * gcc.dg/tree-ssa/dump-6.c: Ditto. * gcc.dg/tree-ssa/pr19210-1.c: Ditto. * gcc.dg/tree-ssa/pr47059.c: Ditto. * gcc.dg/tree-ssa/pr86017.c: Ditto. * gcc.dg/tree-ssa/pr91482.c: Ditto. * gcc.dg/tree-ssa/predcom-1.c: Ditto. * gcc.dg/tree-ssa/predcom-dse-3.c: Ditto. * gcc.dg/tree-ssa/prefetch-3.c: Ditto. * gcc.dg/tree-ssa/prefetch-6.c: Ditto. * gcc.dg/tree-ssa/prefetch-8.c: Ditto. * gcc.dg/tree-ssa/prefetch-9.c: Ditto. * gcc.dg/tree-ssa/ssa-dse-18.c: Ditto. * gcc.dg/tree-ssa/ssa-dse-19.c: Ditto. * gcc.dg/uninit-40.c: Ditto. * gcc.dg/unroll-7.c: Ditto. * gcc.misc-tests/help.exp: Ditto. * gcc.target/i386/avx512vpopcntdqvl-vpopcntd-1.c: Ditto. * gcc.target/i386/pr34012.c: Ditto. * gcc.target/i386/pr49781-1.c: Ditto. * gcc.target/i386/pr95798-1.c: Ditto. * gcc.target/i386/pr95798-2.c: Ditto. * gfortran.dg/pr77498.f: Ditto.
2021-09-01Add MIPS Linux support to gcc.misc-tests/linkage.c (testsuite/51748)Andrew Pinski1-0/+12
This adds MIPS Linux support to gcc.misc-tests/linkage.exp. Basically copying what was done for MIPS IRIX and changing the options to be correct. OK? gcc/testsuite/ChangeLog: PR testsuite/51748 * gcc.misc-tests/linkage.exp: Add mips*-linux-* support.
2021-03-04gcc.misc-tests/outputs.exp: enumerate testsHans-Peter Nilsson1-395/+395
Go from: PASS: outputs asm default 1: outputs-0.s PASS: outputs asm default 1: extra PASS: outputs asm default 1: std out PASS: outputs asm default 2: outputs-1.s PASS: outputs asm default 2: outputs-2.s PASS: outputs asm default 2: extra PASS: outputs asm default 2: std out PASS: outputs obj default 1: outputs-0.o PASS: outputs obj default 1: extra PASS: outputs obj default 1: std out ... to: PASS: outputs-1 asm default 1: outputs-0.s PASS: outputs-1 asm default 1: extra PASS: outputs-1 asm default 1: std out PASS: outputs-2 asm default 2: outputs-1.s PASS: outputs-2 asm default 2: outputs-2.s PASS: outputs-2 asm default 2: extra PASS: outputs-2 asm default 2: std out PASS: outputs-3 obj default 1: outputs-0.o PASS: outputs-3 obj default 1: extra PASS: outputs-3 obj default 1: std out ... thereby helping a human to quickly pin-point the result of a specific test. This mechanical patch was produced by applying perl -pe 's/^(outest "\$b) /sprintf("%s-%d ",$1, ++$n)/e;' to outputs.exp. gcc/testsuite: * gcc.misc-tests/outputs.exp: Enumerate tests.
2021-03-04gcc.misc-tests/outputs.exp: assert unique test-namesHans-Peter Nilsson1-14/+22
The gcc.misc-tests/outputs.exp tests can take some effort to digest. Navigating and debugging causes for failing tests here isn't helped by the existence of tests with duplicate names. Let's stop that from happening. This requires that test-run output is actually reviewed, as Tcl errors don't stop the test-run, but then again there's no such dejagnu construct that I know of. Tested x86_64-pc-linux-gnu. gcc/testsuite: * gcc.misc-tests/outputs.exp: Append discriminating suffixes to tests with duplicate names. (outest): Assert that each running test has a unique name.
2021-03-03outputs.exp: skip @file -save-temps if target has -L or -IHans-Peter Nilsson1-0/+12
The outputs.exp tests check what temporary files are created and left behind with e.g. -save-temps. Additional files are created in presence of @file option. Adding an -I or -L option causes *another* temporary file to appear. I take it that's deliberate, as there are tests for that behavior. For native testing, the default test-framework baseboard file unix.exp doesn't add any -I or -L options and all tests pass. For a newlib target however, you'll have a couple of -L options (see the nopts handling in outputs.exp), leading to: Running /x/gcc/gcc/testsuite/gcc.misc-tests/outputs.exp ... FAIL: outputs exe savetmp namedb: extra outputs.args.1 FAIL: outputs exe savetmp named2: extra outputs.args.1 FAIL: outputs exe savetmp named2: extra outputs.args.3 FAIL: outputs lto sing unnamed: extra a.args.1 The failing tests are among the actual tests that check the behavior of @file, and are confused by the additional -L. Identify presence of -I or -L from the test framework and skip those tests. Tested cris-elf and x86_64-pc-linux-gnu. gcc/testsuite: * gcc.misc-tests/outputs.exp: Skip @file -save-temps tests if target test-framework has -L or -I options.
2021-02-16gcc.misc-tests/outputs.exp (outest): Fix typo "is_target".Hans-Peter Nilsson1-1/+1
Fix typo for istarget in "is_target hppa*-*-hpux*", yielding an error running the test-suite for any target not matching powerpc*-*-aix* (presumably, by code inspection), aborting the check-gcc (check-gcc-c) regression test run some 3000 tests before the last one, missing e.g. all gcc.target tests like so: ----- ... Running /x/gcc/gcc/testsuite/gcc.misc-tests/outputs.exp ... ERROR: (DejaGnu) proc "is_target hppa*-*-hpux*" does not exist. The error code is TCL LOOKUP COMMAND is_target The info on the error is: invalid command name "is_target" while executing "::tcl_unknown is_target hppa*-*-hpux*" ("uplevel" body line 1) invoked from within "uplevel 1 ::tcl_unknown $args" === gcc Summary === ... ----- gcc/testsuite: * gcc.misc-tests/outputs.exp (outest): Fix typo "is_target".
2021-01-11testsuite: Fix test failures from outputs.exp [PR98225]Bernd Edlinger1-5/+18
The .ld1_args file is not created when HAVE_GNU_LD is false. The ltrans0.ltrans_arg file is not created when the make jobserver is available, so remove the MAKEFLAGS variable. Add an exception for *.gcc_args files similar to the exception for *.cdtor.* files. Limit both exceptions to targets that define EH_FRAME_THROUGH_COLLECT2. That means although the test case does not use C++ constructors or destructors it is still using dwarf2 frame info. 2021-01-11 Bernd Edlinger <bernd.edlinger@hotmail.de> PR testsuite/98225 * gcc.misc-tests/outputs.exp: Unset MAKEFLAGS. Expect .ld1_args only when GNU LD is used. Add an exception for *.gcc_args files.
2021-01-04Update copyright years.Jakub Jelinek18-18/+18
2021-01-04Fix -save-temp leaking lto files in /tmpBernd Edlinger1-12/+19
When linking with -flto and -save-temps, various temporary files are created in /tmp. The same happens when invoking the driver with @file parameter, and using -L or -I options. gcc: 2021-01-04 Bernd Edlinger <bernd.edlinger@hotmail.de> * collect-utils.c (collect_execute): Check dumppfx. * collect2.c (maybe_run_lto_and_relink, do_link): Pass atsuffix to collect_execute. (do_link): Add new parameter atsuffix. (main): Handle -dumpdir option. Skip one argument for -o, -isystem and -B options. * gcc.c (make_at_file): New helper function. (close_at_file): Use it. gcc/testsuite: 2021-01-04 Bernd Edlinger <bernd.edlinger@hotmail.de> * gcc.misc-tests/outputs.exp: Adjust testcase.
2020-12-13-fgo-dump-spec: skip typedefs that match struct tagNikhil Benesch1-0/+23
gcc/: * godump.c (go_output_typedef): Suppress typedefs whose name matches the tag of the underlying struct, union, or enum. Output declarations for enums that do not appear in typedefs. gcc/testsuite: * gcc.misc-tests/godump-1.c: Add test cases.