summaryrefslogtreecommitdiffstats
path: root/gcc/testsuite/c-c++-common
Commit message (Collapse)AuthorAgeFilesLines
...
* PR c++/58703jakub2014-02-051-0/+6
| | | | | | | | | | * parser.c (cp_parser_omp_declare_reduction): Save and free declarator_obstack. * c-c++-common/gomp/pr58703.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@207511 138bc75d-0d04-0410-961f-82ee72b054a4
* PR ipa/60026jakub2014-02-041-0/+28
| | | | | | | | | | * tree-inline.c (copy_forbidden): Fail for __attribute__((optimize (0))) functions. * c-c++-common/torture/pr60026.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@207463 138bc75d-0d04-0410-961f-82ee72b054a4
* 2014-02-03 Marc Glisse <marc.glisse@inria.fr>glisse2014-02-031-0/+23
| | | | | | | | | | | | | | | | | | | | | | PR c++/53017 PR c++/59211 gcc/c-family/ * c-common.c (handle_aligned_attribute, handle_alloc_size_attribute, handle_vector_size_attribute, handle_nonnull_attribute): Call default_conversion on the attribute argument. (handle_nonnull_attribute): Increment the argument number. gcc/cp/ * tree.c (handle_init_priority_attribute): Call default_conversion on the attribute argument. gcc/ * doc/extend.texi (Function Attributes): Typo. gcc/testsuite/ * c-c++-common/attributes-1.c: New testcase. * g++.dg/cpp0x/constexpr-attribute2.C: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@207436 138bc75d-0d04-0410-961f-82ee72b054a4
* PR sanitizer/59410jakub2014-01-3118-29/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lib/tsan-dg.exp (tsan_init): Instead of not running any tsan tests if trivial testcase doesn't run, set dg-do-what-default to compile. (tsan_finish): Restore dg-do-what-default. * g++.dg/tsan/atomic_free.C: Remove dg-do line. * g++.dg/tsan/fd_close_norace2.C: Likewise. * g++.dg/tsan/default_options.C: Likewise. * g++.dg/tsan/aligned_vs_unaligned_race.C: Likewise. * g++.dg/tsan/atomic_free2.C: Likewise. * g++.dg/tsan/cond_race.C: Likewise. * g++.dg/tsan/fd_close_norace.C: Likewise. * g++.dg/tsan/benign_race.C: Likewise. * c-c++-common/tsan/fd_pipe_race.c: Likewise. * c-c++-common/tsan/simple_race.c: Likewise. * c-c++-common/tsan/mutexset1.c: Likewise. * c-c++-common/tsan/thread_leak2.c: Likewise. * c-c++-common/tsan/tls_race.c: Likewise. * c-c++-common/tsan/write_in_reader_lock.c: Likewise. * c-c++-common/tsan/race_on_barrier2.c: Likewise. * c-c++-common/tsan/free_race2.c: Likewise. * c-c++-common/tsan/thread_leak.c: Likewise. * c-c++-common/tsan/thread_leak1.c: Likewise. * c-c++-common/tsan/race_on_barrier.c: Likewise. * c-c++-common/tsan/free_race.c: Likewise. * c-c++-common/tsan/sleep_sync.c: Likewise. * c-c++-common/tsan/tiny_race.c: Likewise. * c-c++-common/tsan/race_on_mutex2.c: Likewise. * c-c++-common/tsan/atomic_stack.c: Likewise. * c-c++-common/tsan/race_on_mutex.c: Likewise. Adjust line numbers in dg-output regexps. * c-c++-common/tsan/simple_stack.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@207371 138bc75d-0d04-0410-961f-82ee72b054a4
* * c-c++-common/tsan/simple_race.c: Made test less flaky.chefmax2014-01-311-1/+24
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@207344 138bc75d-0d04-0410-961f-82ee72b054a4
* Fix test c-c++-common/cpp/warning-zero-location-2.cdodji2014-01-291-1/+1
| | | | | | | | | | | gcc/testsuite/ChangeLog: * c-c++-common/cpp/warning-zero-location-2.c: Fix error message specifier. Signed-off-by: Dodji Seketeli <dodji@seketeli.org> git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@207234 138bc75d-0d04-0410-961f-82ee72b054a4
* PR middle-end/59917jakub2014-01-292-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PR tree-optimization/59920 * tree.c (build_common_builtin_nodes): Remove __builtin_setjmp_dispatcher initialization. * omp-low.h (make_gimple_omp_edges): Add a new int * argument. * profile.c (branch_prob): Use gsi_start_nondebug_after_labels_bb instead of gsi_after_labels + manually skipping debug stmts. Don't ignore bbs with BUILT_IN_SETJMP_DISPATCHER, instead ignore bbs with IFN_ABNORMAL_DISPATCHER. * tree-inline.c (copy_edges_for_bb): Remove can_make_abnormal_goto argument, instead add abnormal_goto_dest argument. Ignore computed_goto_p stmts. Don't call make_abnormal_goto_edges. If a call might need abnormal edges for non-local gotos, see if it already has an edge to IFN_ABNORMAL_DISPATCHER or if it is IFN_ABNORMAL_DISPATCHER with true argument, don't do anything then, otherwise add EDGE_ABNORMAL from the call's bb to abnormal_goto_dest. (copy_cfg_body): Compute abnormal_goto_dest, adjust copy_edges_for_bb caller. * gimple-low.c (struct lower_data): Remove calls_builtin_setjmp. (lower_function_body): Don't emit __builtin_setjmp_dispatcher. (lower_stmt): Don't set data->calls_builtin_setjmp. (lower_builtin_setjmp): Adjust comment. * builtins.def (BUILT_IN_SETJMP_DISPATCHER): Remove. * tree-cfg.c (found_computed_goto): Remove. (factor_computed_gotos): Remove. (make_goto_expr_edges): Return bool, true for computed gotos. Don't call make_abnormal_goto_edges. (build_gimple_cfg): Don't set found_computed_goto, don't call factor_computed_gotos. (computed_goto_p): No longer static. (make_blocks): Don't set found_computed_goto. (get_abnormal_succ_dispatcher, handle_abnormal_edges): New functions. (make_edges): If make_goto_expr_edges returns true, push bb into ab_edge_goto vector, for stmt_can_make_abnormal_goto calls instead of calling make_abnormal_goto_edges push bb into ab_edge_call vector. Record mapping between bbs and OpenMP regions if there are any, adjust make_gimple_omp_edges caller. Call handle_abnormal_edges. (make_abnormal_goto_edges): Remove. * tree-cfg.h (make_abnormal_goto_edges): Remove. (computed_goto_p, get_abnormal_succ_dispatcher): New prototypes. * internal-fn.c (expand_ABNORMAL_DISPATCHER): New function. * builtins.c (expand_builtin): Don't handle BUILT_IN_SETJMP_DISPATCHER. * internal-fn.def (ABNORMAL_DISPATCHER): New. * omp-low.c (make_gimple_omp_edges): Add region_idx argument, when filling *region also set *region_idx to (*region)->entry->index. * gcc.dg/pr59920-1.c: New test. * gcc.dg/pr59920-2.c: New test. * gcc.dg/pr59920-3.c: New test. * c-c++-common/gomp/pr59917-1.c: New test. * c-c++-common/gomp/pr59917-2.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@207231 138bc75d-0d04-0410-961f-82ee72b054a4
* PR preprocessor/59935 - caret diagnostics crashes on non-file locationsdodji2014-01-282-0/+18
| | | | | | | | | | | | | | | | | gcc/ChangeLog * input.c (location_get_source_line): Bail out on when line number is zero, and test the return value of lookup_or_add_file_to_cache_tab. gcc/testsuite/ChangeLog * c-c++-common/cpp/warning-zero-location.c: New test. * c-c++-common/cpp/warning-zero-location-2.c: Likewise. Signed-off-by: Dodji Seketeli <dodji@seketeli.org> git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@207195 138bc75d-0d04-0410-961f-82ee72b054a4
* PR c/58346mpolacek2014-01-233-0/+48
| | | | | | | | | | | | | | | | | | | c-family/ * c-common.c (pointer_to_zero_sized_aggr_p): New function. * c-common.h: Declare it. cp/ * typeck.c (pointer_diff): Give an error on arithmetic on pointer to an empty aggregate. c/ * c-typeck.c (pointer_diff): Give an error on arithmetic on pointer to an empty aggregate. testsuite/ * c-c++-common/pr58346-1.c: New test. * c-c++-common/pr58346-2.c: New test. * c-c++-common/pr58346-3.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@207004 138bc75d-0d04-0410-961f-82ee72b054a4
* Added support for Cilk Plus SIMD-enabled functions for C++.bviyer2014-01-232-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | gcc/c/c-parser.c 2014-01-23 Balaji V. Iyer <balaji.v.iyer@intel.com> * c-parser.c (c_finish_omp_declare_simd): Made "cilk simd function" attribute an attribute without value. gcc/cp/ChangeLog 2014-01-23 Balaji V. Iyer <balaji.v.iyer@intel.com> * parser.c (cp_parser_direct_declarator): When Cilk Plus is enabled see if there is an attribute after function decl. If so, then parse them now. (cp_parser_late_return_type_opt): Handle parsing of Cilk Plus SIMD enabled function late parsing. (cp_parser_gnu_attribute_list): Parse all the tokens for the vector attribute for a SIMD-enabled function. (cp_parser_omp_all_clauses): Skip parsing to the end of pragma when the function is used by SIMD-enabled function (indicated by NULL pragma token). Added 3 new clauses: PRAGMA_CILK_CLAUSE_MASK, PRAGMA_CILK_CLAUSE_NOMASK and PRAGMA_CILK_CLAUSE_VECTORLENGTH (cp_parser_cilk_simd_vectorlength): Modified this function to handle vectorlength clause in SIMD-enabled function and #pragma SIMD's vectorlength clause. Added a new bool parameter to differentiate between the two. (cp_parser_cilk_simd_fn_vector_attrs): New function. (is_cilkplus_vector_p): Likewise. (cp_parser_late_parsing_elem_fn_info): Likewise. (cp_parser_omp_clause_name): Added a check for "mask", "nomask" and "vectorlength" clauses when Cilk Plus is enabled. (cp_parser_omp_clause_linear): Added a new parameter of type bool and emit a sorry message when step size is a parameter. * parser.h (cp_parser::cilk_simd_fn_info): New field. * decl.c (grokfndecl): Added flag_enable_cilkplus along with flag_openmp. * pt.c (apply_late_template_attributes): Likewise. testsuite/ChangeLog 2014-01-23 Balaji V. Iyer <balaji.v.iyer@intel.com> * g++.dg/cilk-plus/cilk-plus.exp: Called the C/C++ common tests for SIMD enabled function. * g++.dg/cilk-plus/ef_test.C: New test. * c-c++-common/cilk-plus/ef_error3.c: Made certain messages C specific and added C++ ones. * c-c++-common/cilk-plus/vlength_errors.c: Added new dg-error tags to differenciate C error messages from C++ ones. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206975 138bc75d-0d04-0410-961f-82ee72b054a4
* PR middle-end/58809jakub2014-01-231-0/+31
| | | | | | | | | | | | | * c-typeck.c (c_finish_omp_clause): Reject MIN_EXPR, MAX_EXPR, BIT_AND_EXPR, BIT_IOR_EXPR and BIT_XOR_EXPR on COMPLEX_TYPEs. * semantics.c (finish_omp_reduction_clause): Reject BIT_AND_EXPR, BIT_IOR_EXPR and BIT_XOR_EXPR on COMPLEX_TYPEs. * c-c++-common/gomp/pr58809.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206962 138bc75d-0d04-0410-961f-82ee72b054a4
* 2014-01-23 Dominique Dhumieres <dominiq@lps.ens.fr>chefmax2014-01-231-1/+1
| | | | | | | | | PR sanitizer/59897 * c-c++-common/asan/use-after-return-1.c: Fixed to pass on darwin. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206961 138bc75d-0d04-0410-961f-82ee72b054a4
* PR preprocessor/58580 - preprocessor goes OOM with warning for zero literalsdodji2014-01-231-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In this problem report, the compiler is fed a (bogus) translation unit in which some literals contain bytes whose value is zero. The preprocessor detects that and proceeds to emit diagnostics for that king of bogus literals. But then when the diagnostics machinery re-reads the input file again to display the bogus literals with a caret, it attempts to calculate the length of each of the lines it got using fgets. The line length calculation is done using strlen. But that doesn't work well when the content of the line can have several zero bytes. The result is that the read_line never sees the end of the line because strlen repeatedly reports that the line ends before the end-of-line character; so read_line thinks its buffer for reading the line is too small; it thus increases the buffer, leading to a huge memory consumption and disaster. Here is what this patch does. location_get_source_line is modified to return the length of a source line that can now contain bytes with zero value. diagnostic_show_locus() is then modified to consider that a line can have characters of value zero, and so just shows a white space when instructed to display one of these characters. Additionally location_get_source_line is modified to avoid re-reading each and every line from the beginning of the file until it reaches the line number N that it is instructed to get; this was leading to annoying quadratic behaviour when reading adjacent lines near the end of (big) files. So a cache is now associated to the file opened in text mode. When the content of the file is read, that content is stashed in the file cache. That file cache is searched for line delimiters. A number of line positions are saved in the cache and a number of file caches are kept in memory. That way when location_get_source_line is asked to read line N + 1, it just has to start reading from line N that it has already read. libcpp/ChangeLog: * include/line-map.h (linemap_get_file_highest_location): Declare new function. * line-map.c (linemap_get_file_highest_location): Define it. gcc/ChangeLog: * input.h (location_get_source_line): Take an additional line_size parameter. (void diagnostics_file_cache_fini): Declare new function. * input.c (struct fcache): New type. (fcache_tab_size, fcache_buffer_size, fcache_line_record_size): New static constants. (diagnostic_file_cache_init, total_lines_num) (lookup_file_in_cache_tab, evicted_cache_tab_entry) (add_file_to_cache_tab, lookup_or_add_file_to_cache_tab) (needs_read, needs_grow, maybe_grow, read_data, maybe_read_data) (get_next_line, read_next_line, goto_next_line, read_line_num): New static function definitions. (diagnostic_file_cache_fini): New function. (location_get_source_line): Take an additional output line_len parameter. Re-write using lookup_or_add_file_to_cache_tab and read_line_num. * diagnostic.c (diagnostic_finish): Call diagnostic_file_cache_fini. (adjust_line): Take an additional input parameter for the length of the line, rather than calculating it with strlen. (diagnostic_show_locus): Adjust the use of location_get_source_line and adjust_line with respect to their new signature. While displaying a line now, do not stop at the first null byte. Rather, display the zero byte as a space and keep going until we reach the size of the line. * Makefile.in: Add vec.o to OBJS-libcommon gcc/testsuite/ChangeLog: * c-c++-common/cpp/warning-zero-in-literals-1.c: New test file. Signed-off-by: Dodji Seketeli <dodji@seketeli.org> git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206957 138bc75d-0d04-0410-961f-82ee72b054a4
* PR c++/57945jakub2014-01-171-0/+11
| | | | | | | | | | * passes.c (rest_of_decl_compilation): Don't call varpool_finalize_decl on decls for which assemble_alias has been called. * c-c++-common/torture/pr57945.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206708 138bc75d-0d04-0410-961f-82ee72b054a4
* Silence vector ABI change warnings for x86hjl2014-01-153-0/+3
| | | | | | | | | | | | | | | | | | | | | | PR target/59794 * c-c++-common/convert-vec-1.c: Also prune ABI change for Linux/x86. * g++.dg/cpp0x/constexpr-53094-2.C: Likewise. * g++.dg/ext/attribute-test-1.C: Likewise. * g++.dg/ext/attribute-test-2.C: Likewise. * g++.dg/ext/attribute-test-3.C: Likewise. * g++.dg/ext/attribute-test-4.C: Likewise. * g++.dg/ext/pr56790-1.C: Likewise. * g++.dg/torture/pr38565.C: Likewise. * gcc.dg/pr53060.c: Likewise. * c-c++-common/scal-to-vec2.c: Add -msse2 for x86. * c-c++-common/vector-compare-2.c: Likewise. * gcc.dg/Wstrict-aliasing-bogus-ref-all-2.c: Likewise. * g++.dg/conversion/simd1.C: Add -msse2 for x86. Adjust dg-message line number. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206634 138bc75d-0d04-0410-961f-82ee72b054a4
* 2014-01-10 Max Ostapenko <m.ostapenko@partner.samsung.com>chefmax2014-01-101-0/+16
| | | | | | | * c-c++-common/asan/no-asan-stack.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206515 138bc75d-0d04-0410-961f-82ee72b054a4
* PR sanitizer/59136jakub2014-01-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | libsanitizer/ * sanitizer_common/Makefile.am (AM_CXXFLAGS): If LIBBACKTRACE_SUPPORTED add -DSANITIZER_LIBBACKTRACE and -I/-include flags. * lsan/Makefile.am (liblsan_la_LIBADD): Add libsanitizer_libbacktrace.la if LIBBACKTRACE_SUPPORTED. * tsan/Makefile.am (libtsan_la_LIBADD): Likewise. * ubsan/Makefile.am (libubsan_la_LIBADD): Likewise. * asan/Makefile.am (libasan_la_LIBADD): Likewise. * Makefile.am (SUBDIRS): If LIBBACKTRACE_SUPPORTED add libbacktrace. * README.gcc: Document that also lsan and ubsan are maintained in compiler-rt upstream. * libbacktrace/Makefile.am: New file. * libbacktrace/backtrace-rename.h: New file. * libbacktrace/backtrace-supported.h.in: New file. * libbacktrace/bridge.cc: New file. * configure.ac: Add tests needed for libbacktrace build within libsanitizer. * sanitizer_common/Makefile.in: Regenerated. * lsan/Makefile.in: Regenerated. * tsan/Makefile.in: Regenerated. * ubsan/Makefile.in: Regenerated. * libbacktrace/Makefile.in: Generated. * config.h.in: Regenerated. * configure: Regenerated. * Makefile.in: Regenerated. * interception/Makefile.in: Regenerated. * asan/Makefile.in: Regenerated. * aclocal.m4: Regenerated. testsuite/ * c-c++-common/asan/strip-path-prefix-1.c: Allow also the filename:line instead of (modulename+offset) form with stripped initial / from the filename. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206475 138bc75d-0d04-0410-961f-82ee72b054a4
* Fix for PR c++/59631.bviyer2014-01-097-5/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | +++ gcc/cp/ChangeLog +2014-01-09 Balaji V. Iyer <balaji.v.iyer@intel.com> + + PR c++/59631 + * parser.c (cp_parser_postfix_expression): Added a new if-statement + and replaced an existing if-statement with else-if statement. + Changed an existing error message wording to match the one from the C + parser. + +++ gcc/testsuite/ChangeLog +2014-01-09 Balaji V. Iyer <balaji.v.iyer@intel.com> + + PR c++/59631 + * gcc.dg/cilk-plus/cilk-plus.exp: Removed "-fcilkplus" from flags list. + * g++.dg/cilk-plus/cilk-plus.exp: Likewise. + * c-c++-common/cilk-plus/CK/spawnee_inline.c: Replaced second dg-option + with dg-additional-options. + * c-c++-common/cilk-plus/CK/varargs_test.c: Likewise. + * c-c++-common/cilk-plus/CK/steal_check.c: Likewise. + * c-c++-common/cilk-plus/CK/spawner_inline.c: Likewise. + * c-c++-common/cilk-plus/CK/spawning_arg.c: Likewise. + * c-c++-common/cilk-plus/CK/invalid_spawns.c: Added a dg-options tag. + * c-c++-common/cilk-plus/CK/pr59631.c: New testcase. + gcc/c/ChangeLog +2014-01-09 Balaji V. Iyer <balaji.v.iyer@intel.com> + + PR c++/59631 + * c-parser.c (c_parser_postfix_expression): Replaced consecutive if + statements with if-elseif statements. + git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206463 138bc75d-0d04-0410-961f-82ee72b054a4
* 2014-01-09 Max Ostapenko <m.ostapenko@partner.samsung.com>chefmax2014-01-095-0/+105
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * cfgexpand.c (expand_stack_vars): Optionally disable asan stack protection. (expand_used_vars): Likewise. (partition_stack_vars): Likewise. * asan.c (asan_emit_stack_protection): Optionally disable after return stack usage. (instrument_derefs): Optionally disable memory access instrumentation. (instrument_builtin_call): Likewise. (instrument_strlen_call): Likewise. (asan_protect_global): Optionally disable global variables protection. * doc/invoke.texi: Added doc for new options. * params.def: Added new options. * params.h: Likewise. 2014-01-09 Max Ostapenko <m.ostapenko@partner.samsung.com> * c-c++-common/asan/no-asan-globals.c: New test. * c-c++-common/asan/no-instrument-reads.c: Likewise. * c-c++-common/asan/no-instrument-writes.c: Likewise. * c-c++-common/asan/use-after-return-1.c: Likewise. * c-c++-common/asan/no-use-after-return.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206458 138bc75d-0d04-0410-961f-82ee72b054a4
* PR sanitizer/59667mpolacek2014-01-081-0/+15
| | | | | | | | | * ubsan.c (ubsan_type_descriptor): Call strip_array_types on type2. testsuite/ * c-c++-common/ubsan/pr59667.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206423 138bc75d-0d04-0410-961f-82ee72b054a4
* 2013-12-27 Yury Gribov <y.gribov@samsung.com>ygribov2013-12-2714-15/+15
| | | | | | | | | | | | | | | | | | | | | PR target/59585 * c-c++-common/ubsan/div-by-zero-1.c: Fixed pattern. * c-c++-common/ubsan/div-by-zero-2.c: Likewise. * c-c++-common/ubsan/div-by-zero-3.c: Likewise. * c-c++-common/ubsan/load-bool-enum.c: Likewise. * c-c++-common/ubsan/overflow-add-2.c: Likewise. * c-c++-common/ubsan/overflow-mul-2.c: Likewise. * c-c++-common/ubsan/overflow-mul-4.c: Likewise. * c-c++-common/ubsan/overflow-negate-1.c: Likewise. * c-c++-common/ubsan/overflow-sub-2.c: Likewise. * c-c++-common/ubsan/pr59333.c: Likewise. * c-c++-common/ubsan/shift-1.c: Likewise. * c-c++-common/ubsan/shift-2.c: Likewise. * c-c++-common/ubsan/shift-4.c: Likewise. * c-c++-common/ubsan/vla-1.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206219 138bc75d-0d04-0410-961f-82ee72b054a4
* * ubsan.c: Include tree-ssanames.h, asan.h and gimplify-me.h.jakub2013-12-201-0/+29
| | | | | | | | | | | | | | | | | | | | | | | (ubsan_type_descriptor): Handle BOOLEAN_TYPE and ENUMERAL_TYPE like INTEGER_TYPE. (instrument_bool_enum_load): New function. (ubsan_pass): Call it. (gate_ubsan): Also enable for SANITIZE_BOOL or SANITIZE_ENUM. * asan.c (create_cond_insert_point): No longer static. * asan.h (create_cond_insert_point): Declare. * sanitizer.def (BUILT_IN_UBSAN_HANDLE_LOAD_INVALID_VALUE): New built-in. * opts.c (common_handle_option): Handle -fsanitize=bool and -fsanitize=enum. * builtins.c (fold_builtin_memory_op): When sanitizing bool and enum loads, don't use enum or bool types for memcpy folding. * flag-types.h (SANITIZE_BOOL, SANITIZE_ENUM): New. (SANITIZE_UNDEFINED): Or these in. * c-c++-common/ubsan/load-bool-enum.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206143 138bc75d-0d04-0410-961f-82ee72b054a4
* 2013-12-19 Kyrylo Tkachov <kyrylo.tkachov@arm.com>ktkachov2013-12-191-2/+1
| | | | | | | * c-c++-common/cilk-plus/SE/ef_error.c: Use -fopen-simd. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206127 138bc75d-0d04-0410-961f-82ee72b054a4
* 2013-12-19 Kyrylo Tkachov <kyrylo.tkachov@arm.com>ktkachov2013-12-191-0/+1
| | | | | | | | * c-c++-common/cilk-plus/SE/ef_error.c: Add fopenmp effective target check. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206109 138bc75d-0d04-0410-961f-82ee72b054a4
* Added support for Cilk Plus SIMD-enabled function for C.bviyer2013-12-186-0/+209
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | +++ gcc/ChangeLog +2013-12-18 Balaji V. Iyer <balaji.v.iyer@intel.com> + + * omp-low.c (simd_clone_clauses_extract): Replaced the string + "cilk simd elemental" with "cilk simd function." + * config/i386/i386.c (ix86_simd_clone_compute_vecsize_and_simdlen): + Removed a carriage-return from a warning string. + +++ gcc/c-family/ChangeLog +2013-12-18 Balaji V. Iyer <balaji.v.iyer@intel.com> + + * c-common.c (c_common_attribute_table): Added "cilk simd function" + attribute. + * c-pragma.h (enum pragma_cilk_clause): Remove. + (enum pragma_omp_clause): Added the following fields: + PRAGMA_CILK_CLAUSE_NOMASK, PRAGMA_CILK_CLAUSE_MASK, + PRAGMA_CILK_CLAUSE_VECTORLENGTH, PRAGMA_CILK_CLAUSE_NONE, + PRAGMA_CILK_CLAUSE_LINEAR, PRAGMA_CILK_CLAUSE_PRIVATE, + PRAGMA_CILK_CLAUSE_FIRSTPRIVATE, PRAGMA_CILK_CLAUSE_LASTPRIVATE, + PRAGMA_CILK_CLAUSE_UNIFORM. + + +++ gcc/c/ChangeLog +2013-12-18 Balaji V. Iyer <balaji.v.iyer@intel.com> + + * c-parser.c (struct c_parser::cilk_simd_fn_tokens): Added new field. + (c_parser_declaration_or_fndef): Added a check if cilk_simd_fn_tokens + field in parser is not empty. If not-empty, call the function + c_parser_finish_omp_declare_simd. + (c_parser_cilk_clause_vectorlength): Modified function to be shared + between SIMD-enabled functions and #pragma simd. Added new parameter. + (c_parser_cilk_all_clauses): Modified the usage of the function + c_parser_cilk_clause_vectorlength as mentioned above. + (c_parser_cilk_simd_fn_vector_attrs): New function. + (c_finish_cilk_simd_fn_tokens): Likewise. + (is_cilkplus_vector_p): Likewise. + (c_parser_omp_clause_name): Added checking for "vectorlength," + "nomask," and "mask" strings in clause name. + (c_parser_omp_all_clauses): Added 3 new case statements: + PRAGMA_CILK_CLAUSE_VECTORLENGTH, PRAGMA_CILK_CLAUSE_MASK and + PRAGMA_CILK_CLAUSE_NOMASK. + (c_parser_attributes): Added a cilk_simd_fn_tokens parameter. Added a + check for vector attribute and if so call the function + c_parser_cilk_simd_fn_vector_attrs. Also, when Cilk plus is enabled, + called the function c_finish_cilk_simd_fn_tokens. + (c_finish_omp_declare_simd): Added a check if cilk_simd_fn_tokens in + parser field is non-empty. If so, parse them as you would parse + the omp declare simd pragma. + (c_parser_omp_clause_linear): Added a new bool parm. is_cilk_simd_fn. + Added a check when step is a parameter and flag it as error. + (CILK_SIMD_FN_CLAUSE_MASK): New #define. + (c_parser_cilk_clause_name): Changed pragma_cilk_clause to + pragma_omp_clause. + +++ gcc/testsuite/ChangeLog +2013-12-18 Balaji V. Iyer <balaji.v.iyer@intel.com> + + * c-c++-common/cilk-plus/SE/ef_test.c: New test. + * c-c++-common/cilk-plus/SE/ef_test2.c: Likewise. + * c-c++-common/cilk-plus/SE/vlength_errors.c: Likewise. + * c-c++-common/cilk-plus/SE/ef_error.c: Likewise. + * c-c++-common/cilk-plus/SE/ef_error2.c: Likewise. + * c-c++-common/cilk-plus/SE/ef_error3.c: Likewise. + * gcc.dg/cilk-plus/cilk-plus.exp: Added calls for the above tests. + git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206095 138bc75d-0d04-0410-961f-82ee72b054a4
* Add __int128 test.mpolacek2013-12-171-0/+48
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206065 138bc75d-0d04-0410-961f-82ee72b054a4
* * predict.h (PROB_LIKELY): Fix the value.jakub2013-12-162-0/+125
| | | | | | | | | | | | * internal-fn.c (ubsan_expand_si_overflow_mul_check): Add support for overflow checking for modes without 2xwider supported mode, if the mode has 2xnarrower mode. * c-c++-common/ubsan/overflow-mul-3.c: New test. * c-c++-common/ubsan/overflow-mul-4.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206026 138bc75d-0d04-0410-961f-82ee72b054a4
* More overflow-negate-* testing.mpolacek2013-12-142-3/+67
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205992 138bc75d-0d04-0410-961f-82ee72b054a4
* More tests for ubsan.mpolacek2013-12-142-0/+271
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205985 138bc75d-0d04-0410-961f-82ee72b054a4
* PR sanitizer/59503mpolacek2013-12-141-0/+14
| | | | | | | | | | | * internal-fn.c (ubsan_expand_si_overflow_addsub_check): Call expand_binop with correct optab depending on code. testsuite/ * c-c++-common/ubsan/pr59503.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205984 138bc75d-0d04-0410-961f-82ee72b054a4
* 2013-12-12 Max Ostapenko <m.ostapenko@partner.samsung.com>chefmax2013-12-126-0/+226
| | | | | | | | | | | | | | | | | | | | | * c-c++-common/tsan/free_race2.c: New file. * c-c++-common/tsan/race_on_barrier2.c: Likewise. * c-c++-common/tsan/race_on_mutex.c: Likewise. * c-c++-common/tsan/race_on_mutex2.c: Likewise. * c-c++-common/tsan/simple_race.c: Likewise. * c-c++-common/tsan/simple_stack.c: Likewise. * g++.dg/tsan/aligned_vs_unaligned_race.C: Likewise. Test applies only on x86_64-linux targets. * g++.dg/tsan/atomic_free.C: Likewise. * g++.dg/tsan/atomic_free2.C: Likewise. * g++.dg/tsan/benign_race.C: Likewise. * g++.dg/tsan/cond_race.C: Likewise. * g++.dg/tsan/default_options.C: Likewise. * g++.dg/tsan/fd_close_norace.C: Likewise. * g++.dg/tsan/fd_close_norace2.C: Likewise. * g++-dg/tsan/tsan.exp: Modified to run additional C++ tests. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205925 138bc75d-0d04-0410-961f-82ee72b054a4
* PR libgomp/59467jakub2013-12-121-0/+68
| | | | | | | | | | | | | | | | * gimplify.c (omp_check_private): Add copyprivate argument, if it is true, don't check omp_privatize_by_reference. (gimplify_scan_omp_clauses): For OMP_CLAUSE_COPYPRIVATE verify decl is private in outer context. Adjust omp_check_private caller. * gfortran.dg/gomp/pr59467.f90: New test. * c-c++-common/gomp/pr59467.c: New test. * testsuite/libgomp.fortran/crayptr2.f90: Add private (d) clause to !$omp parallel. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205922 138bc75d-0d04-0410-961f-82ee72b054a4
* 2013-12-10 Max Ostapenko <m.ostapenko@partner.samsung.com>ygribov2013-12-101-1/+0
| | | | | | | | | * c-c++-common/tsan/thread_leak2.c: `dg-skip-if' removed. * gcc-dg/tsan/tsan.exp: Run only with '-O0' and '-O2' options. * g++-dg/tsan/tsan.exp: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205853 138bc75d-0d04-0410-961f-82ee72b054a4
* PR sanitizer/59333mpolacek2013-12-052-0/+29
| | | | | | | | | | | | | | | | | | | | | PR sanitizer/59397 * ubsan.c: Include rtl.h and expr.h. (ubsan_encode_value): Add new parameter. If expanding, assign a stack slot for DECL_RTL of the temporary and call expand_assignment. Handle BOOLEAN_TYPE and ENUMERAL_TYPE. (ubsan_build_overflow_builtin): Adjust ubsan_encode_value call. * ubsan.h (ubsan_encode_value): Adjust declaration. * internal-fn.c (ubsan_expand_si_overflow_addsub_check): Move ubsan_build_overflow_builtin above expand_normal call. Surround this call with push_temp_slots and pop_temp_slots. (ubsan_expand_si_overflow_neg_check): Likewise. (ubsan_expand_si_overflow_mul_check): Likewise. testsuite/ * c-c++-common/ubsan/pr59333.c: New test. * c-c++-common/ubsan/pr59397.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205714 138bc75d-0d04-0410-961f-82ee72b054a4
* 2013-12-05 Max Ostapenko <m.ostapenko@partner.samsung.com>ygribov2013-12-0512-0/+343
| | | | | | | | | | | | | | | | | | | | | | * c-c++-common/tsan/atomic_stack.c: New test. * c-c++-common/tsan/fd_pipe_race.c: New test. * c-c++-common/tsan/free_race.c: New test. * c-c++-common/tsan/mutexset1.c: New test. * c-c++-common/tsan/race_on_barrier.c: New test. * c-c++-common/tsan/sleep_sync.c: New test. * c-c++-common/tsan/thread_leak.c: New test. * c-c++-common/tsan/thread_leak1.c: New test. * c-c++-common/tsan/thread_leak2.c: New test. * c-c++-common/tsan/tiny_race.c: New test. * c-c++-common/tsan/tls_race.c: New test. * c-c++-common/tsan/write_in_reader_lock.c: New test. * lib/tsan-dg.exp: New file. * gcc.dg/tsan/tsan.exp: New file. * g++.dg/tsan/tsan.exp: New file. * g++.dg/dg.exp: Prune tsan subdirectory. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205704 138bc75d-0d04-0410-961f-82ee72b054a4
* 2013-12-05 Yury Gribov <y.gribov@samsung.com>ygribov2013-12-052-2/+2
| | | | | | | | | PR sanitizer/59369 * c-c++-common/asan/pr59063-1.c: Disable on non-Linux platforms. * c-c++-common/asan/pr59063-2.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205699 138bc75d-0d04-0410-961f-82ee72b054a4
* libsanitizer merge from upstream r196090kcc2013-12-051-1/+0
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205695 138bc75d-0d04-0410-961f-82ee72b054a4
* Implement -fsanitize=signed-integer-overflow.mpolacek2013-12-047-0/+328
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205684 138bc75d-0d04-0410-961f-82ee72b054a4
* 2013-12-02 Marek Polacek <polacek@redhat.com>mpolacek2013-12-021-13/+84
| | | | | | | | | | testsuite/ * c-c++-common/ubsan/vla-1.c: Split the tests into individual functions. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205590 138bc75d-0d04-0410-961f-82ee72b054a4
* PR sanitizer/59331mpolacek2013-11-293-3/+3
| | | | | | | | | | | | | | | | | cp/ * decl.c (compute_array_index_type): Don't build COMPOUND_EXPR for instrumentation. testsuite/ * g++.dg/ubsan/pr59331.C: New test. * g++.dg/ubsan/cxx1y-vla.C: Enable -Wall -Wno-unused-variable. Disable the -w option. * c-c++-common/ubsan/vla-1.c: Likewise. * c-c++-common/ubsan/vla-2.c: Likewise. * c-c++-common/ubsan/vla-3.c: Don't use the -w option. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205544 138bc75d-0d04-0410-961f-82ee72b054a4
* gcc/ygribov2013-11-292-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2013-11-29 Jakub Jelinek <jakub@redhat.com> Yury Gribov <y.gribov@samsung.com> PR sanitizer/59063 * config/gnu-user.h: Removed old code for setting up sanitizer libs. * gcc.c: Using libsanitizer spec instead of explicit libs. gcc/testsuite/ 2013-11-29 Jakub Jelinek <jakub@redhat.com> Yury Gribov <y.gribov@samsung.com> PR sanitizer/59063 * c-c++-common/asan/pr59063-1.c: New test. * c-c++-common/asan/pr59063-2.c: Likewise. * lib/asan-dg.exp: Add path to libsanitizer.spec to cflags. * lib/ubsan-dg.exp: Likewise. libsanitizer/ 2013-11-29 Jakub Jelinek <jakub@redhat.com> Yury Gribov <y.gribov@samsung.com> PR sanitizer/59063 * libsanitizer.spec.in: Add spec file to hold link flags for various sanitizer libs. * configure.ac: Check whether clock_* routines come from librt. * asan/Makefile.am (libasan_la_LDFLAGS): Libs now come from configure.ac. * tsan/Makefile.am (libtsan_la_LDFLAGS): Likewise. * ubsan/Makefile.am (libubsan_la_LDFLAGS): Likewise. * lsan/Makefile.am (liblsan_la_LDFLAGS): Likewise. * asan/Makefile.in: Regenerate. * interception/Makefile.in: Regenerate. * lsan/Makefile.in: Regenerate. * sanitizer_common/Makefile.in: Regenerate. * tsan/Makefile.in: Regenerate. * ubsan/Makefile.in: Regenerate. * Makefile.in: Regenerate. * configure: Regenerate. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205524 138bc75d-0d04-0410-961f-82ee72b054a4
* PR c/59280jakub2013-11-291-0/+4
| | | | | | | | | | | * c-common.c (get_priority): If TREE_VALUE (args) is IDENTIFIER_NODE, goto invalid. If it is error_mark_node, don't issue further diagnostics. testsuite/ * c-c++-common/pr59280.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205510 138bc75d-0d04-0410-961f-82ee72b054a4
* Handle vector increment/decrement in build_unary_opvries2013-11-271-0/+30
| | | | | | | | | | | | | | 2013-11-27 Tom de Vries <tom@codesourcery.com> Marc Glisse <marc.glisse@inria.fr> PR c++/59032 * c-typeck.c (build_unary_op): Allow vector increment and decrement. * typeck.c (cp_build_unary_op): Allow vector increment and decrement. * c-c++-common/pr59032.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205439 138bc75d-0d04-0410-961f-82ee72b054a4
* Don't create out-of-bounds BIT_FIELD_REF.vries2013-11-271-0/+12
| | | | | | | | | | | | | | | | | | | 2013-11-27 Tom de Vries <tom@codesourcery.com> Marc Glisse <marc.glisse@inria.fr> PR middle-end/59037 * semantics.c (cxx_fold_indirect_ref): Don't create out-of-bounds BIT_FIELD_REF. * fold-const.c (fold_indirect_ref_1): Don't create out-of-bounds BIT_FIELD_REF. * gimple-fold.c (gimple_fold_indirect_ref): Same. * tree-cfg.c (verify_expr): Give error if BIT_FIELD_REF is out-of-bounds. * c-c++-common/pr59037.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205438 138bc75d-0d04-0410-961f-82ee72b054a4
* 2013-11-27 Marek Polacek <polacek@redhat.com>mpolacek2013-11-271-0/+26
| | | | | | | | | | | * ubsan.c (ubsan_type_descriptor): If varpool_get_node returns NULL for a decl, recreate that decl. Save into the hash table VAR_DECLs rather than ADDR_EXPRs. testsuite/ * c-c++-common/ubsan/undefined-1.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205433 138bc75d-0d04-0410-961f-82ee72b054a4
* PR middle-end/59152jakub2013-11-261-0/+40
| | | | | | | | | | | * omp-low.c (expand_omp_for_static_chunk): Don't set loop->latch for the inner loop if collapse_bb is non-NULL. (expand_omp_simd): Use cont_bb rather than e->dest as latch. * c-c++-common/gomp/pr59152.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205410 138bc75d-0d04-0410-961f-82ee72b054a4
* PR sanitizer/59061jakub2013-11-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common.opt (static-liblsan): Add. * config/gnu-user.h (STATIC_LIBLSAN_LIBS, STATIC_LIBUBSAN_LIBS): Define. * flag-types.h (enum sanitize_code): Add SANITIZE_LEAK. Renumber SANITIZE_SHIFT, SANITIZE_DIVIDE, SANITIZE_UNREACHABLE, SANITIZE_VLA, SANITIZE_RETURN. * opts.c (common_handle_option): Handle -fsanitize=leak. * gcc.c (ADD_STATIC_LIBLSAN_LIBS, LIBLSAN_SPEC): Define. (LIBUBSAN_SPEC): Don't test LIBUBSAN_EARLY_SPEC. (LIBUBSAN_EARLY_SPEC): Remove. (SANITIZER_EARLY_SPEC): Don't do anything for libubsan. (SANITIZER_SPEC): Add -fsanitize=leak handling. (sanitize_spec_function): Handle %sanitize(leak). * doc/invoke.texi (-static-liblsan, -fsanitize=leak): Document. * c-c++-common/asan/no-redundant-instrumentation-7.c: Fix cleanup-tree-dump directive. * configure.tgt: Set LSAN_SUPPORTED=yes for x86_64-linux. * configure.ac (LSAN_SUPPORTED): New AM_CONDITIONAL. * configure: Regenerated. * lsan/Makefile.am (toolexeclib_LTLIBRARIES, lsan_files, liblsan_la_SOURCES, liblsan_la_LIBADD, liblsan_la_LDFLAGS): Add. * lsan/Makefile.in: Regenerated. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205290 138bc75d-0d04-0410-961f-82ee72b054a4
* * sanitizer.def (BUILT_IN_ASAN_BEFORE_DYNAMIC_INIT,jakub2013-11-221-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | BUILT_IN_ASAN_AFTER_DYNAMIC_INIT): New. * asan.c (instrument_derefs): Handle also VAR_DECL loads/stores. Don't instrument accesses to VAR_DECLs which are known to fit into their bounds and the vars are known to have shadow bytes indicating allowed access. (asan_dynamic_init_call): New function. (asan_add_global): If vnode->dynamically_initialized, set __has_dynamic_init to 1 instead of 0. (initialize_sanitizer_builtins): Add BT_FN_VOID_CONST_PTR var. * asan.h (asan_dynamic_init_call): New prototype. * cgraph.h (varpool_node): Add dynamically_initialized bitfield. cp/ * decl2.c: Include asan.h. (one_static_initialization_or_destruction): If -fsanitize=address, init is non-NULL and guard is NULL, set vnode->dynamically_initialized. (do_static_initialization_or_destruction): Call __asan_{before,after}_dynamic_init around the static initialization. testsuite/ * c-c++-common/asan/no-redundant-instrumentation-1.c: Tweak to avoid optimizing away some __asan_report* calls. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205282 138bc75d-0d04-0410-961f-82ee72b054a4
* 2013-11-19 Joshua J Cogliati <jrincayc@yahoo.com>manu2013-11-201-0/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PR c/53001 Splitting out a -Wfloat-conversion from -Wconversion for conversions that lower floating point number precision or conversion from floating point numbers to integers. gcc/c-family/ * c-common.c (unsafe_conversion_p): Make this function return an enumeration with more detail. (conversion_warning): Use the new return type of unsafe_conversion_p to separately warn either about conversions that lower floating point number precision or about the other kinds of conversions. * c-common.h (enum conversion_safety): New enumeration. (unsafe_conversion_p): switching return type to conversion_safety enumeration. * c.opt: Adding new warning -Wfloat-conversion and enabling it with -Wconversion. gcc/ * doc/invoke.texi: Adding documentation about -Wfloat-conversion. gcc/testsuite/ * c-c++-common/Wfloat-conversion.c: Copies relevant tests from c-c++-common/Wconversion-real.c, gcc.dg/Wconversion-real-integer.c and gcc.dg/pr35635.c into new testcase for conversions that are warned about by -Wfloat-conversion. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205090 138bc75d-0d04-0410-961f-82ee72b054a4
* config/mpolacek2013-11-1913-9/+183
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * bootstrap-ubsan.mk (POSTSTAGE1_LDFLAGS): Add -ldl. gcc/c-family/ * c-ubsan.c (ubsan_instrument_division): Adjust ubsan_create_data call. (ubsan_instrument_shift): Likewise. (ubsan_instrument_vla): Likewise. gcc/ * opts.c (common_handle_option): Add -fsanitize=null option. Turn off -fdelete-null-pointer-checks option when doing the NULL pointer checking. * sanitizer.def (BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH): Add. * tree-pass.h (make_pass_ubsan): Declare. (make_pass_sanopt): Declare. * timevar.def (TV_TREE_UBSAN): New timevar. * passes.def: Add pass_sanopt and pass_ubsan. * ubsan.h (ubsan_null_ckind): New enum. (ubsan_mismatch_data): New struct. (ubsan_expand_null_ifn): Declare. (ubsan_create_data): Adjust declaration. (ubsan_type_descriptor): Likewise. * asan.c: Include "ubsan.h". (pass_data_sanopt): New pass. (execute_sanopt): New function. (gate_sanopt): Likewise. (make_pass_sanopt): Likewise. (class pass_sanopt): New class. * ubsan.c: Include tree-pass.h, gimple-ssa.h, gimple-walk.h, gimple-iterator.h and cfgloop.h. (PROB_VERY_UNLIKELY): Define. (tree_type_map_hash): New function. (ubsan_type_descriptor): Add new parameter. Improve type name generation. (ubsan_create_data): Add new parameter. Add pointer data into ubsan structure. (ubsan_expand_null_ifn): New function. (instrument_member_call): Likewise. (instrument_mem_ref): Likewise. (instrument_null): Likewise. (ubsan_pass): Likewise. (gate_ubsan): Likewise. (make_pass_ubsan): Likewise. (ubsan_instrument_unreachable): Adjust ubsan_create_data call. (class pass_ubsan): New class. (pass_data_ubsan): New pass. * flag-types.h (enum sanitize_code): Add SANITIZE_NULL. * internal-fn.c (expand_UBSAN_NULL): New function. * cgraphunit.c (varpool_finalize_decl): Call varpool_assemble_decl even when !flag_toplevel_reorder. * internal-fn.def (UBSAN_NULL): New. gcc/testsuite/ * c-c++-common/ubsan/null-1.c: New test. * c-c++-common/ubsan/null-2.c: New test. * c-c++-common/ubsan/null-3.c: New test. * c-c++-common/ubsan/null-4.c: New test. * c-c++-common/ubsan/null-5.c: New test. * c-c++-common/ubsan/null-6.c: New test. * c-c++-common/ubsan/null-7.c: New test. * c-c++-common/ubsan/null-8.c: New test. * c-c++-common/ubsan/null-9.c: New test. * c-c++-common/ubsan/null-10.c: New test. * c-c++-common/ubsan/null-11.c: New test. * gcc.dg/ubsan/c99-shift-2.c: Adjust dg-output. * c-c++-common/ubsan/shift-1.c: Likewise. * c-c++-common/ubsan/div-by-zero-3.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205021 138bc75d-0d04-0410-961f-82ee72b054a4
OpenPOWER on IntegriCloud