[gcc(refs/users/omachota/heads/rtl-ssa-dce)] rtl-ssa-dce: apply clang format
https://gcc.gnu.org/g:71827344a150eaa480e87c78faf71e49c04be9c5 commit 71827344a150eaa480e87c78faf71e49c04be9c5 Author: Ondřej Machota Date: Mon Apr 28 08:45:07 2025 +0200 rtl-ssa-dce: apply clang format Diff: --- gcc/dce.cc | 680 - 1 file changed, 361 insertions(+), 319 deletions(-) diff --git a/gcc/dce.cc b/gcc/dce.cc index 70c9faf27c59..e21f8bff8898 100644 --- a/gcc/dce.cc +++ b/gcc/dce.cc @@ -1318,33 +1318,28 @@ public: } // namespace -struct offset_bitmap { - private: -const int m_offset; -sbitmap m_bitmap; - - public: -offset_bitmap(size_t size, int offset) : m_offset{offset}, - m_bitmap{sbitmap_alloc(size)} {} - -offset_bitmap(int min_index, int max_index) : - offset_bitmap(size_t(max_index - min_index + 1), -min_index) {} - -void clear_bit(int index) { - bitmap_clear_bit(m_bitmap, index + m_offset); -} +struct offset_bitmap +{ +private: + const int m_offset; + sbitmap m_bitmap; -void set_bit(int index) { - bitmap_set_bit(m_bitmap, index + m_offset); -} +public: + offset_bitmap (size_t size, int offset) +: m_offset{offset}, m_bitmap{sbitmap_alloc (size)} + {} -bool get_bit(int index) { - return bitmap_bit_p(m_bitmap, index + m_offset); -} + offset_bitmap (int min_index, int max_index) +: offset_bitmap (size_t (max_index - min_index + 1), -min_index) + {} -~offset_bitmap() { - sbitmap_free(m_bitmap); -} + void clear_bit (int index) { bitmap_clear_bit (m_bitmap, index + m_offset); } + + void set_bit (int index) { bitmap_set_bit (m_bitmap, index + m_offset); } + + bool get_bit (int index) { return bitmap_bit_p (m_bitmap, index + m_offset); } + + ~offset_bitmap () { sbitmap_free (m_bitmap); } }; class rtl_ssa_dce @@ -1353,33 +1348,37 @@ public: unsigned int execute (function *); private: - bool is_rtx_body_prelive(const_rtx); - bool can_delete_call(const_rtx); - bool is_rtx_prelive(const_rtx); - bool is_prelive(insn_info *); - void mark_prelive_insn(insn_info *, auto_vec&); - auto_vec mark_prelive(); - void mark(); - std::unordered_set propagate_dead_phis(); - void reset_dead_debug_insn(insn_info *); - void reset_dead_debug(); - void sweep(); - + bool is_rtx_body_prelive (const_rtx); + bool can_delete_call (const_rtx); + bool is_rtx_prelive (const_rtx); + bool is_prelive (insn_info *); + void mark_prelive_insn (insn_info *, auto_vec &); + auto_vec mark_prelive (); + void mark (); + std::unordered_set propagate_dead_phis (); + void reset_dead_debug_insn (insn_info *); + void reset_dead_debug (); + void sweep (); + + offset_bitmap mm_marked; + offset_bitmap mm_marked_phis; std::unordered_set m_marked; std::unordered_set m_marked_phis; }; bool -rtl_ssa_dce::is_rtx_body_prelive(const_rtx insn) { - switch (GET_CODE(insn)) { +rtl_ssa_dce::is_rtx_body_prelive (const_rtx insn) +{ + switch (GET_CODE (insn)) +{ case PREFETCH: case UNSPEC: case TRAP_IF: /* testsuite/gcc.c-torture/execute/20020418-1.c */ return true; default: - return side_effects_p(insn); - } + return side_effects_p (insn); +} } bool @@ -1387,10 +1386,9 @@ rtl_ssa_dce::can_delete_call (const_rtx insn) { if (cfun->can_delete_dead_exceptions) return true; - if (!insn_nothrow_p (insn)) -return false; - // if (can_alter_cfg) - return true; + // if (!insn_nothrow_p (insn)) +// return false; + return insn_nothrow_p (insn); // UD_DCE ignores this and works... /* If we can't alter cfg, even when the call can't throw exceptions, it @@ -1403,45 +1401,49 @@ rtl_ssa_dce::can_delete_call (const_rtx insn) // edge_iterator ei; // FOR_EACH_EDGE (e, ei, BLOCK_FOR_INSN (insn)->succs) - // if ((e->flags & EDGE_ABNORMAL_CALL) != 0) - // return false; + // if ((e->flags & EDGE_ABNORMAL_CALL) != 0) + // return false; // } // return true; } bool -rtl_ssa_dce::is_rtx_prelive(const_rtx insn) { - gcc_assert(insn != nullptr); +rtl_ssa_dce::is_rtx_prelive (const_rtx insn) +{ + gcc_assert (insn != nullptr); if (CALL_P (insn) -// We cannot delete pure or const sibling calls because it is -// hard to see the result. -&& (!SIBLING_CALL_P (insn)) -// We can delete dead const or pure calls as long as they do not -// infinite loop. -&& (RTL_CONST_OR_PURE_CALL_P (insn) && !RTL_LOOPING_CONST_OR_PURE_CALL_P (insn)) -// Don't delete calls that may throw if we cannot do so. -&& can_delete_call (insn)) - return false; + // We cannot delete pure or const sibling calls because it is + // hard to see the result. + && (!SIBLING_CALL_P (insn)) + // We can delete dead const or pure calls as long as they do not + // infinite loop. + && (RTL_CONST_OR_PURE_CALL_P (insn) + && !RTL_LOOPING_CONST_OR_PURE_CALL_P (insn)) + // Don't delete calls that may throw if we c
[gcc r16-175] c++/modules: Ensure DECL_FRIEND_CONTEXT is streamed [PR119939]
https://gcc.gnu.org/g:1c5cf7cc82d3a2afa5d4fb90049456be408c2a7a commit r16-175-g1c5cf7cc82d3a2afa5d4fb90049456be408c2a7a Author: Nathaniel Shead Date: Sat Apr 26 00:10:34 2025 +1000 c++/modules: Ensure DECL_FRIEND_CONTEXT is streamed [PR119939] An instantiated friend function relies on DECL_FRIEND_CONTEXT being set to be able to recover the template arguments of the class that instantiated it, despite not being a template itself. This patch ensures that this data is streamed even when DECL_CLASS_SCOPE_P is not true. PR c++/119939 gcc/cp/ChangeLog: * module.cc (trees_out::lang_decl_vals): Also stream lang->u.fn.context when DECL_UNIQUE_FRIEND_P. (trees_in::lang_decl_vals): Likewise. gcc/testsuite/ChangeLog: * g++.dg/modules/concept-11_a.H: New test. * g++.dg/modules/concept-11_b.C: New test. Signed-off-by: Nathaniel Shead Diff: --- gcc/cp/module.cc| 4 ++-- gcc/testsuite/g++.dg/modules/concept-11_a.H | 9 + gcc/testsuite/g++.dg/modules/concept-11_b.C | 9 + 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc index 5ff5c462e79c..a2e0d6d25718 100644 --- a/gcc/cp/module.cc +++ b/gcc/cp/module.cc @@ -7386,7 +7386,7 @@ trees_out::lang_decl_vals (tree t) WU (lang->u.fn.ovl_op_code); } - if (DECL_CLASS_SCOPE_P (t)) + if (DECL_CLASS_SCOPE_P (t) || DECL_UNIQUE_FRIEND_P (t)) WT (lang->u.fn.context); if (lang->u.fn.thunk_p) @@ -7470,7 +7470,7 @@ trees_in::lang_decl_vals (tree t) lang->u.fn.ovl_op_code = code; } - if (DECL_CLASS_SCOPE_P (t)) + if (DECL_CLASS_SCOPE_P (t) || DECL_UNIQUE_FRIEND_P (t)) RT (lang->u.fn.context); if (lang->u.fn.thunk_p) diff --git a/gcc/testsuite/g++.dg/modules/concept-11_a.H b/gcc/testsuite/g++.dg/modules/concept-11_a.H new file mode 100644 index ..451276828123 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/concept-11_a.H @@ -0,0 +1,9 @@ +// PR c++/119939 +// { dg-additional-options "-fmodule-header -std=c++20" } +// { dg-module-cmi {} } + +template concept A = true; +template concept B = requires { T{}; }; +template struct S { + friend bool operator==(const S&, const S&) requires B = default; +}; diff --git a/gcc/testsuite/g++.dg/modules/concept-11_b.C b/gcc/testsuite/g++.dg/modules/concept-11_b.C new file mode 100644 index ..3f6676ff9652 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/concept-11_b.C @@ -0,0 +1,9 @@ +// PR c++/119939 +// { dg-additional-options "-fmodules -std=c++20" } + +import "concept-11_a.H"; + +int main() { + S s; + s == s; +}
[gcc r15-9593] c++/modules: Find non-exported reachable decls when instantiating friend classes [PR119863]
https://gcc.gnu.org/g:947e0d1811805468116b0d497bd62779273bfa2b commit r15-9593-g947e0d1811805468116b0d497bd62779273bfa2b Author: Nathaniel Shead Date: Mon Apr 21 19:58:03 2025 +1000 c++/modules: Find non-exported reachable decls when instantiating friend classes [PR119863] In r15-9029-geb26b667518c95, we started checking for conflicting declarations with any reachable decl attached to the same originating module. This exposed the issue in the PR, where we would always create a new type even if a matching type existed in the original module. This patch reworks lookup_imported_hidden_friend to handle this case better, by first checking for any reachable decl in the attached module before looking in the mergeable decl slots. PR c++/119863 gcc/cp/ChangeLog: * name-lookup.cc (get_mergeable_namespace_binding): Remove no-longer-used function. (lookup_imported_hidden_friend): Also look for hidden imported decls in an attached decl's module. gcc/testsuite/ChangeLog: * g++.dg/modules/tpl-friend-18_a.C: New test. * g++.dg/modules/tpl-friend-18_b.C: New test. * g++.dg/modules/tpl-friend-18_c.C: New test. Signed-off-by: Nathaniel Shead (cherry picked from commit 948ea8766780f7e44f39ccde3f2436ac2fec80da) Diff: --- gcc/cp/name-lookup.cc | 43 ++ gcc/testsuite/g++.dg/modules/tpl-friend-18_a.C | 25 +++ gcc/testsuite/g++.dg/modules/tpl-friend-18_b.C | 9 ++ gcc/testsuite/g++.dg/modules/tpl-friend-18_c.C | 10 ++ 4 files changed, 67 insertions(+), 20 deletions(-) diff --git a/gcc/cp/name-lookup.cc b/gcc/cp/name-lookup.cc index 1cd982e12d49..d2898ec5d395 100644 --- a/gcc/cp/name-lookup.cc +++ b/gcc/cp/name-lookup.cc @@ -4178,22 +4178,6 @@ mergeable_namespace_slots (tree ns, tree name, bool is_attached, tree *vec) return vslot; } -/* Retrieve the bindings for an existing mergeable entity in namespace - NS slot NAME. Returns NULL if no such bindings exists. */ - -static tree -get_mergeable_namespace_binding (tree ns, tree name, bool is_attached) -{ - tree *mslot = find_namespace_slot (ns, name, false); - if (!mslot || !*mslot || TREE_CODE (*mslot) != BINDING_VECTOR) -return NULL_TREE; - - tree *vslot = get_fixed_binding_slot -(mslot, name, is_attached ? BINDING_SLOT_PARTITION : BINDING_SLOT_GLOBAL, - false); - return vslot ? *vslot : NULL_TREE; -} - /* DECL is a new mergeable namespace-scope decl. Add it to the mergeable entities on GSLOT. */ @@ -4574,9 +4558,9 @@ lookup_imported_hidden_friend (tree friend_tmpl) lazy_load_pendings (friend_tmpl); - tree bind = get_mergeable_namespace_binding -(current_namespace, DECL_NAME (inner), DECL_MODULE_ATTACH_P (inner)); - if (!bind) + tree name = DECL_NAME (inner); + tree *slot = find_namespace_slot (current_namespace, name, false); + if (!slot || !*slot || TREE_CODE (*slot) != BINDING_VECTOR) return NULL_TREE; /* We're only interested in declarations attached to the same module @@ -4584,9 +4568,28 @@ lookup_imported_hidden_friend (tree friend_tmpl) int m = get_originating_module (friend_tmpl, /*global=-1*/true); gcc_assert (m != 0); + /* First check whether there's a reachable declaration attached to the module + we're looking for. */ + if (m > 0) +if (binding_slot *mslot = search_imported_binding_slot (slot, m)) + { + if (mslot->is_lazy ()) + lazy_load_binding (m, current_namespace, name, mslot); + for (ovl_iterator iter (*mslot); iter; ++iter) + if (DECL_CLASS_TEMPLATE_P (*iter)) + return *iter; + } + + /* Otherwise, look in the mergeable slots for this name, in case an importer + has already instantiated this declaration. */ + tree *vslot = get_fixed_binding_slot +(slot, name, m > 0 ? BINDING_SLOT_PARTITION : BINDING_SLOT_GLOBAL, false); + if (!vslot || !*vslot) +return NULL_TREE; + /* There should be at most one class template from the module we're looking for, return it. */ - for (ovl_iterator iter (bind); iter; ++iter) + for (ovl_iterator iter (*vslot); iter; ++iter) if (DECL_CLASS_TEMPLATE_P (*iter) && get_originating_module (*iter, true) == m) return *iter; diff --git a/gcc/testsuite/g++.dg/modules/tpl-friend-18_a.C b/gcc/testsuite/g++.dg/modules/tpl-friend-18_a.C new file mode 100644 index ..333c9764ce0e --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/tpl-friend-18_a.C @@ -0,0 +1,25 @@ +// PR c++/119863 +// { dg-additional-options "-fmodules" } +// { dg-module-cmi A } + +export module A; + +template +class T; + +template +class U +{ + template + friend class T; +}; + +template +class T +{ + U x = {}; +}; + +export +template +T f(V) { return {}; } diff --git a/gcc/testsuite/g++.dg/modules/tpl-friend-18_b.C b/gcc/testsuite/g++.
[gcc r15-9594] c++/modules: Ensure DECL_FRIEND_CONTEXT is streamed [PR119939]
https://gcc.gnu.org/g:57feb6afcade6b066477359bee41d071225ab499 commit r15-9594-g57feb6afcade6b066477359bee41d071225ab499 Author: Nathaniel Shead Date: Sat Apr 26 00:10:34 2025 +1000 c++/modules: Ensure DECL_FRIEND_CONTEXT is streamed [PR119939] An instantiated friend function relies on DECL_FRIEND_CONTEXT being set to be able to recover the template arguments of the class that instantiated it, despite not being a template itself. This patch ensures that this data is streamed even when DECL_CLASS_SCOPE_P is not true. PR c++/119939 gcc/cp/ChangeLog: * module.cc (trees_out::lang_decl_vals): Also stream lang->u.fn.context when DECL_UNIQUE_FRIEND_P. (trees_in::lang_decl_vals): Likewise. gcc/testsuite/ChangeLog: * g++.dg/modules/concept-11_a.H: New test. * g++.dg/modules/concept-11_b.C: New test. Signed-off-by: Nathaniel Shead (cherry picked from commit 1c5cf7cc82d3a2afa5d4fb90049456be408c2a7a) Diff: --- gcc/cp/module.cc| 4 ++-- gcc/testsuite/g++.dg/modules/concept-11_a.H | 9 + gcc/testsuite/g++.dg/modules/concept-11_b.C | 9 + 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc index 5ff5c462e79c..a2e0d6d25718 100644 --- a/gcc/cp/module.cc +++ b/gcc/cp/module.cc @@ -7386,7 +7386,7 @@ trees_out::lang_decl_vals (tree t) WU (lang->u.fn.ovl_op_code); } - if (DECL_CLASS_SCOPE_P (t)) + if (DECL_CLASS_SCOPE_P (t) || DECL_UNIQUE_FRIEND_P (t)) WT (lang->u.fn.context); if (lang->u.fn.thunk_p) @@ -7470,7 +7470,7 @@ trees_in::lang_decl_vals (tree t) lang->u.fn.ovl_op_code = code; } - if (DECL_CLASS_SCOPE_P (t)) + if (DECL_CLASS_SCOPE_P (t) || DECL_UNIQUE_FRIEND_P (t)) RT (lang->u.fn.context); if (lang->u.fn.thunk_p) diff --git a/gcc/testsuite/g++.dg/modules/concept-11_a.H b/gcc/testsuite/g++.dg/modules/concept-11_a.H new file mode 100644 index ..451276828123 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/concept-11_a.H @@ -0,0 +1,9 @@ +// PR c++/119939 +// { dg-additional-options "-fmodule-header -std=c++20" } +// { dg-module-cmi {} } + +template concept A = true; +template concept B = requires { T{}; }; +template struct S { + friend bool operator==(const S&, const S&) requires B = default; +}; diff --git a/gcc/testsuite/g++.dg/modules/concept-11_b.C b/gcc/testsuite/g++.dg/modules/concept-11_b.C new file mode 100644 index ..3f6676ff9652 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/concept-11_b.C @@ -0,0 +1,9 @@ +// PR c++/119939 +// { dg-additional-options "-fmodules -std=c++20" } + +import "concept-11_a.H"; + +int main() { + S s; + s == s; +}
[gcc r16-179] c-family: Improve location for -Wunknown-pragmas in a _Pragma [PR118838]
https://gcc.gnu.org/g:78673484b4055b93207eee0efd60a434b0bf96ab commit r16-179-g78673484b4055b93207eee0efd60a434b0bf96ab Author: Lewis Hyatt Date: Tue Feb 11 13:45:41 2025 -0500 c-family: Improve location for -Wunknown-pragmas in a _Pragma [PR118838] The warning for -Wunknown-pragmas is issued at the location provided by libcpp to the def_pragma() callback. This location is cpp_reader::directive_line, which is a location for the start of the line only; it is also not a valid location in case the unknown pragma was lexed from a _Pragma string. These factors make it impossible to suppress -Wunknown-pragmas via _Pragma("GCC diagnostic...") directives on the same source line, as in the PR and the test case. Address that by issuing the warning at a better location returned by cpp_get_diagnostic_override_loc(). libcpp already maintains this location to handle _Pragma-related diagnostics internally; it was needed also to make a publicly accessible version of it. gcc/c-family/ChangeLog: PR c/118838 * c-lex.cc (cb_def_pragma): Call cpp_get_diagnostic_override_loc() to get a valid location at which to issue -Wunknown-pragmas, in case it was triggered from a _Pragma. libcpp/ChangeLog: PR c/118838 * errors.cc (cpp_get_diagnostic_override_loc): New function. * include/cpplib.h (cpp_get_diagnostic_override_loc): Declare. gcc/testsuite/ChangeLog: PR c/118838 * c-c++-common/cpp/pragma-diagnostic-loc-2.c: New test. * g++.dg/gomp/macro-4.C: Adjust expected output. * gcc.dg/gomp/macro-4.c: Likewise. * gcc.dg/cpp/Wunknown-pragmas-1.c: Likewise. Diff: --- gcc/c-family/c-lex.cc | 7 ++- .../c-c++-common/cpp/pragma-diagnostic-loc-2.c | 15 +++ gcc/testsuite/g++.dg/gomp/macro-4.C| 8 gcc/testsuite/gcc.dg/cpp/Wunknown-pragmas-1.c | 22 +- gcc/testsuite/gcc.dg/gomp/macro-4.c| 8 libcpp/errors.cc | 10 ++ libcpp/include/cpplib.h| 2 ++ 7 files changed, 54 insertions(+), 18 deletions(-) diff --git a/gcc/c-family/c-lex.cc b/gcc/c-family/c-lex.cc index e450c9a57f0c..fef6ae6f457b 100644 --- a/gcc/c-family/c-lex.cc +++ b/gcc/c-family/c-lex.cc @@ -248,7 +248,12 @@ cb_def_pragma (cpp_reader *pfile, location_t loc) { const unsigned char *space, *name; const cpp_token *s; - location_t fe_loc = loc; + + /* If we are processing a _Pragma, LOC is not a valid location, but libcpp +will provide a good location via this function instead. */ + location_t fe_loc = cpp_get_diagnostic_override_loc (pfile); + if (fe_loc == UNKNOWN_LOCATION) + fe_loc = loc; space = name = (const unsigned char *) ""; diff --git a/gcc/testsuite/c-c++-common/cpp/pragma-diagnostic-loc-2.c b/gcc/testsuite/c-c++-common/cpp/pragma-diagnostic-loc-2.c new file mode 100644 index ..734da2154705 --- /dev/null +++ b/gcc/testsuite/c-c++-common/cpp/pragma-diagnostic-loc-2.c @@ -0,0 +1,15 @@ +/* PR c/118838 */ +/* { dg-do compile } */ +/* { dg-additional-options "-Wunknown-pragmas" } */ + +/* Make sure the warnings are suppressed as expected. */ + +/* The tokens need to be all on the same line here. */ +_Pragma ("GCC diagnostic push") _Pragma ("GCC diagnostic ignored \"-Wunknown-pragmas\"") _Pragma ("__unknown__") _Pragma ("GCC diagnostic pop") + +#define MACRO \ +_Pragma ("GCC diagnostic push") \ +_Pragma ("GCC diagnostic ignored \"-Wunknown-pragmas\"") \ +_Pragma ("__unknown__") \ +_Pragma ("GCC diagnostic pop") +MACRO diff --git a/gcc/testsuite/g++.dg/gomp/macro-4.C b/gcc/testsuite/g++.dg/gomp/macro-4.C index dcc8bcbc8e5c..5aa6d97c6609 100644 --- a/gcc/testsuite/g++.dg/gomp/macro-4.C +++ b/gcc/testsuite/g++.dg/gomp/macro-4.C @@ -3,7 +3,7 @@ // { dg-options "-fopenmp -Wunknown-pragmas" } #define p _Pragma ("omp parallel") -#define omp_p _Pragma ("omp p") +#define omp_p _Pragma ("omp p") // { dg-warning "ignoring '#pragma omp _Pragma'" } void bar (void); @@ -12,18 +12,18 @@ foo (void) { #pragma omp p // { dg-warning "-:ignoring '#pragma omp _Pragma'" } bar (); - omp_p// { dg-warning "-:ignoring '#pragma omp _Pragma'" } +omp_p // { dg-note "in expansion of macro 'omp_p'" } bar (); } #define parallel serial -#define omp_parallel _Pragma ("omp parallel") +#define omp_parallel _Pragma ("omp parallel") // { dg-warning "ignoring '#pragma omp serial'" } void baz (void) { #pragma omp parallel // { dg-warning "-:ignoring '#pragma omp serial'" } bar (); - omp_parallel // { dg-warning "-:ignoring '#pragma omp serial'" } +om
[gcc r16-177] Fix size_t in id-15.c and infoleak-net-ethtool-ioctl.c for llp64
https://gcc.gnu.org/g:346c62c60b88fa6ff123bfc6159f61e865ac8750 commit r16-177-g346c62c60b88fa6ff123bfc6159f61e865ac8750 Author: Jonathan Yong <10wa...@gmail.com> Date: Thu Apr 24 07:42:17 2025 + Fix size_t in id-15.c and infoleak-net-ethtool-ioctl.c for llp64 Use __SIZE_TYPE__ for size_t types so that it works for llp64. Signed-off-by: Jonathan Yong <10wa...@gmail.com> gcc/testsuite/ChangeLog: * gcc.dg/graphite/id-15.c: Use __SIZE_TYPE__ instead of unsigned long. * gcc.dg/plugin/infoleak-net-ethtool-ioctl.c: ditto. Diff: --- gcc/testsuite/gcc.dg/graphite/id-15.c| 2 +- gcc/testsuite/gcc.dg/plugin/infoleak-net-ethtool-ioctl.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/gcc/testsuite/gcc.dg/graphite/id-15.c b/gcc/testsuite/gcc.dg/graphite/id-15.c index d0a804c876bf..d258ef576882 100644 --- a/gcc/testsuite/gcc.dg/graphite/id-15.c +++ b/gcc/testsuite/gcc.dg/graphite/id-15.c @@ -1,7 +1,7 @@ /* { dg-additional-options "-Wno-old-style-definition" } */ /* { dg-require-effective-target int32plus } */ -typedef long unsigned int size_t; +typedef __SIZE_TYPE__ size_t; extern void *memset (void *__s, int __c, size_t __n) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); static void diff --git a/gcc/testsuite/gcc.dg/plugin/infoleak-net-ethtool-ioctl.c b/gcc/testsuite/gcc.dg/plugin/infoleak-net-ethtool-ioctl.c index 52846c40f863..afb4a5714e9a 100644 --- a/gcc/testsuite/gcc.dg/plugin/infoleak-net-ethtool-ioctl.c +++ b/gcc/testsuite/gcc.dg/plugin/infoleak-net-ethtool-ioctl.c @@ -11,8 +11,7 @@ typedef unsigned int __u32; typedef __s8 s8; typedef __u32 u32; enum { false = 0, true = 1 }; -typedef unsigned long __kernel_ulong_t; -typedef __kernel_ulong_t __kernel_size_t; +typedef __SIZE_TYPE__ __kernel_size_t; typedef _Bool bool; typedef __kernel_size_t size_t;
[gcc r16-178] gcc: For Windows x86-32, always attempt to realign stack regardless of SSE
https://gcc.gnu.org/g:dea7b9a78b11b5ca0c85b971521144ba07a66aca commit r16-178-gdea7b9a78b11b5ca0c85b971521144ba07a66aca Author: LIU Hao Date: Sun Apr 27 18:18:34 2025 +0800 gcc: For Windows x86-32, always attempt to realign stack regardless of SSE For Windows x86-32 targets, the Microsoft ABI only guarantees that the stack is aligned to 4-byte boundaries. GCC knows about the default alignment of the stack. However, before this commit, it did not realign the stack unless SSE was also enabled. When a stricter (larger) alignment is requested, it's always necessary to realign the stack, as what Solaris does. Reference: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=07#c14 Signed-off-by: LIU Hao Signed-off-by: Jonathan Yong <10wa...@gmail.com> gcc/ChangeLog: PR target/07 * config/i386/cygming.h (STACK_REALIGN_DEFAULT): Copy from sol2.h. Diff: --- gcc/config/i386/cygming.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h index 3ddcbecb22fd..d587d25a58a8 100644 --- a/gcc/config/i386/cygming.h +++ b/gcc/config/i386/cygming.h @@ -36,7 +36,7 @@ along with GCC; see the file COPYING3. If not see /* 32-bit Windows aligns the stack on a 4-byte boundary but SSE instructions may require 16-byte alignment. */ #undef STACK_REALIGN_DEFAULT -#define STACK_REALIGN_DEFAULT TARGET_SSE +#define STACK_REALIGN_DEFAULT (TARGET_64BIT ? 0 : 1) /* Support hooks for SEH. */ #undef TARGET_ASM_UNWIND_EMIT