Skip to content
Snippets Groups Projects
  1. Jun 11, 2023
  2. Jun 10, 2023
    • Xi Ruoyao's avatar
      libatomic: x86_64: Always try ifunc · db802624
      Xi Ruoyao authored
      We used to skip ifunc check when CX16 is available.  But now we use
      CX16+AVX+Intel/AMD for the "perfect" 16b load implementation, so CX16
      alone is not a sufficient reason not to use ifunc (see PR104688).
      
      This causes a subtle and annoying issue: when GCC is built with a
      higher -march= setting in CFLAGS_FOR_TARGET, ifunc is disabled and
      the worst (locked) implementation of __atomic_load_16 is always used.
      
      There seems no good way to check if the CPU is Intel or AMD from
      the built-in macros (maybe we can check every known model like __skylake,
      __bdver2, ..., but it will be very error-prune and require an update
      whenever we add the support for a new x86 model).  The best thing we can
      do seems "always try ifunc" here.
      
      libatomic/ChangeLog:
      
      	* configure.tgt: For x86_64, always set try_ifunc=yes.
      db802624
  3. Jun 03, 2023
  4. Jun 02, 2023
    • Thomas Schwinge's avatar
      Remove stale Autoconf checks for Perl · 49153588
      Thomas Schwinge authored
      Subversion r110220 (Git commit 03b8fe49) for
      PR25884 "libgomp should not require perl to compile" removed all '$(PERL)'
      usage from libgomp -- but didn't remove the then-unused Autoconf Perl check
      itself.  Later, this Autoconf Perl check appears to have been copied from
      libgomp into other GCC libraries, likewise unused.
      
      	libgomp/
      	* configure.ac (PERL): Remove.
      	* configure: Regenerate.
      	* Makefile.in: Likewise.
      	* testsuite/Makefile.in: Likewise.
      	libatomic/
      	* configure.ac (PERL): Remove.
      	* configure: Regenerate.
      	* Makefile.in: Likewise.
      	* testsuite/Makefile.in: Likewise.
      	libgm2/
      	* configure.ac (PERL): Remove.
      	* configure: Regenerate.
      	* Makefile.in: Likewise.
      	* libm2cor/Makefile.in: Likewise.
      	* libm2iso/Makefile.in: Likewise.
      	* libm2log/Makefile.in: Likewise.
      	* libm2min/Makefile.in: Likewise.
      	* libm2pim/Makefile.in: Likewise.
      	libitm/
      	* configure.ac (PERL): Remove.
      	* configure: Regenerate.
      	* Makefile.in: Likewise.
      	* testsuite/Makefile.in: Likewise.
      49153588
  5. Mar 25, 2023
  6. Mar 24, 2023
    • Wilco Dijkstra's avatar
      libatomic: Fix SEQ_CST 128-bit atomic load [PR108891] · 1f641d6a
      Wilco Dijkstra authored
      The LSE2 ifunc for 16-byte atomic load requires a barrier before the LDP -
      without it, it effectively has Load-AcquirePC semantics similar to LDAPR,
      which is less restrictive than what __ATOMIC_SEQ_CST requires.  This patch
      fixes this and adds comments to make it easier to see which sequence is
      used for each case.  Use a load/store exclusive loop for store to simplify
      testing memory ordering is correct (it is slightly faster too).
      
      libatomic/
      	PR libgcc/108891
      	* config/linux/aarch64/atomic_16.S: Fix libat_load_16_i1.
      	Add comments describing the memory order.
      1f641d6a
  7. Mar 04, 2023
  8. Mar 03, 2023
  9. Jan 17, 2023
  10. Jan 16, 2023
  11. Jan 08, 2023
  12. Jan 07, 2023
    • LIU Hao's avatar
      Always define `WIN32_LEAN_AND_MEAN` before <windows.h> · 902c7559
      LIU Hao authored
      Recently, mingw-w64 has got updated <msxml.h> from Wine which is included
      indirectly by <windows.h> if `WIN32_LEAN_AND_MEAN` is not defined. The
      `IXMLDOMDocument` class has a member function named `abort()`, which gets
      affected by our `abort()` macro in "system.h".
      
      `WIN32_LEAN_AND_MEAN` should, nevertheless, always be defined. This
      can exclude 'APIs such as Cryptography, DDE, RPC, Shell, and Windows
      Sockets' [1], and speed up compilation of these files a bit.
      
      [1] https://learn.microsoft.com/en-us/windows/win32/winprog/using-the-windows-headers
      
      gcc/
      
      	PR middle-end/108300
      	* config/xtensa/xtensa-dynconfig.c: Define `WIN32_LEAN_AND_MEAN`
      	before <windows.h>.
      	* diagnostic-color.cc: Likewise.
      	* plugin.cc: Likewise.
      	* prefix.cc: Likewise.
      
      gcc/ada/
      
      	PR middle-end/108300
      	* adaint.c: Define `WIN32_LEAN_AND_MEAN` before `#include
      	<windows.h>`.
      	* cio.c: Likewise.
      	* ctrl_c.c: Likewise.
      	* expect.c: Likewise.
      	* gsocket.h: Likewise.
      	* mingw32.h: Likewise.
      	* mkdir.c: Likewise.
      	* rtfinal.c: Likewise.
      	* rtinit.c: Likewise.
      	* seh_init.c: Likewise.
      	* sysdep.c: Likewise.
      	* terminals.c: Likewise.
      	* tracebak.c: Likewise.
      
      gcc/jit/
      
      	PR middle-end/108300
      	* jit-w32.h: Define `WIN32_LEAN_AND_MEAN` before <windows.h>.
      
      libatomic/
      
      	PR middle-end/108300
      	* config/mingw/lock.c: Define `WIN32_LEAN_AND_MEAN` before
      	<windows.h>.
      
      libffi/
      
      	PR middle-end/108300
      	* src/aarch64/ffi.c: Define `WIN32_LEAN_AND_MEAN` before
      	<windows.h>.
      
      libgcc/
      
      	PR middle-end/108300
      	* config/i386/enable-execute-stack-mingw32.c: Define
      	`WIN32_LEAN_AND_MEAN` before <windows.h>.
      	* libgcc2.c: Likewise.
      	* unwind-generic.h: Likewise.
      
      libgfortran/
      
      	PR middle-end/108300
      	* intrinsics/sleep.c: Define `WIN32_LEAN_AND_MEAN` before
      	<windows.h>.
      
      libgomp/
      
      	PR middle-end/108300
      	* config/mingw32/proc.c: Define `WIN32_LEAN_AND_MEAN` before
      	<windows.h>.
      
      libiberty/
      
      	PR middle-end/108300
      	* make-temp-file.c: Define `WIN32_LEAN_AND_MEAN` before <windows.h>.
      	* pex-win32.c: Likewise.
      
      libssp/
      
      	PR middle-end/108300
      	* ssp.c: Define `WIN32_LEAN_AND_MEAN` before <windows.h>.
      
      libstdc++-v3/
      
      	PR middle-end/108300
      	* src/c++11/system_error.cc: Define `WIN32_LEAN_AND_MEAN` before
      	<windows.h>.
      	* src/c++11/thread.cc: Likewise.
      	* src/c++17/fs_ops.cc: Likewise.
      	* src/filesystem/ops.cc: Likewise.
      
      libvtv/
      
      	PR middle-end/108300
      	* vtv_malloc.cc: Define `WIN32_LEAN_AND_MEAN` before <windows.h>.
      	* vtv_rts.cc: Likewise.
      	* vtv_utils.cc: Likewise.
      902c7559
  13. Jan 02, 2023
  14. Nov 17, 2022
  15. Nov 16, 2022
  16. Nov 15, 2022
    • Wilco Dijkstra's avatar
      libatomic: Add support for LSE and LSE2 · d1288d85
      Wilco Dijkstra authored
      Add support for AArch64 LSE and LSE2 to libatomic.  Disable outline atomics,
      and use LSE ifuncs for 1-8 byte atomics and LSE2 ifuncs for 16-byte atomics.
      On Neoverse V1, 16-byte atomics are ~4x faster due to avoiding locks.
      
      Note this is safe since we swap all 16-byte atomics using the same ifunc,
      so they either use locks or LSE2 atomics, but never a mix. This also improves
      ABI compatibility with LLVM: its inlined 16-byte atomics are compatible with
      the new libatomic if LSE2 is supported.
      
      libatomic/
      	* Makefile.in: Regenerated with automake 1.15.1.
      	* Makefile.am: Add atomic_16.S for AArch64.
      	* configure.tgt: Disable outline atomics in AArch64 build.
      	* config/linux/aarch64/atomic_16.S: New file - implementation of
      	ifuncs for 16-byte atomics.
      	* config/linux/aarch64/host-config.h: Enable ifuncs, use LSE
      	(HWCAP_ATOMICS) for 1-8-byte atomics and LSE2 (HWCAP_USCAT) for
      	16-byte atomics.
      d1288d85
    • GCC Administrator's avatar
      Daily bump. · 83d400bd
      GCC Administrator authored
      83d400bd
    • Jakub Jelinek's avatar
      libatomic: Handle AVX+CX16 AMD like Intel for 16b atomics [PR104688] · 4a7a8466
      Jakub Jelinek authored
      We got a response from AMD in
      https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104688#c10
      so the following patch starts treating AMD with AVX and CMPXCHG16B
      ISAs like Intel by using vmovdqa for atomic load/store in libatomic.
      We still don't have confirmation from Zhaoxin and VIA (anything else
      with CPUs featuring AVX and CX16?).
      
      2022-11-15  Jakub Jelinek  <jakub@redhat.com>
      
      	PR target/104688
      	* config/x86/init.c (__libat_feat1_init): Don't clear
      	bit_AVX on AMD CPUs.
      4a7a8466
  17. Oct 20, 2022
  18. Oct 19, 2022
    • LIU Hao's avatar
      gcc: Add 'mcf' thread model support from mcfgthread · f036d759
      LIU Hao authored
      This patch adds the new thread model `mcf`, which implements mutexes
      and condition variables with the mcfgthread library.
      
      Source code for mcfgthread is available at <https://github.com/lhmouse/mcfgthread>.
      
      config/ChangeLog:
      	* gthr.m4 (GCC_AC_THREAD_HEADER): Add new case for `mcf` thread
      	model
      
      gcc/ChangeLog:
      	* config/i386/mingw-mcfgthread.h: New file
      	* config/i386/mingw32.h: Add builtin macro and default libraries
      	for mcfgthread when thread model is `mcf`
      	* config.gcc: Include 'i386/mingw-mcfgthread.h' when thread model
      	is `mcf`
      	* configure.ac: Recognize `mcf` as a valid thread model
      	* config.in: Regenerate
      	* configure: Regenerate
      
      libatomic/ChangeLog:
      	* configure.tgt: Add new case for `mcf` thread model
      
      libgcc/ChangeLog:
      	* config.host: Add new cases for `mcf` thread model
      	* config/i386/gthr-mcf.h: New file
      	* config/i386/t-mingw-mcfgthread: New file
      	* config/i386/t-slibgcc-cygming: Add mcfgthread for libgcc DLL
      	* configure: Regenerate
      
      libstdc++-v3/ChangeLog:
      	* libsupc++/atexit_thread.cc (__cxa_thread_atexit): Use
      	implementation from mcfgthread if available
      	* libsupc++/guard.cc (__cxa_guard_acquire, __cxa_guard_release,
      	__cxa_guard_abort): Use implementations from mcfgthread if
      	available
      	* configure: Regenerate
      f036d759
  19. Oct 13, 2022
  20. Oct 12, 2022
    • Martin Liska's avatar
      regenerate configure files · 6d2294a8
      Martin Liska authored
      Needed after a recent change.
      
      gcc/ChangeLog:
      
      	* configure: Regenerate.
      
      libatomic/ChangeLog:
      
      	* configure: Regenerate.
      
      libbacktrace/ChangeLog:
      
      	* configure: Regenerate.
      
      libcc1/ChangeLog:
      
      	* configure: Regenerate.
      
      libffi/ChangeLog:
      
      	* configure: Regenerate.
      
      libgfortran/ChangeLog:
      
      	* configure: Regenerate.
      
      libgomp/ChangeLog:
      
      	* configure: Regenerate.
      
      libitm/ChangeLog:
      
      	* configure: Regenerate.
      
      libobjc/ChangeLog:
      
      	* configure: Regenerate.
      
      liboffloadmic/ChangeLog:
      
      	* configure: Regenerate.
      	* plugin/configure: Regenerate.
      
      libphobos/ChangeLog:
      
      	* configure: Regenerate.
      
      libquadmath/ChangeLog:
      
      	* configure: Regenerate.
      
      libsanitizer/ChangeLog:
      
      	* configure: Regenerate.
      
      libssp/ChangeLog:
      
      	* configure: Regenerate.
      
      libstdc++-v3/ChangeLog:
      
      	* configure: Regenerate.
      
      libvtv/ChangeLog:
      
      	* configure: Regenerate.
      
      lto-plugin/ChangeLog:
      
      	* configure: Regenerate.
      
      zlib/ChangeLog:
      
      	* configure: Regenerate.
      6d2294a8
    • GCC Administrator's avatar
      Daily bump. · ab332cd7
      GCC Administrator authored
      ab332cd7
  21. Oct 11, 2022
    • Olivier Hainque's avatar
      Generic configury support for shared libs on VxWorks · 0ecd0f1c
      Olivier Hainque authored
      This change adds the configury bits to activate the build of
      shared libs on VxWorks ports configured with --enable-shared,
      for libraries variants where this is generally supported (rtp,
      code model !large - currently not compatible with -fPIC).
      
      Set lt_cv_deplibs_check_method in libtool.m4, so the build of
      libraries know how to establish dependencies.  This is useful in
      configurations such as aarch64 where proper support of LSE relies
      on accurate dependency information between libstdc++ and libgcc_s
      to begin with.
      
      Regenerate configure scripts to reflect libtool.m4 change.
      
      2022-10-09  Olivier Hainque  <hainque@adacore.com>
      
      	* libtool.m4 (*vxworks*): When enable_shared, set dynamic_linker
      	and friends for rtp !large. Assume the linker has the required
      	abilities and set lt_cv_deplibs_check_method.
      
      gcc/
      	* config.gcc (*vxworks*): Add t-slibgcc fragment
      	if enable_shared.
      
      libgcc/
      	* config.host (*vxworks*): When enable_shared, add
      	libgcc and crtstuff "shared" fragments for rtp except
      	large code model.
      	(aarch64*-wrs-vxworks7*): Remove t-slibgcc-libgcc from
      	the list of fragments.
      
      2022-10-09  Olivier Hainque  <hainque@adacore.com>
      
      gcc/
      	* configure: Regenerate.
      
      libatomic/
      	* configure: Regenerate.
      
      libbacktrace/
      	* configure: Regenerate.
      
      libcc1/
      	* configure: Regenerate.
      
      libffi/
      	* configure: Regenerate.
      
      libgfortran/
      	* configure: Regenerate.
      
      libgomp/
      	* configure: Regenerate.
      
      libitm/
      	* configure: Regenerate.
      
      libobjc/
      	* configure: Regenerate.
      
      liboffloadmic/
      	* configure: Regenerate.
      
      liboffloadmic/
      	* plugin/configure: Regenerate.
      
      libphobos/
      	* configure: Regenerate.
      
      libquadmath/
      	* configure: Regenerate.
      
      libsanitizer/
      	* configure: Regenerate.
      
      libssp/
      	* configure: Regenerate.
      
      libstdc++-v3/
      	* configure: Regenerate.
      
      libvtv/
      	* configure: Regenerate.
      
      lto-plugin/
      	* configure: Regenerate.
      
      zlib/
      	* configure: Regenerate.
      0ecd0f1c
  22. Aug 31, 2022
  23. Aug 30, 2022
    • Martin Liska's avatar
      automake: regenerate · bab6d812
      Martin Liska authored
      gotools/ChangeLog:
      
      	* Makefile.in: Regenerate.
      
      libatomic/ChangeLog:
      
      	* testsuite/Makefile.in: Regenerate.
      bab6d812
  24. Aug 09, 2022
  25. Aug 08, 2022
    • Tamar Christina's avatar
      AArch32: Fix 128-bit sequential consistency atomic operations. · 5471f55f
      Tamar Christina authored
      Similar to AArch64 the Arm implementation of 128-bit atomics is broken.
      
      For 128-bit atomics we rely on pthread barriers to correct guard the address
      in the pointer to get correct memory ordering.  However for 128-bit atomics the
      address under the lock is different from the original pointer.
      
      This means that one of the values under the atomic operation is not protected
      properly and so we fail during when the user has requested sequential
      consistency as there's no barrier to enforce this requirement.
      
      As such users have resorted to adding an
      
      #ifdef GCC
      <emit barrier>
      #endif
      
      around the use of these atomics.
      
      This corrects the issue by issuing a barrier only when __ATOMIC_SEQ_CST was
      requested.  I have hand verified that the barriers are inserted
      for atomic seq cst.
      
      libatomic/ChangeLog:
      
      	PR target/102218
      	* config/arm/host-config.h (pre_seq_barrier, post_seq_barrier,
      	pre_post_seq_barrier): Require barrier on __ATOMIC_SEQ_CST.
      5471f55f
    • Tamar Christina's avatar
      AArch64: Fix 128-bit sequential consistency atomic operations. · e6a8ae90
      Tamar Christina authored
      The AArch64 implementation of 128-bit atomics is broken.
      
      For 128-bit atomics we rely on pthread barriers to correct guard the address
      in the pointer to get correct memory ordering.  However for 128-bit atomics the
      address under the lock is different from the original pointer.
      
      This means that one of the values under the atomic operation is not protected
      properly and so we fail during when the user has requested sequential
      consistency as there's no barrier to enforce this requirement.
      
      As such users have resorted to adding an
      
      #ifdef GCC
      <emit barrier>
      #endif
      
      around the use of these atomics.
      
      This corrects the issue by issuing a barrier only when __ATOMIC_SEQ_CST was
      requested.  To remedy this performance hit I think we should revisit using a
      similar approach to out-line-atomics for the 128-bit atomics.
      
      Note that I believe I need the empty file due to the include_next chain but
      I am not entirely sure.  I have hand verified that the barriers are inserted
      for atomic seq cst.
      
      libatomic/ChangeLog:
      
      	PR target/102218
      	* config/aarch64/aarch64-config.h: New file.
      	* config/aarch64/host-config.h: New file.
      e6a8ae90
  26. Jun 03, 2022
  27. Jun 02, 2022
    • David Malcolm's avatar
      diagnostics: add SARIF output format · 6cf276dd
      David Malcolm authored
      This patch adds support to gcc's diagnostic subsystem for emitting
      diagnostics in SARIF, aka the Static Analysis Results Interchange Format:
        https://sarifweb.azurewebsites.net/
      by extending -fdiagnostics-format= to add two new options:
        -fdiagnostics-format=sarif-stderr
      and:
        -fdiagnostics-format=sarif-file
      
      The patch targets SARIF v2.1.0
      
      This is a JSON-based format suited for capturing the results of static
      analysis tools (like GCC's -fanalyzer), but it can also be used for plain
      GCC warnings and errors.
      
      SARIF supports per-event metadata in diagnostic paths such as
      ["acquire", "resource"] and ["release", "lock"] (specifically, the
      threadFlowLocation "kinds" property: SARIF v2.1.0 section 3.38.8), so
      the patch extends GCC"s diagnostic_event subclass with a "struct meaning"
      with similar purpose.  The patch implements this for -fanalyzer so that
      the various state-machine-based warnings set these in the SARIF output.
      
      The heart of the implementation is in the new file
      diagnostic-format-sarif.cc.  Much of the rest of the patch is interface
      classes, isolating the diagnostic subsystem (which has no knowledge of
      e.g. tree or langhook) from the "client" code in the compiler proper
      cc1 etc).
      
      The patch adds a langhook for specifying the SARIF v2.1.0
      "artifact.sourceLanguage" property, based on the list in
      SARIF v2.1.0 Appendix J.
      
      The patch adds automated DejaGnu tests to our testsuite via new
      scan-sarif-file and scan-sarif-file-not directives (although these
      merely use regexps, rather than attempting to use a proper JSON parser).
      
      I've tested the patch by hand using the validator at:
        https://sarifweb.azurewebsites.net/Validation
      and the react-based viewer at:
        https://microsoft.github.io/sarif-web-component/
      
      
      which successfully shows most of the information (although not paths,
      and not CWE IDs), and I've fixed all validation errors I've seen (though
      bugs no doubt remain).
      
      I've also tested the generated SARIF using the VS Code extension linked
      to from the SARIF website; I'm a novice with VS Code, but it seems to be
      able to handle my generated SARIF files (e.g. showing the data in the
      SARIF tab, and showing squiggly underlines under issues, and when I
      click on them, it visualizes the events in the path inline within the
      source window).
      
      Has anyone written an Emacs mode for SARIF files? (pretty please)
      
      gcc/ChangeLog:
      	* Makefile.in (OBJS): Add tree-diagnostic-client-data-hooks.o and
      	tree-logical-location.o.
      	(OBJS-libcommon): Add diagnostic-format-sarif.o; reorder.
      	(CFLAGS-tree-diagnostic-client-data-hooks.o): Add TARGET_NAME.
      	* common.opt (fdiagnostics-format=): Add sarif-stderr and sarif-file.
      	(sarif-stderr, sarif-file): New enum values.
      	* diagnostic-client-data-hooks.h: New file.
      	* diagnostic-format-sarif.cc: New file.
      	* diagnostic-path.h (enum diagnostic_event::verb): New enum.
      	(enum diagnostic_event::noun): New enum.
      	(enum diagnostic_event::property): New enum.
      	(struct diagnostic_event::meaning): New struct.
      	(diagnostic_event::get_logical_location): New vfunc.
      	(diagnostic_event::get_meaning): New vfunc.
      	(simple_diagnostic_event::get_logical_location): New vfunc impl.
      	(simple_diagnostic_event::get_meaning): New vfunc impl.
      	* diagnostic.cc: Include "diagnostic-client-data-hooks.h".
      	(diagnostic_initialize): Initialize m_client_data_hooks.
      	(diagnostic_finish): Clean up m_client_data_hooks.
      	(diagnostic_event::meaning::dump_to_pp): New.
      	(diagnostic_event::meaning::maybe_get_verb_str): New.
      	(diagnostic_event::meaning::maybe_get_noun_str): New.
      	(diagnostic_event::meaning::maybe_get_property_str): New.
      	(get_cwe_url): Make non-static.
      	(diagnostic_output_format_init): Handle
      	DIAGNOSTICS_OUTPUT_FORMAT_SARIF_STDERR and
      	DIAGNOSTICS_OUTPUT_FORMAT_SARIF_FILE.
      	* diagnostic.h (enum diagnostics_output_format): Add
      	DIAGNOSTICS_OUTPUT_FORMAT_SARIF_STDERR and
      	DIAGNOSTICS_OUTPUT_FORMAT_SARIF_FILE.
      	(class diagnostic_client_data_hooks): New forward decl.
      	(class logical_location): New forward decl.
      	(diagnostic_context::m_client_data_hooks): New field.
      	(diagnostic_output_format_init_sarif_stderr): New decl.
      	(diagnostic_output_format_init_sarif_file): New decl.
      	(get_cwe_url): New decl.
      	* doc/invoke.texi (-fdiagnostics-format=): Add sarif-stderr and
      	sarif-file.
      	* doc/sourcebuild.texi (Scan a particular file): Add
      	scan-sarif-file and scan-sarif-file-not.
      	* langhooks-def.h (lhd_get_sarif_source_language): New decl.
      	(LANG_HOOKS_GET_SARIF_SOURCE_LANGUAGE): New macro.
      	(LANG_HOOKS_INITIALIZER): Add
      	LANG_HOOKS_GET_SARIF_SOURCE_LANGUAGE.
      	* langhooks.cc (lhd_get_sarif_source_language): New.
      	* langhooks.h (lang_hooks::get_sarif_source_language): New field.
      	* logical-location.h: New file.
      	* plugin.cc (struct for_each_plugin_closure): New.
      	(for_each_plugin_cb): New.
      	(for_each_plugin): New.
      	* plugin.h (for_each_plugin): New decl.
      	* tree-diagnostic-client-data-hooks.cc: New file.
      	* tree-diagnostic.cc: Include "diagnostic-client-data-hooks.h".
      	(tree_diagnostics_defaults): Populate m_client_data_hooks.
      	* tree-logical-location.cc: New file.
      	* tree-logical-location.h: New file.
      
      gcc/ada/ChangeLog:
      	* gcc-interface/misc.cc (gnat_get_sarif_source_language): New.
      	(LANG_HOOKS_GET_SARIF_SOURCE_LANGUAGE): Redefine.
      
      gcc/analyzer/ChangeLog:
      	* checker-path.cc (checker_event::get_meaning): New.
      	(function_entry_event::get_meaning): New.
      	(state_change_event::get_desc): Add dump of meaning of the event
      	to the -fanalyzer-verbose-state-changes output.
      	(state_change_event::get_meaning): New.
      	(cfg_edge_event::get_meaning): New.
      	(call_event::get_meaning): New.
      	(return_event::get_meaning): New.
      	(start_consolidated_cfg_edges_event::get_meaning): New.
      	(warning_event::get_meaning): New.
      	* checker-path.h: Include "tree-logical-location.h".
      	(checker_event::checker_event): Construct m_logical_loc.
      	(checker_event::get_logical_location): New.
      	(checker_event::get_meaning): New decl.
      	(checker_event::m_logical_loc): New.
      	(function_entry_event::get_meaning): New decl.
      	(state_change_event::get_meaning): New decl.
      	(cfg_edge_event::get_meaning): New decl.
      	(call_event::get_meaning): New decl.
      	(return_event::get_meaning): New decl.
      	(start_consolidated_cfg_edges_event::get_meaning): New.
      	(warning_event::get_meaning): New decl.
      	* pending-diagnostic.h: Include "diagnostic-path.h".
      	(pending_diagnostic::get_meaning_for_state_change): New vfunc.
      	* sm-file.cc (file_diagnostic::get_meaning_for_state_change): New
      	vfunc impl.
      	* sm-malloc.cc (malloc_diagnostic::get_meaning_for_state_change):
      	Likewise.
      	* sm-sensitive.cc
      	(exposure_through_output_file::get_meaning_for_state_change):
      	Likewise.
      	* sm-taint.cc (taint_diagnostic::get_meaning_for_state_change):
      	Likewise.
      	* varargs.cc
      	(va_list_sm_diagnostic::get_meaning_for_state_change): Likewise.
      
      gcc/c/ChangeLog:
      	* c-lang.cc (LANG_HOOKS_GET_SARIF_SOURCE_LANGUAGE): Redefine.
      	(c_get_sarif_source_language): New.
      	* c-tree.h (c_get_sarif_source_language): New decl.
      
      gcc/cp/ChangeLog:
      	* cp-lang.cc (LANG_HOOKS_GET_SARIF_SOURCE_LANGUAGE): Redefine.
      	(cp_get_sarif_source_language): New.
      
      gcc/d/ChangeLog:
      	* d-lang.cc (d_get_sarif_source_language): New.
      	(LANG_HOOKS_GET_SARIF_SOURCE_LANGUAGE): Redefine.
      
      gcc/fortran/ChangeLog:
      	* f95-lang.cc (gfc_get_sarif_source_language): New.
      	(LANG_HOOKS_GET_SARIF_SOURCE_LANGUAGE): Redefine.
      
      gcc/go/ChangeLog:
      	* go-lang.cc (go_get_sarif_source_language): New.
      	(LANG_HOOKS_GET_SARIF_SOURCE_LANGUAGE): Redefine.
      
      gcc/objc/ChangeLog:
      	* objc-act.h (objc_get_sarif_source_language): New decl.
      	* objc-lang.cc (LANG_HOOKS_GET_SARIF_SOURCE_LANGUAGE): Redefine.
      	(objc_get_sarif_source_language): New.
      
      gcc/testsuite/ChangeLog:
      	* c-c++-common/diagnostic-format-sarif-file-1.c: New test.
      	* c-c++-common/diagnostic-format-sarif-file-2.c: New test.
      	* c-c++-common/diagnostic-format-sarif-file-3.c: New test.
      	* c-c++-common/diagnostic-format-sarif-file-4.c: New test.
      	* gcc.dg/analyzer/file-meaning-1.c: New test.
      	* gcc.dg/analyzer/malloc-meaning-1.c: New test.
      	* gcc.dg/analyzer/malloc-sarif-1.c: New test.
      	* gcc.dg/plugin/analyzer_gil_plugin.c
      	(gil_diagnostic::get_meaning_for_state_change): New vfunc impl.
      	* gcc.dg/plugin/diagnostic-test-paths-5.c: New test.
      	* gcc.dg/plugin/plugin.exp (plugin_test_list): Add
      	diagnostic-test-paths-5.c to tests for
      	diagnostic_plugin_test_paths.c.
      	* lib/gcc-dg.exp: Load scansarif.exp.
      	* lib/scansarif.exp: New test.
      
      libatomic/ChangeLog:
      	* testsuite/lib/libatomic.exp: Add load_gcc_lib of scansarif.exp.
      
      libgomp/ChangeLog:
      	* testsuite/lib/libgomp.exp: Add load_gcc_lib of scansarif.exp.
      
      libitm/ChangeLog:
      	* testsuite/lib/libitm.exp: Add load_gcc_lib of scansarif.exp.
      
      libphobos/ChangeLog:
      	* testsuite/lib/libphobos-dg.exp: Add load_gcc_lib of scansarif.exp.
      
      Signed-off-by: default avatarDavid Malcolm <dmalcolm@redhat.com>
      6cf276dd
  28. Mar 25, 2022
  29. Mar 24, 2022
    • Tom de Vries's avatar
      [libatomic] Fix return value in libat_test_and_set · 11fb784a
      Tom de Vries authored
      On nvptx (using a Quadro K2000 with driver 470.103.01) I ran into this:
      ...
      FAIL: gcc.dg/atomic/stdatomic-flag-2.c -O1 execution test
      ...
      which mimimized to:
      ...
        #include <stdatomic.h>
        atomic_flag a = ATOMIC_FLAG_INIT;
        int main () {
          if ((atomic_flag_test_and_set) (&a))
            __builtin_abort ();
          return 0;
        }
      ...
      
      The atomic_flag_test_and_set is implemented using __atomic_test_and_set_1,
      which corresponds to the "word-sized compare-and-swap loop" version of
      libat_test_and_set in libatomic/tas_n.c.
      
      The semantics of a test-and-set is that the return value is "true if and only
      if the previous contents were 'set'".
      
      But the code uses:
      ...
        return woldval != 0;
      ...
      which means it doesn't look only at the byte that was either set or not set,
      but at the entire word.
      
      Fix this by using instead:
      ...
        return (woldval & ((UTYPE) ~(UTYPE) 0 << shift)) != 0;
      ...
      
      Tested on nvptx.
      
      libatomic/ChangeLog:
      
      2022-03-24  Tom de Vries  <tdevries@suse.de>
      
      	PR target/105011
      	* tas_n.c (libat_test_and_set): Fix return value.
      11fb784a
  30. Mar 18, 2022
  31. Mar 17, 2022
    • Jakub Jelinek's avatar
      libatomic: Improve 16-byte atomics on Intel AVX [PR104688] · 1d47c051
      Jakub Jelinek authored
      As mentioned in the PR, the latest Intel SDM has added:
      "Processors that enumerate support for Intel® AVX (by setting the feature flag CPUID.01H:ECX.AVX[bit 28])
      guarantee that the 16-byte memory operations performed by the following instructions will always be
      carried out atomically:
      • MOVAPD, MOVAPS, and MOVDQA.
      • VMOVAPD, VMOVAPS, and VMOVDQA when encoded with VEX.128.
      • VMOVAPD, VMOVAPS, VMOVDQA32, and VMOVDQA64 when encoded with EVEX.128 and k0 (masking disabled).
      (Note that these instructions require the linear addresses of their memory operands to be 16-byte
      aligned.)"
      
      The following patch deals with it just on the libatomic library side so far,
      currently (since ~ 2017) we emit all the __atomic_* 16-byte builtins as
      library calls since and this is something that we can hopefully backport.
      
      The patch simply introduces yet another ifunc variant that takes priority
      over the pure CMPXCHG16B one, one that checks AVX and CMPXCHG16B bits and
      on non-Intel clears the AVX bit during detection for now (if AMD comes
      with the same guarantee, we could revert the config/x86/init.c hunk),
      which implements 16-byte atomic load as vmovdqa and 16-byte atomic store
      as vmovdqa followed by mfence.
      
      2022-03-17  Jakub Jelinek  <jakub@redhat.com>
      
      	PR target/104688
      	* Makefile.am (IFUNC_OPTIONS): Change on x86_64 to -mcx16 -mcx16.
      	(libatomic_la_LIBADD): Add $(addsuffix _16_2_.lo,$(SIZEOBJS)) for
      	x86_64.
      	* Makefile.in: Regenerated.
      	* config/x86/host-config.h (IFUNC_COND_1): For x86_64 define to
      	both AVX and CMPXCHG16B bits.
      	(IFUNC_COND_2): Define.
      	(IFUNC_NCOND): For x86_64 define to 2 * (N == 16).
      	(MAYBE_HAVE_ATOMIC_CAS_16, MAYBE_HAVE_ATOMIC_EXCHANGE_16,
      	MAYBE_HAVE_ATOMIC_LDST_16): Define to IFUNC_COND_2 rather than
      	IFUNC_COND_1.
      	(HAVE_ATOMIC_CAS_16): Redefine to 1 whenever IFUNC_ALT != 0.
      	(HAVE_ATOMIC_LDST_16): Redefine to 1 whenever IFUNC_ALT == 1.
      	(atomic_compare_exchange_n): Define whenever IFUNC_ALT != 0
      	on x86_64 for N == 16.
      	(__atomic_load_n, __atomic_store_n): Redefine whenever IFUNC_ALT == 1
      	on x86_64 for N == 16.
      	(atomic_load_n, atomic_store_n): New functions.
      	* config/x86/init.c (__libat_feat1_init): On x86_64 clear bit_AVX
      	if CPU vendor is not Intel.
      1d47c051
  32. Feb 04, 2022
  33. Feb 03, 2022
    • David Seifert's avatar
      make `-Werror` optional in libatomic/libbacktrace/libgomp/libitm/libsanitizer · 45ba6bf2
      David Seifert authored
      * `-Werror` can cause issues when a more recent version of GCC compiles
        an older version:
        - https://bugs.gentoo.org/229059
        - https://bugs.gentoo.org/475350
        - https://bugs.gentoo.org/667104
      
      
      
      libatomic/ChangeLog:
      
      	* configure.ac: Support --disable-werror.
      	* configure: Regenerate.
      
      libbacktrace/ChangeLog:
      
      	* configure.ac: Support --disable-werror.
      	* configure: Regenerate.
      
      libgomp/ChangeLog:
      
      	* configure.ac: Support --disable-werror.
      	* configure: Regenerate.
      
      libitm/ChangeLog:
      
      	* configure.ac: Support --disable-werror.
      	* configure: Regenerate.
      
      libsanitizer/ChangeLog:
      
      	* configure.ac: Support --disable-werror.
      	* aclocal.m4: Include also ../config/warnings.m4.
      	* libbacktrace/Makefile.am (WARN_FLAGS): Remove.
      	* configure: Regenerate.
      	* Makefile.in: Regenerate.
      	* asan/Makefile.in: Regenerate.
      	* hwasan/Makefile.in: Regenerate.
      	* interception/Makefile.in: Regenerate.
      	* libbacktrace/Makefile.in: Regenerate.
      	* lsan/Makefile.in: Regenerate.
      	* sanitizer_common/Makefile.in: Regenerate.
      	* tsan/Makefile.in: Regenerate.
      	* ubsan/Makefile.in: Regenerate.
      
      Co-Authored-By: default avatarJakub Jelinek <jakub@redhat.com>
      45ba6bf2
  34. Feb 01, 2022
Loading