Skip to content
Snippets Groups Projects
  1. Nov 16, 2024
    • Georg-Johann Lay's avatar
      AVR: Fix building LibF7 after switching to C23. · 307b1117
      Georg-Johann Lay authored
      Since r15-5327, GNU-C23 is being used as C language default.
      libf7.h doesn't assume headers like stdbool.h are present
      and defines bool, true and false on its own.
      
      libgcc/config/avr/libf7/
      	* libf7.h (bool, true, false): Don't define in C23 or higher.
      307b1117
    • Andrew Pinski's avatar
      match: Optimize `max(a,b) == 0` to `(a|b) == 0` for unsigned [PR115275] · b085fc99
      Andrew Pinski authored
      
      For unsigned types, you can optimize `max<a,b> == 0` into
      `(a|b) == 0` (that is both have to be zero). A similar thing happens for `!= 0`.
      This optimization fixes the missed optimization (g++.dg/tree-ssa/pr115275.C)
      that was reported exposed by adding phiprop early.
      
      Bootstrapped and tested on x86_64-linux-gnu.
      
      	PR tree-optimization/115275
      
      gcc/ChangeLog:
      
      	* match.pd (umax(a,b) ==/!= 0): New pattern.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/tree-ssa/pr115275.C: New test.
      	* gcc.dg/tree-ssa/max_eqne-1.c: New test.
      	* gcc.dg/tree-ssa/max_eqne-2.c: New test.
      
      Signed-off-by: default avatarAndrew Pinski <quic_apinski@quicinc.com>
      b085fc99
    • Eikansh Gupta's avatar
      MATCH: Simplify `min(a, b) op max(a, b)` to `a op b` [PR109401] · 5eadc673
      Eikansh Gupta authored
      
      This patch simplify `min(a,b) op max(a,b)` to `a op b`. This optimization
      will work for all the binary commutative operations. So, the `op` here can
      be one of {plus, mult, bit_and, bit_xor, bit_ior, eq, ne, min, max}.
      
      	PR tree-optimization/109401
      
      gcc/ChangeLog:
      
      	* match.pd (min(a,b) op max(a,b) -> a op b): New pattern.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.dg/tree-ssa/pr109401.c: New test.
      	* gcc.dg/tree-ssa/pr109401-1.c: New test.
      
      Signed-off-by: default avatarEikansh Gupta <quic_eikagupt@quicinc.com>
      5eadc673
    • Andrew Pinski's avatar
      libiberity: ANSIfy test-demangle.c · 94bea5dd
      Andrew Pinski authored
      
      Some of the function definitions used K&R style definitions (but not all).
      This just moves them all to be ANSI C
      
      Bootstrapped and tested on x86_64-linux-gnu.
      
      libiberty/ChangeLog:
      
      	* testsuite/test-demangle.c (get_line): Change K&R style
      	definition into ANSI C90 definitions.
      	(fail): Likewise.
      	(main): Likewise.
      
      Signed-off-by: default avatarAndrew Pinski <quic_apinski@quicinc.com>
      94bea5dd
    • Georg-Johann Lay's avatar
      AVR: target/116781 - Fix ICE due to (clobber (match_dup)) in tablejump. · 083892ba
      Georg-Johann Lay authored
      This patch avoids (clobber (match_dup)) in insn patterns for tablejump.
      The machine description now uses a scratch_operand instead which is
      possible since the clobbered entity is known in advance:
      
      3-byte PC        : REG_Z
      2-byte PC + JMP  : REG_Z
      2-byte PC + RJMP : None, hence scratch:HI is used.
      
      The avr-casesi pass and optimization has to be adjusted to the new patterns.
      
      	PR target/116781
      gcc/
      	* config/avr/avr.md (*tablejump_split, *tablejump): Add
      	operand 2 as a "scratch_operand" instead of a match_dup.
      	(casesi): Adjust expander operands accordingly.  Use a scratch:HI
      	when the jump address is not clobbered.  This is the case for a
      	2-byte PC + has no JMP instruction.  In all the other cases, the
      	affected operand is REG_Z (reg:HI 30).
      	(casesi_<mode>_sequence): Adjust matcher to new anatomy.
      	* config/avr/avr-passes.cc (avr_is_casesi_sequence)
      	(avr_is_casesi_sequence, avr_optimize_casesi)
      	(avr_casei_sequence_check_operands): Adjust to new anatomy.
      083892ba
    • Georg-Johann Lay's avatar
      AVR: target/117500 - Use output_operand_lossage in avr_print_operand. · 02d73709
      Georg-Johann Lay authored
      	PR target/117500
      gcc/
      	* config/avr/avr.cc (avr_print_operand) [code = 'i']: Use
      	output_operand_lossage on bad operands instead of fatal_insn.
      02d73709
    • Georg-Johann Lay's avatar
      AVR: Add an RTL peephole to tweak lower_reg:QI o= cst. · bbfba1cc
      Georg-Johann Lay authored
      For operations like  X o= CST, regalloc may spill l-reg X to a d-reg:
         D =  X
         D o= CST
         X =  D
      where it is better to instead
         D =  CST
         X o= D
      This patch adds an according RTL peephole.
      
      gcc/
      	* config/avr/avr.md: Add a peephole2 that improves bit operations
      	with a lower register and a constant.
      bbfba1cc
    • Jeff Law's avatar
      [committed] RISC-V testsuite adjustments for c23 · e30bc91e
      Jeff Law authored
      Mix of fixes and workarounds by passing in -std=gnu17.  The former is the
      preferred approach, but occasionally we have code that's just fugly to fix.
      
      gcc/testsuite/
      	* gcc.target/riscv/cmo-32.c: Pass in -std=gnu17.
      	* gcc.target/riscv/cmo-64.c: Likewise.
      	* gcc.target/riscv/pr98777.c: Likewise.
      	* gcc.target/riscv/rvv/vsetvl/pr115214.c: Likewise.
      	* gcc.target/riscv/rvv/autovec/pr113469.c: Likewise.
      	* gcc.target/riscv/rvv/autovec/pr111391-1.c: Fix prototype for c23.
      	* gcc.target/riscv/rvv/vsetvl/vsetvl_bug-1.c: Likewise.
      	* gcc.target/riscv/sum-of-two-s12-const-2.c: Likewise.
      	* gcc.target/riscv/target-attr-01.c: Likewise.
      	* gcc.target/riscv/target-attr-02.c: Likewise.
      	* gcc.target/riscv/target-attr-03.c: Likewise.
      	* gcc.target/riscv/target-attr-04.c: Likewise.
      	* gcc.target/riscv/target-attr-05.c: Likewise.
      	* gcc.target/riscv/target-attr-06.c: Likewise.
      	* gcc.target/riscv/target-attr-07.c: Likewise.
      	* gcc.target/riscv/target-attr-08.c: Likewise.
      	* gcc.target/riscv/target-attr-09.c: Likewise.
      	* gcc.target/riscv/target-attr-10.c: Likewise.
      	* gcc.target/riscv/target-attr-11.c: Likewise.
      	* gcc.target/riscv/target-attr-12.c: Likewise.
      	* gcc.target/riscv/target-attr-13.c: Likewise.
      	* gcc.target/riscv/target-attr-14.c: Likewise.
      	* gcc.target/riscv/target-attr-15.c: Likewise.
      	* gcc.target/riscv/target-attr-bad-01.c: Likewise.
      	* gcc.target/riscv/target-attr-bad-02.c: Likewise.
      	* gcc.target/riscv/target-attr-bad-03.c: Likewise.
      	* gcc.target/riscv/target-attr-bad-04.c: Likewise.
      	* gcc.target/riscv/target-attr-bad-05.c: Likewise.
      	* gcc.target/riscv/target-attr-bad-06.c: Likewise.
      	* gcc.target/riscv/target-attr-bad-07.c: Likewise.
      	* gcc.target/riscv/target-attr-bad-08.c: Likewise.
      	* gcc.target/riscv/target-attr-bad-09.c: Likewise.
      	* gcc.target/riscv/target-attr-bad-10.c: Likewise.
      e30bc91e
    • Jeff Law's avatar
      [committed] Adjust ARC tests after c23 changes · 9c18fe50
      Jeff Law authored
      This test passes different kinds of objects to the underlying function.  So
      just pass in -std=gnu17.
      
      gcc/testsuite
      	* gcc.target/arc/add_n-combine.c: Pass in -std=gnu17.
      9c18fe50
    • Jakub Jelinek's avatar
      libgcc: Fix a warning/error in libgcc2.c [PR117624] · 09ef9756
      Jakub Jelinek authored
      Since the switch to -std=gnu23 by default, float.h (included from
      tsystem.h) defines INFINITY macro (to __builtin_inff ()), which now
      results in a warning when compiling libgcc2.c which defines it
      to something else (and, worse aarch64 compiles it with -Werror and
      build fails).
      libgcc2.c asserts INFINITY has the expected type which depends on
      the macros with which libgcc2.c is being compiled, so guarding
      the define with #ifndef INFINITY wouldn't work.
      So this patch instead #undefs the macro before defining it.
      
      2024-11-16  Jakub Jelinek  <jakub@redhat.com>
      
      	PR libgcc/117624
      	* libgcc2.c (INFINITY): Add #undef before #define.
      09ef9756
    • Paul Thomas's avatar
      Fortran: Fix segmentation fault in defined assignment [PR109066] · 27ff8049
      Paul Thomas authored
      2024-11-16  Paul Thomas  <pault@gcc.gnu.org>
      
      gcc/fortran
      	PR fortran/109066
      	* resolve.cc (generate_component_assignments): If the temporary
      	for 'var' is a pointer and 'expr' is neither a constant or
      	a variable, change its attribute from pointer to allocatable.
      	This avoids assignment to a temporary point that has neither
      	been allocated or associated.
      
      gcc/testsuite/
      	PR fortran/109066
      	* gfortran.dg/defined_assignment_12.f90: New test.
      27ff8049
    • Gerald Pfeifer's avatar
      doc: Streamline hppa*-hp-hpux11 installation instructions · 4a4bd60f
      Gerald Pfeifer authored
      	A HP/UX linker patch from the GCC 3.3 era and Binutils 2.14
      	no longer should require special mention.
      
      	These originally came in via commit c5124497 in April 2004 as
      	  * doc/install.texi: Update HP-UX 11 installation procedure.
      
      gcc:
      	PR target/69374
      	* doc/install.texi (Specific) <hppa*-hp-hpux11>: Remove references
      	to HP/UX linker patch from 2004 and Binutils 2.14.
      4a4bd60f
    • Jeff Law's avatar
      Fix various sh tests to work with c23 · 7c7e630c
      Jeff Law authored
      A few SH tests want to create a bool typedef which doesn't work for c23.
      Easiest fix which should have no impact on the test behavior would be to just
      change the name of the typedef so that doesn't conflict.
      
      One test has a crazy function signature (similar to the PRU test someone just
      fixed up).  For that I'm using -std=gnu17.
      
      Pushing to the trunk.
      
      testsuite/
      	* gcc.target/sh/pr51244-15.c: Use "mybool" rather than "bool".
      	* gcc.target/sh/pr52933-1.c: Similarly.
      	* gcc.target/sh/pr54089-1.c: Similarly.
      	* gcc.target/sh/pr54089-7.c: Similarly.
      	* gcc.target/sh/pr54089-8.c: Similarly.
      	* gcc.target/sh/pr54089-9.c: Similarly.
      	* gcc.target/sh/pr64366.c: Use -std=gnu17.
      7c7e630c
    • Thomas Koenig's avatar
      Document that SELECT CASE works for unsigned. · bf00f117
      Thomas Koenig authored
      gcc/fortran/ChangeLog:
      
      	* gfortran.texi: Document that SELECT CASE works for UNSIGNED.
      bf00f117
    • Jeff Law's avatar
      [committed] Fix compilation of testglue wrapper after c23 changes · 8e2b9c80
      Jeff Law authored
      testglue.c (which is used for exit/abort wrappers in the testsuite) isn't c23
      compatible.   The testing harness tries to build testglue.c and use it, but
      doesn't report a failure if the build fails, instead it's just not used.  As a
      result we get all kinds of failures on targets which depend on testglue to
      report back simulator status -- like tens of thousands of execution failures.
      
      This patch just adds -std=gnu17 to the command line to build testglue.c.
      
      There's other fallout from the c23 change..  My tester is chewing through
      things right now...
      
      Installing on the trunk.
      
      testsuite
      	* lib/wrapper.exp (${tool}_maybe_build_wrapper): Pass -std=gnu17 flag
      	to build testglue wrapper.
      8e2b9c80
    • Dimitar Dimitrov's avatar
      testsuite: pru: Fix pr64366.c for new -std=gnu23 default · 601a7341
      Dimitar Dimitrov authored
      
      Provide function declaration in order to fix the test case build with
      the new -std=gnu23 default.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/pru/pr64366.c (foobar): Provide full function
      	delaration.
      
      Signed-off-by: default avatarDimitar Dimitrov <dimitar@dinux.eu>
      601a7341
    • Thomas Koenig's avatar
      Handle unsigned constants for module I/O. · 66096151
      Thomas Koenig authored
      gcc/fortran/ChangeLog:
      
      	* module.cc (mio_expr): Handle BT_UNSIGNED.
      
      gcc/testsuite/ChangeLog:
      
      	* gfortran.dg/unsigned_42.f90: New test.
      66096151
    • Richard Biener's avatar
      Flip vectorization to forced SLP · 4b8c5b33
      Richard Biener authored
      The following flips the vectorizer to forced SLP, there is almost
      no expected fallout at this point, the remains should be target
      specific cost modeling issues.
      
      	* params.opt (vect-force-slp): Default to 1.
      4b8c5b33
    • Richard Biener's avatar
      tree-optimization/117606 - SLP and single element interleaving · 39e763ca
      Richard Biener authored
      The following tries to reduce the amount of difference between
      SLP and non-SLP for single-element interleaving load classification.
      
      This fixes another fallout of --param vect-force-slp=1
      
      	PR tree-optimization/117606
      	* tree-vect-stmts.cc (get_group_load_store_type): For single
      	element interleaving also fall back to VMAT_ELEMENTWISE if
      	a left-over permutation isn't supported.
      39e763ca
    • Richard Biener's avatar
      tree-optimization/117605 - SLP with large negative single-element interleaving · 4621b684
      Richard Biener authored
      We fail to demote this to VMAT_ELEMENTWISE and thus run into the three
      vector permutation limit (and would not consider to use strided loads
      or gathers).
      
      This resolves another bunch of SVE regressions with --param
      vect-force-slp=1
      
      	PR tree-optimization/117605
      	* tree-vect-stmts.cc (get_group_load_store_type): Also
      	apply group size limit for single-element interleaving
      	to VMAT_CONTIGUOUS_REVERSE.
      4621b684
    • Richard Biener's avatar
      tree-optimization/117558 - peeling for gaps and VL vectors · 935aafac
      Richard Biener authored
      The following ensures that peeling a single iteration for gaps is
      sufficient by enforcing niter masking (partial vector use) given
      we cannot (always) statically decide when the vector size isn't known.
      The condition guarding this and thus statically giving a pass in
      some cases for VL vectors is questionable, the patch doesn't address
      this.
      
      This fixes a set of known failout from enabling
      --param vect-force-slp=1 by default.
      
      	PR tree-optimization/117558
      	* tree-vectorizer.h (_loop_vec_info::must_use_partial_vectors_p): New.
      	(LOOP_VINFO_MUST_USE_PARTIAL_VECTORS_P): Likewise.
      	* tree-vect-loop.cc (_loop_vec_info::_loop_vec_info): Initialize
      	must_use_partial_vectors_p.
      	(vect_determine_partial_vectors_and_peeling): Enforce it.
      	(vect_analyze_loop_2): Reset before restarting.
      	* tree-vect-stmts.cc (get_group_load_store_type): When peeling
      	a single gap iteration cannot be determined safe statically
      	enforce the use of partial vectors.
      935aafac
    • Jan Hubicka's avatar
      Ignore conditions guarding __builtin_unreachable in inliner metrics · cee7d080
      Jan Hubicka authored
      This extends my last year attempt to make inliner metric ignore
      conditionals guarding __builtin_unreachable.  Compared to previous
      patch, this one implements a "mini-dce" in ipa-fnsummary to avoid
      accounting all statements that are only used to determine conditionals
      guarding __builtin_unnecesary.  These will be removed later once value
      ranges are determined.
      
      While working on this, I noticed that we do have a lot of dead code while
      computing fnsummary for early inline. Those are only used to apply
      large-function growth, but it seems there is enough dead code to make this
      valud kind of irrelevant.  Also there seems to be quite a lot of const/pure
      calls that can be cheaply removed before we inline them.  So I wonder if we
      want to run one DCE before early inlining.
      
      gcc/ChangeLog:
      
      	PR tree-optimization/109442
      	* ipa-fnsummary.cc (builtin_unreachable_bb_p): New function.
      	(guards_builtin_unreachable): New function.
      	(STMT_NECESSARY): New macro.
      	(mark_stmt_necessary): New function.
      	(mark_operand_necessary): New function.
      	(find_necessary_statements): New function.
      	(analyze_function_body): Use it.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.dg/ipa/fnsummary-1.c: New test.
      cee7d080
    • Jason Merrill's avatar
      c++: adjust some tests for modules · 064c6493
      Jason Merrill authored
      We aren't enabling modules by default yet, but let's fix these tests now so
      they won't fail when that happens.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/template/error25.C: Adjust export diagnostic.
      	* g++.old-deja/g++.benjamin/tem05.C: Likewise.
      	* g++.old-deja/g++.pt/export1.C: Likewise.
      	* g++.dg/pch/pch.exp: Specify -fno-modules.
      064c6493
    • Martin Uecker's avatar
      c: fix ICE when forming composite type for two structures / unions [PR117548] · d8af6c20
      Martin Uecker authored
      When forming the composite type from two tagged type, we need to find the
      original type for a typedecl to get the correct tag.
      
      	PR c/117548
      
      gcc/c/ChangeLog:
      	* c-decl.cc (finish_struct): Add checking assertion.
      	* c-typeck.cc (c_type_original): New function.
      	(composite_types_internal): Get tag from original type.
      
      gcc/testsuite/ChangeLog:
      	* gcc.dg/pr117548.c: New test.
      d8af6c20
    • Sam James's avatar
      testsuite: i386: adapt to -std=gnu23 default change · 6aabe3ad
      Sam James authored
      r15-5327-g55e3bd376b2214 changes the default to -std=gnu23 but this
      test relies on unprototyped functions. Follow Joseph's advice
      in that commit and tweak the test accordingly.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/i386/pr66891.c: Pass -std=gnu17.
      6aabe3ad
    • Sam James's avatar
      testsuite: graphite: adapt to -std=gnu23 default change · 714f7d8e
      Sam James authored
      r15-5327-g55e3bd376b2214 changes the default to -std=gnu23 but these
      tests now trigger -Wold-style-definition. Follow Joseph's advice
      in that commit and tweak the tests accordingly.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.dg/graphite/id-15.c: Pass -Wno-old-style-definition.
      	* gcc.dg/graphite/pr38413.c: Ditto.
      	* gcc.dg/graphite/pr38510.c: Ditto.
      714f7d8e
    • Gaius Mulley's avatar
      PR modula2/117555: Add missing return statement after raise · e77fd9aa
      Gaius Mulley authored
      
      This patch adds missing return statements after a call to RAISE.  Four
      of the modules in libgm2 have procedure functions with missing return
      statements.  These errors were exposed after the reimplementation of
      parameter declaration patch and triggered by -Wreturn-type.  The patch
      also adds exit statements to the M2RTS noreturn functions.
      
      gcc/m2/ChangeLog:
      
      	PR modula2/117555
      	* gm2-libs-iso/EXCEPTIONS.mod (CurrentNumber): Add return
      	statement.
      	* gm2-libs-iso/IOChan.mod (ReadResult): Ditto.
      	(CurrentFlags): Ditto.
      	(DeviceError): Ditto.
      	* gm2-libs-iso/IOLink.mod (DeviceTablePtrValue): Ditto.
      	* gm2-libs-iso/LongConv.mod (ValueReal): Ditto.
      	* gm2-libs/M2RTS.mod (Halt): Add noreturn attribute.
      	Add exit (1).
      	(HaltC): Add exit (1).
      	* pge-boot/GM2RTS.cc (M2RTS_Halt): Add exit (1).
      	(M2RTS_HaltC): Ditto.
      
      Signed-off-by: default avatarGaius Mulley <gaiusmod2@gmail.com>
      e77fd9aa
    • Jonathan Wakely's avatar
      libstdc++: Use -C option to run recursive make in sub-directories · 63798670
      Jonathan Wakely authored
      libstdc++-v3/ChangeLog:
      
      	* Makefile.am: Use $(MAKE) -C dir instead of cd dir && $(MAKE).
      	* Makefile.in: Regenerate.
      63798670
    • Pan Li's avatar
      RISC-V: Remove unnecessary option for scalar SAT_SUB testcase · 4f9af8e4
      Pan Li authored
      
      After we create a isolated folder to hold all SAT scalar test,
      we have fully control of what optimization options passing to
      the testcase.  Thus, it is better to remove the unnecessary
      work around for flto option, as well as the -O3 option for
      each cases.  The riscv.exp will pass sorts of different optimization
      options for each case.
      
      The below test suites are passed for this patch.
      * The rv64gcv fully regression test.
      
      It is test only patch and obvious up to a point, will commit it
      directly if no comments in next 48H.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/sat/sat_u_sub-1-u16.c: Remove flto dg-skip
      	workaround and -O3 option.
      	* gcc.target/riscv/sat/sat_u_sub-1-u32.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub-1-u64.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub-1-u8.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub-10-u16.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub-10-u32.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub-10-u64.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub-10-u8.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub-11-u16.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub-11-u32.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub-11-u64.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub-11-u8.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub-12-u16.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub-12-u32.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub-12-u64.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub-12-u8.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub-2-u16.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub-2-u32.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub-2-u64.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub-2-u8.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub-3-u16.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub-3-u32.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub-3-u64.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub-3-u8.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub-4-u16.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub-4-u32.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub-4-u64.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub-4-u8.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub-5-u16.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub-5-u32.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub-5-u64.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub-5-u8.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub-6-u16.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub-6-u32.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub-6-u64.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub-6-u8.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub-7-u16.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub-7-u32.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub-7-u64.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub-7-u8.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub-8-u16.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub-8-u32.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub-8-u64.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub-8-u8.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub-9-u16.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub-9-u32.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub-9-u64.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub-9-u8.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-1-u16-1.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-1-u16-2.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-1-u16-3.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-1-u16-4.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-1-u16.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-1-u32-1.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-1-u32-2.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-1-u32-3.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-1-u32-4.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-1-u32.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-1-u64-1.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-1-u64-2.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-1-u64.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-1-u8-1.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-1-u8-2.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-1-u8-3.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-1-u8-4.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-1-u8.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-2-u16-1.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-2-u16-2.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-2-u16-3.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-2-u16.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-2-u32-1.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-2-u32-2.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-2-u32-3.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-2-u32.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-2-u64-1.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-2-u64.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-2-u8-1.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-2-u8-2.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-2-u8-3.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-2-u8.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-3-u16-1.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-3-u16-2.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-3-u16.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-3-u32-1.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-3-u32-2.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-3-u32.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-3-u64.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-3-u8-1.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-3-u8-2.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-3-u8.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-4-u16-1.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-4-u16-2.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-4-u16.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-4-u32-1.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-4-u32-2.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-4-u32.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-4-u64.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-4-u8-1.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-4-u8-2.c: Ditto.
      	* gcc.target/riscv/sat/sat_u_sub_imm-4-u8.c: Ditto.
      
      Signed-off-by: default avatarPan Li <pan2.li@intel.com>
      4f9af8e4
    • GCC Administrator's avatar
      Daily bump. · 349368ae
      GCC Administrator authored
      349368ae
  2. Nov 15, 2024
    • Joseph Myers's avatar
      c: Default to -std=gnu23 · 55e3bd37
      Joseph Myers authored
      Change the default language version for C compilation from -std=gnu17
      to -std=gnu23.  A few tests are updated to remove local definitions of
      bool, true and false (where making such an unconditional test change
      seemed to make more sense than changing the test conditionally earlier
      or building it with -std=gnu17); most test issues were already
      addressed in previous patches.  In the case of
      ctf-function-pointers-2.c, it was agreed in bug 117289 that it would
      be OK to put -std=gnu17 in the test and leave more optimal BTF / CTF
      output for this test as a potential future improvement.
      
      Since the original test fixes, more such fixes have become necessary
      and so are included in this patch.  More noinline attributes are added
      to simulate-thread tests where () meaning a prototype affected test
      results, while gcc.dg/torture/pr117496-1.c (a test declaring a
      function with () then calling it with arguments) gets -std=gnu17
      added.
      
      Bootstrapped with no regressions for x86_64-pc-linux-gnu.
      
      NOTE: it's likely there are target-specific tests for non-x86 targets
      that need updating as a result of this change.  See commit
      9fb5348e ("testsuite: Prepare for
      -std=gnu23 default") for examples of changes to prepare the testsuite
      to work with a -std=gnu23 default.  In most cases, adding
      -Wno-old-style-definition (for warnings for old-style function
      definitions) or -std=gnu17 (for other issues such as unprototyped
      function declarations with ()) is appropriate, but watch out for cases
      that indicate bugs with -std=gnu23 (in particular, any ICEs - there
      was only the one nested function test where I had to fix an ICE on
      x86_64).
      
      gcc/
      	* doc/invoke.texi (-std=gnu17, -std=gnu23): Document -std=gnu23 as
      	default for C code.
      
      gcc/c-family/
      	* c-opts.cc (c_common_init_options): Default to C23.
      
      gcc/testsuite/
      	* c-c++-common/analyzer/asm-x86-dyndbg-2.c,
      	c-c++-common/analyzer/asm-x86-lp64-2.c,
      	c-c++-common/analyzer/attr-malloc-CVE-2019-19078-usb-leak.c,
      	c-c++-common/analyzer/coreutils-cksum-pr108664.c,
      	c-c++-common/analyzer/feasibility-3.c,
      	c-c++-common/analyzer/pr105783.c, c-c++-common/analyzer/sock-1.c,
      	c-c++-common/attributes-4.c, gcc.dg/Warray-bounds-78.c,
      	gcc.dg/analyzer/asm-x86-dyndbg-1.c: Do not define bool, true or
      	false.
      	* gcc.dg/debug/ctf/ctf-function-pointers-2.c: Use -std-gnu17.
      	* gcc.dg/gnu23-version-2.c: New test.
      	* gcc.dg/simulate-thread/atomic-load-int.c,
      	gcc.dg/simulate-thread/atomic-load-longlong.c,
      	gcc.dg/simulate-thread/atomic-load-short.c: Add more noinline
      	attributes.
      	* gcc.dg/torture/pr117496-1.c: Use -std=gnu17.
      55e3bd37
    • Gaius Mulley's avatar
      PR modula2/117371: type incompatibility between INTEGER and CARDINAL · f242f79b
      Gaius Mulley authored
      
      This patch enforces a const expression increment in a FOR loop.
      It also fixes missing error locations.  The FOR loop last iterator
      value is now calculated during M2GenGCC after all types and constants have
      been resolved.  This results in fewer quadruples (as there is no need to
      build two paths for step > 0 and step < 0).
      
      gcc/m2/ChangeLog:
      
      	PR modula2/117371
      	* gm2-compiler/M2Base.mod (MixMetaTypes): Add parameter TRUE to
      	MetaErrorDecl.
      	(IsUserType): Test against ZType.
      	(MixTypesDecl): Test for ZType.
      	* gm2-compiler/M2GenGCC.mod (ErrorMessageDecl): Add parameter TRUE to
      	MetaErrorDecl.
      	(CodeLastForIterator): New procedure.
      	(FoldLastForIterator): Ditto.
      	(PerformLastForIterator): Ditto.
      	(CodeStatement): Add case clause for LastForIteratorOp.
      	(ErrorMessageDecl): Add iserror parameter.
      	Call MetaErrorDecl with iserror parameter.
      	(checkIncorrectMeta): Call MetaErrorDecl with TRUE parameter.
      	(CheckBinaryExpressionTypes): Ditto.
      	(CheckElementSetTypes): Ditto.
      	* gm2-compiler/M2LexBuf.def (MakeVirtualTok): Update comment
      	detailing the fall back when UnknownTokenNo is encountered.
      	(MakeVirtual2Tok): Ditto.
      	* gm2-compiler/M2LexBuf.mod (MakeVirtualTok): Check against
      	UnknownTokenNo.
      	(MakeVirtual2Tok): Ditto.
      	* gm2-compiler/M2MetaError.def (MetaErrorDecl): Add error parameter.
      	* gm2-compiler/M2MetaError.mod (MetaErrorDecl): Add error
      	parameter.
      	Issue warning if error is FALSE.
      	* gm2-compiler/M2Quads.def (QuadOperator): Add LastForIteratorOp.
      	* gm2-compiler/M2Quads.mod (AddQuadInformation): New case clause
      	LastForIteratorOp.
      	(CheckAddTuple2Read): New procedure.
      	(BuildForLoopToRangeCheck): Remove.
      	(ForLoopLastIteratorVariable): Ditto.
      	(ForLoopLastIteratorConstant): Ditto.
      	(ForLoopLastIterator): Reimplement.
      	(BuildForToByDo): Remove ByType from call to ForLoopLastIterator.
      	(WriteQuad): New case clause LastForIteratorOp.
      	(WriteOperator): Ditto.
      	* gm2-compiler/M2Students.def
      	(CheckForVariableThatLooksLikeKeyword): Replace with ...
      	(CheckVariableAgainstKeyword): ... this.
      	* gm2-compiler/M2Students.mod
      	(CheckForVariableThatLooksLikeKeyword): Replace with ...
      	(CheckVariableAgainstKeyword): ... this.
      	* gm2-compiler/M2SymInit.mod (CheckLastForIterator): New
      	procedure.
      	(CheckReadBeforeInitQuad): New case clause to call
      	CheckLastForIterator.
      	* gm2-compiler/P2SymBuild.mod: Replace
      	CheckForVariableThatLooksLikeKeyword with CheckVariableAgainstKeyword.
      
      gcc/testsuite/ChangeLog:
      
      	PR modula2/117371
      	* gm2/iso/fail/forloopbyvar.mod: New test.
      	* gm2/iso/fail/forloopbyvar4.mod: New test.
      	* gm2/iso/fail/forloopbyvar5.mod: New test.
      	* gm2/iso/pass/forloopbyvar3.mod: New test.
      
      Signed-off-by: default avatarGaius Mulley <gaiusmod2@gmail.com>
      f242f79b
    • Gaius Mulley's avatar
      modula2: Add dependencies for generated sources · 3e6a7824
      Gaius Mulley authored
      
      This patch adds rules and dependencies for the automatically
      generated grammar sources.  Bootstrapped using make -j 160.
      
      gcc/m2/ChangeLog:
      
      	* Make-lang.in (m2/gm2-compiler-boot/P0SyntaxCheck.c):
      	New rule.
      	(m2/gm2-compiler-boot/P0SyntaxCheck.o): Ditto.
      	(m2/gm2-compiler-boot/P1Build.c): Ditto.
      	(m2/gm2-compiler-boot/P1Build.o): Ditto.
      	(m2/gm2-compiler-boot/P2Build.c): Ditto.
      	(m2/gm2-compiler-boot/P2Build.o): Ditto.
      	(m2/gm2-compiler-boot/P3Build.c): Ditto.
      	(m2/gm2-compiler-boot/P3Build.o): Ditto.
      	(m2/gm2-compiler-boot/PCBuild.c): Ditto.
      	(m2/gm2-compiler-boot/PCBuild.o): Ditto.
      	(m2/gm2-compiler-boot/PHBuild.c): Ditto.
      	(m2/gm2-compiler-boot/PHBuild.o): Ditto.
      
      Signed-off-by: default avatarGaius Mulley <gaiusmod2@gmail.com>
      3e6a7824
    • Jennifer Schmitz's avatar
      match.pd: Fold vec_perm with view_convert · c83e2d47
      Jennifer Schmitz authored
      
      This patch improves the codegen for the following test case:
      uint64x2_t foo (uint64x2_t r) {
          uint32x4_t a = vreinterpretq_u32_u64 (r);
          uint32_t t;
          t = a[0]; a[0] = a[1]; a[1] = t;
          t = a[2]; a[2] = a[3]; a[3] = t;
          return vreinterpretq_u64_u32 (a);
      }
      from (-O1):
      foo:
              mov     v31.16b, v0.16b
              ins     v0.s[0], v0.s[1]
              ins     v0.s[1], v31.s[0]
              ins     v0.s[2], v31.s[3]
              ins     v0.s[3], v31.s[2]
              ret
      to:
      foo:
      	rev64   v0.4s, v0.4s
              ret
      
      This is achieved by extending the following match.pd pattern to account
      for type differences between @0 and @1 due to view converts.
      /* Simplify vector inserts of other vector extracts to a permute.  */
      (simplify
       (bit_insert @0 (BIT_FIELD_REF@2 @1 @rsize @rpos) @ipos)
      
      The patch was bootstrapped and regtested on aarch64-linux-gnu and
      x86_64-linux-gnu, no regression.
      OK for mainline?
      
      Signed-off-by: default avatarJennifer Schmitz <jschmitz@nvidia.com>
      Co-authored-by: default avatarRichard Biener <rguenther@suse.de>
      
      gcc/
      	PR tree-optimization/117093
      	* match.pd: Extend
      	(bit_insert @0 (BIT_FIELD_REF@2 @1 @rsize @rpos) @ipos) to allow
      	type differences between @0 and @1 due to view converts.
      
      gcc/testsuite/
      	PR tree-optimization/117093
      	* gcc.dg/tree-ssa/pr117093.c: New test.
      c83e2d47
    • John David Anglin's avatar
      hppa: Fix typos in 32-bit SFmode peephole2 patterns · 029c16c1
      John David Anglin authored
      2024-11-15  John David Anglin  <danglin@gcc.gnu.org>
      
      gcc/ChangeLog:
      
      	PR target/117564
      	* config/pa/pa.md: Fix typos in 32-bit SFmode peephole2 patterns.
      029c16c1
    • Jan Hubicka's avatar
      Fix type of malloc parameter in trans-expr.cc · d5af5657
      Jan Hubicka authored
      gcc/fortran/ChangeLog:
      
      	* trans-expr.cc (gfc_trans_subcomponent_assign): Fix type of malloc
      	parameter.
      d5af5657
    • Joseph Myers's avatar
      tree-nested: Do not inline or clone functions with nested functions with VM return type [PR117164] · 3320319e
      Joseph Myers authored
      Bug 117164 is an ICE on an existing test with -std=gnu23 involving a
      nested function returning a variable-size structure (and I think the
      last bug needing to be resolved before switching to -std=gnu23 as the
      default, as without fixing this would be a clear regression from a
      change in default).
      
      The problem is a GIMPLE verification failure where (after type
      remapping from inlining / cloning) the return type of the function no
      longer exactly matches the type to which it is assigned (these types
      use structural equality, which means GIMPLE verification can't use
      TYPE_CANONICAL and expects an exact match).  Specifically, the nested
      function itself is *not* inlined (the -fno-inline-small-functions in
      the original test nested-func-12.c, I think, or the noinline attribute
      in some of my variant tests), but the function containing it is either
      cloned (the --param ipa-cp-eval-threshold=0 in the original test) or
      inlined.  (I'm not sure what role -fno-guess-branch-probability plays
      in getting the right situation for the ICE; maybe affecting when
      inlining or cloning is considered profitable?)
      
      There is in fact existing code in tree-nested.cc to prevent inlining
      of a function containing a nested function with variably modified
      *argument* types.  I think the same issue of ensuring consistency of
      types means such prevention should also apply for a variably modified
      return type.  Furthermore, exactly the same problem applies for
      cloning for other reasons as it does for inlining.  Thus, change the
      logic to include variably modified return types for nested functions
      alongside those for arguments of those functions as a reason not to
      inline, and also add the noclone attribute in these cases.
      
      Bootstrapped with no regressions for x86-64-pc-linux-gnu.
      
      	PR c/117164
      
      gcc/
      	* tree-nested.cc: Include "attribs.h".
      	(check_for_nested_with_variably_modified): Also return true for
      	variably modified return type.
      	(create_nesting_tree): If check_for_nested_with_variably_modified
      	returns true, also add noclone attribute.
      
      gcc/testsuite/
      	* gcc.dg/nested-func-13.c, gcc.dg/nested-func-14.c:
      	gcc.dg/nested-func-15.c, gcc.dg/nested-func-16.c,
      	gcc.dg/nested-func-17.c: New tests.
      3320319e
    • Richard Biener's avatar
      Remove unused vcond{,u,eq} expander infrastructure · c57b2f88
      Richard Biener authored
      Now that we no longer exercise vcond{,u,eq} patterns remove unused
      infrastructure.
      
      	* optabs-query.h (get_vcond_icode): Remove.
      	(get_vcond_eq_icode): Likewise.
      	* optabs-tree.h (expand_vec_cond_expr_p): Remove code
      	argument.
      	* optabs-tree.cc (expand_vec_cond_expr_p): Likewise.
      	(vcond_icode_p): Remove.
      	(vcond_eq_icode_p): Likewise.
      	* optabs.h (can_vcond_compare_p): Remove.
      	* optabs.cc (can_vcond_compare_p): Likewise.
      c57b2f88
    • Christophe Lyon's avatar
      testsuite: Fix tail_call and musttail effective targets [PR116080] · a064fed1
      Christophe Lyon authored
      Some of the musttail tests (eg musttail7.c) fail on arm-eabi because
      check_effective_target_musttail pass, but the actual code in the test
      is rejected.
      
      The reason is that on arm-eabi with the default configuration, the
      compiler targets armv4t for which TARGET_INTERWORK is true, making
      arm_function_ok_for_sibcall reject a tail-call candidate if
      TREE_ASM_WRITTEN (decl) is false.
      
      For more recent architecture versions, TARGET_INTERWORK is false,
      hence the problem was not seen on all arm configurations.
      
      musttail7.c is in turn rejected because f2 is recursive, so
      TREE_ASM_WRITTEN is false.
      
      However, the same code used in check_effective_target_musttail is not
      recursive and the function body for foo has TREE_ASM_WRITTEN == true.
      
      The simplest fix is to remove the (empty) body for foo () in
      check_effective_target_musttail.  For consistency, do the same with
      check_effective_target_tail_call.
      
      gcc/testsuite/ChangeLog:
      	PR testsuite/116080
      	* lib/target-supports.exp (check_effective_target_tail_call):
      	Remove foo's body.
      	(check_effective_target_musttail): Likewise.
      a064fed1
    • Richard Biener's avatar
      Remove dead code related to VEC_COND_EXPR expansion from ISEL · 5a2c3a69
      Richard Biener authored
      ISEL was introduced to translate vector comparison and vector
      condition combinations back to internal function calls mapping to
      one of the vcond[u][_eq][_mask] and vec_cmp[_eq] optabs.  With
      removing the legacy non-mask vcond expanders we now rely on all
      vector comparisons and vector conditions to be directly expandable.
      The following keeps the intermediate internal function rewrite
      given gimple_expand_vec_cond_expr still performs some optimizations
      which eventually should move to vector lowering or match.pd, but
      simplifies it down to always expand VEC_COND_EXPR to .VCOND_MASK.
      
      	* gimple-isel.cc (gimple_expand_vec_cond_expr): If not
      	simplifying or lowering, always expand to .VCOND_MASK.
      	(pass_gimple_isel::execute): Simplify.
      5a2c3a69
Loading