Skip to content
Snippets Groups Projects
  1. Dec 01, 2023
    • David Malcolm's avatar
      diagnostics, analyzer: add optional per-diagnostic property bags to SARIF · 12b67d1e
      David Malcolm authored
      
      I've found it useful in debugging the analyzer for the SARIF output to
      contain extra analyzer-specific data in each diagnostic.
      
      This patch:
      * adds a way for a diagnostic_metadata to populate a property
      bag within a SARIF "result" object based on a new vfunc
      * reworks how diagnostics are emitted within the analyzer so
      that a custom diagnostic_metadata subclass is used, which populates
      the property bag with information from the saved_diagnostic, and with
      a vfunc hook allowing for per-pending_diagnotic-subclass extra
      properties.
      
      Doing so makes it trivial to go from the SARIF output back to
      pertinent parts of the analyzer's internals (e.g. the index of
      the diagnostic within the ana::diagnostic_manager, the index of
      the ana::exploded_node, etc).
      
      It also replaces a lot of boilerplate in the "emit" implementations
      in the various pending_diagnostics subclasses.  In particular, doing
      so fixes missing CVE metadata for -Wanalyzer-fd-phase-mismatch (where
      sm-fd.cc's fd_phase_mismatch::emit was failing to use its
      diagnostic_metadata instance).
      
      gcc/analyzer/ChangeLog:
      	* analyzer.h (class saved_diagnostic): New forward decl.
      	* bounds-checking.cc: Update for changes to
      	pending_diagnostic::emit.
      	* call-details.cc: Likewise.
      	* diagnostic-manager.cc: Include "diagnostic-format-sarif.h".
      	(saved_diagnostic::maybe_add_sarif_properties): New.
      	(class pending_diagnostic_metadata): New.
      	(diagnostic_manager::emit_saved_diagnostic): Create a
      	pending_diagnostic_metadata and a diagnostic_emission_context.
      	Pass the latter to the pending_diagnostic::emit vfunc.
      	* diagnostic-manager.h
      	(saved_diagnostic::maybe_add_sarif_properties): New decl.
      	* engine.cc: Update for changes to pending_diagnostic::emit.
      	* infinite-loop.cc: Likewise.
      	* infinite-recursion.cc: Likewise.
      	* kf-analyzer.cc: Likewise.
      	* kf.cc: Likewise.
      	* pending-diagnostic.cc
      	(diagnostic_emission_context::get_pending_diagnostic): New.
      	(diagnostic_emission_context::warn): New.
      	(diagnostic_emission_context::inform): New.
      	* pending-diagnostic.h (class diagnostic_emission_context): New.
      	(pending_diagnostic::emit): Update params.
      	(pending_diagnostic::maybe_add_sarif_properties): New vfunc.
      	* region.cc: Don't include "diagnostic-metadata.h".
      	* region-model.cc: Include "diagnostic-format-sarif.h".  Update
      	for changes to pending_diagnostic::emit.
      	(exposure_through_uninit_copy::maybe_add_sarif_properties): New.
      	* sm-fd.cc: Update for changes to pending_diagnostic::emit.
      	* sm-file.cc: Likewise.
      	* sm-malloc.cc: Likewise.
      	* sm-pattern-test.cc: Likewise.
      	* sm-sensitive.cc: Likewise.
      	* sm-signal.cc: Likewise.
      	* sm-taint.cc: Likewise.
      	* store.cc: Don't include "diagnostic-metadata.h".
      	* varargs.cc: Update for changes to pending_diagnostic::emit.
      
      gcc/ChangeLog:
      	* diagnostic-core.h (emit_diagnostic_valist): New overload decl.
      	* diagnostic-format-sarif.cc (sarif_builder::make_result_object):
      	When we have metadata, call its maybe_add_sarif_properties vfunc.
      	* diagnostic-metadata.h (class sarif_object): Forward decl.
      	(diagnostic_metadata::~diagnostic_metadata): New.
      	(diagnostic_metadata::maybe_add_sarif_properties): New vfunc.
      	* diagnostic.cc (emit_diagnostic_valist): New overload.
      
      gcc/testsuite/ChangeLog:
      	* gcc.dg/analyzer/fd-accept.c: Update for fix to missing CWE
      	metadata for -Wanalyzer-fd-phase-mismatch.
      	* gcc.dg/analyzer/fd-bind.c: Likewise.
      	* gcc.dg/analyzer/fd-socket-misuse.c: Likewise.
      	* gcc.dg/plugin/analyzer_cpython_plugin.c: Update for changes to
      	pending_diagnostic::emit.
      	* gcc.dg/plugin/analyzer_gil_plugin.c: Likewise.
      
      Signed-off-by: default avatarDavid Malcolm <dmalcolm@redhat.com>
      12b67d1e
    • David Malcolm's avatar
      docs: remove stray reference to -fanalyzer-checker=taint [PR103533] · 83b210d5
      David Malcolm authored
      
      I missed this one in r14-5464-gcfaaa8b11b8429.
      
      gcc/ChangeLog:
      	PR analyzer/103533
      	* doc/extend.texi: Remove stray reference to
      	-fanalyzer-checker=taint.
      
      Signed-off-by: default avatarDavid Malcolm <dmalcolm@redhat.com>
      83b210d5
    • Juzhe-Zhong's avatar
      RISC-V: Support highpart register overlap for widen vx/vf instructions · a23415d7
      Juzhe-Zhong authored
      This patch leverages the same approach as vwcvt.
      
      Before this patch:
      
      .L5:
              add     a3,s0,s1
              add     a4,s6,s1
              add     a5,s7,s1
              vsetvli zero,s0,e32,m4,ta,ma
              vle32.v v16,0(s1)
              vle32.v v12,0(a3)
              mv      s1,s2
              vle32.v v8,0(a4)
              vle32.v v4,0(a5)
              nop
              vfwadd.vf       v24,v16,fs0
              vfwadd.vf       v16,v12,fs0
              vs8r.v  v16,0(sp)                -----> spill
              vfwadd.vf       v16,v8,fs0
              vfwadd.vf       v8,v4,fs0
              nop
              vsetvli zero,zero,e64,m8,ta,ma
              vfmv.f.s        fa4,v24
              vl8re64.v       v24,0(sp)       -----> reload
              vfmv.f.s        fa5,v24
              fcvt.lu.d a0,fa4,rtz
              fcvt.lu.d a1,fa5,rtz
              vfmv.f.s        fa4,v16
              vfmv.f.s        fa5,v8
              fcvt.lu.d a2,fa4,rtz
              fcvt.lu.d a3,fa5,rtz
              add     s2,s2,s5
              call    sumation
              add     s3,s3,a0
              bgeu    s4,s2,.L5
      
      After this patch:
      
      .L5:
      	add	a3,s0,s1
      	add	a4,s6,s1
      	add	a5,s7,s1
      	vsetvli	zero,s0,e32,m4,ta,ma
      	vle32.v	v4,0(s1)
      	vle32.v	v28,0(a3)
      	mv	s1,s2
      	vle32.v	v20,0(a4)
      	vle32.v	v12,0(a5)
      	vfwadd.vf	v0,v4,fs0
      	vfwadd.vf	v24,v28,fs0
      	vfwadd.vf	v16,v20,fs0
      	vfwadd.vf	v8,v12,fs0
      	vsetvli	zero,zero,e64,m8,ta,ma
      	vfmv.f.s	fa4,v0
      	vfmv.f.s	fa5,v24
      	fcvt.lu.d a0,fa4,rtz
      	fcvt.lu.d a1,fa5,rtz
      	vfmv.f.s	fa4,v16
      	vfmv.f.s	fa5,v8
      	fcvt.lu.d a2,fa4,rtz
      	fcvt.lu.d a3,fa5,rtz
      	add	s2,s2,s5
      	call	sumation
      	add	s3,s3,a0
      	bgeu	s4,s2,.L5
      
      	PR target/112431
      
      gcc/ChangeLog:
      
      	* config/riscv/vector.md: Support highpart overlap for vx/vf.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/base/pr112431-22.c: New test.
      	* gcc.target/riscv/rvv/base/pr112431-23.c: New test.
      	* gcc.target/riscv/rvv/base/pr112431-24.c: New test.
      	* gcc.target/riscv/rvv/base/pr112431-25.c: New test.
      	* gcc.target/riscv/rvv/base/pr112431-26.c: New test.
      	* gcc.target/riscv/rvv/base/pr112431-27.c: New test.
      a23415d7
    • Juzhe-Zhong's avatar
      RISC-V: Support highpart overlap for indexed load with SRC EEW < DEST EEW · 4418d55b
      Juzhe-Zhong authored
      Leverage previous approach.
      
      Before this patch:
      
      .L5:
              add     a3,s0,s2
              add     a4,s6,s2
              add     a5,s7,s2
              vsetvli zero,s0,e64,m8,ta,ma
              vle8.v  v4,0(s2)
              vle8.v  v3,0(a3)
              mv      s2,s1
              vle8.v  v2,0(a4)
              vle8.v  v1,0(a5)
              nop
              vluxei8.v       v8,(s1),v4
              vs8r.v  v8,0(sp)              ---> spill
              vluxei8.v       v8,(s1),v3
              vluxei8.v       v16,(s1),v2
              vluxei8.v       v24,(s1),v1
              nop
              vmv.x.s a1,v8
              vl8re64.v       v8,0(sp)     ---> reload
              vmv.x.s a3,v24
              vmv.x.s a2,v16
              vmv.x.s a0,v8
              add     s1,s1,s5
              call    sumation
              add     s3,s3,a0
              bgeu    s4,s1,.L5
      
      After this patch:
      
      .L5:
      	add	a3,s0,s2
      	add	a4,s6,s2
      	add	a5,s7,s2
      	vsetvli	zero,s0,e64,m8,ta,ma
      	vle8.v	v15,0(s2)
      	vle8.v	v23,0(a3)
      	mv	s2,s1
      	vle8.v	v31,0(a4)
      	vle8.v	v7,0(a5)
      	vluxei8.v	v8,(s1),v15
      	vluxei8.v	v16,(s1),v23
      	vluxei8.v	v24,(s1),v31
      	vluxei8.v	v0,(s1),v7
      	vmv.x.s	a3,v0
      	vmv.x.s	a2,v24
      	vmv.x.s	a1,v16
      	vmv.x.s	a0,v8
      	add	s1,s1,s5
      	call	sumation
      	add	s3,s3,a0
      	bgeu	s4,s1,.L5
      
      	PR target/112431
      
      gcc/ChangeLog:
      
      	* config/riscv/vector.md: Support highpart overlap for indexed load.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/base/pr112431-28.c: New test.
      	* gcc.target/riscv/rvv/base/pr112431-29.c: New test.
      	* gcc.target/riscv/rvv/base/pr112431-30.c: New test.
      	* gcc.target/riscv/rvv/base/pr112431-31.c: New test.
      	* gcc.target/riscv/rvv/base/pr112431-32.c: New test.
      	* gcc.target/riscv/rvv/base/pr112431-33.c: New test.
      4418d55b
    • Richard Biener's avatar
      Fix ambiguity between vect_get_vec_defs with/without vectype · 8332b991
      Richard Biener authored
      When querying a single set of vector defs with the overloaded
      vect_get_vec_defs API then when you try to use the overload with
      the vector type specified the call will be ambiguous with the
      variant without the vector type.  The following fixes this by
      re-ordering the vector type argument to come before the output
      def vector argument.
      
      I've changed vectorizable_conversion as that triggered this
      so it has coverage showing this works.  The motivation is to
      reduce the number of (redundant) get_vectype_for_scalar_type
      calls.
      
      	* tree-vectorizer.h (vect_get_vec_defs): Re-order arguments.
      	* tree-vect-stmts.cc (vect_get_vec_defs): Likewise.
      	(vectorizable_condition): Update caller.
      	(vectorizable_comparison_1): Likewise.
      	(vectorizable_conversion): Specify the vector type to be
      	used for invariant/external defs.
      	* tree-vect-loop.cc (vect_transform_reduction): Update caller.
      8332b991
    • Jakub Jelinek's avatar
      testsuite: Tweak some further tests for modern C changes · 9e688546
      Jakub Jelinek authored
      On IRC Richi mentioned some FAILs in gcc.target/x86_64 and in pr83126.c.
      
      The following patch fixes the former ones (they need recent binutils to
      be enabled), for pr83126.c because I didn't have graphite configured I've
      just verified that the test compiles (didn't without the patch) and that
      the gimple dump is identical with one from yesterday's gcc (as it was a
      tree-parloops.cc ICE, I guess identical gimple is all we care about
      and no need to verify it further).
      
      2023-12-01  Jakub Jelinek  <jakub@redhat.com>
      
      	* gcc.target/x86_64/abi/avx512fp16/m512h/test_passing_m512.c
      	(fun_check_passing_m512_8_values, fun_check_passing_m512h_8_values):
      	Add missing void return type.
      	* gcc.target/x86_64/abi/avx512fp16/m256h/test_passing_m256.c
      	(fun_check_passing_m256_8_values, fun_check_passing_m256h_8_values):
      	Likewise.
      	* gcc.dg/graphite/pr83126.c (ew): Add missing casts to __INTPTR_TYPE__
      	and then to int *.
      9e688546
    • Jakub Jelinek's avatar
      lower-bitint: Fix lowering of middle sized _BitInt operations which can throw [PR112770] · b1fe98de
      Jakub Jelinek authored
      The middle kind _BitInt lowering is mostly done by casting the BITINT_TYPE
      operands (if any) to a signed/unsigned integer type which has larger/equal
      precision, using such integer type also for the lhs (if BITINT_TYPE) and
      and adding a cast after the statement from that new lhs to the old
      (BITINT_TYPE) lhs.  Note, for middle kind this isn't done for GIMPLE_CALLs.
      Most of the time that works nicely, the exception as the following testcase
      shows is -fnon-call-exceptions and some operations which can trap.  Because
      inserting the cast to a new lhs after the statement results in a trapping
      statement in the middle of a basic block.
      The following patch fixes that by emitting the cast on the fallthru edge
      instead.
      
      2023-12-01  Jakub Jelinek  <jakub@redhat.com>
      
      	PR middle-end/112770
      	* gimple-lower-bitint.cc (gimple_lower_bitint): When adjusting
      	lhs of middle _BitInt setter which ends bb, insert cast on
      	the fallthru edge rather than after stmt.
      
      	* gcc.dg/bitint-45.c: New test.
      b1fe98de
    • Jakub Jelinek's avatar
      lower-bitint: Fix up handle_operand_addr for 0 constants [PR112771] · 9bfebcb1
      Jakub Jelinek authored
      handle_operand_addr for INTEGER_CSTs uses wi::min_precision (UNSIGNED
      for non-negative constants, SIGNED for negative ones) and from that
      computes mp as minimum number of limbs which can represent that value,
      and in some cases creates a test BITINT_TYPE with that precision to
      categorize it and decide based on that what types to use on the constant
      emitted into memory.  For the actual precisions (what will be passed
      to libgcc) it actually already uses MAX/MIN to adjust the corner cases:
                *prec = MAX (min_prec, 1);
      ...
                *prec = MIN ((int) -min_prec, -2);
      but for integer_zerop min_prec will be 0,
      mp = CEIL (min_prec, limb_prec) * limb_prec;
      will be also 0 and we ICE trying to build unsigned BITINT_TYPE with
      0 precision.
      
      Fixed thusly by noting even 0 has to be encoded at least as one limb.
      
      2023-12-01  Jakub Jelinek  <jakub@redhat.com>
      
      	PR middle-end/112771
      	* gimple-lower-bitint.cc (bitint_large_huge::handle_operand_addr):
      	Use mp = 1 if it is zero.
      
      	* gcc.dg/bitint-44.c: New test.
      9bfebcb1
    • Jose E. Marchesi's avatar
      bpf: quote section names whenever necessary in assembly output · b506834e
      Jose E. Marchesi authored
      In BPF section names are used to encode the kind of BPF program and
      other metadata, involving all sort of non alphanumeric characters.
      
      For example:
      
        /* use auto-attach format for section definition. */
        SEC("uretprobe//proc/self/exe:trigger_func2")
        int handle_uretprobe_byname(struct pt_regs *ctx)
        {
        	uretprobe_byname_res = 6;
        	return 0;
        }
      
      The above requires to quote the section name in the output assembly
      file, since otherwise the // in the name would be interpreted by the
      assembler lexer as the beginning of a line comment.
      
      This patch makes the BPF backend to emit quoted section names in
      .section directives if the name requires to be quoted.  Simple section
      names whose constituent characters are in the set [0-9a-zA-Z_] are
      still emitted unquoted.
      
      Tested in target bpf-unknown-none-gcc and host x86_64-linux-gnu.
      
      gcc/ChangeLog
      
      	* config/bpf/bpf.cc (bpf_asm_named_section): New function.
      	(TARGET_ASM_NAMED_SECTION): Set to bpf_asm_named_section.
      
      gcc/testsuite/ChangeLog
      
      	* gcc.target/bpf/section-name-quoting-1.c: New test.
      b506834e
    • Di Zhao's avatar
      aarch64: modify Ampere CPU tunings on reassociation/FMA · 6563d676
      Di Zhao authored
      1. Allow reassociation on FP additions.
      
      2. Avoid generating loop-dependant FMA chains. Added a tuning
      option 'AARCH64_EXTRA_TUNE_AVOID_CROSS_LOOP_FMA' for this.
      
      gcc/ChangeLog:
      
      	* config/aarch64/aarch64-tuning-flags.def
      	(AARCH64_EXTRA_TUNING_OPTION): New tuning option to avoid
      	cross-loop FMA.
      	* config/aarch64/aarch64.cc
      	(aarch64_override_options_internal): Set
      	param_avoid_fma_max_bits according to tuning option.
      	* config/aarch64/tuning_models/ampere1.h (ampere1_tunings):
      	Modify tunings related with FMA.
      	* config/aarch64/tuning_models/ampere1a.h (ampere1a_tunings):
      	Likewise.
      	* config/aarch64/tuning_models/ampere1b.h (ampere1b_tunings):
      	Likewise.
      6563d676
    • Rainer Orth's avatar
      libstdc++: Regenerate GCC_CHECK_ASSEMBLER_HWCAP users · 82288550
      Rainer Orth authored
      This patch regenerates the remaining user of the GCC_CHECK_ASSEMBLER_HWCAP
      macro.  No functional changes.
      
      2023-11-30  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
      
      	libstdc++-v3:
      	* configure: Regenerate.
      82288550
    • Sebastian Huber's avatar
      gcov: Fix use of __LIBGCC_HAVE_LIBATOMIC · 4b807814
      Sebastian Huber authored
      libgcc/ChangeLog:
      
      	PR target/112777
      
      	* libgcov.h (GCOV_SUPPORTS_ATOMIC):  Honor that __LIBGCC_HAVE_LIBATOMIC is
      	always defined as either 0 or 1.
      4b807814
    • Richard Sandiford's avatar
      aarch64: Add a result_mode helper function · a1bc121c
      Richard Sandiford authored
      SME will add more intrinsics whose expansion code requires
      the mode of the function return value.  This patch adds an
      associated helper routine.
      
      gcc/
      	* config/aarch64/aarch64-sve-builtins.h
      	(function_expander::result_mode): New member function.
      	* config/aarch64/aarch64-sve-builtins-base.cc
      	(svld234_impl::expand): Use it.
      	* config/aarch64/aarch64-sve-builtins.cc
      	(function_expander::get_reg_target): Likewise.
      a1bc121c
    • Jakub Jelinek's avatar
      lower-bitint: Fix up maximum addition/subtraction/multiplication result computations · e3be66df
      Jakub Jelinek authored
      When debugging PR112750, I've noticed some issues in the computation
      of precisions and the following patch attempts to fix those.
      
      The pass uses range_to_prec function, which possibly using ranger returns
      minimum precision of some operand in the style that libgcc _BitInt
      entrypoints expect, i.e. for operands with unsigned types either the
      precision of that type or with help of ranger
      wi::min_precision (upper_bound, UNSIGNED) (done both if the types
      are really unsigned or even when lower_bound is non-negative), while
      for operands with signed types either negated precision of that type or
      with help of ranger negated value of maximum of SIGNED min_precisions
      of lower and upper bound.
      Because _BitInt in C only supports unsigned precisions >= 1 and signed
      precisions >= 2, the function also ensures that 0 is never returned (returns
      1 instead) and should ensure that -1 is never returned (should return -2).
      That is the first bug I found though, for the ranger case it ensured that,
      but if an operand would be signed 1-bit precision (that means
      non-BITINT_TYPE) operand, it could return -1.
      
      Another thing is that both lower_addsub_overflow and lower_mul_overflow
      compute from the prec0 and prec1 of the operands (returned by range_to_prec
      with the above value meanings) prec2, which is how many bits of the result
      we actually need to compute to know the infinite precision result.
      This is then used by arith_overflow function together with prec
      (TYPE_PRECISION (type)), type (type of the result), prec0 and prec1 to
      compute which range of bits should be tested (if any, or that there is never
      an overflow) and with which kind (require those bits to be zero vs.
      check if all those bits together all all zeros/ones).
      The arith_overflow function has one special case, when
      prec0 >= 0 && prec1 >= 0 and operation is not .SUB_OVERFLOW; in that case
      we treat prec2 as minimum precision to express any infinite precision
      unsigned result (the result is never negative in that case), while
      in all other cases prec2 is treated as minimum precision to express
      any infinite precision signed result (because the result can be also
      negative).
      The computations of those values were apparently incorrect for all of
      .{ADD,SUB}_OVERFLOW (in that case only if one operand was signed and
      the other unsigned) and for .MUL_OVERFLOW it was sometimes too large.
      
      It took me a while to get to the right expression how to compute that,
      I've started with writing into the comment the possible results for
      different prec0 and prec1 values (used just 8/-8/10/-10 as placeholders
      for equal or different absolute values of the 2 precisions and cases
      with positive and/or negative signs) and then turned into the attached
      test program that actually printed what I was writing to make sure
      I didn't make mistakes in it and in the end also verified the computation,
      this time for all combinations of 1..14 and -2..-14 precisions.
      The UNSIGNED vs. SIGNED in the table is what arith_overflow expects
      the prec2 to be (see above mentioned exception).
      
      2023-12-01  Jakub Jelinek  <jakub@redhat.com>
      
      	* gimple-lower-bitint.cc (range_to_prec): Don't return -1 for
      	signed types.
      	(bitint_large_huge::lower_addsub_overflow): Fix up computation of
      	prec2.
      	(bitint_large_huge::lower_mul_overflow): Likewise.
      e3be66df
    • Jakub Jelinek's avatar
      lower-bitint: Fix ICE on bitint-39.c · 0ef93c86
      Jakub Jelinek authored
      torture/bitint-39.c ICEs with -O1; the problem is that the
      finish_arith_overflow code in one spot replaces use_stmt with an
      assignment or cast, but if unlucky and m_gsi iterator is the same statement,
      when the code later
            tree clobber = build_clobber (TREE_TYPE (var), CLOBBER_EOL);
            g = gimple_build_assign (var, clobber);
            gsi_insert_after (&m_gsi, g, GSI_SAME_STMT);
      it will insert after iterator which contains already replaced statement and
      that causes the gimple chain corruption.
      
      2023-12-01  Jakub Jelinek  <jakub@redhat.com>
      
      	* gimple-lower-bitint.cc (bitint_large_huge::finish_arith_overflow):
      	When replacing use_stmt which is gsi_stmt (m_gsi), update m_gsi to
      	the new statement.
      0ef93c86
    • Jakub Jelinek's avatar
      lower-bitint: Fix _BitInt .{ADD,SUB}_OVERFLOW lowering [PR112750] · 36433265
      Jakub Jelinek authored
      The .{ADD,SUB}_OVERFLOW lowering is implemented by performing normal
      addition/subtraction (perhaps extended to even more bits than normally by
      continuing with extended values of operands after running of normal bits)
      and in addition to that trying to compute if certain sets of bits are either
      all zero or all sign extensions of the least significant bit.
      
      That code is in a lot of cases guarded just by a single condition (which
      can be idx > startlimb, idx >= startlimb or idx == startlimb) or by
      2 conditions - if (idx >= startlimb) { if (idx == startlimb) ... else ... }
      Now, if_then_if_then_else when the second argument is NULL works just as
      if_then and sets m_gsi to be within the initially empty then block and that is
      where we emit code for constant tidx startlimb + (cmp_code == GT_EXPR).
      But in the 2 conditions case, m_gsi is set to the initially empty else
      block, so using EQ_EXPR for the condition was incorrect (and strangely
      nothing in the testsuite caught that), because the code for extracting the
      lowest set of bits (i.e. when tidx is startlimb) is then done when idx
      is not startlimb rather than when it is.
      The following patch fixes that.
      
      Note, when developing the lowering, I was using gcov to make sure all code
      is covered by the testsuite with minimum exceptions, so no idea how this
      slipped out.
      
      2023-12-01  Jakub Jelinek  <jakub@redhat.com>
      
      	PR middle-end/112750
      	* gimple-lower-bitint.cc (bitint_large_huge::lower_addsub_overflow):
      	Use NE_EXPR rather than EQ_EXPR for g2 if !single_comparison and
      	adjust probabilities.
      
      	* gcc.dg/bitint-41.c: Use -std=c23 rather than -std=c2x.
      	* gcc.dg/torture/bitint-43.c: Likewise.
      	* gcc.dg/torture/bitint-44.c: Likewise.
      	* gcc.dg/torture/bitint-45.c: New test.
      36433265
    • Xi Ruoyao's avatar
      doc: Update the status of build directory not fully separated · 875c7771
      Xi Ruoyao authored
      Recently there are some people building GCC with srcdir == objdir and
      the attempts just failed [1].  So stop to say "it should work".  OTOH
      objdir as a subdirectory of srcdir works: we've built GCC in LFS [2]
      and BLFS [3] this way for decades and this is confirmed during the
      review of a previous version of this patch [4].
      
      [1]: https://gcc.gnu.org/pipermail/gcc-help/2023-November/143068.html
      [2]: https://www.linuxfromscratch.org/lfs/view/12.0/chapter08/gcc.html
      [3]: https://www.linuxfromscratch.org/blfs/view/12.0/general/gcc.html
      [4]: https://gcc.gnu.org/pipermail/gcc-patches/2023-November/638760.html
      
      gcc/ChangeLog:
      
      	* doc/install.texi: Deem srcdir == objdir broken, but objdir
      	as a subdirectory of srcdir fine.
      875c7771
    • Juergen Christ's avatar
      s390x: Fix s390_md_asm_adjust handling of long doubles [PR112753] · 8a2e4285
      Juergen Christ authored
      Commit 466b100e introduced a bug in
      s390_md_asm_adjust if vector extensions are not available.  Fix the
      control flow of this function to not adjust long double values.
      
      gcc/ChangeLog:
      
      	PR target/112753
      	* config/s390/s390.cc (s390_md_asm_adjust): Return after dealing
      	with the outputs, if no further processing of long doubles is
      	required.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/s390/pr112753.c: New test.
      8a2e4285
    • Jakub Jelinek's avatar
      s390: Fix builtin-classify-type-1.c on s390 too [PR112725] · 28944a01
      Jakub Jelinek authored
      s390 suffers from the same issue with __builtin_classify_type vector
      arguments, the target hook diagnoses those because it thinks a vector
      is passed to an unprototyped function, but in this case it is a type-generic
      builtin which can support vector types just fine, by folding into the
      appropriate constant.
      
      This fixes
      -FAIL: c-c++-common/builtin-classify-type-1.c  -Wc++-compat  (test for excess errors)
      -UNRESOLVED: c-c++-common/builtin-classify-type-1.c  -Wc++-compat  compilation failed to produce executable
      on s390x-linux.
      
      2023-12-01  Jakub Jelinek  <jakub@redhat.com>
      
      	PR target/112725
      	* config/s390/s390.cc (s390_invalid_arg_for_unprototyped_fn): Return
      	NULL for __builtin_classify_type calls with vector arguments.
      28944a01
    • Florian Weimer's avatar
      c: Add new -Wdeclaration-missing-parameter-type permerror · ff9efa3f
      Florian Weimer authored
      This used to be a warning, enabled by default, without its own option.
      
      A subsequent change could improve diagnostics and provide spelling
      hints for declarations like “void function (int32t);”.
      
      gcc/c-family/
      
      	* c.opt (Wdeclaration-missing-parameter-type): New.
      
      gcc/c/ChangeLog:
      
      	PR other/44209
      	* c-decl.cc (grokparms): Issue permerror for
      	OPT_Wdeclaration_missing_parameter_type instead of a pedwarn.
      
      gcc/ChangeLog:
      
      	* doc/invoke.texi (Warning Options): Document
      	-Wdeclaration-missing-parameter-type.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.dg/permerror-default.c (missing_parameter_type):
      	Expect error.
      	* gcc.dg/permerror-fpermissive.c (missing_parameter_type):
      	Expect -Wdeclaration-missing-parameter-type warning.
      	* gcc.dg/permerror-gnu89-nopermissive.c (missing_parameter_type):
      	Expect -Wdeclaration-missing-parameter-type error.
      	* gcc.dg/permerror-gnu89-pedantic.c (missing_parameter_type):
      	Likewise.
      	* gcc.dg/permerror-gnu89.c (missing_parameter_type):
      	Expect -Wdeclaration-missing-parameter-type warning.
      	* gcc.dg/permerror-noerror.c: Add
      	-Wno-error=declaration-missing-parameter-type to build flags.
      	(missing_parameter_type): Expect
      	-Wdeclaration-missing-parameter-type warning.
      	* gcc.dg/permerror-nowarning.c: Build with
      	-Wno-declaration-missing-parameter-type.  Remove previously
      	expected warning.
      	* gcc.dg/permerror-fpermissive-nowarning.c: Likewise.
      	* gcc.dg/permerror-pedantic.c (missing_parameter_type):
      	Expect -Wdeclaration-missing-parameter-type error.
      	* gcc.dg/permerror-system.c (missing_parameter_type):
      	Likewise.
      ff9efa3f
    • Florian Weimer's avatar
      c: Turn -Wincompatible-pointer-types into a permerror · 9715c545
      Florian Weimer authored
      The change to build_conditional_expr drops the downgrade
      from a pedwarn to warning for builtins for C99 and later
      language dialects.  It remains a warning in C89 mode (not
      a permerror), as the -std=gnu89 -fno-permissive test shows.
      
      gcc/
      
      	* doc/invoke.texi (Warning Options): Document changes.
      
      gcc/c/
      
      	PR c/96284
      	* c-typeck.cc (build_conditional_expr): Upgrade most pointer
      	type mismatches to a permerror.
      	(convert_for_assignment): Use permerror_opt and
      	permerror_init for OPT_Wincompatible_pointer_types warnings.
      
      gcc/testsuite/
      
      	* gcc.dg/permerror-default.c (incompatible_pointer_types):
      	Expect new permerror.
      	* gcc.dg/permerror-gnu89-nopermissive.c
      	(incompatible_pointer_types): Likewise.
      	* gcc.dg/permerror-pedantic.c (incompatible_pointer_types):
      	Likewise.
      	* gcc.dg/permerror-system.c: Likewise.
      	* gcc.dg/Wincompatible-pointer-types-2.c: Compile with
      	-fpermissive due to expected errors.
      	* gcc.dg/Wincompatible-pointer-types-5.c: New test.  Copied
      	from gcc.dg/Wincompatible-pointer-types-2.c.  Expect errors.
      	* gcc.dg/anon-struct-11.c: Compile with -fpermissive
      	due to expected errors.
      	* gcc.dg/anon-struct-11a.c: New test.  Copied from
      	gcc.dg/anon-struct-11.c.  Expect errors.
      	* gcc.dg/anon-struct-13.c: Compile with -fpermissive
      	due to expected errors.
      	* gcc.dg/anon-struct-13a.c: New test.  Copied from
      	gcc.dg/anon-struct-13.c.  Expect errors.
      	* gcc.dg/builtin-arith-overflow-4.c: Compile with -fpermissive
      	due to expected errors.
      	* gcc.dg/builtin-arith-overflow-4a.c: New test.  Copied from
      	gcc.dg/builtin-arith-overflow-4.c.  Expect errors.
      	* gcc.dg/c23-qual-4.c: Expect -Wincompatible-pointer-types errors.
      	* gcc.dg/dfp/composite-type.c: Compile with -fpermissive
      	due to expected errors.
      	* gcc.dg/dfp/composite-type-2.c: New test.  Copied from
      	gcc.dg/dfp/composite-type.c.  Expect errors.
      	* gcc.dg/diag-aka-1.c: Compile with -fpermissive
      	due to expected errors.
      	* gcc.dg/diag-aka-1a.c: New test.  Copied from
      	gcc.dg/diag-aka-1a.c.  Expect errors.
      	* gcc.dg/enum-compat-1.c: Compile with -fpermissive
      	due to expected errors.
      	* gcc.dg/enum-compat-2.c: New test.  Copied from
      	gcc.dg/enum-compat-1.c.  Expect errors.
      	* gcc.dg/func-ptr-conv-1.c: Compile with -fpermissive
      	due to expected errors.
      	* gcc.dg/func-ptr-conv-2.c: New test.  Copied from
      	gcc.dg/func-ptr-conv-1.c.  Expect errors.
      	* gcc.dg/init-bad-7.c: Compile with -fpermissive
      	due to expected errors.
      	* gcc.dg/init-bad-7a.c: New test.  Copied from gcc.dg/init-bad-7.c.
      	Expect errors.
      	* gcc.dg/noncompile/incomplete-3.c (foo): Expect
      	-Wincompatible-pointer-types error.
      	* gcc.dg/param-type-mismatch-2.c (test8): Likewise.
      	* gcc.dg/pointer-array-atomic.c: Compile with -fpermissive
      	due to expected errors.
      	* gcc.dg/pointer-array-atomic-2.c: New test.  Copied from
      	gcc.dg/pointer-array-atomic.c.  Expect errors.
      	* gcc.dg/pointer-array-quals-1.c (test): Expect
      	-Wincompatible-pointer-types errors.
      	* gcc.dg/transparent-union-1.c: Compile with -fpermissive
      	due to expected errors.
      	* gcc.dg/transparent-union-1a.c: New test.  Copied from
      	gcc.dg/transparent-union-1.c.  Expect errors.
      	* gcc.target/aarch64/acle/memtag_2a.c
      	(test_memtag_warning_return_qualifier): Expect additional
      	errors.
      	* gcc.target/aarch64/sve/acle/general-c/load_2.c (f1): Likewise.
      	* gcc.target/aarch64/sve/acle/general-c/load_ext_gather_offset_1.c
      	(f1): Likewise.
      	* gcc.target/aarch64/sve/acle/general-c/load_ext_gather_offset_2.c
      	(f1): Likewise.
      	* gcc.target/aarch64/sve/acle/general-c/load_ext_gather_offset_3.c
      	(f1): Likewise.
      	* gcc.target/aarch64/sve/acle/general-c/load_ext_gather_offset_4.c
      	(f1): Likewise.
      	* gcc.target/aarch64/sve/acle/general-c/load_ext_gather_offset_5.c
      	(f1): Likewise.
      	* gcc.target/aarch64/sve/acle/general-c/load_ext_gather_offset_restricted_1.c
      	(f1): Likewise.
      	* gcc.target/aarch64/sve/acle/general-c/load_ext_gather_offset_restricted_2.c
      	(f1): Likewise.
      	* gcc.target/aarch64/sve/acle/general-c/load_ext_gather_offset_restricted_3.c
      	(f1): Likewise.
      	* gcc.target/aarch64/sve/acle/general-c/load_ext_gather_offset_restricted_4.c
      	(f1): Likewise.
      	* gcc.target/aarch64/sve/acle/general-c/sizeless-1.c (f1): Likewise.
      	* gcc.target/aarch64/sve/acle/general-c/sizeless-2.c (f1): Likewise.
      	* gcc.target/aarch64/sve/acle/general-c/store_1.c (f1): Likewise.
      	* gcc.target/aarch64/sve/acle/general-c/store_2.c (f1): Likewise.
      	* gcc.target/aarch64/sve/acle/general-c/store_scatter_index_1.c
      	(f1): Likewise.
      	* gcc.target/aarch64/sve/acle/general-c/store_scatter_index_restricted_1.c
      	(f1): Likewise.
      	* gcc.target/aarch64/sve/acle/general-c/store_scatter_offset_2.c
      	(f1): Likewise.
      	* gcc.target/aarch64/sve/acle/general-c/store_scatter_offset_restricted_1.c
      	(f1): Likewise.
      	* gcc.target/aarch64/sve/acle/general/attributes_7.c
      	(f1): Likewise.
      	* gcc.target/i386/sse2-bfloat16-scalar-typecheck.c (footest):
      	Expect -Wincompatible-pointer-types errors.
      	* gcc.target/i386/vect-bfloat16-typecheck_1.c (footest): Likewise.
      	* gcc.target/i386/vect-bfloat16-typecheck_2.c (footest): Likewise.
      9715c545
    • Florian Weimer's avatar
      c: Turn -Wreturn-mismatch into a permerror · 4ecfa6c4
      Florian Weimer authored
      gcc/
      
      	* doc/invoke.texi (Warning Options): Document that
      	-Wreturn-mismatch is a permerror in C99 and later.
      
      gcc/c/
      
      	PR c/96284
      	* c-typeck.cc (c_finish_return): Use permerrors
      	for OPT_Wreturn_mismatch diagnostics.
      
      gcc/testsuite/
      
      	* gcc.dg/permerror-default.c (return_mismatch_1)
      	(return_mismatch_2): Expect new permerror.
      	* gcc.dg/permerror-gnu89-nopermissive.c (return_mismatch_1):
      	Likewise.
      	* gcc.dg/permerror-system.c: Likewise.
      	* gcc.dg/20030906-1.c: Compile with -fpermissive due to
      	expected -Wreturn-mismatch error.
      	* gcc.dg/20030906-1a.c: New test.  Copied from
      	gcc.dg/20030906-1.c.  Expect the error.
      	* gcc.dg/20030906-2.c: Compile with -fpermissive due to
      	expected -Wreturn-mismatch error.
      	* gcc.dg/20030906-2a.c: New test.  Copied from
      	gcc.dg/20030906-2.c.  Expect the error.
      	* gcc.dg/Wreturn-mismatch-1.c: Compile with -fpermissive due to
      	expected -Wreturn-mismatch error.
      	* gcc.dg/Wreturn-mismatch-1a.c: New test.  Copied from
      	gcc.dg/Wreturn-mismatch-1.c.  Expect the error.
      	* gcc.dg/Wreturn-mismatch-2.c: Compile with -fpermissive due to
      	expected -Wreturn-mismatch error.
      	* gcc.dg/Wreturn-mismatch-2a.c: New test.  Copied from
      	gcc.dg/Wreturn-mismatch-2.c.  Expect the error.
      	* gcc.dg/diagnostic-range-bad-return.c: Compile with
      	-fpermissive due to expected -Wreturn-mismatch error.
      	* gcc.dg/diagnostic-range-bad-return-2.c: New test.
      	Copied from gcc.dg/diagnostic-range-bad-return.c.  Expect the
      	error.
      	* gcc.dg/pr105635-2.c: Expect -Wreturn-mismatch error.
      	* gcc.dg/pr23075.c: Build with -fpermissive due to
      	expected -Wreturn-mismatch error.
      	* gcc.dg/pr23075-2.c: New test.  Copied from gcc.dg/pr23075.c.
      	Expect the error.
      	* gcc.dg/pr29521.c: Compile with -fpermissive due to expected
      	-Wreturn-mismatch error.
      	* gcc.dg/pr29521-a.c: New test. Copied from gcc.dg/pr29521.c.
      	Expect error.
      	* gcc.dg/pr67730.c: Compile with -fpermissive due to expected
      	-Wreturn-mismatch error.
      	* gcc.dg/pr67730-a.c: New test.  Copied from
      	gcc.dg/pr67730-a.c.  Expect error.
      	* gcc.target/powerpc/conditional-return.c: Compile with
      	-fpermissive due to expected -Wreturn-mismatch error.
      4ecfa6c4
    • Florian Weimer's avatar
      c: Do not ignore some forms of -Wimplicit-int in system headers · 3ae8882e
      Florian Weimer authored
      Most -Wimplicit-int warnings were unconditionally disabled for system
      headers.  Only missing types for parameters in old-style function
      definitions resulted in warnings.  This is inconsistent with the
      treatment of other permerrors, which are active in system headers.
      
      gcc/c/
      
      	* c-decl.cc (grokdeclarator): Do not skip -Wimplicit-int
      	warnings or errors in system headers.
      
      gcc/testsuite/
      
      	* gcc.dg/permerror-system.c: Expect all -Wimplicit-int
      	permerrors.
      3ae8882e
    • Florian Weimer's avatar
      c: Turn -Wimplicit-int into a permerror · 4ee2aca7
      Florian Weimer authored
      Most of these new permerrors are currently not diagnosed in system
      headers.
      
      gcc/
      
      	PR c/91093
      	PR c/96284
      	* doc/invoke.texi (Warning Options): Document changes.
      
      gcc/c/
      
      	* c-decl.cc (warn_defaults_to): Remove.
      	(grok_declarator, start_function): Call permerror_opt
      	instead of warn_defaults_to.
      	(store_parm_decls_oldstyle): Call permerror_opt for
      	OPT_Wimplicit_int.
      
      gcc/testsuite/
      
      	* gcc.dg/permerror-default.c (implicit_int_1, implicit_int_2)
      	(implicit_int_3, implicit_int_4): Expect new permerror.
      	* gcc.dg/permerror-system.c: Expect a single new permerror.
      	* gcc.dg/Wimplicit-int-1.c: Compile with -fpermissive due to
      	expected warning.
      	* gcc.dg/Wimplicit-int-4.c: Likewise.
      	* gcc.dg/Wimplicit-int-1a.c: New test.  Copied from
      	gcc.dg/Wimplicit-int-1.c, but expect errors.
      	* gcc.dg/Wimplicit-int-4a.c: New test.  Copied from
      	gcc.dg/Wimplicit-int-4.c, but expect errors.
      	* gcc.dg/gnu23-attr-syntax-2.c: Compile with -fpermissive
      	due to expected implicit-int error.
      	* gcc.dg/gnu23-attr-syntax-3.c: New test.  Copied from
      	gcc.dg/gnu23-attr-syntax-2.c, but expect an error.
      	* gcc.dg/pr105635.c: Build with -fpermissive due to implicit
      	int.
      	* gcc.dg/pr105635-2.c: New test.  Copied from
      	gcc.dg/pr105635.c.  Expect implicit int error.
      	* gcc.dg/noncompile/pr79758.c: Build with -fpermissive due to
      	implicit int.
      	* gcc.dg/noncompile/pr79758-2.c: New test.  Copied from
      	gcc.dg/noncompile/pr79758.c.  Expect implicit int error.
      4ee2aca7
    • Florian Weimer's avatar
      c: Turn -Wimplicit-function-declaration into a permerror · 55e94561
      Florian Weimer authored
      In the future, it may make sense to avoid cascading errors from
      the implicit declaration, especially its assumed int return type.
      This change here only changes the kind of the diagnostic, not
      its wording or consequences.
      
      gcc/
      
      	* doc/invoke.texi (Warning Options): Document changes.
      
      gcc/c/
      
      	PR c/91092
      	PR c/96284
      	* c-decl.cc (implicit_decl_permerror): Rename from
      	implicit_decl_warning.  Call permerror_opt instead of
      	pedwarn and warning_at.
      	(implicitly_declare): Adjust callers.
      
      gcc/testsuite/
      
      	* gcc.dg/permerror-default.c (implicit_function_declaration):
      	Expect the new permerror.
      	* gcc.dg/permerror-system.c: Likewise.
      	* c-c++-common/spellcheck-reserved.c (test, test_2): Expect
      	error instead of warning.
      	(f): Expect error instead of warning.
      	* gcc.dg/Wimplicit-function-declaration-c99.c: Compile with
      	-fpermissive due to expected warning.
      	* gcc.dg/Wimplicit-function-declaration-c99-2.c: New test.
      	Copied from gcc.dg/Wimplicit-function-declaration-c99.c.
      	Expect error.
      	* gcc.dg/missing-header-fixit-1.c: Compile with -fpermissive
      	due to expect error.
      	* gcc.dg/missing-header-fixit-1a.c: New test.  Copied from
      	gcc.dg/missing-header-fixit-1.c, but expect error.
      	* gcc.dg/missing-header-fixit-2.c: Compile with -fpermissive
      	due to expect error.
      	* gcc.dg/missing-header-fixit-2a.c: New test.  Copied from
      	gcc.dg/missing-header-fixit-2.c, but expect error.
      	* gcc.dg/missing-header-fixit-4.c: Compile with -fpermissive
      	due to expect error.
      	* gcc.dg/missing-header-fixit-4a.c: New test.  Copied from
      	gcc.dg/missing-header-fixit-4.c, but expect error.
      	* gcc.dg/missing-header-fixit-5.c: Compile with -fpermissive
      	due to expect error.
      	* gcc.dg/missing-header-fixit-5a.c: New test.  Copied from
      	gcc.dg/missing-header-fixit-5.c, but expect error.
      	* gcc.dg/pr61852.c: Expect implicit-function-declaration
      	error instead of warning.
      	* gcc.dg/spellcheck-identifiers-2.c: Compile with
      	-fpermissive due to expected warnings.
      	* gcc.dg/spellcheck-identifiers-2a.c: New test.  Copied
      	from gcc.dg/spellcheck-identifiers-2a.c.  Expect errors.
      	* gcc.dg/spellcheck-identifiers-3.c: Compile with
      	-fpermissive due to expected warnings.
      	* gcc.dg/spellcheck-identifiers-3a.c: New test.  Copied
      	from gcc.dg/spellcheck-identifiers-2a.c.  Expect errors.
      	* gcc.dg/spellcheck-identifiers-4.c: Compile with
      	-fpermissive due to expected warnings.
      	* gcc.dg/spellcheck-identifiers-4a.c: New test.  Copied
      	from gcc.dg/spellcheck-identifiers-2a.c.  Expect error.
      	* gcc.dg/spellcheck-identifiers.c: Compile with
      	-fpermissive due to expected warnings.
      	* gcc.dg/spellcheck-identifiers-1a.c: New test.  Copied
      	from gcc.dg/spellcheck-identifiers.c.  Expect errors.
      	* gcc.target/aarch64/sve/acle/general-c/ld1sh_gather_1.c (f1):
      	Expect error.
      	* gcc.target/aarch64/sve/acle/general-c/load_ext_gather_index_1.c:
      	(f1): Likewise.
      	* gcc.target/aarch64/sve/acle/general-c/load_ext_gather_index_restricted_1.c:
      	(f1): Likewise.
      	* gcc.target/aarch64/sve/acle/general-c/load_ext_gather_offset_1.c:
      	(f1): Likewise.
      	* gcc.target/aarch64/sve/acle/general-c/load_ext_gather_offset_2.c:
      	(f1): Likewise.
      	* gcc.target/aarch64/sve/acle/general-c/load_ext_gather_offset_3.c:
      	(f1): Likewise.
      	* gcc.target/aarch64/sve/acle/general-c/load_ext_gather_offset_4.c:
      	(f1): Likewise.
      	* gcc.target/aarch64/sve/acle/general-c/load_ext_gather_offset_5.c:
      	(f1): Likewise.
      	* gcc.target/aarch64/sve/acle/general-c/load_ext_gather_offset_restricted_1.c:
      	(f1): Likewise.
      	* gcc.target/aarch64/sve/acle/general-c/load_ext_gather_offset_restricted_2.c:
      	(f1): Likewise.
      	* gcc.target/aarch64/sve/acle/general-c/load_ext_gather_offset_restricted_3.c:
      	(f1): Likewise.
      	* gcc.target/aarch64/sve/acle/general-c/load_ext_gather_offset_restricted_4.c:
      	(f1): Likewise.
      55e94561
    • Florian Weimer's avatar
      c: Turn int-conversion warnings into permerrors · 2c3db94d
      Florian Weimer authored
      gcc/
      
      	* doc/invoke.texi (Warning Options): Document changes.
      
      gcc/c/
      
      	PR c/96284
      	PR c/106416
      	* c-typeck.cc (build_conditional_expr): Use permerror_opt for
      	pointer/integer type mismatches, based on -Wint-conversion.
      	(pedwarn_permerror_init, permerror_init): New function.
      	(pedwarn_init): Call pedwarn_permerror_init.
      	(convert_for_assignment): Use permerror_opt and
      	permerror_init for -Wint-conversion warnings.
      
      gcc/testsuite/
      
      	* gcc.dg/permerror-default.c (int_conversion_1)
      	(int_conversion_2): Expect the new permerrors.
      	* gcc.dg/permerror-gnu89-nopermissive.c (int_conversion_1)
      	(int_conversion_2): Likewise.
      	* gcc.dg/permerror-system.c: Likewise.
      	* c-c++-common/pr77624-1.c (foo, bar): Expect
      	error instead of warning.
      	* gcc.dg/Wint-conversion-2.c: Compile with -fpermissive due
      	to expected int-conversion warning.
      	* gcc.dg/Wint-conversion-3.c: Likewise.
      	* gcc.dg/Wint-conversion-4.c: New test.  Based on
      	gcc.dg/Wint-conversion-3.c.  Expect int-conversion errors.
      	* gcc.dg/assign-warn-1.c: Compile with -fpermissive.
      	* gcc.dg/assign-warn-4.c: New file.  Extracted from
      	assign-warn1.c.  Expect int-conversion errors.
      	* gcc.dg/diagnostic-types-1.c: Compile with -fpermissive.
      	* gcc.dg/diagnostic-types-2.c: New file.  Extracted from
      	gcc.dg/diagnostic-types-1.c.  Expect some errors instead of
      	warnings.
      	* gcc.dg/gomp/pr35738.c: Compile with -fpermissive due to
      	expected int-conversion error.
      	* gcc.dg/gomp/pr35738-2.c: New test.  Based on
      	gcc.dg/gomp/pr35738.c.  Expect int-converison errors.
      	* gcc.dg/init-excess-3.c: Expect int-converison errors.
      	* gcc.dg/overflow-warn-1.c: Likewise.
      	* gcc.dg/overflow-warn-3.c: Likewise.
      	* gcc.dg/param-type-mismatch.c: Compile with -fpermissive.
      	* gcc.dg/param-type-mismatch-2.c: New test.  Copied from
      	gcc.dg/param-type-mismatch.c.  Expect errors.
      	* gcc.dg/pr61162-2.c: Compile with -fpermissive.
      	* gcc.dg/pr61162-3.c: New test. Extracted from
      	gcc.dg/pr61162-2.c.  Expect int-conversion errors.
      	* gcc.dg/spec-barrier-3.c: Use -fpermissive due to expected
      	int-conversion error.
      	* gcc.dg/spec-barrier-3a.c: New test.  Based on
      	gcc.dg/spec-barrier-3.c.  Expect int-conversion errors.
      	* gcc.target/aarch64/acle/memtag_2.c: Use -fpermissive due to expected
      	int-conversion error.
      	* gcc.target/aarch64/acle/memtag_2a.c: New test.  Copied from
      	gcc.target/aarch64/acle/memtag_2.c.  Expect error.
      	* gcc.target/aarch64/sve/acle/general-c/load_3.c (f1): Expect
      	error.
      	* gcc.target/aarch64/sve/acle/general-c/store_2.c (f1): Likewise.
      	* gcc.target/aarch64/sve/acle/general-c/store_scatter_index_1.c
      	(f1): Likewise.
      	* gcc.target/aarch64/sve/acle/general-c/store_scatter_index_restricted_1.c
      	(f1): Likewise.
      	* gcc.target/aarch64/sve/acle/general-c/store_scatter_offset_2.c
      	(f1): Likewise.
      	* gcc.target/aarch64/sve/acle/general-c/store_scatter_offset_restricted_1.c
      	(f1): Likewise.
      2c3db94d
    • Florian Weimer's avatar
      Add tests for validating future C permerrors · 37043268
      Florian Weimer authored
      The dg-error directives for gcc.dg/permerror-system.c can be generated
      using (for the most part at least):
      
      perl -ne 'print if s,.*(/\* \{ dg-error .*) } \*/$,$1 "" { target *-*-* } $. } */,' \
        < gcc/testsuite/gcc.dg/permerror-default.c
      
      gcc/testsuite/
      
      	* gcc.dg/permerror-default.c: New test.
      	* gcc.dg/permerror-fpermissive.c: Likewise.
      	* gcc.dg/permerror-fpermissive-nowarning.c: Likewise.
      	* gcc.dg/permerror-gnu89-nopermissive.c: Likewise.
      	No permerrors yet, so this matches gcc.dg/permerror-gnu89.c
      	for now.
      	* gcc.dg/permerror-gnu89-pedantic.c: New test.
      	* gcc.dg/permerror-gnu89.c: Likewise.
      	* gcc.dg/permerror-noerror.c: Likewise.
      	* gcc.dg/permerror-nowarning.c: Likewise.
      	* gcc.dg/permerror-pedantic.c: Likewise.
      	* gcc.dg/permerror-system.c: Likewise.
      37043268
    • Florian Weimer's avatar
      gm2: Add missing declaration of m2pim_M2RTS_Terminate to test · bf783f6c
      Florian Weimer authored
      gcc/testsuite/
      
      	* gm2/link/externalscaffold/pass/scaffold.c (m2pim_M2RTS_Terminate):
      	Declare.
      bf783f6c
    • Florian Weimer's avatar
      aarch64: Call named function in gcc.target/aarch64/aapcs64/ice_1.c · 989af947
      Florian Weimer authored
      This test looks like it intends to pass a small struct argument
      through both a non-variadic and variadic argument, but due to
      the typo, it does not achieve that.
      
      gcc/testsuite/
      
      	* gcc.target/aarch64/aapcs64/ice_1.c (foo): Call named.
      989af947
    • Florian Weimer's avatar
      aarch64: Avoid -Wincompatible-pointer-types warning in Linux unwinder · 335bd6c9
      Florian Weimer authored
      	* config/aarch64/linux-unwind.h
      	(aarch64_fallback_frame_state): Add cast to the expected type
      	in sc assignment.
      335bd6c9
    • Juzhe-Zhong's avatar
      RISC-V: Fix VSETVL PASS regression · 923a67f1
      Juzhe-Zhong authored
      This patch fix 2 regression (one is bug regression, the other is performance regression).
      Those 2 regressions are both we are comparing ratio for same AVL in wrong place.
      
      1. BUG regression:
      avl_single-84.c:
      
      f0:
              li      a5,999424
              add     a1,a1,a5
              li      a4,299008
              add     a5,a0,a5
              addi    a3,a4,992
              addi    a5,a5,576
              addi    a1,a1,576
              vsetvli a4,zero,e8,m2,ta,ma
              add     a0,a0,a3
              vlm.v   v1,0(a5)
              vsm.v   v1,0(a1)
              vl1re64.v       v1,0(a0)
              beq     a2,zero,.L10
              li      a5,0
              vsetvli zero,zero,e64,m1,tu,ma   --->  This is totally incorrect since the ratio above is 4, wheras it is demanding ratio = 64 here.
      .L3:
              fcvt.d.lu       fa5,a5
              addi    a5,a5,1
              fadd.d  fa5,fa5,fa0
              vfmv.s.f        v1,fa5
              bne     a5,a2,.L3
              vfmv.f.s        fa0,v1
              ret
      .L10:
              vsetvli zero,zero,e64,m1,ta,ma
              vfmv.f.s        fa0,v1
              ret
      
      2. Performance regression:
      
      before this patch:
      
              vsetvli a5,a4,e8,m1,ta,ma
              vsetvli zero,a5,e32,m1,tu,ma
              vmv.s.x v2,zero
              vmv.s.x v1,zero
              vsetvli zero,a5,e32,m4,tu,ma
              vle32.v v4,0(a1)
              vfmul.vv        v4,v4,v4
              vfredosum.vs    v1,v4,v2
              vfmv.f.s        fa5,v1
              fsw     fa5,0(a0)
              sub     a4,a4,a5
              bne     a4,zero,.L2
              ret
      
      After this patch:
      
      	vsetvli	a5,a4,e32,m4,tu,ma
      	vle32.v	v4,0(a1)
      	vmv.s.x	v2,zero
      	vmv.s.x	v1,zero
      	vfmul.vv	v4,v4,v4
      	vfredosum.vs	v1,v4,v2
      	vfmv.f.s	fa5,v1
      	fsw	fa5,0(a0)
      	sub	a4,a4,a5
      	bne	a4,zero,.L2
      	ret
      
      Tested rv64gcv_zvfh_zfh passed no regression.
      
      zvl256b/zvl512b/zvl1024b/zve64d is runing.
      
      	PR target/112776
      
      gcc/ChangeLog:
      
      	* config/riscv/riscv-vsetvl.cc (pre_vsetvl::pre_global_vsetvl_info): Fix ratio.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/vsetvl/avl_single-84.c: Adapt test.
      	* gcc.target/riscv/rvv/vsetvl/pr111037-3.c: Ditto.
      	* gcc.target/riscv/rvv/vsetvl/pr112776.c: New test.
      923a67f1
    • Jason Merrill's avatar
      c++: lambda capture and explicit object parm · 73e2bdbf
      Jason Merrill authored
      More adjustments to allow for explicit object parameters in lambdas.  This
      has no practical effect until that patch goes in, but applying this
      separately seems reasonable.
      
      gcc/cp/ChangeLog:
      
      	* semantics.cc (finish_non_static_data_member)
      	(finish_decltype_type, capture_decltype):
      	Handle deduced closure parameter.
      73e2bdbf
    • GCC Administrator's avatar
      Daily bump. · 8428bcd7
      GCC Administrator authored
      8428bcd7
  2. Nov 30, 2023
    • Marek Polacek's avatar
      c++: wrong ambiguity in accessing static field [PR112744] · 725c68c5
      Marek Polacek authored
      Given
      
        struct A { constexpr static int a = 0; };
        struct B : A {};
        struct C : A {};
        struct D : B, C {};
      
      we give the "'A' is an ambiguous base of 'D'" error for
      
        D{}.A::a;
      
      which seems wrong: 'a' is a static data member so there is only one copy
      so it can be unambiguously referred to even if there are multiple A
      objects.  clang++/MSVC/icx agree.
      
      This patch uses ba_any: [class.access.base] requires conversion to a unique
      base subobject for non-static data members, but it does not require that the
      base be unique or accessible for static data members.
      
      	PR c++/112744
      
      gcc/cp/ChangeLog:
      
      	* typeck.cc (finish_class_member_access_expr): When accessing
      	a static data member, use ba_any for lookup_base.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/lookup/scoped11.C: New test.
      	* g++.dg/lookup/scoped12.C: New test.
      	* g++.dg/lookup/scoped13.C: New test.
      	* g++.dg/lookup/scoped14.C: New test.
      	* g++.dg/lookup/scoped15.C: New test.
      725c68c5
    • Ian Lance Taylor's avatar
      libgo: update configure.ac to upstream GCC · e81e84e0
      Ian Lance Taylor authored
      The libgo/configure.ac file in upstream GCC was changed in
      
      https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=6a6d3817afa02bbcd2388c8e005da6faf88932f1
      
      This adds an automake conditional that is not used, but will be used
      in the future when and if libgo is ported to Darwin.
      
      This CL makes the corresponding change in this repo.
      
      Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/546435
      e81e84e0
    • Ian Lance Taylor's avatar
      libbacktrace: support ASLR on Windows · c6f7253b
      Ian Lance Taylor authored
      Patch from Björn Schäpers.
      
      	* pecoff.c: Include <windows.h> if available.
      	(coff_add): On Windows call GetModuleHandle to get base address.
      c6f7253b
    • Wilco Dijkstra's avatar
      AArch64: Fix __sync_val_compare_and_swap [PR111404] · df8958e6
      Wilco Dijkstra authored
      __sync_val_compare_and_swap may be used on 128-bit types and either calls the
      outline atomic code or uses an inline loop.  On AArch64 LDXP is only atomic if
      the value is stored successfully using STXP, but the current implementations
      do not perform the store if the comparison fails.  In this case the value
      returned is not read atomically.
      
      gcc/ChangeLog:
      	PR target/111404
      	* config/aarch64/aarch64.cc (aarch64_split_compare_and_swap):
      	For 128-bit store the loaded value and loop if needed.
      
      libgcc/ChangeLog:
      	PR target/111404
      	* config/aarch64/lse.S (__aarch64_cas16_acq_rel): Execute STLXP using
      	either new value or loaded value.
      df8958e6
    • Jonathan Wakely's avatar
      libstdc++: Fix std::ranges::to errors · 18d8a50a
      Jonathan Wakely authored
      Fix some errors that Patrick noticed, and remove a #if 0 group that I
      didn't mean to leave in the file.
      
      libstdc++-v3/ChangeLog:
      
      	* include/std/ranges (__detail::__toable): Fix incorrect use of
      	_Range instead of _Cont.
      	(__detail::_ToClosure, __detail::_ToClosure2): Add missing
      	constexpr specifier on constructors.
      	* testsuite/std/ranges/conv/1.cc (_Cont, _Cont2, _Cont3): Remove
      	unnecessary begin() and end() members.
      	(test_constexpr): New function to check range adaptors are
      	usable in constant expressions.
      18d8a50a
    • Gaius Mulley's avatar
      modula2: libgm2 bump version to 19:0.0 · c8dafbef
      Gaius Mulley authored
      
      This patch bumps the libgm2 version to 19.0.0 reflecting
      time related fixes, changes to builtins.def and the
      commencement of gcc stage3.
      
      libgm2/ChangeLog:
      
      	* configure: Regenerate.
      	* configure.ac:(libtool_VERSION): Bump to 19:0:0.
      
      Signed-off-by: default avatarGaius Mulley <gaiusmod2@gmail.com>
      c8dafbef
    • Christophe Lyon's avatar
      testsuite/arm: Fix bfloat16_vector_typecheck_[12].c tests [PR 112698] · d77d2dd9
      Christophe Lyon authored
      After commit r14-5617-gb8592186611, int32x[24]_t types now use
      elements of 'long int' type instead of 'int' on arm-eabi (it's still
      'int' on arm-linux-gnueabihf).  Both are 32-bit types anyway.
      
      This patch adjust the two tests so that they optionnally accept 'long '
      before 'int' in the expected error message.
      
      2023-11-30  Christophe Lyon  <christophe.lyon@linaro.org>
      
      	PR target/112698
      	gcc/testsuite/
      	* gcc.target/arm/bfloat16_vector_typecheck_1.c: Update expected
      	error message.
      	* gcc.target/arm/bfloat16_vector_typecheck_2.c: Likewise.
      d77d2dd9
Loading