aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
2018-12-24Fix double-application of patch.Jan Hubicka1-11/+0
From-SVN: r267399
2018-12-24tree.c (fld_simplified_type): Temporarily disable array simplification.Jan Hubicka4-1/+32
* tree.c (fld_simplified_type): Temporarily disable array simplification. * gcc.c-torture/pr88140.c: New testcase. From-SVN: r267398
2018-12-24lto-symtab.c (lto_symtab_merge_decls_2): Do not report ODR violations for ↵Jan Hubicka5-4/+34
method whose basetype was already reported. * lto-symtab.c (lto_symtab_merge_decls_2): Do not report ODR violations for method whose basetype was already reported. * ipa-devirt.c (odr_type_violation_reported_p): New. * ipa-utils.h (odr_type_violation_reported_p): Declare. From-SVN: r267397
2018-12-24Fix PR67974 for Darwin by adding an asm shim for AVX.Iain Sandoe2-0/+82
The PR is about a set of tests that were not executed because of missing asm support. However, the assembler can handle the insns now, so the tests are attempted (but with a missing asm shim they fail). This adds the shim. In principle (bugs notwithstanding) Darwin’s x86_64 ABI is supposed to follow the sysv psABI so we can have essentially a copy of the Linux one. 2018-12-24 Iain Sandoe <iain@sandoe.co.uk> PR testsuite/67974 * gcc.target/x86_64/abi/avx/asm-support-darwin.s: New. From-SVN: r267395
2018-12-24powerpc-darwin, skip ident tests.Iain Sandoe7-0/+15
The c-c++-common tests fail (or XPASS depending on which) on powerpc Darwin because it doesn't currently emit .ident marker. Since there's no support for .ident in the assembler, we can't enable the output and therefore these tests should be skipped. 2018-12-24 Iain Sandoe <iain@sandoe.co.uk> * c-c++-common/ident-0a.c: Skip for powerpc-darwin. * c-c++-common/ident-0b.c: Likewise. * c-c++-common/ident-1a.c: Likewise. * c-c++-common/ident-1b.c: Likewise. * c-c++-common/ident-2a.c: Likewise. * c-c++-common/ident-2b.c: Likewise. From-SVN: r267394
2018-12-24darwin, configuration, check properly for dwarf2 debug line supportIain Sandoe3-0/+14
This corrects a long-standing misconfiguration for Darwin. The assembler supports the “.file” and “.loc” directives, but the GCC configury was not detecting this because it was using objdump, which does not exist on most Darwin installations. We added support for “otool” to GCC and now we can use that to make the check that’s done with objdump on ELF targets. 2018-12-24 Iain Sandoe <iain@sandoe.co.uk> * configure.ac (dwarf2_debug_line): Check for the debug_line section using otool when there’s no objdump available. * configure: Regenerate. From-SVN: r267393
2018-12-24ipa-utils.c (ipa_merge_profiles): Fix updating of fnsummary; also handle ↵Jan Hubicka3-4/+36
rescaling of mismatched profiles. * ipa-utils.c (ipa_merge_profiles): Fix updating of fnsummary; also handle rescaling of mismatched profiles. * ipa-fnsummary.c (analyze_function): Handle speculative edges. From-SVN: r267392
2018-12-24Daily bump.GCC Administrator1-1/+1
From-SVN: r267391
2018-12-23re PR fortran/77703 (ICE on assignment to pointer function)Paul Thomas4-1/+62
2018-12-23 Paul Thomas <pault@gcc.gnu.org> PR fortran/77703 * resolve.c (get_temp_from_expr): Use the string length of constant character expressions. 2018-12-23 Paul Thomas <pault@gcc.gnu.org> PR fortran/77703 * gfortran.dg/ptr_func_assign_5.f08 : New test. From-SVN: r267379
2018-12-23builtins.h (c_strlen_data): Add new fields and comments.Martin Sebor5-10/+54
* builtins.h (c_strlen_data): Add new fields and comments. * builtins.c (unterminated_array): Change field reference from "len" to "minlen" in c_strlen_data instance. * gimple-fold.c (get_range_strlen): Likewise. * gimple-ssa-sprintf.c (get_string_length): Likewise. Co-Authored-By: Jeff Law <law@redhat.com> From-SVN: r267378
2018-12-23builtins.c (unterminated_array): Rename "data" to "lendata".Martin Sebor3-53/+62
* builtins.c (unterminated_array): Rename "data" to "lendata". Fix a few comments. (expand_builtin_strnlen, expand_builtin_stpcpy_1): Likewise. (fold_builtin_strlen): Likewise. * gimple-fold.c (get_range_strlen): Likewise. Also rename a couple instances of "type" to "optype" and "arg" to "fld". Co-Authored-By: Jeff Law <law@redhat.com> From-SVN: r267377
2018-12-23builtins.c (unterminated_array): Use empty brace initialization for ↵Martin Sebor4-16/+19
c_strlen_data. 2018-12-23 Martin Sebor <msebor@redhat.com> Jeff Law <law@redhat.com> * builtins.c (unterminated_array): Use empty brace initialization for c_strlen_data. (c_strlen, expand_builtin_strnlen): Likewise. (expand_builtin_stpcpy_1, fold_builtin_strlen): Likewise. * gimple-fold.c (get_range_strlen): Likewise. (gimple_fold_builtin_stpcpy): Likewise. * gimple-ssa-sprintf.c (get_string_length): Likewise. Co-Authored-By: Jeff Law <law@redhat.com> From-SVN: r267376
2018-12-23[RS6000] PR88346, Inconsistent list of CPUs supported after r266502Alan Modra5-10/+22
This patch removes the %e error for AIX, since it seems there has been no attempt to keep cpu support up to date for AIX, and adds missing entries to ASM_CPU_SPEC in rs6000.h. The rs64a->rs64 name change happened a long time ago as a fix for PR20813 (git commit c92b4c3f5b). PR 88346 * config/rs6000/rs6000.h (ASM_CPU_SPEC): Correct %e message. Handle -mcpu=rs64, not -mcpu=rs64a. Handle -mcpu=powerpc64 and -mcpu=titan. * config/rs6000/driver-rs6000.c (asm_names): Similarly. * config/rs6000/aix71.h (ASM_CPU_SPEC): Delete %e message. Handle -mcpu=rs64, not -mcpu=rs64a. * config/rs6000/aix72.h (ASM_CPU_SPEC): Likewise. From-SVN: r267375
2018-12-23Fix Ada bootstrap for Darwin9 and earlier.Iain Sandoe2-3/+16
2018-12-23 Iain Sandoe <iain@sandoe.co.uk> gcc/ada/ * adaint.c [__APPLE__] (__gnat_lwp_self): Ensure that the system interface used is available on the target. From-SVN: r267374
2018-12-23LTO-wrapper, don't pre-link early debug objects.Iain Sandoe2-85/+57
Pass them to the final link, the pre-link wasn't effective. Make the temp filenames easier to follow. Also save them in the CWD when save-temps is given. 2018-12-23 Iain Sandoe <iain@sandoe.co.uk> * lto-wrapper.c (tool_cleanup): Don’t report ficticious temp files. (debug_objcopy): Improve temp filenames. Append the early debug objects to the outfiles. Remove the phase prelinking the early debug. Emit the early debug filenames for ld. From-SVN: r267373
2018-12-23Fix ident tests by Enabling ident output for X86 Darwin.Iain Sandoe2-0/+9
The c-c++-common tests fail (or XPASS depending on which) on Darwin because it doesn't currently emit .ident marker. For X86 Darwin, this is a trivial oversight; the assembler supports the directive. We can therefore use the default target hook there. 2018-12-23 Iain Sandoe <iain@sandoe.co.uk> * config/i386/darwin.h (TARGET_ASM_OUTPUT_IDENT): New. From-SVN: r267372
2018-12-23use simple-object instead of nm to determine if files contain LTO.Iain Sandoe2-63/+66
This replaces the use of nm to search for the LTO common symbol marker and uses simple object to see if there's a section starting with ".gnu.lto_." or ".gnu.offload_lto_" 2018-12-23 Iain Sandoe <iain@sandoe.co.uk> * collect2.c (maybe_run_lto_and_relink): Don’t say we have a temp file unless we actually did some LTO. (has_lto_section, is_lto_object_file): New. (maybe_lto_object_file): Remove. (scan_prog_file): Use is_lto_object_file() instead of scanning the output of nm. From-SVN: r267371
2018-12-23Handle -save-temps in collect2Iain Sandoe2-16/+50
Handle the option, make the saved filenames and paths easier to handle. Don't print '[Leaving...]' for files we never created and don't exist - or unless verbose is true. 2018-12-23 Iain Sandoe <iain@sandoe.co.uk> * collect2.c (main): Parse the output file early so we can make nicer temp names. Respond to “-save-temps” in the GCC OPTIONS. (maybe_unlink): Don’t print “[Leaving…”] for files we never created and don’t exist. From-SVN: r267370
2018-12-23Ensure collect2 responds to intended commmand line options.Iain Sandoe2-23/+37
To ensure compatibility with the flags consumed by ld, some of the flags needed by collect2 come from the command line and some are passed in the COLLECT_GCC_OPTIONS. Here we combine initial parses of both and then set the LTO mode accordingly. 2018-12-23 Iain Sandoe <iain@sandoe.co.uk> * collect2.c (main): Combine flags from both the command line and COLLECT_GCC_OPTIONS to determine the set in force From-SVN: r267369
2018-12-23re PR fortran/88328 (ICE in resolve_tag_format, at fortran/io.c:1641)Steven G. Kargl4-1/+34
2018-12-22 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/88328 * io.c (resolve_tag_format): Add error for zero-sized array. (gfc_resolve_dt): Manipulate gfc_current_locus to get sensible error message locus. 2018-12-22 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/88328 * gfortran.dg/pr88328.f90: New test. From-SVN: r267367
2018-12-23Daily bump.GCC Administrator1-1/+1
From-SVN: r267366
2018-12-22* ipa-utils.c (ipa_merge_profiles): Recompute summaries.Jan Hubicka2-1/+7
From-SVN: r267361
2018-12-22tree.c: (obj_type_ref_class): Move to...Jan Hubicka17-19/+101
* tree.c: (obj_type_ref_class): Move to... * ipa-devirt.c (obj_type_ref_class): Move to here; lookup main odr type. (get_odr_type): Compensate for type simplification. * g++.dg/ipa/devirt-30.C: Add dg-do. * g++.dg/lto/devirt-1_0.C: New testcase. * g++.dg/lto/devirt-2_0.C: New testcase. * g++.dg/lto/devirt-3_0.C: New testcase. * g++.dg/lto/devirt-4_0.C: New testcase. * g++.dg/lto/devirt-5_0.C: New testcase. * g++.dg/lto/devirt-6_0.C: New testcase. * g++.dg/lto/devirt-13_0.C: New testcase. * g++.dg/lto/devirt-14_0.C: New testcase. * g++.dg/lto/devirt-19_0.C: New testcase. * g++.dg/lto/devirt-22_0.C: New testcase. * g++.dg/lto/devirt-23_0.C: New testcase. * g++.dg/lto/devirt-30_0.C: New testcase. * g++.dg/lto/devirt-34_0.C: New testcase. From-SVN: r267359
2018-12-22re PR fortran/85798 (ICE in get_array_index, at fortran/data.c:69)Steven G. Kargl4-0/+51
2018-12-22 Steven G . Kargl <kargl@gcc.gnu.org> PR fortran/85798 * decl.c (gfc_match_data): If a component of a derived type entity appears in data statement, check that does not have the allocatable attribute. 2018-12-22 Steven G . Kargl <kargl@gcc.gnu.org> PR fortran/85798 * gfortran.dg/pr85798.f90: New test. From-SVN: r267356
2018-12-22re PR fortran/88169 (Rejects USE rename of namelist group)Steven G. Kargl6-12/+80
2018-12-21 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/88169 * module.c (mio_namelist): Remove an error condition/message that is contrary to the Fortran standard. 2018-12-21 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/88169 * gfortran.dg/pr88169_1.f90: new test. * gfortran.dg/pr88169_2.f90: Ditto. * gfortran.dg/pr88169_3.f90: Ditto. From-SVN: r267351
2018-12-22backport: re PR fortran/85544 (ICE in gfc_conv_scalarized_array_ref, at ↵Thomas Koenig1-0/+27
fortran/trans-array.c:3385) 2018-12-22 Thomas Koenig <tkoenig@gcc.gnu.org> Backport from trunk PR fortran/85544 * gfortran.dg/power_7.f90: New test. From-SVN: r267348
2018-12-22re PR fortran/85544 (ICE in gfc_conv_scalarized_array_ref, at ↵Thomas Koenig3-81/+85
fortran/trans-array.c:3385) 2018-12-22 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/85544 * frontend-passes.c (optimize_power): Remove. (optimize_op): Remove call to optimize_power. * trans-expr.c (gfc_conv_power_op): Handle cases of 1**integer, (2|4|8|16) ** integer and (-1) ** integer. 2018-12-22 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/85544 * gfortran.dg/power_7.f90: New test. From-SVN: r267347
2018-12-22Daily bump.GCC Administrator1-1/+1
From-SVN: r267346
2018-12-21re PR fortran/69121 (IEEE_SCALB is not generic)Steven G. Kargl2-0/+75
2018-12-21 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/69121 * ieee/ieee_arithmetic.F90: Provide missing interfaces for IEEE_SCALB. 2018-12-21 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/69121 * gfortran.dg/ieee/ieee_9.f90: New test. From-SVN: r267343
2018-12-21re PR c++/86524 (std::less with pointer arguments not usable in ↵Jakub Jelinek10-13/+179
static_assert in constexpr function) PR c++/86524 PR c++/88446 * cp-tree.h (cp_fold_maybe_rvalue, cp_fold_rvalue): Declare. (fold_non_dependent_expr): Add manifestly_const_eval argument. * constexpr.c (cxx_eval_builtin_function_call): Evaluate __builtin_constant_p if ctx->manifestly_const_eval even in constexpr functions. Don't reuse dummy{1,2} vars between different arguments. Use cp_fold_rvalue instead of cp_fully_fold. Fix comment typo. (fold_non_dependent_expr): Add manifestly_const_eval argument, pass it through to cxx_eval_outermost_constant_expr and maybe_constant_value. * cp-gimplify.c (cp_fold_maybe_rvalue, cp_fold_rvalue): No longer static. * semantics.c (finish_static_assert): Call fold_non_dependent_expr with true as manifestly_const_eval. * g++.dg/cpp1y/constexpr-86524.C: New test. * g++.dg/cpp2a/is-constant-evaluated4.C: New test. * g++.dg/cpp2a/is-constant-evaluated5.C: New test. * g++.dg/cpp2a/is-constant-evaluated6.C: New test. From-SVN: r267341
2018-12-21correct double semi-colonsPaul Thomas1-1/+1
From-SVN: r267340
2018-12-21re PR middle-end/85594 (ICE during expand when compiling with -fwrapv -fopenmp)Jakub Jelinek5-7/+38
PR middle-end/85594 PR middle-end/88553 * omp-expand.c (extract_omp_for_update_vars): Regimplify the condition if needed. (expand_omp_for_generic): Don't clobber t temporary for ordered loops. * gcc.dg/gomp/pr85594.c: New test. * gcc.dg/gomp/pr88553.c: New test. From-SVN: r267339
2018-12-21re PR ipa/88561 (PGO devirtualization miscompilation of firefox)Jan Hubicka5-4/+174
PR ipa/88561 * ipa-polymorphic-call.c (ipa_polymorphic_call_context::ipa_polymorphic_call_context): Handle arguments of thunks correctly. (ipa_polymorphic_call_context::get_dynamic_context): Be ready for NULL instance pinter. * lto-cgraph.c (lto_output_node): Always stream thunk info. From-SVN: r267338
2018-12-21re PR fortran/87881 (gfortran.dg/inquiry_type_ref_(1.f08|3.f90) fail on darwin)Paul Thomas4-40/+73
2018-12-21 Paul Thomas <pault@gcc.gnu.org> PR fortran/87881 * expr.c (find_inquiry_ref): Loop through the inquiry refs in case there are two of them. (simplify_ref_chain): Return true after a successful call to find_inquiry_ref. 2018-12-21 Paul Thomas <pault@gcc.gnu.org> PR fortran/87881 * gfortran.dg/inquiry_part_ref_4.f90: New test. From-SVN: r267337
2018-12-21S/390: Add support for double<->long vector convertsAndreas Krebbel5-0/+115
gcc/ChangeLog: 2018-12-21 Andreas Krebbel <krebbel@linux.ibm.com> * config/s390/vector.md ("floatv2div2df2", "floatunsv2div2df2") ("fix_truncv2dfv2di2", "fixuns_truncv2dfv2di2"): New pattern definitions. gcc/testsuite/ChangeLog: 2018-12-21 Andreas Krebbel <krebbel@linux.ibm.com> * gcc.target/s390/vector/fp-signedint-convert-1.c: New test. * gcc.target/s390/vector/fp-unsignedint-convert-1.c: New test. From-SVN: r267336
2018-12-21pr88418.c (dg-options): Add -mno-avx.Uros Bizjak1-1/+1
* gcc.target/i386/pr88418.c (dg-options): Add -mno-avx. From-SVN: r267334
2018-12-21re PR rtl-optimization/87727 (gcc.target/sparc/overflow-2.c FAILs)Eric Botcazou3-4/+16
PR rtl-optimization/87727 * combine.c (cant_combine_insn_p): On a LEAF_REGISTERS target, combine again moves from leaf hard registers. * final.c (final_scan_insn_1) <NOTE_INSN_INLINE_ENTRY>: Minor tweak. From-SVN: r267328
2018-12-21re PR target/88522 (Error: operand size mismatch for `vpgatherqq')Jakub Jelinek2-28/+48
PR target/88522 * config/i386/sse.md (*avx512pf_gatherpf<mode>sf_mask, *avx512pf_gatherpf<mode>df_mask, *avx512pf_scatterpf<mode>sf_mask, *avx512pf_scatterpf<mode>df_mask): Use %X5 instead of %5 for -masm=intel. (gatherq_mode): Remove mode iterator. (*avx512f_gathersi<mode>, *avx512f_gathersi<mode>_2): Use X instead of <xtg_mode>. (*avx512f_gatherdi<mode>): Use X instead of <gatherq_mode>. (*avx512f_gatherdi<mode>_2, *avx512f_scattersi<mode>, *avx512f_scatterdi<mode>): Use %X5 for -masm=intel. From-SVN: r267327
2018-12-21re PR rtl-optimization/88563 (wrong code with -O2 -fno-code-hoisting ↵Jakub Jelinek4-13/+37
-fno-tree-ccp -fno-tree-dominator-opts -fno-tree-forwprop -fno-tree-fre -fno-tree-pre -fno-tree-vrp) PR rtl-optimization/88563 * expr.c (expand_expr_real_2) <case WIDEN_MULT_EXPR>: Swap innermode and mode arguments to convert_modes. Likewise swap mode and word_mode arguments. Handle both arguments with VOIDmode before convert_modes of one of them. Formatting fixes. * gcc.dg/pr88563.c: New test. From-SVN: r267326
2018-12-21re PR target/88556 (Inline built-in sinh, cosh, tanh for -ffast-math)Uros Bizjak6-1/+231
PR target/88556 * internal-fn.def (COSH): New. (SINH): Ditto. (TANH): Ditto. * optabs.def (cosh_optab): New. (sinh_optab): Ditto. (tanh_optab): Ditto. * config/i386/i386-protos.h (ix86_emit_i387_sinh): New prototype. (ix86_emit_i387_cosh): Ditto. (ix86_emit_i387_tanh): Ditto. * config/i386/i386.c (ix86_emit_i387_sinh): New function. (ix86_emit_i387_cosh): Ditto. (ix86_emit_i387_tanh): Ditto. * config/i386/i386.md (sinhxf2): New expander. (sinh<mode>2): Ditto. (coshxf2): Ditto. (cosh<mode>2): Ditto. (tanhxf2): Ditto. (tanh<mode>2): Ditto. From-SVN: r267325
2018-12-21re PR c++/87125 (ICE in tsubst_copy starting with r261084)Jakub Jelinek2-0/+20
PR c++/87125 * g++.dg/cpp0x/pr87125.C: New test. From-SVN: r267324
2018-12-21[ARM] Fix size-optimization-ieee testcase failureThomas Preud'homme4-0/+10
On some version of dejagnu, options in RUNTESTFLAGS are appended to the command-line and thus any -mfloat-abi=softfp or -mfloat-abi=hard in there overwrite the -mfloat-abi=soft in the dg-options for size-optimization-ieee-* tests. Test is still run though because arm_soft_ok returns true if -mfloat-abi=soft is accepted, even if the file is not compiled for softfloat due to a later -mfloat-abi on the command line. This patch adds a dg-skip-if to those tests to ensure they are not run in softfp or hard mode. 2018-12-21 Thomas Preud'homme <thomas.preudhomme@linaro.org> gcc/testsuite/ * gcc.target/arm/size-optimization-ieee-1.c: Skip if passing -mfloat-abi=softfp or -mfloat-abi=hard. * gcc.target/arm/size-optimization-ieee-2.c: Likewise. * gcc.target/arm/size-optimization-ieee-3.c: Likewise. From-SVN: r267323
2018-12-21re PR target/88547 (missed optimization for vector comparisons)Jakub Jelinek15-3/+702
PR target/88547 * config/i386/i386.c (ix86_expand_int_sse_cmp): Optimize x > y ? 0 : -1 into min (x, y) == x ? -1 : 0. * gcc.target/i386/pr88547-1.c: Expect only 2 knotb and 2 knotw insns instead of 4, check for vpminud, vpminuq and no vpsubd or vpsubq. * gcc.target/i386/sse2-pr88547-1.c: New test. * gcc.target/i386/sse2-pr88547-2.c: New test. * gcc.target/i386/sse4_1-pr88547-1.c: New test. * gcc.target/i386/sse4_1-pr88547-2.c: New test. * gcc.target/i386/avx2-pr88547-1.c: New test. * gcc.target/i386/avx2-pr88547-2.c: New test. * gcc.target/i386/avx512f-pr88547-2.c: New test. * gcc.target/i386/avx512vl-pr88547-1.c: New test. * gcc.target/i386/avx512vl-pr88547-2.c: New test. * gcc.target/i386/avx512vl-pr88547-3.c: New test. * gcc.target/i386/avx512f_cond_move.c (y): Change from unsigned int array to int array. From-SVN: r267322
2018-12-21x86: VAESDEC{,LAST} allow memory inputsJan Beulich2-2/+7
They are no different from their VAESENC{,LAST} counterparts in this regard. From-SVN: r267321
2018-12-21support --with-multilib-list=@name for ARMAlexandre Oliva3-10/+52
Introduce @name as a means to specify alternate multilib profiles as arguments to --with-multilib-list. So far this is only implemented for ARM. for gcc/ChangeLog * config.gcc (tmake_file): Add name to tmake_file for each @name in --with-multilib-list on arm-*-* targets. * doc/install.texi (with-multilib-list): Document it. From-SVN: r267320
2018-12-21PR c++/88196 - ICE with class non-type template parameter.Marek Polacek6-14/+33
* pt.c (convert_nontype_argument): If the expr is a PTRMEM_CST, also check if the type we're converting it to is TYPE_PTRMEM_P. * g++.dg/cpp0x/ptrmem-cst-arg1.C: Tweak dg-error. * g++.dg/cpp2a/nontype-class10.C: New test. * g++.dg/template/pr54858.C: Tweak dg-error. From-SVN: r267319
2018-12-21tree-vect-data-refs.c (vect_enhance_data_refs_alignment): Use ↵Jakub Jelinek2-3/+8
DR_TARGET_ALIGNMENT on dr_info rather than dr. * tree-vect-data-refs.c (vect_enhance_data_refs_alignment): Use DR_TARGET_ALIGNMENT on dr_info rather than dr. Spelling fixes. From-SVN: r267318
2018-12-21Daily bump.GCC Administrator1-1/+1
From-SVN: r267317
2018-12-20tree-vect-data-refs.c (vect_enhance_data_refs_alignment): Don't do ↵Joern Rennecke2-0/+19
versioning for data accesses with misaligned step. 2018-12-20 Joern Rennecke <joern.rennecke@riscy-ip.com> * tree-vect-data-refs.c (vect_enhance_data_refs_alignment): Don't do versioning for data accesses with misaligned step. From-SVN: r267314
2018-12-20C/C++: Add -Waddress-of-packed-memberH.J. Lu59-19/+960
When address of packed member of struct or union is taken, it may result in an unaligned pointer value. This patch adds -Waddress-of-packed-member to check alignment at pointer assignment and warn unaligned address as well as unaligned pointer: $ cat x.i struct pair_t { char c; int i; } __attribute__ ((packed)); extern struct pair_t p; int *addr = &p.i; $ gcc -O2 -S x.i x.i:8:13: warning: taking address of packed member of ‘struct pair_t’ may result in an unaligned pointer value [-Waddress-of-packed-member] 8 | int *addr = &p.i; | ^ $ cat c.i struct B { int i; }; struct C { struct B b; } __attribute__ ((packed)); long* g8 (struct C *p) { return p; } $ gcc -O2 -S c.i -Wno-incompatible-pointer-types c.i: In function ‘g8’: c.i:4:18: warning: converting a packed ‘struct C *’ pointer (alignment 1) to ‘long int *’ (alignment 8) may may result in an unaligned pointer value [-Waddress-of-packed-member] 4 | long* g8 (struct C *p) { return p; } | ^ c.i:2:8: note: defined here 2 | struct C { struct B b; } __attribute__ ((packed)); | ^ $ This warning is enabled by default. Since read_encoded_value_with_base in unwind-pe.h has union unaligned { void *ptr; unsigned u2 __attribute__ ((mode (HI))); unsigned u4 __attribute__ ((mode (SI))); unsigned u8 __attribute__ ((mode (DI))); signed s2 __attribute__ ((mode (HI))); signed s4 __attribute__ ((mode (SI))); signed s8 __attribute__ ((mode (DI))); } __attribute__((__packed__)); _Unwind_Internal_Ptr result; and GCC warns: gcc/libgcc/unwind-pe.h:210:37: warning: taking address of packed member of 'union unaligned' may result in an unaligned pointer value [-Waddress-of-packed-member] result = (_Unwind_Internal_Ptr) u->ptr; ^ we need to add GCC pragma to ignore -Waddress-of-packed-member. gcc/ PR c/51628 * doc/invoke.texi: Document -Wno-address-of-packed-member. gcc/c-family/ PR c/51628 * c-common.h (warn_for_address_or_pointer_of_packed_member): New. * c-warn.c (check_alignment_of_packed_member): New function. (check_address_of_packed_member): Likewise. (check_and_warn_address_of_packed_member): Likewise. (warn_for_address_or_pointer_of_packed_member): Likewise. * c.opt: Add -Wno-address-of-packed-member. gcc/c/ PR c/51628 * c-typeck.c (convert_for_assignment): Call warn_for_address_or_pointer_of_packed_member. gcc/cp/ PR c/51628 * call.c (convert_for_arg_passing): Call warn_for_address_or_pointer_of_packed_member. * typeck.c (convert_for_assignment): Likewise. gcc/testsuite/ PR c/51628 * c-c++-common/pr51628-1.c: New test. * c-c++-common/pr51628-2.c: Likewise. * c-c++-common/pr51628-3.c: Likewise. * c-c++-common/pr51628-4.c: Likewise. * c-c++-common/pr51628-5.c: Likewise. * c-c++-common/pr51628-6.c: Likewise. * c-c++-common/pr51628-7.c: Likewise. * c-c++-common/pr51628-8.c: Likewise. * c-c++-common/pr51628-9.c: Likewise. * c-c++-common/pr51628-10.c: Likewise. * c-c++-common/pr51628-11.c: Likewise. * c-c++-common/pr51628-12.c: Likewise. * c-c++-common/pr51628-13.c: Likewise. * c-c++-common/pr51628-14.c: Likewise. * c-c++-common/pr51628-15.c: Likewise. * c-c++-common/pr51628-26.c: Likewise. * c-c++-common/pr51628-27.c: Likewise. * c-c++-common/pr51628-28.c: Likewise. * c-c++-common/pr51628-29.c: Likewise. * c-c++-common/pr51628-30.c: Likewise. * c-c++-common/pr51628-31.c: Likewise. * c-c++-common/pr51628-32.c: Likewise. * gcc.dg/pr51628-17.c: Likewise. * gcc.dg/pr51628-18.c: Likewise. * gcc.dg/pr51628-19.c: Likewise. * gcc.dg/pr51628-20.c: Likewise. * gcc.dg/pr51628-21.c: Likewise. * gcc.dg/pr51628-22.c: Likewise. * gcc.dg/pr51628-23.c: Likewise. * gcc.dg/pr51628-24.c: Likewise. * gcc.dg/pr51628-25.c: Likewise. * c-c++-common/asan/misalign-1.c: Add -Wno-address-of-packed-member. * c-c++-common/asan/misalign-2.c: Likewise. * c-c++-common/ubsan/align-2.c: Likewise. * c-c++-common/ubsan/align-4.c: Likewise. * c-c++-common/ubsan/align-6.c: Likewise. * c-c++-common/ubsan/align-7.c: Likewise. * c-c++-common/ubsan/align-8.c: Likewise. * c-c++-common/ubsan/align-10.c: Likewise. * g++.dg/ubsan/align-2.C: Likewise. * gcc.target/i386/avx512bw-vmovdqu16-2.c: Likewise. * gcc.target/i386/avx512f-vmovdqu32-2.c: Likewise. * gcc.target/i386/avx512f-vmovdqu64-2.c: Likewise. * gcc.target/i386/avx512vl-vmovdqu16-2.c: Likewise. * gcc.target/i386/avx512vl-vmovdqu32-2.c: Likewise. * gcc.target/i386/avx512vl-vmovdqu64-2.c: Likewise. libgcc/ * unwind-pe.h (read_encoded_value_with_base): Add GCC pragma to ignore -Waddress-of-packed-member. From-SVN: r267313