Skip to content
Snippets Groups Projects
  1. Oct 16, 2024
    • David Malcolm's avatar
      diagnostics: eliminate m_ice_handler_cb [PR116613] · d826b638
      David Malcolm authored
      
      No functional change intended.
      
      gcc/ChangeLog:
      	PR other/116613
      	* diagnostic-format-sarif.cc
      	(sarif_builder::on_report_diagnostic): Move the fnotice here from
      	sarif_ice_handler.
      	(sarif_ice_handler): Delete.
      	(diagnostic_output_format_init_sarif): Drop setting of ice handler
      	callback.
      	* diagnostic.cc (diagnostic_context::initialize): Likewise.
      	(diagnostic_context::action_after_output): Rather than call
      	m_ice_handler_cb, instead call finish on this context.
      	* diagnostic.h (ice_handler_callback_t): Delete typedef.
      	(diagnostic_context::set_ice_handler_callback): Delete.
      	(diagnostic_context::m_ice_handler_cb): Delete.
      
      gcc/testsuite/ChangeLog:
      	PR other/116613
      	* gcc.dg/plugin/diagnostic_plugin_xhtml_format.c: Update for
      	removal of ICE callback.
      
      Signed-off-by: default avatarDavid Malcolm <dmalcolm@redhat.com>
      d826b638
    • Joseph Myers's avatar
      testsuite: Prepare for -std=gnu23 default · 9fb5348e
      Joseph Myers authored
      Now that C23 support is essentially feature-complete, I'd like to
      switch the default language version for C compilation to -std=gnu23.
      
      This requires updating a large number of testcases that fail with the
      new language version if left unchanged.  In this patch, update most of
      the tests for which there is a safe change that works both before and
      after the update to default language version - typically adding the
      option -std=gnu17 or -Wno-old-style-definition to the tests.  (There
      are also a few tests where I'd like to investigate further why they
      fail with -std=gnu23, or where I think such failures show an actual
      bug to fix before changing the default language version, or where it
      seems more appropriate to make a testcase change that would result in
      failures in the absence of the language version change rather than
      just adding an option that does nothing with the gnu17 default.)
      
      The libffi test fixes have also been submitted upstream:
      <https://github.com/libffi/libffi/pull/861>.
      
      Most of the failures requiring such changes are for one of two
      reasons:
      
      * Unprototyped function declarations with () (meaning the same as
        (void) in C23 mode) for a function then called with arguments.
      
      * Old-style function definitions, which warn by default in C23 mode,
        so resulting in test failures for the unexpected warnings.
      
      Other reasons for failures include:
      
      * Tests with their own definitions of bool, true and false.
      
      * Tests of diagnostics (often with -pedantic) in cases where C23 has
        changed semantics, such as:
      
        - tag compatibility for structs;
        - enum values out of range of int;
        - handing of qualified array types;
        - decimal floating types formerly needing -pedantic diagnostics, but
          being standard in C23.
      
      Bootstrapped with no regressions for x86_64-pc-linux-gnu.
      
      gcc/testsuite/
      	* c-c++-common/Wcast-function-type.c: Add -std=gnu17 for C.
      	* c-c++-common/Wformat-pr84258.c: Add -std=gnu17 for C.
      	* c-c++-common/Wvarargs.c: Add -std=gnu17 for C.
      	* c-c++-common/analyzer/data-model-12.c: Add -std=gnu17 for C.
      	* c-c++-common/builtins.c: Add -std=gnu17 for C.
      	* c-c++-common/pointer-to-fn1.c: Add -std=gnu17 for C.
      	* c-c++-common/pragma-diag-17.c: Add -std=gnu17 for C.
      	* c-c++-common/sizeof-array-argument.c: Add
      	-Wno-old-style-definition for C.
      	* g++.dg/lto/pr54625-1_0.c: Add -std=gnu17.
      	* g++.dg/lto/pr54625-2_0.c: Add -std=gnu17.
      	* gcc.c-torture/compile/20040214-2.c: Add -std=gnu17.
      	* gcc.c-torture/compile/921011-2.c: Add -std=gnu17.
      	* gcc.c-torture/compile/931102-1.c: Add -std=gnu17.
      	* gcc.c-torture/compile/990801-1.c: Add -std=gnu17.
      	* gcc.c-torture/compile/nested-1.c: Add -std=gnu17.
      	* gcc.c-torture/compile/pr100241-1.c: Add -std=gnu17.
      	* gcc.c-torture/compile/pr106101.c: Add -std=gnu17.
      	* gcc.c-torture/compile/pr113616.c: Add -std=gnu17.
      	* gcc.c-torture/compile/pr47967.c: Add -std=gnu17.
      	* gcc.c-torture/compile/pr51694.c: Add -std=gnu17.
      	* gcc.c-torture/compile/pr71109.c: Add -std=gnu17.
      	* gcc.c-torture/compile/pr83051-2.c: Add -std=gnu17.
      	* gcc.c-torture/compile/pr89663-1.c: Add -std=gnu17.
      	* gcc.c-torture/compile/pr94238.c: Add -std=gnu17.
      	* gcc.c-torture/compile/pr96796.c: Add -std=gnu17.
      	* gcc.c-torture/compile/pr97576.c: Add -std=gnu17.
      	* gcc.c-torture/compile/udivmod4.c: Add -std=gnu17.
      	* gcc.c-torture/execute/20010605-2.c: Add -std=gnu17.
      	* gcc.c-torture/execute/20020404-1.c: Add -std=gnu17.
      	* gcc.c-torture/execute/20030714-1.c: Add -std=gnu17.
      	* gcc.c-torture/execute/20051012-1.c: Add -std=gnu17.
      	* gcc.c-torture/execute/20190820-1.c: Add -std=gnu17.
      	* gcc.c-torture/execute/920612-1.c: Add -Wno-old-style-definition.
      	* gcc.c-torture/execute/930608-1.c: Add -std=gnu17.
      	* gcc.c-torture/execute/comp-goto-1.c: Add -std=gnu17.
      	* gcc.c-torture/execute/ieee/fp-cmp-1.x: Add -std=gnu17.
      	* gcc.c-torture/execute/ieee/fp-cmp-2.x: Add -std=gnu17.
      	* gcc.c-torture/execute/ieee/fp-cmp-3.x: Add -std=gnu17.
      	* gcc.c-torture/execute/ieee/fp-cmp-4.x: New file.
      	* gcc.c-torture/execute/ieee/fp-cmp-4f.x: New file.
      	* gcc.c-torture/execute/ieee/fp-cmp-4l.x: New file.
      	* gcc.c-torture/execute/loop-9.c: Add -std=gnu17.
      	* gcc.c-torture/execute/pr103209.c: Add -std=gnu17.
      	* gcc.c-torture/execute/pr28289.c: Add -std=gnu17.
      	* gcc.c-torture/execute/pr34982.c: Add -std=gnu17.
      	* gcc.c-torture/execute/pr67037.c: Add -std=gnu17.
      	* gcc.c-torture/execute/va-arg-2.c: Add -std=gnu17.
      	* gcc.dg/20010202-1.c: Add -std=gnu17.
      	* gcc.dg/20020430-1.c: Add -std=gnu17.
      	* gcc.dg/20031218-3.c: Add -std=gnu17.
      	* gcc.dg/20040127-1.c: Add -std=gnu17.
      	* gcc.dg/20041014-1.c: Add -Wno-old-style-definition.
      	* gcc.dg/20041122-1.c: Add -std=gnu17.
      	* gcc.dg/20050309-1.c: Add -std=gnu17.
      	* gcc.dg/20061026.c: Add -std=gnu17.
      	* gcc.dg/20101010-1.c: Add -std=gnu17.
      	* gcc.dg/Warray-parameter-10.c: Add -std=gnu17.
      	* gcc.dg/Wbuiltin-declaration-mismatch-2.c: Add -std=gnu17.
      	* gcc.dg/Wbuiltin-declaration-mismatch-3.c: Add -std=gnu17.
      	* gcc.dg/Wbuiltin-declaration-mismatch-4.c: Add -std=gnu17.
      	* gcc.dg/Wbuiltin-declaration-mismatch-5.c: Add -std=gnu17.
      	* gcc.dg/Wbuiltin-declaration-mismatch.c: Add -std=gnu17.
      	* gcc.dg/Wcxx-compat-2.c: Add -std=gnu17.
      	* gcc.dg/Wdouble-promotion.c: Add -std=gnu17.
      	* gcc.dg/Wfree-nonheap-object-7.c: Add -std=gnu17.
      	* gcc.dg/Wimplicit-int-1.c: Add -std=gnu17.
      	* gcc.dg/Wimplicit-int-1a.c: Add -std=gnu17.
      	* gcc.dg/Wimplicit-int-2.c: Add -std=gnu17.
      	* gcc.dg/Wimplicit-int-3.c: Add -std=gnu17.
      	* gcc.dg/Wimplicit-int-4.c: Add -std=gnu17.
      	* gcc.dg/Wimplicit-int-4a.c: Add -std=gnu17.
      	* gcc.dg/Wincompatible-pointer-types-1.c: Add -std=gnu17.
      	* gcc.dg/Wrestrict-19.c: Add -std=gnu17.
      	* gcc.dg/Wrestrict-4.c: Add -std=gnu17.
      	* gcc.dg/Wrestrict-5.c: Add -std=gnu17.
      	* gcc.dg/Wstrict-overflow-20.c: Add -std=gnu17.
      	* gcc.dg/Wstringop-overflow-13.c: Add -std=gnu17.
      	* gcc.dg/analyzer/doom-d_main-IdentifyVersion.c: Add -std=gnu17.
      	* gcc.dg/analyzer/doom-s_sound-pr108867.c: Add -std=gnu17.
      	* gcc.dg/analyzer/pr93032-mztools-signed-char.c: Add
      	-Wno-old-style-definition.
      	* gcc.dg/analyzer/pr93032-mztools-unsigned-char.c: Add
      	-Wno-old-style-definition.
      	* gcc.dg/analyzer/pr93355-localealias.c: Add
      	-Wno-old-style-definition.
      	* gcc.dg/analyzer/pr93375.c: Add -std=gnu17.
      	* gcc.dg/analyzer/pr94688.c: Add -std=gnu17.
      	* gcc.dg/analyzer/sensitive-1.c: Add -std=gnu17.
      	* gcc.dg/analyzer/torture/asm-x86-linux-wfx_get_ps_timeout-full.c:
      	Add -std=gnu17.
      	* gcc.dg/analyzer/torture/pr104863.c: Add -std=gnu17.
      	* gcc.dg/analyzer/torture/pr93379.c: Add -std=gnu17.
      	* gcc.dg/array-quals-2.c: Add -std=gnu17.
      	* gcc.dg/attr-invalid.c: Add -Wno-old-style-definition.
      	* gcc.dg/auto-init-uninit-A.c: Add -Wno-old-style-definition.
      	* gcc.dg/builtin-choose-expr.c: Declare exit with (int) prototype.
      	* gcc.dg/builtin-tgmath-err-1.c: Add -std=gnu17.
      	* gcc.dg/builtins-30.c: Add -std=gnu17.
      	* gcc.dg/cast-function-1.c: Add -std=gnu17.
      	* gcc.dg/cleanup-1.c: Add -std=gnu17.
      	* gcc.dg/compat/struct-complex-1_x.c: Add -std=gnu17.
      	* gcc.dg/compat/struct-complex-2_x.c: Add -std=gnu17.
      	* gcc.dg/compat/union-m128-1_x.c: Add -std=gnu17.
      	* gcc.dg/debug/dwarf2/pr66482.c: Add -std=gnu17.
      	* gcc.dg/dfp/composite-type-2.c: Add -std=gnu17.
      	* gcc.dg/dfp/composite-type.c: Add -std=gnu17.
      	* gcc.dg/dfp/keywords-pedantic.c: Add -std=gnu17.
      	* gcc.dg/dremf-type-compat-1.c: Add -std=gnu17.
      	* gcc.dg/dremf-type-compat-2.c: Add -std=gnu17.
      	* gcc.dg/dremf-type-compat-3.c: Add -std=gnu17.
      	* gcc.dg/dremf-type-compat-4.c: Add -std=gnu17.
      	* gcc.dg/enum-compat-1.c: Add -std=gnu17.
      	* gcc.dg/enum-compat-2.c: Add -std=gnu17.
      	* gcc.dg/floatn-errs.c: Add -std=gnu17.
      	* gcc.dg/fltconst-pedantic-dfp.c: Add -std=gnu17.
      	* gcc.dg/format/proto.c: Add -std=gnu17.
      	* gcc.dg/format/sentinel-1.c: Add -std=gnu17.
      	* gcc.dg/gomp/declare-simd-1.c: Add -Wno-old-style-definition.
      	* gcc.dg/ifelse-1.c: Add -Wno-old-style-definition.
      	* gcc.dg/inline-33.c: Add -std=gnu17.
      	* gcc.dg/ipa/inline-5.c: Add -std=gnu17.
      	* gcc.dg/ipa/ipa-sra-21.c: Add -std=gnu17.
      	* gcc.dg/ipa/pr102714.c: Add -std=gnu17.
      	* gcc.dg/ipa/pr104813.c: Add -std=gnu17.
      	* gcc.dg/ipa/pr108679.c: Add -std=gnu17.
      	* gcc.dg/ipa/pr42706.c: Add -std=gnu17.
      	* gcc.dg/ipa/pr88214.c: Add -Wno-old-style-definition.
      	* gcc.dg/ipa/pr91853.c: Add -Wno-old-style-definition.
      	* gcc.dg/ipa/pr93763.c: Add -std=gnu17.
      	* gcc.dg/ipa/pr96482-2.c: Add -std=gnu17.
      	* gcc.dg/lto/20091013-1_2.c: Add -std=gnu17.
      	* gcc.dg/lto/20091015-1_2.c: Add -std=gnu17.
      	* gcc.dg/lto/pr113197_1.c: Add -std=gnu17.
      	* gcc.dg/lto/pr54702_1.c: Add -std=gnu17.
      	* gcc.dg/lto/pr99849_0.c: Add -std=gnu17.
      	* gcc.dg/noncompile/920923-1.c: Add -std=gnu17.
      	* gcc.dg/noncompile/old-style-parm-1.c: Add
      	-Wno-old-style-definition.
      	* gcc.dg/noncompile/old-style-parm-3.c: Add
      	-Wno-old-style-definition.
      	* gcc.dg/noncompile/pr30552-2.c: Add -Wno-old-style-definition.
      	* gcc.dg/noncompile/pr30552-3.c: Add -std=gnu17.
      	* gcc.dg/noncompile/pr71265.c: Add -Wno-old-style-definition.
      	* gcc.dg/noncompile/pr79758-2.c: Add -Wno-old-style-definition.
      	* gcc.dg/noncompile/pr79758.c: Add -Wno-old-style-definition.
      	* gcc.dg/noncompile/va-arg-1.c: Add -std=gnu17.
      	* gcc.dg/old-style-prom-1.c: Add -std=gnu17.
      	* gcc.dg/old-style-prom-2.c: Add -std=gnu17.
      	* gcc.dg/old-style-prom-3.c: Add -std=gnu17.
      	* gcc.dg/old-style-then-proto-1.c: Add -std=gnu17.
      	* gcc.dg/parm-incomplete-1.c: Add -std=gnu17.
      	* gcc.dg/parm-mismatch-1.c: Add -std=gnu17.
      	* gcc.dg/permerror-default.c: Add -std=gnu17.
      	* gcc.dg/permerror-fpermissive-nowarning.c: Add -std=gnu17.
      	* gcc.dg/permerror-fpermissive.c: Add -std=gnu17.
      	* gcc.dg/permerror-noerror.c: Add -std=gnu17.
      	* gcc.dg/permerror-nowarning.c: Add -std=gnu17.
      	* gcc.dg/permerror-pedantic.c: Add -std=gnu17.
      	* gcc.dg/plugin/infoleak-net-ethtool-ioctl.c: Add -std=gnu17.
      	* gcc.dg/pointer-array-quals-1.c: Add -std=gnu17.
      	* gcc.dg/pointer-array-quals-2.c: Add -std=gnu17.
      	* gcc.dg/pr100791.c: Add -std=gnu17.
      	* gcc.dg/pr100843.c: Add -std=gnu17.
      	* gcc.dg/pr102273.c: Add -std=gnu17.
      	* gcc.dg/pr102385.c: Add -std=gnu17.
      	* gcc.dg/pr103222.c: Add -std=gnu17.
      	* gcc.dg/pr105140.c: Add -std=gnu17.
      	* gcc.dg/pr105150.c: Add -std=gnu17.
      	* gcc.dg/pr105250.c: Add -std=gnu17.
      	* gcc.dg/pr105972.c: Add -Wno-old-style-definition.
      	* gcc.dg/pr111039.c: Add -std=gnu17.
      	* gcc.dg/pr111407.c: Add -std=gnu17.
      	* gcc.dg/pr111922.c: Add -Wno-old-style-definition.
      	* gcc.dg/pr15236.c: Add -std=gnu17.
      	* gcc.dg/pr17188-1.c: Add -std=gnu17.
      	* gcc.dg/pr20368-1.c: Add -std=gnu17.
      	* gcc.dg/pr20368-2.c: Add -std=gnu17.
      	* gcc.dg/pr20368-3.c: Add -std=gnu17.
      	* gcc.dg/pr27331.c: Add -Wno-old-style-definition.
      	* gcc.dg/pr27861-1.c: Add -std=gnu17.
      	* gcc.dg/pr28121.c: Add -std=gnu17.
      	* gcc.dg/pr28243.c: Add -std=gnu17.
      	* gcc.dg/pr28888.c: Add -std=gnu17.
      	* gcc.dg/pr29254.c: Add -std=gnu17.
      	* gcc.dg/pr34457-1.c: Add -std=gnu17.
      	* gcc.dg/pr36015.c: Add -std=gnu17.
      	* gcc.dg/pr38245-3.c: Add -std=gnu17.
      	* gcc.dg/pr38245-4.c: Add -std=gnu17.
      	* gcc.dg/pr41241.c: Add -std=gnu17.
      	* gcc.dg/pr43058.c: Add -std=gnu17.
      	* gcc.dg/pr44539.c: Add -std=gnu17.
      	* gcc.dg/pr45055.c: Add -std=gnu17.
      	* gcc.dg/pr50908.c: Add -Wno-old-style-definition.
      	* gcc.dg/pr60647-1.c: Add -Wno-old-style-definition.
      	* gcc.dg/pr63762.c: Add -std=gnu17.
      	* gcc.dg/pr63804.c: Add -std=gnu17.
      	* gcc.dg/pr68306-3.c: Add -std=gnu17.
      	* gcc.dg/pr68533.c: Add -std=gnu17.
      	* gcc.dg/pr69156.c: Add -std=gnu17.
      	* gcc.dg/pr7356-2.c: Add -Wno-old-style-definition.
      	* gcc.dg/pr79983.c: Add -std=gnu17.
      	* gcc.dg/pr83463.c: Add -std=gnu17.
      	* gcc.dg/pr87347.c: Add -std=gnu17.
      	* gcc.dg/pr89521-1.c: Add -std=gnu17.
      	* gcc.dg/pr89521-2.c: Add -std=gnu17.
      	* gcc.dg/pr90648.c: Add -std=gnu17.
      	* gcc.dg/pr93573-1.c: Add -std=gnu17.
      	* gcc.dg/pr94167.c: Add -std=gnu17.
      	* gcc.dg/pr94705.c: Add -std=gnu17.
      	* gcc.dg/pr95118.c: Add -std=gnu17.
      	* gcc.dg/pr96335.c: Add -std=gnu17.
      	* gcc.dg/pr97830.c: Add -std=gnu17.
      	* gcc.dg/pr97882.c: Add -std=gnu17.
      	* gcc.dg/pr99122-2.c: Add -std=gnu17.
      	* gcc.dg/pr99122-3.c: Add -std=gnu17.
      	* gcc.dg/qual-component-1.c: Add -std=gnu17.
      	* gcc.dg/sibcall-6.c: Add -Wno-old-style-definition.
      	* gcc.dg/sms-2.c: Add -Wno-old-style-definition.
      	* gcc.dg/tm/20091221.c: Add -std=gnu17.
      	* gcc.dg/torture/bfloat16-basic.c: Add -Wno-old-style-definition.
      	* gcc.dg/torture/float128-basic.c: Add -Wno-old-style-definition.
      	* gcc.dg/torture/float128x-basic.c: Add -Wno-old-style-definition.
      	* gcc.dg/torture/float16-basic.c: Add -Wno-old-style-definition.
      	* gcc.dg/torture/float32-basic.c: Add -Wno-old-style-definition.
      	* gcc.dg/torture/float32x-basic.c: Add -Wno-old-style-definition.
      	* gcc.dg/torture/float64-basic.c: Add -Wno-old-style-definition.
      	* gcc.dg/torture/float64x-basic.c: Add -Wno-old-style-definition.
      	* gcc.dg/torture/pr102762.c: Add -std=gnu17.
      	* gcc.dg/torture/pr103987.c: Add -std=gnu17.
      	* gcc.dg/torture/pr104825.c: Add -Wno-old-style-definition.
      	* gcc.dg/torture/pr105166.c: Add -std=gnu17.
      	* gcc.dg/torture/pr105185.c: Add -Wno-old-style-definition.
      	* gcc.dg/torture/pr109652.c: Add -std=gnu17.
      	* gcc.dg/torture/pr112444.c: Add -std=gnu17.
      	* gcc.dg/torture/pr113895-3.c: Add -std=gnu17.
      	* gcc.dg/torture/pr24626-2.c: Add -std=gnu17.
      	* gcc.dg/torture/pr25183.c: Add -std=gnu17.
      	* gcc.dg/torture/pr38948.c: Add -std=gnu17.
      	* gcc.dg/torture/pr44807.c: Add -std=gnu17.
      	* gcc.dg/torture/pr47281.c: Add -std=gnu17.
      	* gcc.dg/torture/pr47958-1.c: Add -Wno-old-style-definition.
      	* gcc.dg/torture/pr48063.c: Add -std=gnu17.
      	* gcc.dg/torture/pr57036-1.c: Add -std=gnu17.
      	* gcc.dg/torture/pr57330.c: Add -std=gnu17.
      	* gcc.dg/torture/pr57584.c: Add -std=gnu17.
      	* gcc.dg/torture/pr67741.c: Add -std=gnu17.
      	* gcc.dg/torture/pr68104.c: Add -std=gnu17.
      	* gcc.dg/torture/pr69242.c: Add -std=gnu17.
      	* gcc.dg/torture/pr70457.c: Add -std=gnu17.
      	* gcc.dg/torture/pr70985.c: Add -std=gnu17.
      	* gcc.dg/torture/pr71606.c: Add -std=gnu17.
      	* gcc.dg/torture/pr71816.c: Add -std=gnu17.
      	* gcc.dg/torture/pr77286.c: Add -std=gnu17.
      	* gcc.dg/torture/pr77646.c: Add -std=gnu17.
      	* gcc.dg/torture/pr77677-2.c: Add -std=gnu17.
      	* gcc.dg/torture/pr78365.c: Add -Wno-old-style-definition.
      	* gcc.dg/torture/pr79732.c: Add -std=gnu17.
      	* gcc.dg/torture/pr80612.c: Add -std=gnu17.
      	* gcc.dg/torture/pr80764.c: Add -std=gnu17.
      	* gcc.dg/torture/pr80842.c: Add -std=gnu17.
      	* gcc.dg/torture/pr81900.c: Add -std=gnu17.
      	* gcc.dg/torture/pr82276.c: Add -std=gnu17.
      	* gcc.dg/torture/pr84803.c: Add -std=gnu17.
      	* gcc.dg/torture/pr93124.c: Add -std=gnu17.
      	* gcc.dg/torture/pr97330-1.c: Add -Wno-old-style-definition.
      	* gcc.dg/tree-prof/comp-goto-1.c: Add -std=gnu17.
      	* gcc.dg/tree-ssa/20030703-2.c: Add -Wno-old-style-definition.
      	* gcc.dg/tree-ssa/20030708-1.c: Add -Wno-old-style-definition.
      	* gcc.dg/tree-ssa/20030709-2.c: Add -Wno-old-style-definition.
      	* gcc.dg/tree-ssa/20030709-3.c: Add -Wno-old-style-definition.
      	* gcc.dg/tree-ssa/20030710-1.c: Add -Wno-old-style-definition.
      	* gcc.dg/tree-ssa/20030711-1.c: Add -Wno-old-style-definition.
      	* gcc.dg/tree-ssa/20030711-2.c: Add -Wno-old-style-definition.
      	* gcc.dg/tree-ssa/20030711-3.c: Add -Wno-old-style-definition.
      	* gcc.dg/tree-ssa/20030714-1.c: Add -Wno-old-style-definition.
      	* gcc.dg/tree-ssa/20030714-2.c: Add -Wno-old-style-definition.
      	* gcc.dg/tree-ssa/20030728-1.c: Add -Wno-old-style-definition.
      	* gcc.dg/tree-ssa/20030807-10.c: Add -Wno-old-style-definition.
      	* gcc.dg/tree-ssa/20030807-11.c: Add -Wno-old-style-definition.
      	* gcc.dg/tree-ssa/20030807-3.c: Add -Wno-old-style-definition.
      	* gcc.dg/tree-ssa/20030807-6.c: Add -Wno-old-style-definition.
      	* gcc.dg/tree-ssa/20030807-7.c: Add -Wno-old-style-definition.
      	* gcc.dg/tree-ssa/20030814-4.c: Add -Wno-old-style-definition.
      	* gcc.dg/tree-ssa/20030814-5.c: Add -Wno-old-style-definition.
      	* gcc.dg/tree-ssa/20030814-6.c: Add -Wno-old-style-definition.
      	* gcc.dg/tree-ssa/20030918-1.c: Add -Wno-old-style-definition.
      	* gcc.dg/tree-ssa/20040514-2.c: Add -Wno-old-style-definition.
      	* gcc.dg/tree-ssa/loadpre7.c: Add -Wno-old-style-definition.
      	* gcc.dg/tree-ssa/pr111003.c: Add -std=gnu17.
      	* gcc.dg/tree-ssa/pr115128.c: Add -std=gnu17.
      	* gcc.dg/tree-ssa/pr115191.c: Add -std=gnu17.
      	* gcc.dg/tree-ssa/pr24840.c: Add -std=gnu17.
      	* gcc.dg/tree-ssa/pr69666.c: Add -std=gnu17.
      	* gcc.dg/tree-ssa/pr70232.c: Add -std=gnu17.
      	* gcc.dg/ubsan/pr79757-1.c: Add -Wno-old-style-definition.
      	* gcc.dg/ubsan/pr79757-2.c: Add -Wno-old-style-definition.
      	* gcc.dg/ubsan/pr79757-3.c: Add -Wno-old-style-definition.
      	* gcc.dg/ubsan/pr81223.c: Add -std=gnu17.
      	* gcc.dg/uninit-10-O0.c: Add -Wno-old-style-definition.
      	* gcc.dg/uninit-10.c: Add -Wno-old-style-definition.
      	* gcc.dg/uninit-32.c: Add -std=gnu17.
      	* gcc.dg/uninit-41.c: Add -std=gnu17.
      	* gcc.dg/uninit-A-O0.c: Add -Wno-old-style-definition.
      	* gcc.dg/uninit-A.c: Add -Wno-old-style-definition.
      	* gcc.dg/unused-1.c: Add -Wno-old-style-definition.
      	* gcc.dg/vect/bb-slp-pr114249.c: Add -std=gnu17.
      	* gcc.dg/vect/bb-slp-pr97486.c: Add -std=gnu17.
      	* gcc.dg/vect/bb-slp-subgroups-1.c: Add -std=gnu17.
      	* gcc.dg/vect/bb-slp-subgroups-2.c: Add -std=gnu17.
      	* gcc.dg/vect/bb-slp-subgroups-3.c: Add -std=gnu17.
      	* gcc.dg/vect/vect-early-break_111-pr113731.c: Add -std=gnu17.
      	* gcc.dg/vect/vect-early-break_122-pr114239.c: Add -std=gnu17.
      	* gcc.dg/vect/vect-multi-peel-gaps.c: Add -std=gnu17.
      	* gcc.dg/vla-stexp-2.c: Add -std=gnu17.
      	* gcc.dg/warn-1.c: Add -Wno-old-style-definition.
      	* gcc.dg/winline-10.c: Add -Wno-old-style-definition.
      	* gcc.dg/wtr-label-1.c: Add -Wno-old-style-definition.
      	* gcc.dg/wtr-switch-1.c: Add -Wno-old-style-definition.
      	* gcc.target/i386/excess-precision-3.c: Add
      	-Wno-old-style-definition.
      	* gcc.target/i386/fma4-256-nmsubXX.c: Add -std=gnu17.
      	* gcc.target/i386/fma4-nmsubXX.c: Add -std=gnu17.
      	* gcc.target/i386/nop-mcount.c: Add -Wno-old-style-definition.
      	* gcc.target/i386/pr102627.c: Add -std=gnu17.
      	* gcc.target/i386/pr106994.c: Add -std=gnu17.
      	* gcc.target/i386/pr68349.c: Add -std=gnu17.
      	* gcc.target/i386/pr97313.c: Add -std=gnu17.
      	* gcc.target/i386/pr99454.c: Add -std=gnu17.
      	* gcc.target/i386/record-mcount.c: Add -Wno-old-style-definition.
      
      libffi/
      	* testsuite/libffi.call/va_struct2.c (test_fn): Cast n to void.
      	* testsuite/libffi.call/va_struct3.c (test_fn): Likewise.
      	Backported from <https://github.com/libffi/libffi/pull/861>.
      9fb5348e
    • Jakub Jelinek's avatar
      c: Add some checking asserts to named loops handling code · 6756250f
      Jakub Jelinek authored
      Jonathan mentioned an unnamed static analyzer reported issue in
      c_finish_bc_name.
      It is actually a false positive, because the construction of the
      loop_names vector guarantees that the last element of the vector
      (if the vector is non-empty) always has either
      C_DECL_LOOP_NAME (l) or C_DECL_SWITCH_NAME (l) (or both) flags
      set, so c will be always non-NULL after the if at the start of the
      loops.
      The following patch is an attempt to help those static analyzers
      (though dunno if it actually helps), by adding a checking assert.
      
      2024-10-16  Jakub Jelinek  <jakub@redhat.com>
      
      	* c-decl.cc (c_get_loop_names): Add checking assert that
      	c is non-NULL in the loop.
      	(c_finish_bc_name): Likewise.
      6756250f
    • Jakub Jelinek's avatar
      c: Fix up uninitialized next.original_type use in #embed optimization · f5224caf
      Jakub Jelinek authored
      Jonathan pointed me at a diagnostic from an unnamed static analyzer
      which found that next.original_type isn't initialized for the CPP_EMBED
      case when it is parsed in a comma expression, yet
        expr.original_type = next.original_type;
      is done a few lines later and the expr is returned.
      
      2024-10-16  Jakub Jelinek  <jakub@redhat.com>
      
      	* c-parser.cc (c_parser_expression): Initialize next.original_type
      	to integer_type_node for the CPP_EMBED case.
      f5224caf
    • Tobias Burnus's avatar
      Add libgomp.oacc-fortran/acc_on_device-1-4.f · ee4fdda7
      Tobias Burnus authored
      Kind of undoes r15-4315-g9f549d216c9716 by adding the original testcase back;
      namely, adding acc_on_device-1-3.f as acc_on_device-1-4.f with
      -fno-builtin-acc_on_device removed.
      
      libgomp/ChangeLog:
      
      	* testsuite/libgomp.oacc-fortran/acc_on_device-1-4.f: New test;
      	same as acc_on_device-1-3.f but using the builtin function.
      ee4fdda7
    • Andi Kleen's avatar
      PR116510: Add missing fold_converts into tree switch if conversion · d5a05db8
      Andi Kleen authored
      Passes test suite. Ok to commit?
      
      gcc/ChangeLog:
      
      	PR middle-end/116510
      	* tree-if-conv.cc (predicate_bbs): Add missing fold_converts.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.dg/vect/vect-switch-ifcvt-3.c: New test.
      d5a05db8
    • Jakub Jelinek's avatar
      Ternary operator formatting fixes · e48a65d3
      Jakub Jelinek authored
      While working on PR117028 C2Y changes, I've noticed weird ternary
      operator formatting (operand1 ? operand2: operand3).
      The usual formatting is operand1 ? operand2 : operand3
      where we have around 18000+ cases of that (counting only what fits
      on one line) and
      indent -nbad -bap -nbc -bbo -bl -bli2 -bls -ncdb -nce -cp1 -cs -di2 -ndj \
             -nfc1 -nfca -hnl -i2 -ip5 -lp -pcs -psl -nsc -nsob
      documented in
      https://www.gnu.org/prep/standards/html_node/Formatting.html#Formatting
      does the same.
      Some code was even trying to save space as much as possible and used
      operand1?operand2:operand3 or
      operand1 ? operand2:operand3
      
      Today I've grepped for such cases (the grep was '?.*[^ ]:' and I had to
      skim through various false positives with that where the : matched e.g.
      stuff inside of strings, or *.md pattern macros or :: scope) and the
      following patch is a fix for what I found.
      
      2024-10-16  Jakub Jelinek  <jakub@redhat.com>
      
      gcc/
      	* attribs.cc (lookup_scoped_attribute_spec): ?: operator formatting
      	fixes.
      	* basic-block.h (FOR_BB_INSNS_SAFE): Likewise.
      	* cfgcleanup.cc (outgoing_edges_match): Likewise.
      	* cgraph.cc (cgraph_node::dump): Likewise.
      	* config/arc/arc.cc (gen_acc1, gen_acc2): Likewise.
      	* config/arc/arc.h (CLASS_MAX_NREGS, CONSTANT_ADDRESS_P): Likewise.
      	* config/arm/arm.cc (arm_print_operand): Likewise.
      	* config/cris/cris.md (*b<rnzcond:code><mode>): Likewise.
      	* config/darwin.cc (darwin_asm_declare_object_name,
      	darwin_emit_common): Likewise.
      	* config/darwin-driver.cc (darwin_driver_init): Likewise.
      	* config/epiphany/epiphany.md (call, sibcall, call_value,
      	sibcall_value): Likewise.
      	* config/i386/i386.cc (gen_push2): Likewise.
      	* config/i386/i386.h (ix86_cur_cost): Likewise.
      	* config/i386/openbsdelf.h (FUNCTION_PROFILER): Likewise.
      	* config/loongarch/loongarch-c.cc (loongarch_cpu_cpp_builtins):
      	Likewise.
      	* config/loongarch/loongarch-cpu.cc (fill_native_cpu_config):
      	Likewise.
      	* config/riscv/riscv.cc (riscv_union_memmodels): Likewise.
      	* config/riscv/zc.md (*mva01s<X:mode>, *mvsa01<X:mode>): Likewise.
      	* config/rs6000/mmintrin.h (_mm_cmpeq_pi8, _mm_cmpgt_pi8,
      	_mm_cmpeq_pi16, _mm_cmpgt_pi16, _mm_cmpeq_pi32, _mm_cmpgt_pi32):
      	Likewise.
      	* config/v850/predicates.md (pattern_is_ok_for_prologue): Likewise.
      	* config/xtensa/constraints.md (d, C, W): Likewise.
      	* coverage.cc (coverage_begin_function, build_init_ctor,
      	build_gcov_exit_decl): Likewise.
      	* df-problems.cc (df_create_unused_note): Likewise.
      	* diagnostic.cc (diagnostic_set_caret_max_width): Likewise.
      	* diagnostic-path.cc (path_summary::path_summary): Likewise.
      	* expr.cc (expand_expr_divmod): Likewise.
      	* gcov.cc (format_gcov): Likewise.
      	* gcov-dump.cc (dump_gcov_file): Likewise.
      	* genmatch.cc (main): Likewise.
      	* incpath.cc (remove_duplicates, register_include_chains): Likewise.
      	* ipa-devirt.cc (dump_odr_type): Likewise.
      	* ipa-icf.cc (sem_item_optimizer::merge_classes): Likewise.
      	* ipa-inline.cc (inline_small_functions): Likewise.
      	* ipa-polymorphic-call.cc (ipa_polymorphic_call_context::dump):
      	Likewise.
      	* ipa-sra.cc (create_parameter_descriptors): Likewise.
      	* ipa-utils.cc (find_always_executed_bbs): Likewise.
      	* predict.cc (predict_loops): Likewise.
      	* selftest.cc (read_file): Likewise.
      	* sreal.h (SREAL_SIGN, SREAL_ABS): Likewise.
      	* tree-dump.cc (dequeue_and_dump): Likewise.
      	* tree-ssa-ccp.cc (bit_value_binop): Likewise.
      gcc/c-family/
      	* c-opts.cc (c_common_init_options, c_common_handle_option,
      	c_common_finish, set_std_c89, set_std_c99, set_std_c11,
      	set_std_c17, set_std_c23, set_std_cxx98, set_std_cxx11,
      	set_std_cxx14, set_std_cxx17, set_std_cxx20, set_std_cxx23,
      	set_std_cxx26): ?: operator formatting fixes.
      gcc/cp/
      	* search.cc (lookup_member): ?: operator formatting fixes.
      	* typeck.cc (cp_build_modify_expr): Likewise.
      libcpp/
      	* expr.cc (interpret_float_suffix): ?: operator formatting fixes.
      e48a65d3
    • Eric Botcazou's avatar
      Fix bootstrap on 32-bit SPARC/Solaris · 935b7fbd
      Eric Botcazou authored
      The 'U' constraint cannot be used with LRA.
      
      gcc/
      	PR target/113952
      	PR target/117168
      	* config/sparc/constraints.md ('U'): Delete.
      	* config/sparc/sparc.md (*movdi_insn_sp32): Remove U alternatives.
      	(*movdf_insn_sp32): Likewise.
      	(*mov<VM64:mode>_insn_sp32): Likewise.
      	* doc/md.texi (SPARC constraints): Remove entry for 'U'.
      935b7fbd
    • GCC Administrator's avatar
      Daily bump. · d9e02add
      GCC Administrator authored
      d9e02add
    • Richard Biener's avatar
      Enhance gather fallback for PR65518 with SLP · 62cdddd4
      Richard Biener authored
      With SLP forced we fail to use gather for PR65518 on RISC-V as expected
      because we're failing due to not effective peeling for gaps.  The
      following appropriately moves the memory_access_type adjustment before
      doing all the overrun checking since using VMAT_ELEMENTWISE means
      there's no overrun.
      
      	* tree-vect-stmts.cc (get_group_load_store_type): Move
      	VMAT_ELEMENTWISE fallback for single-element interleaving
      	of too large groups before overrun checking.
      
      	* gcc.dg/vect/pr65518.c: Adjust.
      62cdddd4
    • Richard Biener's avatar
      tree-optimization/117050 - fix ICE with non-grouped .MASK_LOAD SLP · ae224de0
      Richard Biener authored
      The following is a more complete fix for PR117050, restoring the
      ability to permute non-grouped .MASK_LOAD with.
      
      	PR tree-optimization/117050
      	* tree-vect-slp.cc (vect_build_slp_tree_2): Properly handle
      	non-grouped masked loads when handling permutations.
      ae224de0
    • Richard Biener's avatar
      Remove SLP_INSTANCE_UNROLLING_FACTOR, compute VF in vect_make_slp_decision · 962a994d
      Richard Biener authored
      The following prepares us for SLP instances with a non-uniform number
      of lanes.  We already have this with load permutation lowering, but
      we managed to keep that within the constraints of the per SLP instance
      computed VF based on its max_nunits (with a vector type fixed for
      each node) and the instance group size which is the number of lanes
      in the SLP instance root.  But in the case where arbitrary splitting
      and merging SLP nodes at non-power-of-two lane boundaries is allowed
      this simple calculation based on the outgoing group size falls apart.
      
      The following, instead of computing a VF during SLP instance
      discovery, computes it at vect_make_slp_decision time by walking
      the SLP graph and looking at each SLP node in isolation.  We do
      track max_nunits per node which could be a VF per node instead or
      forgo with both completely (though for BB vectorization we need
      to communicate a VF > 1 requirement upward, or compute that after
      the fact).  In the end we'd like to delay vector type assignment
      and only compute a minimum VF here, allowing vector types to
      grow when the actual VF is bigger.
      
      There's slight complication with permutes of externs / constants
      as those get their vector type (and thus max_nunits) assigned late.
      While we force them to have the same vector type as the result at
      the moment their number of lanes can differ.  So those get handled
      explicitly there right now to up the VF as needed - the alternative
      is to fail vectorization, I have an addition to
      vect_maybe_update_slp_op_vectype that would FAIL if the set
      vector type isn't within the constraints of the VF.
      
      	* tree-vectorizer.h (SLP_INSTANCE_UNROLLING_FACTOR): Remove.
      	(slp_instance::unrolling_factor): Likewise.
      	* tree-vect-slp.cc (vect_build_slp_instance): Do not set
      	SLP_INSTANCE_UNROLLING_FACTOR.  Remove then dead code.
      	Compute and set max_nunits from the RHS nodes merged.
      	(vect_update_slp_vf_for_node): New function.
      	(vect_make_slp_decision): Use vect_update_slp_vf_for_node
      	to compute VF recursively.
      	(vect_build_slp_store_interleaving): Get max_nunits and
      	properly set that on the permute nodes built.
      	(vect_analyze_slp): Do not set SLP_INSTANCE_UNROLLING_FACTOR.
      962a994d
    • Joseph Myers's avatar
      testsuite: Add tests for C23 __STDC_VERSION__ · 65abc81c
      Joseph Myers authored
      Add some tests for the value of __STDC_VERSION__ in C23 mode.
      
      Bootstrapped with no regressions for x86_64-pc-linux-gnu.
      
      	* gcc.dg/c23-version-1.c, gcc.dg/c23-version-2.c,
      	gcc.dg/gnu23-version-1.c: New tests.
      65abc81c
    • Jonathan Wakely's avatar
      libstdc++: Fix Python deprecation warning in printers.py · b9e98bb9
      Jonathan Wakely authored
      python/libstdcxx/v6/printers.py:1355: DeprecationWarning: 'count' is passed as positional argument
      
      The Python docs say:
      
        Deprecated since version 3.13: Passing count and flags as positional
        arguments is deprecated. In future Python versions they will be
        keyword-only parameters.
      
      Using a keyword argument for count only became possible with Python 3.1
      so introduce a new function to do the substitution.
      
      libstdc++-v3/ChangeLog:
      
      	* python/libstdcxx/v6/printers.py (strip_fundts_namespace): New.
      	(StdExpAnyPrinter, StdExpOptionalPrinter): Use it.
      b9e98bb9
    • Robin Dapp's avatar
      RISC-V: Use biggest_mode as mode for constants. · cc217a1e
      Robin Dapp authored
      In compute_nregs_for_mode we expect that the current variable's mode is
      at most as large as the biggest mode to be used for vectorization.
      
      This might not be true for constants as they don't actually have a mode.
      In that case, just use the biggest mode so max_number_of_live_regs
      returns 1.
      
      This fixes several test cases in the test suite.
      
      gcc/ChangeLog:
      
      	PR target/116655
      
      	* config/riscv/riscv-vector-costs.cc (max_number_of_live_regs):
      	Use biggest mode instead of constant's saved mode.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/autovec/pr116655.c: New test.
      cc217a1e
    • Jakub Jelinek's avatar
      c: Speed up compilation of large char array initializers when not using #embed · f9bac238
      Jakub Jelinek authored
      The following patch on attempts to speed up compilation of large char array
      initializers when one doesn't use #embed in the source.
      
      My testcase has been
      unsigned char a[] = {
       #embed "cc1gm2" limit (100000000)
      };
      and corresponding variant which has the middle line replaced with
      dd if=cc1gm bs=100000000 count=1 | xxd -i
      With embed 95.3MiB is really fast:
      time ./cc1 -quiet -O2 -o test4a.s test4a.c
      
      real    0m0.700s
      user    0m0.576s
      sys     0m0.123s
      Without embed and without this patch it needs around 11GB of RAM and
      time ./cc1 -quiet -O2 -o test4b.s test4b.c
      
      real    2m47.230s
      user    2m41.548s
      sys     0m4.328s
      Without embed and with this patch it needs around 3.5GB of RAM and
      time ./cc1 -quiet -O2 -o test4b.s2 test4b.c
      
      real    0m25.004s
      user    0m23.655s
      sys     0m1.308s
      Not perfect (but one needs to parse all the numbers, libcpp also creates
      strings which are pointed by CPP_NUMBER tokens (that can take up to 4 bytes
      per byte), but still almost 7x speed improvement and 3x compile time memory.
      
      One drawback of the patch is that for the larger initializers the precise
      locations for -Wconversion warnings are gone when initializing signed char
      (or char when it is signed) arrays.
      
      If that is important, perhaps c_maybe_optimize_large_byte_initializer could
      tell the caller this is the case and c_parser_initval could emit the
      warnings directly when it still knows the location_t and suppress warnings
      on the RAW_DATA_CST.
      
      2024-10-16  Jakub Jelinek  <jakub@redhat.com>
      
      	* c-tree.h (c_maybe_optimize_large_byte_initializer): Declare.
      	* c-parser.cc (c_parser_initval): Attempt to optimize large char array
      	initializers into RAW_DATA_CST.
      	* c-typeck.cc (c_maybe_optimize_large_byte_initializer): New function.
      
      	* c-c++-common/init-1.c: New test.
      	* c-c++-common/init-2.c: New test.
      	* c-c++-common/init-3.c: New test.
      f9bac238
    • Jakub Jelinek's avatar
      gimplify: Small RAW_DATA_CST gimplification fix · 60ad1e40
      Jakub Jelinek authored
      I've noticed the following testcase hangs during gimplification.
      
      While it is gimplifying an assignment from a VAR_DECL .LCNNN to MEM_REF,
      because the VAR_DECL is TREE_READONLY, it will happily pick its initializer
      and try to gimplify that, which means recursing to the exact same code.
      
      The following patch fixes that by just gimplifying the lhs and building
      assignment, because the code decided that it should use copying from
      a static var.
      
      2024-10-16  Jakub Jelinek  <jakub@redhat.com>
      
      	* gimplify.cc (gimplify_init_ctor_eval): For larger RAW_DATA_CST,
      	just gimplify cref as lvalue and add gimple assignment of rctor
      	to cref instead of going through gimplification of INIT_EXPR, as
      	the latter can suffer from infinite recursion.
      
      	* c-c++-common/cpp/embed-24.c: New test.
      60ad1e40
    • Jakub Jelinek's avatar
      libcpp, c, middle-end: Optimize initializers using #embed in C · 1844a4aa
      Jakub Jelinek authored
      This patch actually optimizes #embed, so far in C.
      
      For a simple testcase (for 494447200 bytes long cc1plus):
      cat embed-11.c
      unsigned char a[] = {
        #embed "cc1plus"
      };
      time ./xgcc -B ./ -S -std=c23 -O2 embed-11.c
      
      real    0m13.647s
      user    0m7.157s
      sys     0m2.597s
      time ./xgcc -B ./ -c -std=c23 -O2 embed-11.c
      
      real    0m28.649s
      user    0m26.653s
      sys     0m1.958s
      
      and when configured against binutils with .base64 support
      time ./xgcc -B ./ -S -std=c23 -O2 embed-11.c
      
      real    0m4.283s
      user    0m2.288s
      sys     0m0.859s
      time ./xgcc -B ./ -c -std=c23 -O2 embed-11.c
      
      real    0m6.888s
      user    0m5.876s
      sys     0m1.002s
      
      (all times with --enable-checking=yes,rtl,extra compiler).
      
      Even just
      ./cc1plus -E -o embed-11.i embed-11.c
      (which doesn't have this optimization yet and so preprocesses it as
      1.3GB preprocessed file) needed almost 25GB of compile time RAM (but
      preprocessed fine).
      And compiling that embed-11.i with -std=c23 -O0 by unpatched gcc
      I gave up after 400 seconds when it already ate 45GB of RAM and didn't
      produce a single byte into embed-11.s yet.
      
      The patch introduces a new CPP_EMBED token which contains raw memory image
      virtually representing a sequence of int literals.
      To simplify the parsing complexities, the preprocessor guarantees CPP_EMBED
      is only emitted if there are 4+ (it actually does that for 64+ right now)
      literals in the sequence and emits CPP_NUMBER CPP_COMMA CPP_EMBED CPP_COMMA
      CPP_NUMBER tokens (with more CPP_EMBED separated by CPP_COMMA if it is
      longer than 2GB, as STRING_CSTs in GCC and also the new RAW_DATA_CST etc.
      are limited to INT_MAX elements).  The main reason is that the preprocessor
      doesn't really know in which context #embed directive appears, there could
      be e.g.
      { 25 *
        #embed "whatever"
      * 2 - 15 }
      or similar and dealing with this special case deep in the expression parsing
      is undesirable.
      With the CPP_NUMBERs around it, I believe in the C FE the only places which
      need handling of the CPP_EMBED token are initializer parsing (that is the
      only one which adds actual optimizations for it), comma expressions (I
      believe nothing really cares whether it is 25,13,95 or
      25,13,0,1,2,3,4,5,6,7,8,9,10,13,95 etc., so besides the 2 outer CPP_NUMBER
      the parsing just adds one INTEGER_CST to the comma expression, I doubt users
      want to be spammed with millions of -Wunused warnings per #embed),
      whatever uses c_parser_expr_list (function calls, attribute arguments,
      OpenMP sizes clause argument, OpenACC tile clause argument and whatever uses
      c_parser_get_builtin_args (mainly for __builtin_shufflevector).  Please correct
      me if I'm wrong.
      
      The patch introduces a RAW_DATA_CST tree code, which can then be used inside
      of array CONSTRUCTOR elt values.  In some sense RAW_DATA_CST is similar to
      STRING_CST, but right now STRING_CST is used only if the whole array
      initializer is that constant, while RAW_DATA_CST at index idx (should be
      always INTEGER_CST index, another advantage of the CPP_NUMBER around is that
      [30 ... 250] =
        #embed "whatever"
      really does what it would do with a integer sequence there) stands for
      [idx] = RAW_DATA_POINTER (val)[0],
      [idx+1] = RAW_DATA_POINTER (val)[1],
      ...
      [idx+RAW_DATA_LENGTH (val)-1] = RAW_DATA_POINTER (val)[RAW_DATA_LENGTH (val)-1].
      Another important thing is that unlike STRING_CST which has the data
      embedded in it RAW_DATA_CST doesn't own the data, it has RAW_DATA_OWNER
      which owns the data (that can be a STRING_CST, e.g. used for PCH or LTO
      after reading LTO in) or another RAW_DATA_CST (with NULL RAW_DATA_OWNER,
      standing for data owned by libcpp buffers).  The advantage is that it can be
      cheaply peeled off, or split into multiple smaller pieces, e.g. if one uses
      designated initializer to store something into the middle of a 10GB #embed
      array, in no case we need to actually copy data around for that.
      Right now RAW_DATA_CST is only used in initializers of integral arrays where
      the integer type has (host) CHAR_BIT precision, so usually char/signed
      char/unsigned char (for C++ later maybe std::byte); in theory we could say
      allocate 4 times as big buffer for conversions to int array and depending
      on endianity and storage order reversal etc., but I'm not sure if that is
      something that will be actually needed in the wild.
      And an optimization inside of c-common.cc attempts to undo that CPP_NUMBER
      CPP_EMBED CPP_NUMBER division in case one uses #embed the usual way and
      doesn't use the boundary literals in weird ways and the values there match
      the surrounding bytes in the owner buffer.
      
      For LTO, in order to avoid copying perhaps gigabytes long data around,
      the hacks in the streamer out/in cause the data owned by libcpp to be
      streamed right into the stream and streamed back as a STRING_CST which
      owns the data.
      
      2024-10-16  Jakub Jelinek  <jakub@redhat.com>
      
      libcpp/
      	* include/cpplib.h (TTYPE_TABLE): Add CPP_EMBED token type.
      	* files.cc (finish_embed): For limit >= 64 and C preprocessing
      	instead of emitting CPP_NUMBER CPP_COMMA separated sequence for the
      	whole embed emit it just for the first and last byte and in between
      	emit a CPP_EMBED token or tokens if too large.
      gcc/
      	* treestruct.def (TS_RAW_DATA_CST): New.
      	* tree.def (RAW_DATA_CST): New tree code.
      	* tree-core.h (struct tree_raw_data): New type.
      	(union tree_node): Add raw_data_cst member.
      	* tree.h (RAW_DATA_LENGTH, RAW_DATA_POINTER, RAW_DATA_OWNER): Define.
      	(gt_ggc_mx, gt_pch_nx): Declare overloads for tree_raw_data *.
      	* tree.cc (tree_node_structure_for_code): Handle RAW_DATA_CST.
      	(initialize_tree_contains_struct): Handle TS_RAW_DATA_CST.
      	(tree_code_size): Handle RAW_DATA_CST.
      	(initializer_zerop): Likewise.
      	(gt_ggc_mx, gt_pch_nx): Define overloads for tree_raw_data *.
      	* gimplify.cc (gimplify_init_ctor_eval): Handle RAW_DATA_CST.
      	* fold-const.cc (operand_compare::operand_equal_p): Handle
      	RAW_DATA_CST.  Formatting fix.
      	(operand_compare::hash_operand): Handle RAW_DATA_CST.
      	(native_encode_initializer): Likewise.
      	(get_array_ctor_element_at_index): Likewise.
      	(fold): Likewise.
      	* gimple-fold.cc (fold_array_ctor_reference): Likewise.  Formatting
      	fix.
      	* varasm.cc (const_hash_1): Handle RAW_DATA_CST.
      	(initializer_constant_valid_p_1): Likewise.
      	(array_size_for_constructor): Likewise.
      	(output_constructor_regular_field): Likewise.
      	* expr.cc (categorize_ctor_elements_1): Likewise.
      	(expand_expr_real_1) <case ARRAY_REF>: Punt for RAW_DATA_CST.
      	* tree-streamer.cc (streamer_check_handled_ts_structures): Mark
      	TS_RAW_DATA_CST as handled.
      	* tree-streamer-in.cc (streamer_alloc_tree): Handle RAW_DATA_CST.
      	(lto_input_ts_raw_data_cst_tree_pointers): New function.
      	(streamer_read_tree_body): Call it for RAW_DATA_CST.
      	* tree-streamer-out.cc (write_ts_raw_data_cst_tree_pointers): New
      	function.
      	(streamer_write_tree_body): Call it for RAW_DATA_CST.
      	(streamer_write_tree_header): Handle RAW_DATA_CST.
      	* lto-streamer-out.cc (DFS::DFS_write_tree_body): Handle RAW_DATA_CST.
      	* tree-pretty-print.cc (dump_generic_node): Likewise.
      gcc/c-family/
      	* c-ppoutput.cc (token_streamer::stream): Add special code to spell
      	CPP_EMBED token.
      	* c-lex.cc (c_lex_with_flags): Handle CPP_EMBED.  Formatting fix.
      	* c-common.cc (c_parse_error): Handle CPP_EMBED.
      	(braced_list_to_string): Optimize RAW_DATA_CST surrounded by
      	INTEGER_CSTs which match some bytes before or after RAW_DATA_CST in
      	its owner.
      gcc/c/
      	* c-parser.cc (c_parser_braced_init): Handle CPP_EMBED.
      	(c_parser_get_builtin_args): Likewise.
      	(c_parser_expression): Likewise.
      	(c_parser_expr_list): Likewise.
      	* c-typeck.cc (digest_init): Handle RAW_DATA_CST.  Formatting fix.
      	(init_node_successor): New function.
      	(add_pending_init): Handle RAW_DATA_CST.
      	(set_nonincremental_init): Formatting fix.
      	(output_init_element): Handle RAW_DATA_CST.  Formatting fixes.
      	(maybe_split_raw_data): New function.
      	(process_init_element): Use maybe_split_raw_data.  Handle
      	RAW_DATA_CST.
      gcc/testsuite/
      	* c-c++-common/cpp/embed-20.c: New test.
      	* c-c++-common/cpp/embed-21.c: New test.
      	* c-c++-common/cpp/embed-28.c: New test.
      	* gcc.dg/cpp/embed-8.c: New test.
      	* gcc.dg/cpp/embed-9.c: New test.
      	* gcc.dg/cpp/embed-10.c: New test.
      	* gcc.dg/cpp/embed-11.c: New test.
      	* gcc.dg/cpp/embed-12.c: New test.
      	* gcc.dg/cpp/embed-13.c: New test.
      	* gcc.dg/cpp/embed-14.c: New test.
      	* gcc.dg/cpp/embed-15.c: New test.
      	* gcc.dg/cpp/embed-16.c: New test.
      	* gcc.dg/pch/embed-1.c: New test.
      	* gcc.dg/pch/embed-1.hs: New test.
      	* gcc.dg/lto/embed-1_0.c: New test.
      	* gcc.dg/lto/embed-1_1.c: New test.
      1844a4aa
    • Sam James's avatar
      vax: fixup vax.opt.urls · a9e14d2d
      Sam James authored
      Needed after r15-4373-gb388f65abc71c9.
      
      gcc/ChangeLog:
      
      	* config/vax/vax.opt.urls: Adjust index for -mlra.
      a9e14d2d
    • Sam James's avatar
      sparc: drop -mlra · b388f65a
      Sam James authored
      The sparc port gained LRA support in r7-5076-gf99bd883fb0d05 and has
      defaulted to LRA since r7-5642-g70a6dbe7e37e69.
      
      Let's finish the transition by dropping -mlra entirely.
      
      Tested on sparc64-unknown-linux-gnu with no regressions.
      
      gcc/ChangeLog:
      	PR target/113952
      	* config/sparc/sparc.cc (sparc_lra_p): Delete.
      	(TARGET_LRA_P): Ditto.
      	(sparc_option_override): Don't use MASK_LRA.
      	* config/sparc/sparc.md (disabled,enabled): Drop lra attribute.
      	* config/sparc/sparc.opt: Delete -mlra.
      	* config/sparc/sparc.opt.urls: Ditto.
      	* doc/invoke.texi (SPARC options): Drop -mlra and -mno-lra.
      b388f65a
    • Filip Kastl's avatar
      MAINTAINERS: Fix name order · 2813a5bc
      Filip Kastl authored
      
      ChangeLog:
      
      	* MAINTAINERS: Fix Write After Approval name order.
      
      Signed-off-by: default avatarFilip Kastl <fkastl@suse.cz>
      2813a5bc
    • liuhongt's avatar
      Adjust testcase to avoid scan FIX in REG_EQUIV. · a8b4ea1b
      liuhongt authored
      Also add hard_float target to avoid failed on arm-eabi.
      
      gcc/testsuite/ChangeLog:
      
      	PR testsuite/115365
      	* gcc.dg/pr100927.c: Adjust testcase to avoid scan FIX in REG_EQUIV.
      a8b4ea1b
  2. Oct 15, 2024
    • Qing Zhao's avatar
      Provide new GCC builtin __builtin_counted_by_ref [PR116016] · e7380688
      Qing Zhao authored
      With the addition of the 'counted_by' attribute and its wide roll-out
      within the Linux kernel, a use case has been found that would be very
      nice to have for object allocators: being able to set the counted_by
      counter variable without knowing its name.
      
      For example, given:
      
        struct foo {
          ...
          int counter;
          ...
          struct bar array[] __attribute__((counted_by (counter)));
        } *p;
      
      The existing Linux object allocators are roughly:
      
        #define MAX(A, B) (A > B) ? (A) : (B)
        #define alloc(P, FAM, COUNT) ({ \
          __auto_type __p = &(P); \
          size_t __size = MAX (sizeof(*P),
      			 __builtin_offsetof (__typeof(*P), FAM)
      			 + sizeof (*(P->FAM)) * COUNT); \
          *__p = kmalloc(__size); \
        })
      
      Right now, any addition of a counted_by annotation must also
      include an open-coded assignment of the counter variable after
      the allocation:
      
        p = alloc(p, array, how_many);
        p->counter = how_many;
      
      In order to avoid the tedious and error-prone work of manually adding
      the open-coded counted-by intializations everywhere in the Linux
      kernel, a new GCC builtin __builtin_counted_by_ref will be very useful
      to be added to help the adoption of the counted-by attribute.
      
       -- Built-in Function: TYPE __builtin_counted_by_ref (PTR)
           The built-in function '__builtin_counted_by_ref' checks whether the
           array object pointed by the pointer PTR has another object
           associated with it that represents the number of elements in the
           array object through the 'counted_by' attribute (i.e.  the
           counted-by object).  If so, returns a pointer to the corresponding
           counted-by object.  If such counted-by object does not exist,
           returns a null pointer.
      
           This built-in function is only available in C for now.
      
           The argument PTR must be a pointer to an array.  The TYPE of the
           returned value is a pointer type pointing to the corresponding
           type of the counted-by object or a void pointer type in case of a
           null pointer being returned.
      
      With this new builtin, the central allocator could be updated to:
      
        #define MAX(A, B) (A > B) ? (A) : (B)
        #define alloc(P, FAM, COUNT) ({ \
          __auto_type __p = &(P); \
          __auto_type __c = (COUNT); \
          size_t __size = MAX (sizeof (*(*__p)),\
      			 __builtin_offsetof (__typeof(*(*__p)),FAM) \
      			 + sizeof (*((*__p)->FAM)) * __c); \
          if ((*__p = kmalloc(__size))) { \
            __auto_type ret = __builtin_counted_by_ref((*__p)->FAM); \
            *_Generic(ret, void *: &(size_t){0}, default: ret) = __c; \
          } \
        })
      
      And then structs can gain the counted_by attribute without needing
      additional open-coded counter assignments for each struct, and
      unannotated structs could still use the same allocator.
      
      	PR c/116016
      
      gcc/c-family/ChangeLog:
      
      	* c-common.cc: Add new __builtin_counted_by_ref.
      	* c-common.h (enum rid): Add RID_BUILTIN_COUNTED_BY_REF.
      
      gcc/c/ChangeLog:
      
      	* c-decl.cc (names_builtin_p): Add RID_BUILTIN_COUNTED_BY_REF.
      	* c-parser.cc (has_counted_by_object): New routine.
      	(get_counted_by_ref): New routine.
      	(c_parser_postfix_expression): Handle New RID_BUILTIN_COUNTED_BY_REF.
      	* c-tree.h: New routine handle_counted_by_for_component_ref.
      	* c-typeck.cc (handle_counted_by_for_component_ref): New routine.
      	(build_component_ref): Call the new routine.
      
      gcc/ChangeLog:
      
      	* doc/extend.texi: Add documentation for __builtin_counted_by_ref.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.dg/builtin-counted-by-ref-1.c: New test.
      	* gcc.dg/builtin-counted-by-ref.c: New test.
      e7380688
    • Jakub Jelinek's avatar
      c: Implement C2Y N3355 - Named Loops [PR117022] · 50f27896
      Jakub Jelinek authored
      The following patch implements the C2Y N3355 - Named Loops paper.
      
      I've tried to implement it lazily, rather than proactively e.g. push
      labels to a vector just in case the following statement is iteration
      statement, switch statement or one of the loop pragmas followed by
      iteration statement the patch just notes the last statement in
      cur_stmt_list if any before c_parser_label/c_parser_all_labels and
      passes it down to the iteration/switch statement parsing routines,
      which then search backward for LABEL_EXPRs before they reach the given
      stop statement.
      
      The patch then adds one extra argument to
      {FOR,WHILE,DO,BREAK,CONTINUE,SWITCH}_STMT, which is set to a canonical
      name LABEL_DECL (the last named label before the construct).
      If one just refers to the innermost construct with a fancy name,
      it is in the end parsed the same as break/continue without an identifier
      (i.e. NULL_TREE argument), and if a loop or switch has name(s) but
      break/continue to that isn't used, the name is set to NULL_TREE.
      At c-gimplify.cc time the name is then pushed into a hash map mapping
      it to a pair of labels.
      
      I've implemented it also for ObjC foreach loops (which have break/continue
      handled during parsing, not during c-gimplify.cc).
      
      As for OpenMP/OpenACC, the patch right now pretends no OpenMP loop
      has a name, until something different is decided in the standard.
      As shown in the testcases, most break identifier/continue identifier
      cases aren't really useful in OpenMP code, a break identifier or
      continue identifier jumping out of an OpenMP region is certainly invalid
      (such regions have to be single entry single exit, so escaping it
      through goto/break lab/continue lab violates that), similarly break
      is disallowed in the innermost OpenMP nested loop, just continue
      is allowed, so the only thing that would make sense for OpenMP (second
      gomp testcase) would be allowing to give name to the innermost
      loop in OpenMP canonical loop nest (except that labels aren't allowed
      in the syntax right now in between the loops) and only continue to
      that label.  For collapse(1) loops that would be a label before
      the #pragma or [[omp::directive (parallel for)]] etc.  And of course,
      what already works fine in the patch is break/continue to non-OpenMP loops
      nested in OpenMP loops.
      
      2024-10-12  Jakub Jelinek  <jakub@redhat.com>
      
      	PR c/117022
      gcc/c-family/
      	* c-common.def (FOR_STMT, WHILE_STMT, DO_STMT, BREAK_STMT,
      	CONTINUE_STMT, SWITCH_STMT): Add an extra operand, *_NAME
      	and document it.
      	* c-common.h (bc_hash_map_t): New typedef.
      	(struct bc_state): Add bc_hash_map member.
      	(WHILE_NAME, DO_NAME, FOR_NAME, BREAK_NAME, CONTINUE_NAME,
      	SWITCH_STMT_NAME): Define.
      	* c-pretty-print.cc (c_pretty_printer::statement): Print
      	BREAK_STMT or CONTINUE_STMT operand if any.
      	* c-gimplify.cc (bc_hash_map): New static variable.
      	(note_named_bc, release_named_bc): New functions.
      	(save_bc_state): Save and clear bc_hash_map.
      	(restore_bc_state): Assert NULL and restore bc_hash_map.
      	(genericize_c_loop): Add NAME argument, call note_named_bc
      	and release_named_bc if non-NULL around the body walk.
      	(genericize_for_stmt, genericize_while_stmt, genericize_do_stmt):
      	Adjust callers of it.
      	(genericize_switch_stmt): Rename break_block variable to blab.
      	Call note_named_bc and release_named_bc if SWITCH_STMT_NAME is
      	non-NULL around the body walk.
      	(genericize_continue_stmt): Handle non-NULL CONTINUE_NAME.
      	(genericize_break_stmt): Handle non-NULL BREAK_NAME.
      	(c_genericize): Delete and clear bc_hash_map.
      gcc/c/
      	* c-tree.h: Implement C2Y N3355 - Named loops.
      	(C_DECL_LOOP_NAME, C_DECL_SWITCH_NAME, C_DECL_LOOP_SWITCH_NAME_VALID,
      	C_DECL_LOOP_SWITCH_NAME_USED, IN_NAMED_STMT): Define.
      	(c_get_loop_names, c_release_loop_names, c_finish_bc_name): Declare.
      	(c_start_switch): Add NAME argument.
      	(c_finish_bc_stmt): Likewise.
      	* c-lang.h (struct language_function): Add loop_names and
      	loop_names_hash members.
      	* c-parser.cc (c_parser_external_declaration,
      	c_parser_declaration_or_fndef, c_parser_struct_or_union_specifier,
      	c_parser_parameter_declaration): Adjust c_parser_pragma caller.
      	(get_before_labels): New function.
      	(c_parser_compound_statement_nostart): Call get_before_labels when
      	needed, adjust c_parser_pragma and c_parser_statement_after_labels
      	callers.
      	(c_parser_statement): Call get_before_labels first and pass it to
      	c_parser_statement_after_labels.
      	(c_parser_bc_name): New function.
      	(c_parser_statement_after_labels): Add BEFORE_LABELS argument.  Pass
      	it down to c_parser_switch_statement, c_parser_while_statement,
      	c_parser_do_statement, c_parser_for_statement and c_parser_pragma.
      	Call c_parser_bc_name for RID_BREAK and RID_CONTINUE and pass it as
      	another argument to c_finish_bc_stmt.
      	(c_parser_if_body, c_parser_else_body): Call get_before_labels
      	early and pass it to c_parser_statement_after_labels.
      	(c_parser_switch_statement): Add BEFORE_LABELS argument.  Call
      	c_get_loop_names, if named, pass switch_name to c_start_switch,
      	mark it valid and set IN_NAMED_STMT bit in in_statement before
      	parsing body, otherwise clear IN_NAMED_STMT bit before that parsing.
      	Run c_release_loop_names at the end.
      	(c_parser_while_statement, c_parser_do_statement,
      	c_parser_for_statement): Add BEFORE_LABELS argument.  Call
      	c_get_loop_names, if named, mark it valid and set IN_NAMED_STMT bit
      	in in_statement before parsing body, otherwise clear IN_NAMED_STMT
      	before that parsing, arrange for the loop name if used to be
      	another *_STMT argument.
      	(c_parser_objc_class_instance_variables,
      	c_parser_objc_methodprotolist): Adjust c_parser_pragma callers.
      	(c_parser_pragma): Add BEFORE_LABELS argument.  Pass it down to
      	c_parser_for_statement, c_parser_while_statement or
      	c_parser_do_statement.
      	(c_parser_omp_loop_nest, c_maybe_parse_omp_decl): Adjust
      	c_parser_pragma callers.
      	* c-decl.cc (loop_names, loop_names_hash): New static variables.
      	(add_stmt): Set STATEMENT_LIST_HAS_LABEL after push_stmt_list rather
      	than before it.
      	(c_push_function_context): Save and clear loop_names and
      	loop_names_hash.
      	(c_pop_function_context): Release or delete, restore and clear
      	loop_names and loop_names_hash.
      	(c_get_loop_names, c_release_loop_names, c_finish_bc_name): New
      	functions.
      	* c-typeck.cc (c_start_switch): Add SWITCH_NAME argument, pass it down
      	to build_stmt.
      	(c_finish_bc_stmt): Add NAME argument.  Mark of IN_NAMED_STMT bit
      	of in_statement in swtiches.  Use label for IN_OBJC_FOREACH only if
      	name is NULL.  If name is non-NULL and C_DECL_LOOP_NAME and
      	C_DECL_SWITCH_NAME are both set, assume outer ObjC foreach and
      	dig labels from DECL_CHAIN of name.  Pass NAME to build_stmt
      	otherwise.
      gcc/cp/
      	* semantics.cc (begin_while_stmt, begin_do_stmt, begin_for_stmt,
      	finish_break_stmt, finish_continue_stmt, begin_switch_stmt): Pass
      	another NULL_TREE to build_stmt calls.
      gcc/testsuite/
      	* gcc.dg/c23-named-loops-1.c: New test.
      	* gcc.dg/c23-named-loops-5.c: New test.
      	* gcc.dg/c2y-named-loops-1.c: New test.
      	* gcc.dg/c2y-named-loops-2.c: New test.
      	* gcc.dg/c2y-named-loops-4.c: New test.
      	* gcc.dg/c2y-named-loops-5.c: New test.
      	* gcc.dg/c2y-named-loops-6.c: New test.
      	* gcc.dg/c2y-named-loops-7.c: New test.
      	* gcc.dg/gnu99-named-loops-1.c: New test.
      	* gcc.dg/gnu99-named-loops-2.c: New test.
      	* gcc.dg/gnu99-named-loops-3.c: New test.
      	* gcc.dg/gnu99-named-loops-4.c: New test.
      	* gcc.dg/gnu2y-named-loops-3.c: New test.
      	* gcc.dg/gomp/named-loops-1.c: New test.
      	* gcc.dg/gomp/named-loops-2.c: New test.
      	* objc.dg/named-loops-1.m: New test.
      50f27896
    • Patrick Palka's avatar
      c++: add fixed testcase [PR80637] · b110e092
      Patrick Palka authored
      Fixed by r15-4340-gcacbb4daac3e9a.
      
      	PR c++/80637
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/cpp2a/concepts-fn9.C: New test.
      b110e092
    • Jakub Jelinek's avatar
      match.pd: Further fma negation fixes [PR116891] · 4366f0c7
      Jakub Jelinek authored
      On Mon, Oct 14, 2024 at 08:53:29AM +0200, Jakub Jelinek wrote:
      > >     PR middle-end/116891
      > >     * match.pd ((negate (IFN_FNMS@3 @0 @1 @2)) -> (IFN_FMA @0 @1 @2)):
      > >     Only enable for !HONOR_SIGN_DEPENDENT_ROUNDING.
      >
      > Guess it would be nice to have a testcase which FAILs without the patch and
      > PASSes with it, but it can be added later.
      
      I've added such a testcase now, and additionally found the fix only fixed
      one of the 4 problematic similar cases.
      
      Here is a patch which fixes the others too and adds the testcases.
      fma-pr116891.c FAILed without your patch, FAILs with your patch too (but
      only due to the bar/baz/qux checks) and PASSes with the patch.
      
      2024-10-15  Jakub Jelinek  <jakub@redhat.com>
      
      	PR middle-end/116891
      	* match.pd ((negate (fmas@3 @0 @1 @2)) -> (IFN_FNMS @0 @1 @2)):
      	Only enable for !HONOR_SIGN_DEPENDENT_ROUNDING.
      	((negate (IFN_FMS@3 @0 @1 @2)) -> (IFN_FNMA @0 @1 @2)): Likewise.
      	((negate (IFN_FNMA@3 @0 @1 @2)) -> (IFN_FMS @0 @1 @2)): Likewise.
      
      	* gcc.dg/pr116891.c: New test.
      	* gcc.target/i386/fma-pr116891.c: New test.
      4366f0c7
    • Patrick Palka's avatar
      c++: unifying lvalue vs rvalue (non-forwarding) ref [PR116710] · 8161c4ad
      Patrick Palka authored
      
      When unifying two (non-forwarding) reference types, unify immediately
      recurses into the referenced type without first comparing rvalueness.
      (Note that at this point forwarding references and other reference
      parameters have already been stripped to their referenced type by
      maybe_adjust_types_for_deduction, so this code path applies only to
      nested reference types.)
      
      	PR c++/116710
      
      gcc/cp/ChangeLog:
      
      	* pt.cc (unify) <case REFERENCE_TYPE>: Compare rvalueness.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/template/unify12.C: New test.
      
      Reviewed-by: default avatarJason Merrill <jason@redhat.com>
      8161c4ad
    • Patrick Palka's avatar
      c++: checking ICE w/ constexpr if and lambda as def targ [PR117054] · bb2bfdb2
      Patrick Palka authored
      
      Here we're tripping over the assert in extract_locals_r which enforces
      that an extra-args tree appearing inside another extra-args tree doesn't
      actually have extra args.  This invariant doesn't always hold for lambdas
      (which recently gained the extra-args mechanism) but that should be
      harmless since cp_walk_subtrees doesn't walk LAMBDA_EXPR_EXTRA_ARGS and
      so should be immune to the PR114303 issue for now.  So let's just disable
      this assert for lambdas.
      
      	PR c++/117054
      
      gcc/cp/ChangeLog:
      
      	* pt.cc (extract_locals_r): Disable tree_extra_args assert
      	for LAMBDA_EXPR.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/cpp2a/lambda-targ9.C: New test.
      
      Reviewed-by: default avatarJason Merrill <jason@redhat.com>
      bb2bfdb2
    • Uros Bizjak's avatar
      testsuite/i386: Require AVX2 effective target in pr107432-9.c · 0fa5017d
      Uros Bizjak authored
      x86-64-v3 requires AVX2 effective target and AVX2 specific avx2-check.h.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/i386/pr107432-9.c: Require AVX2 effective target.
      	Include avx2-check.h instead of avx-check.h.  Define TEST to avx2_test.
      0fa5017d
    • Andrew Pinski's avatar
      C++: Regenerate c.opt.urls [PR117157] · a72064c8
      Andrew Pinski authored
      
      I forgot to regenerate the c.opt.urls files after adding the opindex for changes-meaning.
      Fixed thusly.
      
      gcc/c-family/ChangeLog:
      
      	PR c++/117157
      	* c.opt.urls: Regenerate.
      
      Signed-off-by: default avatarAndrew Pinski <quic_apinski@quicinc.com>
      a72064c8
    • Andrew Pinski's avatar
      C++: Add opindex for -Wchanges-meaning [PR117157] · 11f0ea45
      Andrew Pinski authored
      
      Adds missing opindex for -Wchanges-meaning
      
      Pushed as obvious after building the HTML and checking the index.
      
      gcc/ChangeLog:
      
      	PR c++/117157
      	* doc/invoke.texi (Wno-changes-meaning): Add opindex.
      
      Signed-off-by: default avatarAndrew Pinski <quic_apinski@quicinc.com>
      11f0ea45
    • David Malcolm's avatar
      testsuite: simplify analyzer_cpython_plugin.c · 77076d85
      David Malcolm authored
      
      No functional change intended.
      
      gcc/testsuite/ChangeLog:
      	* gcc.dg/plugin/analyzer_cpython_plugin.c: Use success_call_info
      	in a couple of places to avoid reimplementing get_desc.
      
      Signed-off-by: default avatarDavid Malcolm <dmalcolm@redhat.com>
      77076d85
    • David Malcolm's avatar
      testsuite, jit: fix test-error-pr63969-missing-driver.c · f8dcb559
      David Malcolm authored
      
      jit.dg/test-error-pr63969-missing-driver.c tries to break PATH and
      verify that an error is generated when using an external driver.
      
      However it does this by unsetting PATH, and so the test could
      accidentally find the driver if the system supplies a default and the
      driver happens to be installed in that path (reported as rhbz#2318021).
      
      Fix the test by instead setting PATH to a bogus value.
      
      gcc/testsuite/ChangeLog:
      	* jit.dg/test-error-pr63969-missing-driver.c (create_code): When
      	breaking PATH, use setenv with a bogus value, rather than
      	unsetenv, in case the system uses a default path that contains
      	the driver binary.
      
      Signed-off-by: default avatarDavid Malcolm <dmalcolm@redhat.com>
      f8dcb559
    • Uros Bizjak's avatar
      i386: Fix expand_vector_set for VEC_MERGE/VEC_DUPLICATE RTX [PR117116] · 80d70320
      Uros Bizjak authored
      Middle end can generate SYMBOL_REF RTX as a value "val" in the call
      to expand_vector_set, but SYMBOL_REF RTX is not accepted in
      <sse2p4_1>_pinsr<ssemodesuffix> insn pattern, generated via
      VEC_MERGE/VEC_DUPLICATE RTX path.
      
      Force the value into a register before VEC_MERGE/VEC_DUPLICATE RTX
      is generated if it doesn't satisfy nonimmediate_operand predicate.
      
      	PR target/117116
      
      gcc/ChangeLog:
      
      	* config/i386/i386-expand.cc (expand_vector_set): Force "val"
      	into a register before VEC_MERGE/VEC_DUPLICATE RTX is generated
      	if it doesn't satisfy nonimmediate_operand predicate.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/i386/pr117116.c: New test.
      80d70320
    • Andrew Pinski's avatar
      dce: Remove FIXME that has not been true for years · 8065982a
      Andrew Pinski authored
      
      This FIXME:
         FIXME: Aggressive mode before PRE doesn't work currently because
      	  the dominance info is not invalidated after DCE1.
      
      Has not been true since at least r0-104723-g5ac60b564faa85 which
      added a call to calculate_dominance_info. Plus we run agressive mode
      before PRE since r0-89162-g11b08ee9118d10 too. And since r0-95499-gb5b8b0ac643d31,
      dominance information was required even for non-agressive mode.
      
      Also we have been verifying dominance information is correct and not needing to invalidate
      since ssa branch was merged so this comment has been out of date even before it was merged in.
      
      gcc/ChangeLog:
      
      	* tree-ssa-dce.cc (perform_tree_ssa_dce): Remove FIXME note.
      
      Signed-off-by: default avatarAndrew Pinski <quic_apinski@quicinc.com>
      8065982a
    • Andrew Pinski's avatar
      passes: Remove limit on the number of params · 061a4e35
      Andrew Pinski authored
      
      Having a limit of 2 params for NEXT_PASS was just done because I didn't think there was
      a way to handle arbitrary number of params. But I found that we can handle this
      via a static const variable array (constexpr so we know it is true or false at compile time)
      and just loop over the array.
      
      Note I keep around NEXT_PASS_WITH_ARG and NEXT_PASS macros instead of always using
      NEXT_PASS_WITH_ARGS macro to make sure these cases get optimized for -O0 (stage1).
      
      Tested INSERT_PASS_AFTER/INSERT_PASS_BEFORE manually by changing config/i386/i386-passes.def's
      stv lines to have a 2nd argument and checked the resuling pass-instances.def to see the NEXT_PASS_WITH_ARGS
      was correctly done.
      
      changes from v1:
      * v2: Handle INSERT_PASS_AFTER/INSERT_PASS_BEFORE too.
      
      Bootstrapped and tested on x86_64-linux-gnu.
      
      gcc/ChangeLog:
      
      	* gen-pass-instances.awk: Remove the limit of the params.
      	* pass_manager.h (NEXT_PASS_WITH_ARG2): Rename to ...
      	(NEXT_PASS_WITH_ARGS): This.
      	* passes.cc (NEXT_PASS_WITH_ARG2): Rename to ...
      	(NEXT_PASS_WITH_ARGS): This and support more than 2 params by using
      	a constexpr array.
      
      Signed-off-by: default avatarAndrew Pinski <quic_apinski@quicinc.com>
      061a4e35
    • Jonathan Wakely's avatar
      libstdc++: Implement LWG 3798 for range adaptors [PR106676] · 7f65f949
      Jonathan Wakely authored
      
      LWG 3798 modified the iterator_category of the iterator types for
      transform_view, join_with_view, zip_transform_view and
      adjacent_transform_view, to allow the iterator's reference type to be an
      rvalue reference.
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/106676
      	* include/bits/iterator_concepts.h (__cpp17_fwd_iterator): Use
      	is_reference instead of is_value_reference.
      	rvalue references.
      	* include/std/ranges (transform_view:__iter_cat::_S_iter_cat):
      	Likewise.
      	(zip_transform_view::__iter_cat::_S_iter_cat): Likewise.
      	(adjacent_transform_view::__iter_cat::_S_iter_cat): Likewise.
      	(join_with_view::__iter_cat::_S_iter_cat): Likewise.
      	* testsuite/std/ranges/adaptors/transform.cc: Check
      	iterator_category when the transformation function returns an
      	rvalue reference type.
      
      Reviewed-by: default avatarPatrick Palka <ppalka@redhat.com>
      7f65f949
    • Richard Biener's avatar
      tree-optimization/116907 - stale BLOCK reference from DECL_VALUE_EXPR · 7d15248d
      Richard Biener authored
      When we remove unused BLOCKs we fail to clean references to them
      from DECL_VALUE_EXPRs of variables in other BLOCKs which in the
      PR causes LTO streaming to walk into pointers to GGC freed blocks.
      
      There's the question of whether such DECL_VALUE_EXPRs should keep
      variables and blocks referenced live (it doesn't seem to do that)
      and whether such DECL_VALUE_EXPRs should have survived in the
      first place.
      
      	PR tree-optimization/116907
      	* tree-ssa-live.cc (clear_unused_block_pointer_in_block): New
      	helper.
      	(clear_unused_block_pointer): Call it.
      7d15248d
    • Pan Li's avatar
      Match: Remove dup match pattern for signed_integer_sat_sub [PR117141] · 97f98855
      Pan Li authored
      
      This patch would like to fix the warning as below:
      
      /home/slyfox/dev/git/gcc/gcc/match.pd:3424:3 warning: duplicate pattern
       (cond^ (ne (imagpart (IFN_SUB_OVERFLOW:c@2 @0 @1)) integer_zerop)
        ^
      /home/slyfox/dev/git/gcc/gcc/match.pd:3397:3 warning: previous pattern
      defined here
       (cond^ (ne (imagpart (IFN_SUB_OVERFLOW@2 @0 @1)) integer_zerop)
      
      The second has a optional nop_convert which allows for the first one,
      thus remove the dup one.
      
      The below test suites are passed for this patch.
      * The rv64gcv fully regression test.
      * The x86 bootstrap test.
      * The x86 fully regression test.
      
      	PR middle-end/117141
      
      gcc/ChangeLog:
      
      	* match.pd: Remove the dup pattern for signed SAT_SUB.
      
      Signed-off-by: default avatarPan Li <pan2.li@intel.com>
      97f98855
    • Tamar Christina's avatar
      AArch64: re-enable memory access costing after SLP change. · a1540bb8
      Tamar Christina authored
      While chasing down a costing difference between SLP and non-SLP for memory
      access costing I noticed that at some point the SLP and non-SLP costing have
      diverged.  It used to be we only supported LOAD_LANES in SLP and so the non-SLP
      costing was working fine.
      
      But with the change to SLP only we now lost costing.
      
      It looks like the vectorizer for non-SLP stores the VMAT type in
      STMT_VINFO_MEMORY_ACCESS_TYPE on the stmt_info, but for SLP it stores it in
      SLP_TREE_MEMORY_ACCESS_TYPE which is on the SLP node itself.
      
      While my first attempt of a patch was to just also store the VMAT in the
      stmt_info https://gcc.gnu.org/pipermail/gcc-patches/2024-October/665295.html
      Richi pointed out that this goes wrong when the same access is used Hybrid.
      
      And so we have to do a backend specific fix.  To help out other backends this
      also introduces a generic helper function suggested by Richi in that patch
      (I hope that's ok.. I didn't want to split out just the helper.)
      
      This successfully restores VMAT based costing in the new SLP only world.
      
      gcc/ChangeLog:
      
      	* tree-vectorizer.h (vect_mem_access_type): New.
      	* config/aarch64/aarch64.cc (aarch64_ld234_st234_vectors): Use it.
      	(aarch64_detect_vector_stmt_subtype): Likewise.
      	(aarch64_adjust_stmt_cost): Likewise.
      	(aarch64_vector_costs::count_ops): Likewise.
      	(aarch64_vector_costs::add_stmt_cost): Make SLP node named.
      a1540bb8
Loading