From 0c0907f99155366e9f3560c29ac37eb0e2880254 Mon Sep 17 00:00:00 2001 From: Patrick Palka Date: Thu, 19 Aug 2021 09:05:35 -0400 Subject: Fix PR number for r12-2991 in ChangeLogs --- gcc/cp/ChangeLog | 2 +- gcc/testsuite/ChangeLog | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc') diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index a06a496..6f872f6 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,7 +1,7 @@ 2021-08-18 Patrick Palka PR c++/101344 - PR c++/101820 + PR c++/101803 * cp-tree.h (CONSTRUCTOR_BRACES_ELIDED_P): Define. * decl.c (reshape_init_r): Set it. * pt.c (collect_ctor_idx_types): Recurse into a sub-CONSTRUCTOR diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 57b714a..7cdc16d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -40,7 +40,7 @@ 2021-08-18 Patrick Palka PR c++/101344 - PR c++/101820 + PR c++/101803 * g++.dg/cpp2a/class-deduction-aggr11.C: New test. * g++.dg/cpp2a/class-deduction-aggr12.C: New test. -- cgit v1.1 From 4285ca3e1c4a6c9540dcdf1c4a71b99aba9bbfe8 Mon Sep 17 00:00:00 2001 From: Patrick Palka Date: Thu, 19 Aug 2021 09:07:02 -0400 Subject: c++: Fix PR number in testcase [PR101803] Also clarify the description of CONSTRUCTOR_BRACES_ELIDED_P. PR c++/101803 gcc/cp/ChangeLog: * cp-tree.h (CONSTRUCTOR_IS_PAREN_INIT): Clarify comment. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/class-deduction-aggr12.C: Fix PR number. --- gcc/cp/cp-tree.h | 4 ++-- gcc/testsuite/g++.dg/cpp2a/class-deduction-aggr12.C | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'gcc') diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 7ba02be..75ee887 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -4503,8 +4503,8 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter) #define CONSTRUCTOR_IS_PAREN_INIT(NODE) \ (CONSTRUCTOR_CHECK(NODE)->base.private_flag) -/* True if reshape_init built this CONSTRUCTOR to undo the brace elision - of another CONSTRUCTOR. This flag is used during C++20 aggregate +/* True if reshape_init built this sub-CONSTRUCTOR to undo the brace elision + of the original CONSTRUCTOR. This flag is used during C++20 aggregate CTAD. */ #define CONSTRUCTOR_BRACES_ELIDED_P(NODE) \ (CONSTRUCTOR_CHECK (NODE)->base.protected_flag) diff --git a/gcc/testsuite/g++.dg/cpp2a/class-deduction-aggr12.C b/gcc/testsuite/g++.dg/cpp2a/class-deduction-aggr12.C index ebe73c1..3e330ac 100644 --- a/gcc/testsuite/g++.dg/cpp2a/class-deduction-aggr12.C +++ b/gcc/testsuite/g++.dg/cpp2a/class-deduction-aggr12.C @@ -1,4 +1,4 @@ -// PR c++/101820 +// PR c++/101803 // { dg-do compile { target c++20 } } struct Inner { int i = 0; }; -- cgit v1.1 From 07b4100683e55023a78576cb8c75d8e40e41f44f Mon Sep 17 00:00:00 2001 From: John David Anglin Date: Thu, 19 Aug 2021 15:39:18 +0000 Subject: Define STAGE1_LIBS to link against libcl.a in stage1 on hpux. 2021-08-19 Arnaud Charlet PR ada/101924 gcc/ada/ChangeLog: * gcc-interface/Make-lang.in (STAGE1_LIBS): Define on hpux. --- gcc/ada/gcc-interface/Make-lang.in | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'gcc') diff --git a/gcc/ada/gcc-interface/Make-lang.in b/gcc/ada/gcc-interface/Make-lang.in index b68081e..765654f 100644 --- a/gcc/ada/gcc-interface/Make-lang.in +++ b/gcc/ada/gcc-interface/Make-lang.in @@ -85,6 +85,10 @@ ifeq ($(strip $(filter-out linux%,$(host_os))),) STAGE1_LIBS=-ldl endif +ifeq ($(strip $(filter-out hpux%,$(host_os))),) + STAGE1_LIBS=/usr/lib/libcl.a +endif + ifeq ($(STAGE1),True) ADA_INCLUDES=$(COMMON_ADA_INCLUDES) adalib=$(dir $(shell $(CC) -print-libgcc-file-name))adalib -- cgit v1.1 From 18e9e7db7afb8635316414b560c10852db13c4c1 Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Thu, 19 Aug 2021 14:15:03 -0400 Subject: Drop stabs from h8/300 and v850 ports gcc/ * config.gcc (h8300-*-elf*): Do not include dbxelf.h. (h8300-*-linux*, v850-*-rtems*, v850*-elf*): Likewise. * config/v850/v850.h (DEFAULT_GDB_EXTENSIONS): Remove. --- gcc/config.gcc | 12 ++++-------- gcc/config/v850/v850.h | 3 --- 2 files changed, 4 insertions(+), 11 deletions(-) (limited to 'gcc') diff --git a/gcc/config.gcc b/gcc/config.gcc index eb232df..08e6c67 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -1677,11 +1677,11 @@ moxie-*-moxiebox*) ;; h8300-*-elf*) tmake_file="h8300/t-h8300" - tm_file="h8300/h8300.h dbxelf.h elfos.h newlib-stdint.h h8300/elf.h" + tm_file="h8300/h8300.h elfos.h newlib-stdint.h h8300/elf.h" ;; h8300-*-linux*) tmake_file="${tmake_file} h8300/t-h8300 h8300/t-linux" - tm_file="h8300/h8300.h dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h h8300/linux.h" + tm_file="h8300/h8300.h elfos.h gnu-user.h linux.h glibc-stdint.h h8300/linux.h" ;; hppa*64*-*-linux*) target_cpu_default="MASK_PA_11|MASK_PA_20" @@ -3473,7 +3473,7 @@ tilepro*-*-linux*) ;; v850-*-rtems*) target_cpu_default="TARGET_CPU_generic" - tm_file="dbxelf.h elfos.h v850/v850.h" + tm_file="elfos.h v850/v850.h" tm_file="${tm_file} v850/rtems.h rtems.h newlib-stdint.h" tmake_file="${tmake_file} v850/t-v850" tmake_file="${tmake_file} v850/t-rtems" @@ -3502,11 +3502,7 @@ v850*-*-*) target_cpu_default="TARGET_CPU_generic" ;; esac - tm_file="dbxelf.h elfos.h newlib-stdint.h v850/v850.h" - if test x$stabs = xyes - then - tm_file="${tm_file} dbx.h" - fi + tm_file="elfos.h newlib-stdint.h v850/v850.h" use_collect2=no c_target_objs="v850-c.o" cxx_target_objs="v850-c.o" diff --git a/gcc/config/v850/v850.h b/gcc/config/v850/v850.h index 386f9f5..5162268 100644 --- a/gcc/config/v850/v850.h +++ b/gcc/config/v850/v850.h @@ -694,9 +694,6 @@ typedef enum if ((LOG) != 0) \ fprintf (FILE, "\t.align %d\n", (LOG)) -/* We don't have to worry about dbx compatibility for the v850. */ -#define DEFAULT_GDB_EXTENSIONS 1 - /* Use dwarf2 debugging info by default. */ #undef PREFERRED_DEBUGGING_TYPE #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG -- cgit v1.1 From de0b250b2badb475f8c09f3cd2c57fd3f9127fe3 Mon Sep 17 00:00:00 2001 From: Iain Sandoe Date: Sun, 15 Aug 2021 12:52:30 +0100 Subject: Objective-C, NeXT runtime: Correct the default for fobjc-nilcheck. It is intended that the default for the NeXT runtime at ABI 2 is to check for nil message receivers. This updates this to match the documented behaviour and to match the behaviour of the system tools. Signed-off-by: Iain Sandoe gcc/objc/ChangeLog: * objc-next-runtime-abi-02.c (objc_next_runtime_abi_02_init): Default receiver nilchecks on. --- gcc/objc/objc-next-runtime-abi-02.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'gcc') diff --git a/gcc/objc/objc-next-runtime-abi-02.c b/gcc/objc/objc-next-runtime-abi-02.c index 0d963e3..ce831fc 100644 --- a/gcc/objc/objc-next-runtime-abi-02.c +++ b/gcc/objc/objc-next-runtime-abi-02.c @@ -254,6 +254,10 @@ objc_next_runtime_abi_02_init (objc_runtime_hooks *rthooks) flag_objc_sjlj_exceptions = 0; } + /* NeXT ABI 2 is intended to default to checking for nil receivers. */ + if (! global_options_set.x_flag_objc_nilcheck) + flag_objc_nilcheck = 1; + rthooks->initialize = next_runtime_02_initialize; rthooks->default_constant_string_class_name = DEF_CONSTANT_STRING_CLASS_NAME; rthooks->tag_getclass = TAG_GETCLASS; -- cgit v1.1 From 81501087758cb0c32e555858cf367e449a09246e Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Thu, 19 Aug 2021 12:42:28 -0600 Subject: Release resources acquired by enable_ranger() [PR101984]. Resolves: PR middle-end/101984 - gimple-ssa-warn-access memory leak gcc/ChangeLog: PR middle-end/101984 * gimple-ssa-warn-access.cc (pass_waccess::execute): Also call disable_ranger. --- gcc/gimple-ssa-warn-access.cc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'gcc') diff --git a/gcc/gimple-ssa-warn-access.cc b/gcc/gimple-ssa-warn-access.cc index f3efe56..4a2dd9a 100644 --- a/gcc/gimple-ssa-warn-access.cc +++ b/gcc/gimple-ssa-warn-access.cc @@ -3310,12 +3310,16 @@ pass_waccess::check (basic_block bb) unsigned pass_waccess::execute (function *fun) { + /* Create a new ranger instance and associate it with FUN. */ m_ranger = enable_ranger (fun); basic_block bb; FOR_EACH_BB_FN (bb, fun) check (bb); + /* Release the ranger instance and replace it with a global ranger. */ + disable_ranger (fun); + return 0; } -- cgit v1.1 From 77bf9f83b8e388de8bedb259991f588a7b8a7f57 Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Thu, 19 Aug 2021 12:49:40 -0600 Subject: Document enable_ranger and disable_ranger. gcc: * gimple-range.cc: Add comments. * gimple-range.h: Same. --- gcc/gimple-range.cc | 7 +++++++ gcc/gimple-range.h | 3 +++ 2 files changed, 10 insertions(+) (limited to 'gcc') diff --git a/gcc/gimple-range.cc b/gcc/gimple-range.cc index 60b7d3a..ef3afea 100644 --- a/gcc/gimple-range.cc +++ b/gcc/gimple-range.cc @@ -381,6 +381,10 @@ gimple_ranger::dump (FILE *f) m_cache.dump (f); } +/* Create a new ranger instance and associate it with function FUN. + Each call must be paired with a call to disable_ranger to release + resources. */ + gimple_ranger * enable_ranger (struct function *fun) { @@ -392,6 +396,9 @@ enable_ranger (struct function *fun) return r; } +/* Destroy and release the ranger instance associated with function FUN + and replace it the global ranger. */ + void disable_ranger (struct function *fun) { diff --git a/gcc/gimple-range.h b/gcc/gimple-range.h index 41845b1..eaebb9c5 100644 --- a/gcc/gimple-range.h +++ b/gcc/gimple-range.h @@ -62,6 +62,9 @@ protected: range_tracer tracer; }; +/* Create a new ranger instance and associate it with a function. + Each call must be paired with a call to disable_ranger to release + resources. */ extern gimple_ranger *enable_ranger (struct function *); extern void disable_ranger (struct function *); -- cgit v1.1 From d881460deb1f0bdfc3e8fa2d391a03a9763cbff4 Mon Sep 17 00:00:00 2001 From: Harald Anlauf Date: Thu, 19 Aug 2021 21:00:45 +0200 Subject: Fortran - simplify length of substring with constant bounds gcc/fortran/ChangeLog: PR fortran/100950 * simplify.c (substring_has_constant_len): New. (gfc_simplify_len): Handle case of substrings with constant bounds. gcc/testsuite/ChangeLog: PR fortran/100950 * gfortran.dg/pr100950.f90: New test. --- gcc/fortran/simplify.c | 75 +++++++++++++++++++++++++++++++++- gcc/testsuite/gfortran.dg/pr100950.f90 | 53 ++++++++++++++++++++++++ 2 files changed, 127 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/pr100950.f90 (limited to 'gcc') diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c index c27b47a..492867e 100644 --- a/gcc/fortran/simplify.c +++ b/gcc/fortran/simplify.c @@ -4512,6 +4512,78 @@ gfc_simplify_leadz (gfc_expr *e) } +/* Check for constant length of a substring. */ + +static bool +substring_has_constant_len (gfc_expr *e) +{ + gfc_ref *ref; + HOST_WIDE_INT istart, iend, length; + bool equal_length = false; + + if (e->ts.type != BT_CHARACTER) + return false; + + for (ref = e->ref; ref; ref = ref->next) + if (ref->type != REF_COMPONENT && ref->type != REF_ARRAY) + break; + + if (!ref + || ref->type != REF_SUBSTRING + || !ref->u.ss.start + || ref->u.ss.start->expr_type != EXPR_CONSTANT + || !ref->u.ss.end + || ref->u.ss.end->expr_type != EXPR_CONSTANT + || !ref->u.ss.length) + return false; + + /* For non-deferred strings the given length shall be constant. */ + if (!e->ts.deferred + && (!ref->u.ss.length->length + || ref->u.ss.length->length->expr_type != EXPR_CONSTANT)) + return false; + + /* Basic checks on substring starting and ending indices. */ + if (!gfc_resolve_substring (ref, &equal_length)) + return false; + + istart = gfc_mpz_get_hwi (ref->u.ss.start->value.integer); + iend = gfc_mpz_get_hwi (ref->u.ss.end->value.integer); + + if (istart <= iend) + { + if (istart < 1) + { + gfc_error ("Substring start index (" HOST_WIDE_INT_PRINT_DEC + ") at %L below 1", + istart, &ref->u.ss.start->where); + return false; + } + + /* For deferred strings use end index as proxy for length. */ + if (e->ts.deferred) + length = iend; + else + length = gfc_mpz_get_hwi (ref->u.ss.length->length->value.integer); + if (iend > length) + { + gfc_error ("Substring end index (" HOST_WIDE_INT_PRINT_DEC + ") at %L exceeds string length", + iend, &ref->u.ss.end->where); + return false; + } + length = iend - istart + 1; + } + else + length = 0; + + /* Fix substring length. */ + e->value.character.length = length; + + return true; +} + + gfc_expr * gfc_simplify_len (gfc_expr *e, gfc_expr *kind) { @@ -4521,7 +4593,8 @@ gfc_simplify_len (gfc_expr *e, gfc_expr *kind) if (k == -1) return &gfc_bad_expr; - if (e->expr_type == EXPR_CONSTANT) + if (e->expr_type == EXPR_CONSTANT + || substring_has_constant_len (e)) { result = gfc_get_constant_expr (BT_INTEGER, k, &e->where); mpz_set_si (result->value.integer, e->value.character.length); diff --git a/gcc/testsuite/gfortran.dg/pr100950.f90 b/gcc/testsuite/gfortran.dg/pr100950.f90 new file mode 100644 index 0000000..cb9d126 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr100950.f90 @@ -0,0 +1,53 @@ +! { dg-do run } +! { dg-additional-options "-fdump-tree-original" } +! PR fortran/100950 - ICE in output_constructor_regular_field, at varasm.c:5514 + +program p + character(8), parameter :: u = "123" + character(8) :: x = "", s + character(2) :: w(2) = [character(len(x(3:4))) :: 'a','b' ] + character(*), parameter :: y(*) = [character(len(u(3:4))) :: 'a','b' ] + character(*), parameter :: z(*) = [character(len(x(3:4))) :: 'a','b' ] + character(*), parameter :: t(*) = [character(len(x( :2))) :: 'a','b' ] + character(*), parameter :: v(*) = [character(len(x(7: ))) :: 'a','b' ] + type t_ + character(len=5) :: s + character(len=8) :: t(4) + character(len=8), pointer :: u(:) + character(len=:), allocatable :: str + character(len=:), allocatable :: str2(:) + end type t_ + type(t_) :: q, r(1) + integer, parameter :: lq = len (q%s(3:4)), lr = len (r%s(3:4)) + integer, parameter :: l1 = len (q %t(1)(3:4)) + integer, parameter :: l2 = len (q %t(:)(3:4)) + integer, parameter :: l3 = len (q %str (3:4)) + integer, parameter :: l4 = len (r(:)%t(1)(3:4)) + integer, parameter :: l5 = len (r(1)%t(:)(3:4)) + integer, parameter :: l6 = len (r(1)%str (3:4)) + integer, parameter :: l7 = len (r(1)%str2(1)(3:4)) + integer, parameter :: l8 = len (r(1)%str2(:)(3:4)) + + if (len (y) /= 2) stop 1 + if (len (z) /= 2) stop 2 + if (any (w /= y)) stop 3 + if (len ([character(len(u(3:4))) :: 'a','b' ]) /= 2) stop 4 + if (len ([character(len(x(3:4))) :: 'a','b' ]) /= 2) stop 5 + if (any ([character(len(x(3:4))) :: 'a','b' ] /= y)) stop 6 + write(s,*) [character(len(x(3:4))) :: 'a','b' ] + if (s /= " a b ") stop 7 + if (len (t) /= 2) stop 8 + if (len (v) /= 2) stop 9 + if (lq /= 2 .or. lr /= 2) stop 10 + if (l1 /= 2 .or. l2 /= 2 .or. l4 /= 2 .or. l5 /= 2) stop 11 + if (l3 /= 2 .or. l6 /= 2 .or. l7 /= 2 .or. l8 /= 2) stop 12 + + block + integer, parameter :: l9 = len (r(1)%u(:)(3:4)) + if (l9 /= 2) stop 13 + end block +end + +! { dg-final { scan-tree-dump-times "_gfortran_stop_numeric" 2 "original" } } +! { dg-final { scan-tree-dump "_gfortran_stop_numeric \\(3, 0\\);" "original" } } +! { dg-final { scan-tree-dump "_gfortran_stop_numeric \\(7, 0\\);" "original" } } -- cgit v1.1 From b0963c4379becafaebd8e52b0b42698ff151c293 Mon Sep 17 00:00:00 2001 From: Peter Bergner Date: Thu, 19 Aug 2021 17:33:29 -0500 Subject: rs6000: Fix ICE expanding lxvp and stxvp gimple built-ins [PR101849] PR101849 shows we ICE on a test case when we pass a non __vector_pair * pointer to the __builtin_vsx_lxvp and __builtin_vsx_stxvp built-ins that is cast to __vector_pair *. The problem is that when we expand the built-in, the cast has already been removed from gimple and we are only given the base pointer. The solution used here (which fixes the ICE) is to catch this case and convert the pointer to a __vector_pair * pointer when expanding the built-in. 2021-08-19 Peter Bergner gcc/ PR target/101849 * config/rs6000/rs6000-call.c (rs6000_gimple_fold_mma_builtin): Cast pointer to __vector_pair *. gcc/testsuite/ PR target/101849 * gcc.target/powerpc/pr101849.c: New test. --- gcc/config/rs6000/rs6000-call.c | 6 ++++++ gcc/testsuite/gcc.target/powerpc/pr101849.c | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 gcc/testsuite/gcc.target/powerpc/pr101849.c (limited to 'gcc') diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c index 8b16d65..3c3108a 100644 --- a/gcc/config/rs6000/rs6000-call.c +++ b/gcc/config/rs6000/rs6000-call.c @@ -11919,6 +11919,9 @@ rs6000_gimple_fold_mma_builtin (gimple_stmt_iterator *gsi) tree offset = gimple_call_arg (stmt, 0); tree ptr = gimple_call_arg (stmt, 1); tree lhs = gimple_call_lhs (stmt); + if (TREE_TYPE (TREE_TYPE (ptr)) != vector_pair_type_node) + ptr = build1 (VIEW_CONVERT_EXPR, + build_pointer_type (vector_pair_type_node), ptr); tree mem = build_simple_mem_ref (build2 (POINTER_PLUS_EXPR, TREE_TYPE (ptr), ptr, offset)); gimplify_assign (lhs, mem, &new_seq); @@ -11932,6 +11935,9 @@ rs6000_gimple_fold_mma_builtin (gimple_stmt_iterator *gsi) tree src = gimple_call_arg (stmt, 0); tree offset = gimple_call_arg (stmt, 1); tree ptr = gimple_call_arg (stmt, 2); + if (TREE_TYPE (TREE_TYPE (ptr)) != vector_pair_type_node) + ptr = build1 (VIEW_CONVERT_EXPR, + build_pointer_type (vector_pair_type_node), ptr); tree mem = build_simple_mem_ref (build2 (POINTER_PLUS_EXPR, TREE_TYPE (ptr), ptr, offset)); gimplify_assign (mem, src, &new_seq); diff --git a/gcc/testsuite/gcc.target/powerpc/pr101849.c b/gcc/testsuite/gcc.target/powerpc/pr101849.c new file mode 100644 index 0000000..823fbfe --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr101849.c @@ -0,0 +1,22 @@ +/* PR target/101849 */ +/* { dg-do compile } */ +/* { dg-require-effective-target power10_ok } */ +/* { dg-options "-O2 -mdejagnu-cpu=power10" } */ + +/* Verify we do not ICE on the tests below. */ + +void +foo (__vector_pair *dst, double *x, long offset) +{ + dst[0] = __builtin_vsx_lxvp (0, (__vector_pair *)(void *)x); + dst[1] = __builtin_vsx_lxvp (32, (__vector_pair *)(void *)x); + dst[2] = __builtin_vsx_lxvp (offset, (__vector_pair *)(void *)x); +} + +void +bar (__vector_pair *src, double *x, long offset) +{ + __builtin_vsx_stxvp (src[0], 0, (__vector_pair *)(void *)x); + __builtin_vsx_stxvp (src[1], 32, (__vector_pair *)(void *)x); + __builtin_vsx_stxvp (src[2], offset, (__vector_pair *)(void *)x); +} -- cgit v1.1 From 976401aa4781fa5850e1f34142bc13d1cfe0b2bd Mon Sep 17 00:00:00 2001 From: Roger Sayle Date: Fri, 20 Aug 2021 00:24:23 +0100 Subject: Fold more constants during veclower pass. An issue with a backend patch I've been investigating has revealed a missed optimization opportunity during GCC's vector lowering pass. An unrecognized insn for "(set (reg:SI) (not:SI (const_int 0))" revealed that not only was my expander not expecting a NOT with a constant operand, but also that veclower was producing the dubious tree expression ~0. The attached patch replaces a call to gimple_build_assign with a call to either gimplify_build1 or gimplify_build2 depending upon whether the operation takes one or two operands. The net effect is that where GCC previously produced the following optimized gimple for testsuite/c-c++common/Wunused-var-16.c (notice the ~0 and the "& 0"): void foo () { V x; V y; vector(16) unsigned char _1; unsigned char _7; unsigned char _8; y_2 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; x_3 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; _7 = ~0; _1 = {_7, _7, _7, _7, _7, _7, _7, _7, _7, _7, _7, _7, _7, _7, _7, _7}; _8 = 0 & _7; y_4 = {_8, _8, _8, _8, _8, _8, _8, _8, _8, _8, _8, _8, _8, _8, _8, _8}; v = y_4; return; } With this patch we now generate: void foo () { V x; V y; vector(16) unsigned char _1; y_2 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; x_3 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; _1 = { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 2 55, 255 }; y_4 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; v = y_4; return; } 2021-08-20 Roger Sayle gcc/ChangeLog * tree-vect-generic.c (expand_vector_operations_1): Use either gimplify_build1 or gimplify_build2 instead of gimple_build_assign when constructing scalar splat expressions. gcc/testsuite/ChangeLog * c-c++-common/Wunused-var-16.c: Add an extra check that ~0 is optimized away. --- gcc/testsuite/c-c++-common/Wunused-var-16.c | 4 +++- gcc/tree-vect-generic.c | 7 ++++--- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'gcc') diff --git a/gcc/testsuite/c-c++-common/Wunused-var-16.c b/gcc/testsuite/c-c++-common/Wunused-var-16.c index 8bdbcd3..31c7db3 100644 --- a/gcc/testsuite/c-c++-common/Wunused-var-16.c +++ b/gcc/testsuite/c-c++-common/Wunused-var-16.c @@ -1,6 +1,6 @@ /* PR c++/78949 */ /* { dg-do compile } */ -/* { dg-options "-Wunused" } */ +/* { dg-options "-Wunused -fdump-tree-optimized" } */ /* { dg-additional-options "-fno-common" { target hppa*-*-hpux* } } */ typedef unsigned char V __attribute__((vector_size(16))); @@ -14,3 +14,5 @@ foo () y &= ~x; v = y; } + +/* { dg-final { scan-tree-dump-not " ~0" "optimized" } } */ diff --git a/gcc/tree-vect-generic.c b/gcc/tree-vect-generic.c index 2e00b3e..0d7f041 100644 --- a/gcc/tree-vect-generic.c +++ b/gcc/tree-vect-generic.c @@ -2162,9 +2162,10 @@ expand_vector_operations_1 (gimple_stmt_iterator *gsi, if (op >= FIRST_NORM_OPTAB && op <= LAST_NORM_OPTAB && optab_handler (op, TYPE_MODE (TREE_TYPE (type))) != CODE_FOR_nothing) { - tree slhs = make_ssa_name (TREE_TYPE (TREE_TYPE (lhs))); - gimple *repl = gimple_build_assign (slhs, code, srhs1, srhs2); - gsi_insert_before (gsi, repl, GSI_SAME_STMT); + tree stype = TREE_TYPE (TREE_TYPE (lhs)); + tree slhs = (rhs2 != NULL_TREE) + ? gimplify_build2 (gsi, code, stype, srhs1, srhs2) + : gimplify_build1 (gsi, code, stype, srhs1); gimple_assign_set_rhs_from_tree (gsi, build_vector_from_val (type, slhs)); update_stmt (stmt); -- cgit v1.1 From b57fba5e376c7277168c14e207979e1505e6fe1d Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 20 Aug 2021 00:16:28 +0000 Subject: Daily bump. --- gcc/ChangeLog | 56 ++++++++++++++++++++++++++++++++++++++++++++++ gcc/DATESTAMP | 2 +- gcc/ada/ChangeLog | 5 +++++ gcc/c/ChangeLog | 6 +++++ gcc/cp/ChangeLog | 16 ++++++++++++++ gcc/fortran/ChangeLog | 7 ++++++ gcc/jit/ChangeLog | 7 ++++++ gcc/objc/ChangeLog | 5 +++++ gcc/testsuite/ChangeLog | 59 +++++++++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 162 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4fd8ff7..7be1a77 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,59 @@ +2021-08-19 Roger Sayle + + * tree-vect-generic.c (expand_vector_operations_1): Use either + gimplify_build1 or gimplify_build2 instead of gimple_build_assign + when constructing scalar splat expressions. + +2021-08-19 Peter Bergner + + PR target/101849 + * config/rs6000/rs6000-call.c (rs6000_gimple_fold_mma_builtin): Cast + pointer to __vector_pair *. + +2021-08-19 Martin Sebor + + * gimple-range.cc: Add comments. + * gimple-range.h: Same. + +2021-08-19 Martin Sebor + + PR middle-end/101984 + * gimple-ssa-warn-access.cc (pass_waccess::execute): Also call + disable_ranger. + +2021-08-19 Jeff Law + + * config.gcc (h8300-*-elf*): Do not include dbxelf.h. + (h8300-*-linux*, v850-*-rtems*, v850*-elf*): Likewise. + * config/v850/v850.h (DEFAULT_GDB_EXTENSIONS): Remove. + +2021-08-19 Jakub Jelinek + + PR middle-end/101950 + * optabs.c (expand_clrsb_using_clz): New function. + (expand_unop): Use it as another clrsb expansion fallback. + +2021-08-19 liuhongt + + Revert: + 2021-07-28 liuhongt + + PR target/99881 + * config/i386/i386.h (processor_costs): Add new member + integer_to_sse. + * config/i386/x86-tune-costs.h (ix86_size_cost, i386_cost, + i486_cost, pentium_cost, lakemont_cost, pentiumpro_cost, + geode_cost, k6_cost, athlon_cost, k8_cost, amdfam10_cost, + bdver_cost, znver1_cost, znver2_cost, znver3_cost, + btver1_cost, btver2_cost, btver3_cost, pentium4_cost, + nocona_cost, atom_cost, atom_cost, slm_cost, intel_cost, + generic_cost, core_cost): Initialize integer_to_sse same value + as sse_op. + (skylake_cost): Initialize integer_to_sse twice as much as sse_op. + * config/i386/i386.c (ix86_builtin_vectorization_cost): + Use integer_to_sse instead of sse_op to calculate the cost of + vec_construct. + 2021-08-18 Iain Sandoe * config.gcc: Include rpath.opt for Darwin. diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 30a51b9..a095191 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20210819 +20210820 diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 63a04b1..dddb90f 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2021-08-19 Arnaud Charlet + + PR ada/101924 + * gcc-interface/Make-lang.in (STAGE1_LIBS): Define on hpux. + 2021-08-18 Eric Botcazou * gcc-interface/decl.c (gnat_to_gnu_entity) : Fix diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 53abd1a..1b13446 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,9 @@ +2021-08-19 Jakub Jelinek + + * c-parser.c (c_parser_omp_requires): Don't call + c_parser_peek_2nd_token and optionally consume token if current + token is CPP_EOF, CPP_PRAGMA_EOL or CPP_CLOSE_PAREN. + 2021-08-18 Jakub Jelinek * c-parser.c (c_parser_omp_nothing): New function. diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6f872f6..f50c36c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,19 @@ +2021-08-19 Patrick Palka + + PR c++/101803 + * cp-tree.h (CONSTRUCTOR_IS_PAREN_INIT): Clarify comment. + +2021-08-19 Jakub Jelinek + + * parser.c (cp_parser_omp_requires): Don't call cp_lexer_nth_token_is + and optionally consume token if current token is CPP_EOF, + CPP_PRAGMA_EOL or CPP_CLOSE_PAREN. + +2021-08-19 Jakub Jelinek + + * parser.c (cp_parser_omp_nothing): Use cp_parser_require_pragma_eol + instead of cp_parser_skip_to_pragma_eol. + 2021-08-18 Patrick Palka PR c++/101344 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 90a3e53..8bf8cde 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2021-08-19 Harald Anlauf + + PR fortran/100950 + * simplify.c (substring_has_constant_len): New. + (gfc_simplify_len): Handle case of substrings with constant + bounds. + 2021-08-18 Tobias Burnus * match.h (gfc_match_omp_nothing): New. diff --git a/gcc/jit/ChangeLog b/gcc/jit/ChangeLog index 7557e17..c7379f3 100644 --- a/gcc/jit/ChangeLog +++ b/gcc/jit/ChangeLog @@ -1,3 +1,10 @@ +2021-08-19 Iain Sandoe + + * docs/examples/tut04-toyvm/toyvm.c: Include jit-dejagnu.h. + * docs/examples/tut04-toyvm/toyvm.cc: Likewise. + * jit-dejagnu.h: New file, imported from dejagnu-1.6.2 and + patched for this application. + 2021-08-18 Iain Sandoe PR jit/100613 diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog index ea8c88b..e2d452f 100644 --- a/gcc/objc/ChangeLog +++ b/gcc/objc/ChangeLog @@ -1,3 +1,8 @@ +2021-08-19 Iain Sandoe + + * objc-next-runtime-abi-02.c (objc_next_runtime_abi_02_init): + Default receiver nilchecks on. + 2021-08-18 Iain Sandoe Matt Jacobson diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7cdc16d..7e37eaa 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,62 @@ +2021-08-19 Roger Sayle + + * c-c++-common/Wunused-var-16.c: Add an extra check that ~0 + is optimized away. + +2021-08-19 Peter Bergner + + PR target/101849 + * gcc.target/powerpc/pr101849.c: New test. + +2021-08-19 Harald Anlauf + + PR fortran/100950 + * gfortran.dg/pr100950.f90: New test. + +2021-08-19 Patrick Palka + + PR c++/101803 + * g++.dg/cpp2a/class-deduction-aggr12.C: Fix PR number. + +2021-08-19 Jakub Jelinek + + PR middle-end/101950 + * gcc.target/i386/pr101950-1.c: New test. + * gcc.target/i386/pr101950-2.c: New test. + +2021-08-19 Jakub Jelinek + + * c-c++-common/gomp/requires-3.c: Add testcase for + atomic_default_mem_order ( at the end of line without corresponding ). + +2021-08-19 Iain Sandoe + + * jit.dg/test-asm.c: Provide Mach-O fragment. + * jit.dg/test-asm.cc: Likewise. + +2021-08-19 Jakub Jelinek + + * c-c++-common/gomp/nothing-2.c: New test. + +2021-08-19 Iain Sandoe + + * jit.dg/harness.h: Include jit-dejagnu.h. + * jit.dg/jit.exp: Use -rdynamic conditionally on target + support, instead of unconditional -Wl,--export-dynamic. + +2021-08-19 Thomas Schwinge + + PR testsuite/101969 + * gcc.dg/pr78213.c: Fix up for '--enable-checking=release' etc. + +2021-08-19 liuhongt + + Revert: + 2021-08-19 liuhongt + + PR target/99881 + * gcc.target/i386/pr99881.c: New test. + 2021-08-18 Tobias Burnus PR testsuite/101963 -- cgit v1.1 From d2883be3c8e7b5fd17925ea67b99b7330e1a4f72 Mon Sep 17 00:00:00 2001 From: Michael Meissner Date: Fri, 20 Aug 2021 00:37:49 -0400 Subject: Move xx* builtins to vsx.md. I noticed that the xx built-in functions (xxspltiw, xxspltidp, xxsplti32dx, xxeval, xxblend, and xxpermx) were all defined in altivec.md. However, since the XX instructions can take both traditional floating point and Altivec registers, these built-in functions should be in vsx.md. This patch just moves the insns from altivec.md to vsx.md. I also moved the VM3 mode iterator and VM3_char mode attribute from altivec.md to vsx.md, since the only use of these were for the XXBLEND insns. 2021-08-20 Michael Meissner gcc/ * config/rs6000/altivec.md (UNSPEC_XXEVAL): Move to vsx.md. (UNSPEC_XXSPLTIW): Move to vsx.md. (UNSPEC_XXSPLTID): Move to vsx.md. (UNSPEC_XXSPLTI32DX): Move to vsx.md. (UNSPEC_XXBLEND): Move to vsx.md. (UNSPEC_XXPERMX): Move to vsx.md. (VM3): Move to vsx.md. (VM3_char): Move to vsx.md. (xxspltiw_v4si): Move to vsx.md. (xxspltiw_v4sf): Move to vsx.md. (xxspltiw_v4sf_inst): Move to vsx.md. (xxspltidp_v2df): Move to vsx.md. (xxspltidp_v2df_inst): Move to vsx.md. (xxsplti32dx_v4si_inst): Move to vsx.md. (xxsplti32dx_v4sf): Move to vsx.md. (xxsplti32dx_v4sf_inst): Move to vsx.md. (xxblend_): Move to vsx.md. (xxpermx): Move to vsx.md. (xxpermx_inst): Move to vsx.md. * config/rs6000/vsx.md (UNSPEC_XXEVAL): Move from altivec.md. (UNSPEC_XXSPLTIW): Move from altivec.md. (UNSPEC_XXSPLTID): Move from altivec.md. (UNSPEC_XXSPLTI32DX): Move from altivec.md. (UNSPEC_XXBLEND): Move from altivec.md. (UNSPEC_XXPERMX): Move from altivec.md. (VM3): Move from altivec.md. (VM3_char): Move from altivec.md. (xxspltiw_v4si): Move from altivec.md. (xxspltiw_v4sf): Move from altivec.md. (xxspltiw_v4sf_inst): Move from altivec.md. (xxspltidp_v2df): Move from altivec.md. (xxspltidp_v2df_inst): Move from altivec.md. (xxsplti32dx_v4si_inst): Move from altivec.md. (xxsplti32dx_v4sf): Move from altivec.md. (xxsplti32dx_v4sf_inst): Move from altivec.md. (xxblend_): Move from altivec.md. (xxpermx): Move from altivec.md. (xxpermx_inst): Move from altivec.md. --- gcc/config/rs6000/altivec.md | 197 ----------------------------------------- gcc/config/rs6000/vsx.md | 206 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 206 insertions(+), 197 deletions(-) (limited to 'gcc') diff --git a/gcc/config/rs6000/altivec.md b/gcc/config/rs6000/altivec.md index fd86c300..2c73dde 100644 --- a/gcc/config/rs6000/altivec.md +++ b/gcc/config/rs6000/altivec.md @@ -175,16 +175,10 @@ UNSPEC_VPEXTD UNSPEC_VCLRLB UNSPEC_VCLRRB - UNSPEC_XXEVAL UNSPEC_VSTRIR UNSPEC_VSTRIL UNSPEC_SLDB UNSPEC_SRDB - UNSPEC_XXSPLTIW - UNSPEC_XXSPLTID - UNSPEC_XXSPLTI32DX - UNSPEC_XXBLEND - UNSPEC_XXPERMX ]) (define_c_enum "unspecv" @@ -225,21 +219,6 @@ (KF "FLOAT128_VECTOR_P (KFmode)") (TF "FLOAT128_VECTOR_P (TFmode)")]) -;; Like VM2, just do char, short, int, long, float and double -(define_mode_iterator VM3 [V4SI - V8HI - V16QI - V4SF - V2DF - V2DI]) - -(define_mode_attr VM3_char [(V2DI "d") - (V4SI "w") - (V8HI "h") - (V16QI "b") - (V2DF "d") - (V4SF "w")]) - ;; Map the Vector convert single precision to double precision for integer ;; versus floating point (define_mode_attr VS_sxwsp [(V4SI "sxw") (V4SF "sp")]) @@ -859,170 +838,6 @@ "vsdbi %0,%1,%2,%3" [(set_attr "type" "vecsimple")]) -(define_insn "xxspltiw_v4si" - [(set (match_operand:V4SI 0 "register_operand" "=wa") - (unspec:V4SI [(match_operand:SI 1 "s32bit_cint_operand" "n")] - UNSPEC_XXSPLTIW))] - "TARGET_POWER10" - "xxspltiw %x0,%1" - [(set_attr "type" "vecsimple") - (set_attr "prefixed" "yes")]) - -(define_expand "xxspltiw_v4sf" - [(set (match_operand:V4SF 0 "register_operand" "=wa") - (unspec:V4SF [(match_operand:SF 1 "const_double_operand" "n")] - UNSPEC_XXSPLTIW))] - "TARGET_POWER10" -{ - long value = rs6000_const_f32_to_i32 (operands[1]); - emit_insn (gen_xxspltiw_v4sf_inst (operands[0], GEN_INT (value))); - DONE; -}) - -(define_insn "xxspltiw_v4sf_inst" - [(set (match_operand:V4SF 0 "register_operand" "=wa") - (unspec:V4SF [(match_operand:SI 1 "c32bit_cint_operand" "n")] - UNSPEC_XXSPLTIW))] - "TARGET_POWER10" - "xxspltiw %x0,%1" - [(set_attr "type" "vecsimple") - (set_attr "prefixed" "yes")]) - -(define_expand "xxspltidp_v2df" - [(set (match_operand:V2DF 0 "register_operand" ) - (unspec:V2DF [(match_operand:SF 1 "const_double_operand")] - UNSPEC_XXSPLTID))] - "TARGET_POWER10" -{ - long value = rs6000_const_f32_to_i32 (operands[1]); - rs6000_emit_xxspltidp_v2df (operands[0], value); - DONE; -}) - -(define_insn "xxspltidp_v2df_inst" - [(set (match_operand:V2DF 0 "register_operand" "=wa") - (unspec:V2DF [(match_operand:SI 1 "c32bit_cint_operand" "n")] - UNSPEC_XXSPLTID))] - "TARGET_POWER10" - "xxspltidp %x0,%1" - [(set_attr "type" "vecsimple") - (set_attr "prefixed" "yes")]) - -(define_expand "xxsplti32dx_v4si" - [(set (match_operand:V4SI 0 "register_operand" "=wa") - (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "0") - (match_operand:QI 2 "u1bit_cint_operand" "n") - (match_operand:SI 3 "s32bit_cint_operand" "n")] - UNSPEC_XXSPLTI32DX))] - "TARGET_POWER10" -{ - int index = INTVAL (operands[2]); - - if (!BYTES_BIG_ENDIAN) - index = 1 - index; - - emit_insn (gen_xxsplti32dx_v4si_inst (operands[0], operands[1], - GEN_INT (index), operands[3])); - DONE; -} - [(set_attr "type" "vecsimple")]) - -(define_insn "xxsplti32dx_v4si_inst" - [(set (match_operand:V4SI 0 "register_operand" "=wa") - (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "0") - (match_operand:QI 2 "u1bit_cint_operand" "n") - (match_operand:SI 3 "s32bit_cint_operand" "n")] - UNSPEC_XXSPLTI32DX))] - "TARGET_POWER10" - "xxsplti32dx %x0,%2,%3" - [(set_attr "type" "vecsimple") - (set_attr "prefixed" "yes")]) - -(define_expand "xxsplti32dx_v4sf" - [(set (match_operand:V4SF 0 "register_operand" "=wa") - (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "0") - (match_operand:QI 2 "u1bit_cint_operand" "n") - (match_operand:SF 3 "const_double_operand" "n")] - UNSPEC_XXSPLTI32DX))] - "TARGET_POWER10" -{ - int index = INTVAL (operands[2]); - long value = rs6000_const_f32_to_i32 (operands[3]); - if (!BYTES_BIG_ENDIAN) - index = 1 - index; - - emit_insn (gen_xxsplti32dx_v4sf_inst (operands[0], operands[1], - GEN_INT (index), GEN_INT (value))); - DONE; -}) - -(define_insn "xxsplti32dx_v4sf_inst" - [(set (match_operand:V4SF 0 "register_operand" "=wa") - (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "0") - (match_operand:QI 2 "u1bit_cint_operand" "n") - (match_operand:SI 3 "s32bit_cint_operand" "n")] - UNSPEC_XXSPLTI32DX))] - "TARGET_POWER10" - "xxsplti32dx %x0,%2,%3" - [(set_attr "type" "vecsimple") - (set_attr "prefixed" "yes")]) - -(define_insn "xxblend_" - [(set (match_operand:VM3 0 "register_operand" "=wa") - (unspec:VM3 [(match_operand:VM3 1 "register_operand" "wa") - (match_operand:VM3 2 "register_operand" "wa") - (match_operand:VM3 3 "register_operand" "wa")] - UNSPEC_XXBLEND))] - "TARGET_POWER10" - "xxblendv %x0,%x1,%x2,%x3" - [(set_attr "type" "vecsimple") - (set_attr "prefixed" "yes")]) - -(define_expand "xxpermx" - [(set (match_operand:V2DI 0 "register_operand" "+wa") - (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "wa") - (match_operand:V2DI 2 "register_operand" "wa") - (match_operand:V16QI 3 "register_operand" "wa") - (match_operand:QI 4 "u8bit_cint_operand" "n")] - UNSPEC_XXPERMX))] - "TARGET_POWER10" -{ - if (BYTES_BIG_ENDIAN) - emit_insn (gen_xxpermx_inst (operands[0], operands[1], - operands[2], operands[3], - operands[4])); - else - { - /* Reverse value of byte element indexes by XORing with 0xFF. - Reverse the 32-byte section identifier match by subracting bits [0:2] - of elemet from 7. */ - int value = INTVAL (operands[4]); - rtx vreg = gen_reg_rtx (V16QImode); - - emit_insn (gen_xxspltib_v16qi (vreg, GEN_INT (-1))); - emit_insn (gen_xorv16qi3 (operands[3], operands[3], vreg)); - value = 7 - value; - emit_insn (gen_xxpermx_inst (operands[0], operands[2], - operands[1], operands[3], - GEN_INT (value))); - } - - DONE; -} - [(set_attr "type" "vecsimple")]) - -(define_insn "xxpermx_inst" - [(set (match_operand:V2DI 0 "register_operand" "+v") - (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "v") - (match_operand:V2DI 2 "register_operand" "v") - (match_operand:V16QI 3 "register_operand" "v") - (match_operand:QI 4 "u3bit_cint_operand" "n")] - UNSPEC_XXPERMX))] - "TARGET_POWER10" - "xxpermx %x0,%x1,%x2,%x3,%4" - [(set_attr "type" "vecsimple") - (set_attr "prefixed" "yes")]) - (define_expand "vstrir_" [(set (match_operand:VIshort 0 "altivec_register_operand") (unspec:VIshort [(match_operand:VIshort 1 "altivec_register_operand")] @@ -3873,18 +3688,6 @@ [(set_attr "type" "vecperm") (set_attr "isa" "p9v,*")]) -(define_insn "xxeval" - [(set (match_operand:V2DI 0 "register_operand" "=wa") - (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "wa") - (match_operand:V2DI 2 "register_operand" "wa") - (match_operand:V2DI 3 "register_operand" "wa") - (match_operand:QI 4 "u8bit_cint_operand" "n")] - UNSPEC_XXEVAL))] - "TARGET_POWER10" - "xxeval %0,%1,%2,%3,%4" - [(set_attr "type" "vecsimple") - (set_attr "prefixed" "yes")]) - (define_expand "vec_unpacku_hi_v16qi" [(set (match_operand:V8HI 0 "register_operand" "=v") (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")] diff --git a/gcc/config/rs6000/vsx.md b/gcc/config/rs6000/vsx.md index 441735d..e4ca6e9 100644 --- a/gcc/config/rs6000/vsx.md +++ b/gcc/config/rs6000/vsx.md @@ -372,6 +372,12 @@ UNSPEC_REPLACE_UN UNSPEC_VDIVES UNSPEC_VDIVEU + UNSPEC_XXEVAL + UNSPEC_XXSPLTIW + UNSPEC_XXSPLTID + UNSPEC_XXSPLTI32DX + UNSPEC_XXBLEND + UNSPEC_XXPERMX ]) (define_int_iterator XVCVBF16 [UNSPEC_VSX_XVCVSPBF16 @@ -392,6 +398,22 @@ (define_mode_attr REPLACE_ELT_max [(V4SI "12") (V4SF "12") (V2DI "8") (V2DF "8")]) +;; Like VM2 in altivec.md, just do char, short, int, long, float and double +(define_mode_iterator VM3 [V4SI + V8HI + V16QI + V4SF + V2DF + V2DI]) + +(define_mode_attr VM3_char [(V2DI "d") + (V4SI "w") + (V8HI "h") + (V16QI "b") + (V2DF "d") + (V4SF "w")]) + + ;; VSX moves ;; The patterns for LE permuted loads and stores come before the general @@ -6383,3 +6405,187 @@ "TARGET_POWER10" "vmulld %0,%1,%2" [(set_attr "type" "veccomplex")]) + + +;; XXSPLTIW built-in function support +(define_insn "xxspltiw_v4si" + [(set (match_operand:V4SI 0 "register_operand" "=wa") + (unspec:V4SI [(match_operand:SI 1 "s32bit_cint_operand" "n")] + UNSPEC_XXSPLTIW))] + "TARGET_POWER10" + "xxspltiw %x0,%1" + [(set_attr "type" "vecsimple") + (set_attr "prefixed" "yes")]) + +(define_expand "xxspltiw_v4sf" + [(set (match_operand:V4SF 0 "register_operand" "=wa") + (unspec:V4SF [(match_operand:SF 1 "const_double_operand" "n")] + UNSPEC_XXSPLTIW))] + "TARGET_POWER10" +{ + long value = rs6000_const_f32_to_i32 (operands[1]); + emit_insn (gen_xxspltiw_v4sf_inst (operands[0], GEN_INT (value))); + DONE; +}) + +(define_insn "xxspltiw_v4sf_inst" + [(set (match_operand:V4SF 0 "register_operand" "=wa") + (unspec:V4SF [(match_operand:SI 1 "c32bit_cint_operand" "n")] + UNSPEC_XXSPLTIW))] + "TARGET_POWER10" + "xxspltiw %x0,%1" + [(set_attr "type" "vecsimple") + (set_attr "prefixed" "yes")]) + +;; XXSPLTIDP built-in function support +(define_expand "xxspltidp_v2df" + [(set (match_operand:V2DF 0 "register_operand" ) + (unspec:V2DF [(match_operand:SF 1 "const_double_operand")] + UNSPEC_XXSPLTID))] + "TARGET_POWER10" +{ + long value = rs6000_const_f32_to_i32 (operands[1]); + rs6000_emit_xxspltidp_v2df (operands[0], value); + DONE; +}) + +(define_insn "xxspltidp_v2df_inst" + [(set (match_operand:V2DF 0 "register_operand" "=wa") + (unspec:V2DF [(match_operand:SI 1 "c32bit_cint_operand" "n")] + UNSPEC_XXSPLTID))] + "TARGET_POWER10" + "xxspltidp %x0,%1" + [(set_attr "type" "vecsimple") + (set_attr "prefixed" "yes")]) + +;; XXSPLTI32DX built-in function support +(define_expand "xxsplti32dx_v4si" + [(set (match_operand:V4SI 0 "register_operand" "=wa") + (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "0") + (match_operand:QI 2 "u1bit_cint_operand" "n") + (match_operand:SI 3 "s32bit_cint_operand" "n")] + UNSPEC_XXSPLTI32DX))] + "TARGET_POWER10" +{ + int index = INTVAL (operands[2]); + + if (!BYTES_BIG_ENDIAN) + index = 1 - index; + + emit_insn (gen_xxsplti32dx_v4si_inst (operands[0], operands[1], + GEN_INT (index), operands[3])); + DONE; +} + [(set_attr "type" "vecsimple")]) + +(define_insn "xxsplti32dx_v4si_inst" + [(set (match_operand:V4SI 0 "register_operand" "=wa") + (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "0") + (match_operand:QI 2 "u1bit_cint_operand" "n") + (match_operand:SI 3 "s32bit_cint_operand" "n")] + UNSPEC_XXSPLTI32DX))] + "TARGET_POWER10" + "xxsplti32dx %x0,%2,%3" + [(set_attr "type" "vecsimple") + (set_attr "prefixed" "yes")]) + +(define_expand "xxsplti32dx_v4sf" + [(set (match_operand:V4SF 0 "register_operand" "=wa") + (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "0") + (match_operand:QI 2 "u1bit_cint_operand" "n") + (match_operand:SF 3 "const_double_operand" "n")] + UNSPEC_XXSPLTI32DX))] + "TARGET_POWER10" +{ + int index = INTVAL (operands[2]); + long value = rs6000_const_f32_to_i32 (operands[3]); + if (!BYTES_BIG_ENDIAN) + index = 1 - index; + + emit_insn (gen_xxsplti32dx_v4sf_inst (operands[0], operands[1], + GEN_INT (index), GEN_INT (value))); + DONE; +}) + +(define_insn "xxsplti32dx_v4sf_inst" + [(set (match_operand:V4SF 0 "register_operand" "=wa") + (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "0") + (match_operand:QI 2 "u1bit_cint_operand" "n") + (match_operand:SI 3 "s32bit_cint_operand" "n")] + UNSPEC_XXSPLTI32DX))] + "TARGET_POWER10" + "xxsplti32dx %x0,%2,%3" + [(set_attr "type" "vecsimple") + (set_attr "prefixed" "yes")]) + +;; XXBLEND built-in function support +(define_insn "xxblend_" + [(set (match_operand:VM3 0 "register_operand" "=wa") + (unspec:VM3 [(match_operand:VM3 1 "register_operand" "wa") + (match_operand:VM3 2 "register_operand" "wa") + (match_operand:VM3 3 "register_operand" "wa")] + UNSPEC_XXBLEND))] + "TARGET_POWER10" + "xxblendv %x0,%x1,%x2,%x3" + [(set_attr "type" "vecsimple") + (set_attr "prefixed" "yes")]) + +;; XXPERMX built-in function support +(define_expand "xxpermx" + [(set (match_operand:V2DI 0 "register_operand" "+wa") + (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "wa") + (match_operand:V2DI 2 "register_operand" "wa") + (match_operand:V16QI 3 "register_operand" "wa") + (match_operand:QI 4 "u8bit_cint_operand" "n")] + UNSPEC_XXPERMX))] + "TARGET_POWER10" +{ + if (BYTES_BIG_ENDIAN) + emit_insn (gen_xxpermx_inst (operands[0], operands[1], + operands[2], operands[3], + operands[4])); + else + { + /* Reverse value of byte element indexes by XORing with 0xFF. + Reverse the 32-byte section identifier match by subracting bits [0:2] + of elemet from 7. */ + int value = INTVAL (operands[4]); + rtx vreg = gen_reg_rtx (V16QImode); + + emit_insn (gen_xxspltib_v16qi (vreg, GEN_INT (-1))); + emit_insn (gen_xorv16qi3 (operands[3], operands[3], vreg)); + value = 7 - value; + emit_insn (gen_xxpermx_inst (operands[0], operands[2], + operands[1], operands[3], + GEN_INT (value))); + } + + DONE; +} + [(set_attr "type" "vecsimple")]) + +(define_insn "xxpermx_inst" + [(set (match_operand:V2DI 0 "register_operand" "+v") + (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "v") + (match_operand:V2DI 2 "register_operand" "v") + (match_operand:V16QI 3 "register_operand" "v") + (match_operand:QI 4 "u3bit_cint_operand" "n")] + UNSPEC_XXPERMX))] + "TARGET_POWER10" + "xxpermx %x0,%x1,%x2,%x3,%4" + [(set_attr "type" "vecsimple") + (set_attr "prefixed" "yes")]) + +;; XXEVAL built-in function support +(define_insn "xxeval" + [(set (match_operand:V2DI 0 "register_operand" "=wa") + (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "wa") + (match_operand:V2DI 2 "register_operand" "wa") + (match_operand:V2DI 3 "register_operand" "wa") + (match_operand:QI 4 "u8bit_cint_operand" "n")] + UNSPEC_XXEVAL))] + "TARGET_POWER10" + "xxeval %0,%1,%2,%3,%4" + [(set_attr "type" "vecsimple") + (set_attr "prefixed" "yes")]) + -- cgit v1.1 From b777f228b481ae881a7fbb09de367a053740932c Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Tue, 17 Aug 2021 16:24:26 +0200 Subject: gcov: fix output location for JSON mode. PR gcov-profile/89961 gcc/ChangeLog: * gcov.c (make_gcov_file_name): Rewrite using std::string. (mangle_name): Simplify, do not used the second argument. (strip_extention): New function. (get_md5sum): Likewise. (get_gcov_intermediate_filename): Handle properly -p and -x options. (output_gcov_file): Use string type. (generate_results): Likewise. (md5sum_to_hex): Remove. --- gcc/gcov.c | 158 ++++++++++++++++++++++++++++++------------------------------- 1 file changed, 79 insertions(+), 79 deletions(-) (limited to 'gcc') diff --git a/gcc/gcov.c b/gcc/gcov.c index 5c651a9..cf0a49d 100644 --- a/gcc/gcov.c +++ b/gcc/gcov.c @@ -662,8 +662,8 @@ static void accumulate_line_counts (source_info *); static void output_gcov_file (const char *, source_info *); static int output_branch_count (FILE *, int, const arc_info *); static void output_lines (FILE *, const source_info *); -static char *make_gcov_file_name (const char *, const char *); -static char *mangle_name (const char *, char *); +static string make_gcov_file_name (const char *, const char *); +static char *mangle_name (const char *); static void release_structures (void); extern int main (int, char **); @@ -1134,6 +1134,41 @@ output_intermediate_json_line (json::array *object, object->append (lineo); } +/* Strip filename extension in STR. */ + +static string +strip_extention (string str) +{ + string::size_type pos = str.rfind ('.'); + if (pos != string::npos) + str = str.substr (0, pos); + + return str; +} + +/* Calcualte md5sum for INPUT string and return it in hex string format. */ + +static string +get_md5sum (const char *input) +{ + md5_ctx ctx; + char md5sum[16]; + string str; + + md5_init_ctx (&ctx); + md5_process_bytes (input, strlen (input), &ctx); + md5_finish_ctx (&ctx, md5sum); + + for (unsigned i = 0; i < 16; i++) + { + char b[3]; + sprintf (b, "%02x", (unsigned char)md5sum[i]); + str += b; + } + + return str; +} + /* Get the name of the gcov file. The return value must be free'd. It appends the '.gcov' extension to the *basename* of the file. @@ -1143,20 +1178,26 @@ output_intermediate_json_line (json::array *object, input: foo.da, output: foo.da.gcov input: a/b/foo.cc, output: foo.cc.gcov */ -static char * -get_gcov_intermediate_filename (const char *file_name) +static string +get_gcov_intermediate_filename (const char *input_file_name) { - const char *gcov = ".gcov.json.gz"; - char *result; - const char *cptr; + string base = basename (input_file_name); + string str = strip_extention (base); - /* Find the 'basename'. */ - cptr = lbasename (file_name); - - result = XNEWVEC (char, strlen (cptr) + strlen (gcov) + 1); - sprintf (result, "%s%s", cptr, gcov); + if (flag_hash_filenames) + { + str += "##"; + str += get_md5sum (input_file_name); + } + else if (flag_preserve_paths && base != input_file_name) + { + str += "##"; + str += mangle_path (input_file_name); + str = strip_extention (str); + } - return result; + str += ".gcov.json.gz"; + return str.c_str (); } /* Output the result in JSON intermediate format. @@ -1416,7 +1457,9 @@ process_all_functions (void) static void output_gcov_file (const char *file_name, source_info *src) { - char *gcov_file_name = make_gcov_file_name (file_name, src->coverage.name); + string gcov_file_name_str + = make_gcov_file_name (file_name, src->coverage.name); + const char *gcov_file_name = gcov_file_name_str.c_str (); if (src->coverage.lines) { @@ -1438,13 +1481,12 @@ output_gcov_file (const char *file_name, source_info *src) unlink (gcov_file_name); fnotice (stdout, "Removing '%s'\n", gcov_file_name); } - free (gcov_file_name); } static void generate_results (const char *file_name) { - char *gcov_intermediate_filename; + string gcov_intermediate_filename; for (vector::iterator it = functions.begin (); it != functions.end (); it++) @@ -1547,11 +1589,13 @@ generate_results (const char *file_name) root->print (&pp); pp_formatted_text (&pp); - gzFile output = gzopen (gcov_intermediate_filename, "w"); + fnotice (stdout, "Creating '%s'\n", + gcov_intermediate_filename.c_str ()); + gzFile output = gzopen (gcov_intermediate_filename.c_str (), "w"); if (output == NULL) { fnotice (stderr, "Cannot open JSON output file %s\n", - gcov_intermediate_filename); + gcov_intermediate_filename.c_str ()); return; } @@ -1559,7 +1603,7 @@ generate_results (const char *file_name) || gzclose (output)) { fnotice (stderr, "Error writing JSON output file %s\n", - gcov_intermediate_filename); + gcov_intermediate_filename.c_str ()); return; } } @@ -2546,15 +2590,6 @@ canonicalize_name (const char *name) return result; } -/* Print hex representation of 16 bytes from SUM and write it to BUFFER. */ - -static void -md5sum_to_hex (const char *sum, char *buffer) -{ - for (unsigned i = 0; i < 16; i++) - sprintf (buffer + (2 * i), "%02x", (unsigned char)sum[i]); -} - /* Generate an output file name. INPUT_NAME is the canonicalized main input file and SRC_NAME is the canonicalized file name. LONG_OUTPUT_NAMES and PRESERVE_PATHS affect name generation. With @@ -2567,77 +2602,42 @@ md5sum_to_hex (const char *sum, char *buffer) component. (Remember, the canonicalized name will already have elided '.' components and converted \\ separators.) */ -static char * +static string make_gcov_file_name (const char *input_name, const char *src_name) { - char *ptr; - char *result; - - if (flag_long_names && input_name && strcmp (src_name, input_name)) - { - /* Generate the input filename part. */ - result = XNEWVEC (char, strlen (input_name) + strlen (src_name) + 10); - - ptr = result; - ptr = mangle_name (input_name, ptr); - ptr[0] = ptr[1] = '#'; - ptr += 2; - } - else - { - result = XNEWVEC (char, strlen (src_name) + 10); - ptr = result; - } - - ptr = mangle_name (src_name, ptr); - strcpy (ptr, ".gcov"); + string str; /* When hashing filenames, we shorten them by only using the filename component and appending a hash of the full (mangled) pathname. */ if (flag_hash_filenames) + str = (string (mangle_name (src_name)) + "##" + + get_md5sum (src_name) + ".gcov"); + else { - md5_ctx ctx; - char md5sum[16]; - char md5sum_hex[33]; - - md5_init_ctx (&ctx); - md5_process_bytes (src_name, strlen (src_name), &ctx); - md5_finish_ctx (&ctx, md5sum); - md5sum_to_hex (md5sum, md5sum_hex); - free (result); + if (flag_long_names && input_name && strcmp (src_name, input_name) != 0) + { + str += mangle_name (input_name); + str += "##"; + } - result = XNEWVEC (char, strlen (src_name) + 50); - ptr = result; - ptr = mangle_name (src_name, ptr); - ptr[0] = ptr[1] = '#'; - ptr += 2; - memcpy (ptr, md5sum_hex, 32); - ptr += 32; - strcpy (ptr, ".gcov"); + str += mangle_name (src_name); + str += ".gcov"; } - return result; + return str; } /* Mangle BASE name, copy it at the beginning of PTR buffer and return address of the \0 character of the buffer. */ static char * -mangle_name (char const *base, char *ptr) +mangle_name (char const *base) { - size_t len; - /* Generate the source filename part. */ if (!flag_preserve_paths) - base = lbasename (base); + return xstrdup (lbasename (base)); else - base = mangle_path (base); - - len = strlen (base); - memcpy (ptr, base, len); - ptr += len; - - return ptr; + return mangle_path (base); } /* Scan through the bb_data for each line in the block, increment -- cgit v1.1 From f9400e4e4705845f2b0cdc4eab30c214e0e4cbe0 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 20 Aug 2021 11:29:48 +0200 Subject: openmp: Diagnose some superfluous commas in OpenMP parsing While working on error directive, I've noticed a few spots in OpenMP parsing where we consume and don't diagnose superfluous commas at the end (either of depend sink arguments or at the end of requires pragma). 2021-08-20 Jakub Jelinek gcc/c/ * c-parser.c (c_parser_omp_clause_depend_sink): Reject spurious comma at the end of list. (c_parser_omp_requires): Likewise. gcc/cp/ * parser.c (cp_parser_omp_clause_depend_sink): Reject spurious comma at the end of list. Don't parse closing paren here... (cp_parser_omp_clause_depend): ... but here instead. gcc/testsuite/ * c-c++-common/gomp/sink-5.c: New test. * c-c++-common/gomp/requires-3.c: Add test for spurious comma at the end of pragma line. --- gcc/c/c-parser.c | 8 ++++++-- gcc/cp/parser.c | 13 ++++++++++--- gcc/testsuite/c-c++-common/gomp/requires-3.c | 1 + gcc/testsuite/c-c++-common/gomp/sink-5.c | 16 ++++++++++++++++ 4 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/c-c++-common/gomp/sink-5.c (limited to 'gcc') diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index 407f279..ab79e9c 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -15481,7 +15481,9 @@ c_parser_omp_clause_depend_sink (c_parser *parser, location_t clause_loc, OMP_CLAUSE_DEPEND_SINK_NEGATIVE (vec) = 1; } - if (c_parser_next_token_is_not (parser, CPP_COMMA)) + if (c_parser_next_token_is_not (parser, CPP_COMMA) + || c_parser_peek_2nd_token (parser)->type != CPP_NAME + || c_parser_peek_2nd_token (parser)->id_kind != C_ID_ID) break; c_parser_consume_token (parser); @@ -21663,7 +21665,9 @@ c_parser_omp_requires (c_parser *parser) location_t loc = c_parser_peek_token (parser)->location; while (c_parser_next_token_is_not (parser, CPP_PRAGMA_EOL)) { - if (!first && c_parser_next_token_is (parser, CPP_COMMA)) + if (!first + && c_parser_next_token_is (parser, CPP_COMMA) + && c_parser_peek_2nd_token (parser)->type == CPP_NAME) c_parser_consume_token (parser); first = false; diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 0af1a2c..d321364 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -38465,13 +38465,14 @@ cp_parser_omp_clause_depend_sink (cp_parser *parser, location_t clause_loc, OMP_CLAUSE_DEPEND_SINK_NEGATIVE (vec) = 1; } - if (cp_lexer_next_token_is_not (parser->lexer, CPP_COMMA)) + if (cp_lexer_next_token_is_not (parser->lexer, CPP_COMMA) + || !cp_lexer_nth_token_is (parser->lexer, 2, CPP_NAME)) break; cp_lexer_consume_token (parser->lexer); } - if (cp_parser_require (parser, CPP_CLOSE_PAREN, RT_CLOSE_PAREN) && vec) + if (vec) { tree u = build_omp_clause (clause_loc, OMP_CLAUSE_DEPEND); OMP_CLAUSE_DEPEND_KIND (u) = OMP_CLAUSE_DEPEND_SINK; @@ -38791,7 +38792,13 @@ cp_parser_omp_clause_depend (cp_parser *parser, tree list, location_t loc) goto resync_fail; if (kind == OMP_CLAUSE_DEPEND_SINK) - nlist = cp_parser_omp_clause_depend_sink (parser, loc, list); + { + nlist = cp_parser_omp_clause_depend_sink (parser, loc, list); + if (!parens.require_close (parser)) + cp_parser_skip_to_closing_parenthesis (parser, /*recovering=*/true, + /*or_comma=*/false, + /*consume_paren=*/true); + } else { nlist = cp_parser_omp_var_list_no_open (parser, OMP_CLAUSE_DEPEND, diff --git a/gcc/testsuite/c-c++-common/gomp/requires-3.c b/gcc/testsuite/c-c++-common/gomp/requires-3.c index 0e55b66..bd2479b 100644 --- a/gcc/testsuite/c-c++-common/gomp/requires-3.c +++ b/gcc/testsuite/c-c++-common/gomp/requires-3.c @@ -3,3 +3,4 @@ #pragma omp requires atomic_default_mem_order(foobar) /* { dg-error "expected 'seq_cst', 'relaxed' or 'acq_rel'" } */ #pragma omp requires atomic_default_mem_order ( /* { dg-error "expected 'seq_cst', 'relaxed' or 'acq_rel'" } */ /* { dg-error "expected '\\\)' before end of line" "" { target *-*-* } .-1 } */ +#pragma omp requires atomic_default_mem_order(seq_cst), /* { dg-error "expected end of line before ',' token" } */ diff --git a/gcc/testsuite/c-c++-common/gomp/sink-5.c b/gcc/testsuite/c-c++-common/gomp/sink-5.c new file mode 100644 index 0000000..4fbaa8a --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/sink-5.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ + +void bar (int); + +void +foo () +{ + int i; +#pragma omp parallel for ordered(1) + for (i = 0; i < 100; ++i) + { +#pragma omp ordered depend(sink:i-1,) /* { dg-error "expected '\\\)' before ',' token" } */ + bar (i); +#pragma omp ordered depend(source) + } +} -- cgit v1.1 From 0d973c0a0d90a0a302e7eda1a4d9709be3c5b102 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 20 Aug 2021 11:36:52 +0200 Subject: openmp: Implement the error directive This patch implements the error directive. Depending on clauses it is either a compile time diagnostics (in that case diagnosed right away) or runtime diagnostics (libgomp API call that diagnoses at runtime), and either fatal or warning (error or warning at compile time or fatal error vs. error at runtime) and either has no message or user supplied message (this kind of e.g. deprecated attribute). The directive is also stand-alone directive when at runtime while utility (thus disappears from the IL as if it wasn't there for parsing like nothing directive) at compile time. There are some clarifications in the works ATM, so this patch doesn't yet require that for compile time diagnostics the user message must be a constant string literal, there are uncertainities on what exactly is valid argument of message clause (whether just const char * type, convertible to const char *, qualified/unqualified const char * or char * or what else) and what to do in templates. Currently even in templates it is diagnosed right away for compile time diagnostics, if we'll need to substitute it, we'd need to queue something into the IL, have pt.c handle it and diagnose only later. 2021-08-20 Jakub Jelinek gcc/ * omp-builtins.def (BUILT_IN_GOMP_WARNING, BUILT_IN_GOMP_ERROR): New builtins. gcc/c-family/ * c-pragma.h (enum pragma_kind): Add PRAGMA_OMP_ERROR. * c-pragma.c (omp_pragmas): Add error directive. * c-omp.c (omp_directives): Uncomment error directive entry. gcc/c/ * c-parser.c (c_parser_omp_error): New function. (c_parser_pragma): Handle PRAGMA_OMP_ERROR. gcc/cp/ * parser.c (cp_parser_handle_statement_omp_attributes): Determine if PRAGMA_OMP_ERROR directive is C_OMP_DIR_STANDALONE. (cp_parser_omp_error): New function. (cp_parser_pragma): Handle PRAGMA_OMP_ERROR. gcc/fortran/ * types.def (BT_FN_VOID_CONST_PTR_SIZE): New DEF_FUNCTION_TYPE_2. * f95-lang.c (ATTR_COLD_NORETURN_NOTHROW_LEAF_LIST): Define. gcc/testsuite/ * c-c++-common/gomp/error-1.c: New test. * c-c++-common/gomp/error-2.c: New test. * c-c++-common/gomp/error-3.c: New test. * g++.dg/gomp/attrs-1.C (bar): Add error directive test. * g++.dg/gomp/attrs-2.C (bar): Add error directive test. * g++.dg/gomp/attrs-13.C: New test. * g++.dg/gomp/error-1.C: New test. libgomp/ * libgomp.map (GOMP_5.1): Add GOMP_error and GOMP_warning. * libgomp_g.h (GOMP_warning, GOMP_error): Declare. * error.c (GOMP_warning, GOMP_error): New functions. * testsuite/libgomp.c-c++-common/error-1.c: New test. --- gcc/c-family/c-omp.c | 4 +- gcc/c-family/c-pragma.c | 1 + gcc/c-family/c-pragma.h | 1 + gcc/c/c-parser.c | 171 ++++++++++++++++++++++++ gcc/cp/parser.c | 207 +++++++++++++++++++++++++++++- gcc/fortran/f95-lang.c | 5 +- gcc/fortran/types.def | 1 + gcc/omp-builtins.def | 4 + gcc/testsuite/c-c++-common/gomp/error-1.c | 45 +++++++ gcc/testsuite/c-c++-common/gomp/error-2.c | 24 ++++ gcc/testsuite/c-c++-common/gomp/error-3.c | 70 ++++++++++ gcc/testsuite/g++.dg/gomp/attrs-1.C | 4 +- gcc/testsuite/g++.dg/gomp/attrs-13.C | 34 +++++ gcc/testsuite/g++.dg/gomp/attrs-2.C | 4 +- gcc/testsuite/g++.dg/gomp/error-1.C | 42 ++++++ 15 files changed, 609 insertions(+), 8 deletions(-) create mode 100644 gcc/testsuite/c-c++-common/gomp/error-1.c create mode 100644 gcc/testsuite/c-c++-common/gomp/error-2.c create mode 100644 gcc/testsuite/c-c++-common/gomp/error-3.c create mode 100644 gcc/testsuite/g++.dg/gomp/attrs-13.C create mode 100644 gcc/testsuite/g++.dg/gomp/error-1.C (limited to 'gcc') diff --git a/gcc/c-family/c-omp.c b/gcc/c-family/c-omp.c index d4e98bf..18de7e4 100644 --- a/gcc/c-family/c-omp.c +++ b/gcc/c-family/c-omp.c @@ -2991,8 +2991,8 @@ static const struct c_omp_directive omp_directives[] = { /* { "end", "metadirective", nullptr, PRAGMA_OMP_END, C_OMP_DIR_???, ??? }, */ /* error with at(execution) is C_OMP_DIR_STANDALONE. */ - /* { "error", nullptr, nullptr, PRAGMA_OMP_ERROR, - C_OMP_DIR_UTILITY, false }, */ + { "error", nullptr, nullptr, PRAGMA_OMP_ERROR, + C_OMP_DIR_UTILITY, false }, { "flush", nullptr, nullptr, PRAGMA_OMP_FLUSH, C_OMP_DIR_STANDALONE, false }, { "for", nullptr, nullptr, PRAGMA_OMP_FOR, diff --git a/gcc/c-family/c-pragma.c b/gcc/c-family/c-pragma.c index 238309d..a9be8df 100644 --- a/gcc/c-family/c-pragma.c +++ b/gcc/c-family/c-pragma.c @@ -1326,6 +1326,7 @@ static const struct omp_pragma_def omp_pragmas[] = { { "cancellation", PRAGMA_OMP_CANCELLATION_POINT }, { "critical", PRAGMA_OMP_CRITICAL }, { "depobj", PRAGMA_OMP_DEPOBJ }, + { "error", PRAGMA_OMP_ERROR }, { "end", PRAGMA_OMP_END_DECLARE_TARGET }, { "flush", PRAGMA_OMP_FLUSH }, { "nothing", PRAGMA_OMP_NOTHING }, diff --git a/gcc/c-family/c-pragma.h b/gcc/c-family/c-pragma.h index dc9e8a6..0c5b07a 100644 --- a/gcc/c-family/c-pragma.h +++ b/gcc/c-family/c-pragma.h @@ -53,6 +53,7 @@ enum pragma_kind { PRAGMA_OMP_DECLARE, PRAGMA_OMP_DEPOBJ, PRAGMA_OMP_DISTRIBUTE, + PRAGMA_OMP_ERROR, PRAGMA_OMP_END_DECLARE_TARGET, PRAGMA_OMP_FLUSH, PRAGMA_OMP_FOR, diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index ab79e9c..c578307 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -1588,6 +1588,7 @@ static bool c_parser_omp_target (c_parser *, enum pragma_context, bool *); static void c_parser_omp_end_declare_target (c_parser *); static bool c_parser_omp_declare (c_parser *, enum pragma_context); static void c_parser_omp_requires (c_parser *); +static bool c_parser_omp_error (c_parser *, enum pragma_context); static bool c_parser_omp_ordered (c_parser *, enum pragma_context, bool *); static void c_parser_oacc_routine (c_parser *, enum pragma_context); @@ -12485,6 +12486,9 @@ c_parser_pragma (c_parser *parser, enum pragma_context context, bool *if_p) c_parser_omp_nothing (parser); return false; + case PRAGMA_OMP_ERROR: + return c_parser_omp_error (parser, context); + case PRAGMA_OMP_ORDERED: return c_parser_omp_ordered (parser, context, if_p); @@ -21936,6 +21940,173 @@ c_parser_omp_nothing (c_parser *parser) c_parser_skip_to_pragma_eol (parser); } +/* OpenMP 5.1 + #pragma omp error clauses[optseq] new-line */ + +static bool +c_parser_omp_error (c_parser *parser, enum pragma_context context) +{ + int at_compilation = -1; + int severity_fatal = -1; + tree message = NULL_TREE; + bool first = true; + bool bad = false; + location_t loc = c_parser_peek_token (parser)->location; + + c_parser_consume_pragma (parser); + + while (c_parser_next_token_is_not (parser, CPP_PRAGMA_EOL)) + { + if (!first + && c_parser_next_token_is (parser, CPP_COMMA) + && c_parser_peek_2nd_token (parser)->type == CPP_NAME) + c_parser_consume_token (parser); + + first = false; + + if (!c_parser_next_token_is (parser, CPP_NAME)) + break; + + const char *p + = IDENTIFIER_POINTER (c_parser_peek_token (parser)->value); + location_t cloc = c_parser_peek_token (parser)->location; + static const char *args[] = { + "execution", "compilation", "warning", "fatal" + }; + int *v = NULL; + int idx = 0, n = -1; + tree m = NULL_TREE; + + if (!strcmp (p, "at")) + v = &at_compilation; + else if (!strcmp (p, "severity")) + { + v = &severity_fatal; + idx += 2; + } + else if (strcmp (p, "message")) + { + error_at (cloc, + "expected %, % or % clause"); + c_parser_skip_to_pragma_eol (parser, false); + return false; + } + + c_parser_consume_token (parser); + + matching_parens parens; + if (parens.require_open (parser)) + { + if (v == NULL) + { + location_t expr_loc = c_parser_peek_token (parser)->location; + c_expr expr = c_parser_expr_no_commas (parser, NULL); + expr = convert_lvalue_to_rvalue (expr_loc, expr, true, true); + m = convert (const_string_type_node, expr.value); + m = c_fully_fold (m, false, NULL); + } + else + { + if (c_parser_next_token_is (parser, CPP_NAME)) + { + tree val = c_parser_peek_token (parser)->value; + const char *q = IDENTIFIER_POINTER (val); + + if (!strcmp (q, args[idx])) + n = 0; + else if (!strcmp (q, args[idx + 1])) + n = 1; + } + if (n == -1) + { + error_at (c_parser_peek_token (parser)->location, + "expected %qs or %qs", args[idx], args[idx + 1]); + bad = true; + switch (c_parser_peek_token (parser)->type) + { + case CPP_EOF: + case CPP_PRAGMA_EOL: + case CPP_CLOSE_PAREN: + break; + default: + if (c_parser_peek_2nd_token (parser)->type + == CPP_CLOSE_PAREN) + c_parser_consume_token (parser); + break; + } + } + else + c_parser_consume_token (parser); + } + + parens.skip_until_found_close (parser); + + if (v == NULL) + { + if (message) + { + error_at (cloc, "too many %qs clauses", p); + bad = true; + } + else + message = m; + } + else if (n != -1) + { + if (*v != -1) + { + error_at (cloc, "too many %qs clauses", p); + bad = true; + } + else + *v = n; + } + } + else + bad = true; + } + c_parser_skip_to_pragma_eol (parser); + if (bad) + return true; + + if (at_compilation == -1) + at_compilation = 1; + if (severity_fatal == -1) + severity_fatal = 1; + if (!at_compilation) + { + if (context != pragma_compound) + { + error_at (loc, "%<#pragma omp error%> with % clause " + "may only be used in compound statements"); + return true; + } + tree fndecl + = builtin_decl_explicit (severity_fatal ? BUILT_IN_GOMP_ERROR + : BUILT_IN_GOMP_WARNING); + if (!message) + message = build_zero_cst (const_string_type_node); + tree stmt = build_call_expr_loc (loc, fndecl, 2, message, + build_all_ones_cst (size_type_node)); + add_stmt (stmt); + return true; + } + const char *msg = NULL; + if (message) + { + msg = c_getstr (message); + if (msg == NULL) + msg = _(""); + } + if (msg) + emit_diagnostic (severity_fatal ? DK_ERROR : DK_WARNING, loc, 0, + "% encountered: %s", msg); + else + emit_diagnostic (severity_fatal ? DK_ERROR : DK_WARNING, loc, 0, + "% encountered"); + return false; +} + /* Main entry point to parsing most OpenMP pragmas. */ static void diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index d321364..63c9503 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -11760,10 +11760,30 @@ cp_parser_handle_statement_omp_attributes (cp_parser *parser, tree attrs) "depend") == 0) kind = C_OMP_DIR_STANDALONE; } - /* else if (dir->id == PRAGMA_OMP_ERROR) + else if (dir->id == PRAGMA_OMP_ERROR) { - error with at(execution) clause is C_OMP_DIR_STANDALONE. - } */ + /* error with at(execution) clause is C_OMP_DIR_STANDALONE. */ + int paren_depth = 0; + for (int i = 1; first + i < last; i++) + if (first[i].type == CPP_OPEN_PAREN) + paren_depth++; + else if (first[i].type == CPP_CLOSE_PAREN) + paren_depth--; + else if (paren_depth == 0 + && first + i + 2 < last + && first[i].type == CPP_NAME + && first[i + 1].type == CPP_OPEN_PAREN + && first[i + 2].type == CPP_NAME + && !strcmp (IDENTIFIER_POINTER (first[i].u.value), + "at") + && !strcmp (IDENTIFIER_POINTER (first[i + + 2].u.value), + "execution")) + { + kind = C_OMP_DIR_STANDALONE; + break; + } + } cp_omp_attribute_data v = { DEFPARSE_TOKENS (d), dir, kind }; vec.safe_push (v); if (flag_openmp || dir->simd) @@ -45590,6 +45610,184 @@ cp_parser_omp_nothing (cp_parser *parser, cp_token *pragma_tok) } +/* OpenMP 5.1 + #pragma omp error clauses[optseq] new-line */ + +static bool +cp_parser_omp_error (cp_parser *parser, cp_token *pragma_tok, + enum pragma_context context) +{ + int at_compilation = -1; + int severity_fatal = -1; + tree message = NULL_TREE; + bool first = true; + bool bad = false; + location_t loc = pragma_tok->location; + + while (cp_lexer_next_token_is_not (parser->lexer, CPP_PRAGMA_EOL)) + { + /* For now only in C++ attributes, do it always for OpenMP 5.1. */ + if ((!first || parser->lexer->in_omp_attribute_pragma) + && cp_lexer_next_token_is (parser->lexer, CPP_COMMA) + && cp_lexer_nth_token_is (parser->lexer, 2, CPP_NAME)) + cp_lexer_consume_token (parser->lexer); + + first = false; + + if (cp_lexer_next_token_is_not (parser->lexer, CPP_NAME)) + break; + + const char *p + = IDENTIFIER_POINTER (cp_lexer_peek_token (parser->lexer)->u.value); + location_t cloc = cp_lexer_peek_token (parser->lexer)->location; + static const char *args[] = { + "execution", "compilation", "warning", "fatal" + }; + int *v = NULL; + int idx = 0, n = -1; + tree m = NULL_TREE; + + if (!strcmp (p, "at")) + v = &at_compilation; + else if (!strcmp (p, "severity")) + { + v = &severity_fatal; + idx += 2; + } + else if (strcmp (p, "message")) + { + error_at (cloc, + "expected %, % or % clause"); + cp_parser_skip_to_pragma_eol (parser, pragma_tok); + return false; + } + + cp_lexer_consume_token (parser->lexer); + + matching_parens parens; + if (parens.require_open (parser)) + { + if (v == NULL) + { + m = cp_parser_assignment_expression (parser); + if (type_dependent_expression_p (m)) + m = build1 (IMPLICIT_CONV_EXPR, const_string_type_node, m); + else + m = perform_implicit_conversion_flags (const_string_type_node, m, + tf_warning_or_error, + LOOKUP_NORMAL); + } + else + { + if (cp_lexer_next_token_is (parser->lexer, CPP_NAME)) + { + tree val = cp_lexer_peek_token (parser->lexer)->u.value; + const char *q = IDENTIFIER_POINTER (val); + + if (!strcmp (q, args[idx])) + n = 0; + else if (!strcmp (q, args[idx + 1])) + n = 1; + } + if (n == -1) + { + error_at (cp_lexer_peek_token (parser->lexer)->location, + "expected %qs or %qs", args[idx], args[idx + 1]); + bad = true; + switch (cp_lexer_peek_token (parser->lexer)->type) + { + case CPP_EOF: + case CPP_PRAGMA_EOL: + case CPP_CLOSE_PAREN: + break; + default: + if (cp_lexer_nth_token_is (parser->lexer, 2, + CPP_CLOSE_PAREN)) + cp_lexer_consume_token (parser->lexer); + break; + } + } + else + cp_lexer_consume_token (parser->lexer); + } + + if (!parens.require_close (parser)) + cp_parser_skip_to_closing_parenthesis (parser, + /*recovering=*/true, + /*or_comma=*/false, + /*consume_paren=*/ + true); + + if (v == NULL) + { + if (message) + { + error_at (cloc, "too many %qs clauses", p); + bad = true; + } + else + message = m; + } + else if (n != -1) + { + if (*v != -1) + { + error_at (cloc, "too many %qs clauses", p); + bad = true; + } + else + *v = n; + } + } + else + bad = true; + } + cp_parser_require_pragma_eol (parser, pragma_tok); + if (bad) + return true; + + if (at_compilation == -1) + at_compilation = 1; + if (severity_fatal == -1) + severity_fatal = 1; + if (!at_compilation) + { + if (context != pragma_compound) + { + error_at (loc, "%<#pragma omp error%> with % clause " + "may only be used in compound statements"); + return true; + } + tree fndecl + = builtin_decl_explicit (severity_fatal ? BUILT_IN_GOMP_ERROR + : BUILT_IN_GOMP_WARNING); + if (!message) + message = build_zero_cst (const_string_type_node); + tree stmt = build_call_expr_loc (loc, fndecl, 2, message, + build_all_ones_cst (size_type_node)); + add_stmt (stmt); + return true; + } + + if (in_discarded_stmt) + return false; + + const char *msg = NULL; + if (message) + { + msg = c_getstr (fold_for_warn (message)); + if (msg == NULL) + msg = _(""); + } + if (msg) + emit_diagnostic (severity_fatal ? DK_ERROR : DK_WARNING, loc, 0, + "% encountered: %s", msg); + else + emit_diagnostic (severity_fatal ? DK_ERROR : DK_WARNING, loc, 0, + "% encountered"); + return false; +} + /* OpenMP 4.5: #pragma omp taskloop taskloop-clause[optseq] new-line for-loop @@ -46703,6 +46901,9 @@ cp_parser_pragma (cp_parser *parser, enum pragma_context context, bool *if_p) cp_parser_omp_nothing (parser, pragma_tok); return false; + case PRAGMA_OMP_ERROR: + return cp_parser_omp_error (parser, pragma_tok, context); + case PRAGMA_OMP_ORDERED: if (context != pragma_stmt && context != pragma_compound) goto bad_stmt; diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c index 5fc8481..026228d 100644 --- a/gcc/fortran/f95-lang.c +++ b/gcc/fortran/f95-lang.c @@ -535,7 +535,7 @@ gfc_builtin_function (tree decl) return decl; } -/* So far we need just these 8 attribute types. */ +/* So far we need just these 10 attribute types. */ #define ATTR_NULL 0 #define ATTR_LEAF_LIST (ECF_LEAF) #define ATTR_NOTHROW_LEAF_LIST (ECF_NOTHROW | ECF_LEAF) @@ -546,6 +546,9 @@ gfc_builtin_function (tree decl) #define ATTR_CONST_NOTHROW_LIST (ECF_NOTHROW | ECF_CONST) #define ATTR_ALLOC_WARN_UNUSED_RESULT_SIZE_2_NOTHROW_LIST \ (ECF_NOTHROW) +#define ATTR_COLD_NORETURN_NOTHROW_LEAF_LIST \ + (ECF_COLD | ECF_NORETURN | \ + ECF_NOTHROW | ECF_LEAF) static void gfc_define_builtin (const char *name, tree type, enum built_in_function code, diff --git a/gcc/fortran/types.def b/gcc/fortran/types.def index 8626ed0..85b85ed 100644 --- a/gcc/fortran/types.def +++ b/gcc/fortran/types.def @@ -120,6 +120,7 @@ DEF_FUNCTION_TYPE_2 (BT_FN_BOOL_INT_BOOL, BT_BOOL, BT_INT, BT_BOOL) DEF_FUNCTION_TYPE_2 (BT_FN_VOID_UINT_UINT, BT_VOID, BT_UINT, BT_UINT) DEF_FUNCTION_TYPE_2 (BT_FN_VOID_PTR_PTRMODE, BT_VOID, BT_PTR, BT_PTRMODE) +DEF_FUNCTION_TYPE_2 (BT_FN_VOID_CONST_PTR_SIZE, BT_VOID, BT_CONST_PTR, BT_SIZE) DEF_POINTER_TYPE (BT_PTR_FN_VOID_PTR_PTR, BT_FN_VOID_PTR_PTR) diff --git a/gcc/omp-builtins.def b/gcc/omp-builtins.def index b168575..4520dc0 100644 --- a/gcc/omp-builtins.def +++ b/gcc/omp-builtins.def @@ -463,3 +463,7 @@ DEF_GOMP_BUILTIN (BUILT_IN_GOMP_ALLOC, ATTR_ALLOC_WARN_UNUSED_RESULT_SIZE_2_NOTHROW_LIST) DEF_GOMP_BUILTIN (BUILT_IN_GOMP_FREE, "GOMP_free", BT_FN_VOID_PTR_PTRMODE, ATTR_NOTHROW_LEAF_LIST) +DEF_GOMP_BUILTIN (BUILT_IN_GOMP_WARNING, "GOMP_warning", + BT_FN_VOID_CONST_PTR_SIZE, ATTR_NOTHROW_LEAF_LIST) +DEF_GOMP_BUILTIN (BUILT_IN_GOMP_ERROR, "GOMP_error", + BT_FN_VOID_CONST_PTR_SIZE, ATTR_COLD_NORETURN_NOTHROW_LEAF_LIST) diff --git a/gcc/testsuite/c-c++-common/gomp/error-1.c b/gcc/testsuite/c-c++-common/gomp/error-1.c new file mode 100644 index 0000000..6a40f85 --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/error-1.c @@ -0,0 +1,45 @@ +#pragma omp error /* { dg-error "'pragma omp error' encountered" } */ +#pragma omp error at(compilation) /* { dg-error "'pragma omp error' encountered" } */ +#pragma omp error severity(fatal) /* { dg-error "'pragma omp error' encountered" } */ +#pragma omp error message("my msg") /* { dg-error "'pragma omp error' encountered: my msg" } */ +#pragma omp error severity(warning)message("another message")at(compilation) /* { dg-warning "'pragma omp error' encountered: another message" } */ + +struct S { + #pragma omp error /* { dg-error "'pragma omp error' encountered" } */ + #pragma omp error at(compilation) /* { dg-error "'pragma omp error' encountered" } */ + #pragma omp error severity(fatal) /* { dg-error "'pragma omp error' encountered" } */ + #pragma omp error message("42") /* { dg-error "'pragma omp error' encountered: 42" } */ + #pragma omp error severity(warning), message("foo"), at(compilation) /* { dg-warning "'pragma omp error' encountered: foo" } */ + int s; +}; + +int +foo (int i, int x) +{ + #pragma omp error /* { dg-error "'pragma omp error' encountered" } */ + #pragma omp error at(compilation) /* { dg-error "'pragma omp error' encountered" } */ + #pragma omp error severity(fatal) /* { dg-error "'pragma omp error' encountered" } */ + #pragma omp error message("42 / 1") /* { dg-error "'pragma omp error' encountered: 42 / 1" } */ + #pragma omp error severity(warning) message("bar") at(compilation) /* { dg-warning "'pragma omp error' encountered: bar" } */ + if (x) + #pragma omp error /* { dg-error "'pragma omp error' encountered" } */ + i++; + if (x) + ; + else + #pragma omp error at(compilation) /* { dg-error "'pragma omp error' encountered" } */ + i++; + switch (0) + #pragma omp error severity(fatal) /* { dg-error "'pragma omp error' encountered" } */ + { + default: + break; + } + while (0) + #pragma omp error message("42 - 1") /* { dg-error "'pragma omp error' encountered: 42 - 1" } */ + i++; + lab: + #pragma omp error severity(warning) message("bar") at(compilation) /* { dg-warning "'pragma omp error' encountered: bar" } */ + i++; + return i; +} diff --git a/gcc/testsuite/c-c++-common/gomp/error-2.c b/gcc/testsuite/c-c++-common/gomp/error-2.c new file mode 100644 index 0000000..4e13f03 --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/error-2.c @@ -0,0 +1,24 @@ +void +foo (int x, const char *msg1, const char *msg2) +{ + if (x == 0) + { + #pragma omp error at(execution) + } + else if (x == 1) + { + #pragma omp error severity (warning), at (execution) + } + else if (x == 2) + { + #pragma omp error at ( execution ) severity (fatal) message ("baz") + } + else if (x == 3) + { + #pragma omp error severity(warning) message (msg1) at(execution) + } + else + { + #pragma omp error message (msg2), at(execution), severity(fatal) + } +} diff --git a/gcc/testsuite/c-c++-common/gomp/error-3.c b/gcc/testsuite/c-c++-common/gomp/error-3.c new file mode 100644 index 0000000..d2b8b83 --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/error-3.c @@ -0,0 +1,70 @@ +#pragma omp error asdf /* { dg-error "expected 'at', 'severity' or 'message' clause" } */ +#pragma omp error at /* { dg-error "expected '\\\(' before end of line" } */ +#pragma omp error at( /* { dg-error "expected 'execution' or 'compilation'" } */ + /* { dg-error "expected '\\\)' before end of line" "" { target *-*-* } .-1 } */ +#pragma omp error at(runtime) /* { dg-error "expected 'execution' or 'compilation'" } */ +#pragma omp error at(+ /* { dg-error "expected 'execution' or 'compilation'" } */ + /* { dg-error "expected '\\\)' before '\\\+' token" "" { target *-*-* } .-1 } */ +#pragma omp error at(compilation /* { dg-error "expected '\\\)' before end of line" } */ + /* { dg-error "'pragma omp error' encountered" "" { target *-*-* } .-1 } */ +#pragma omp error severity /* { dg-error "expected '\\\(' before end of line" } */ +#pragma omp error severity( /* { dg-error "expected 'warning' or 'fatal'" } */ + /* { dg-error "expected '\\\)' before end of line" "" { target *-*-* } .-1 } */ +#pragma omp error severity(error) /* { dg-error "expected 'warning' or 'fatal'" } */ +#pragma omp error severity(- /* { dg-error "expected 'warning' or 'fatal'" } */ + /* { dg-error "expected '\\\)' before '-' token" "" { target *-*-* } .-1 } */ +#pragma omp error severity(fatal /* { dg-error "expected '\\\)' before end of line" } */ + /* { dg-error "'pragma omp error' encountered" "" { target *-*-* } .-1 } */ +#pragma omp error message /* { dg-error "expected '\\\(' before end of line" } */ +#pragma omp error message( /* { dg-error "expected expression before end of line" "" { target c } } */ + /* { dg-error "expected primary-expression before end of line" "" { target c++ } .-1 } */ + /* { dg-error "expected '\\\)' before end of line" "" { target c++ } .-2 } */ + /* { dg-error "'pragma omp error' encountered: " "" { target *-*-* } .-3 } */ +#pragma omp error message(0 /* { dg-error "expected '\\\)' before end of line" } */ + /* { dg-error "'pragma omp error' encountered: " "" { target *-*-* } .-1 } */ +#pragma omp error message("foo" /* { dg-error "expected '\\\)' before end of line" } */ + /* { dg-error "'pragma omp error' encountered: foo" "" { target *-*-* } .-1 } */ +#pragma omp error message(1) /* { dg-error "'pragma omp error' encountered: " } */ + /* { dg-error "invalid conversion from 'int' to 'const char\\*'" "" { target c++ } .-1 } */ +#pragma omp error message(1.2) /* { dg-error "cannot convert to a pointer type" "" { target c } } */ + /* { dg-error "could not convert" "" { target c++ } .-1 } */ + /* { dg-error "'pragma omp error' encountered: " "" { target *-*-* } .-2 } */ +#pragma omp error message(L"bar") /* { dg-error "'pragma omp error' encountered: " } */ + /* { dg-error "could not convert" "" { target c++ } .-1 } */ +#pragma omp error message("foo"),at(compilation),severity(fatal), /* { dg-error "expected end of line before ',' token" } */ + /* { dg-error "'pragma omp error' encountered: foo" "" { target *-*-* } .-1 } */ +#pragma omp error message("foo"),at(compilation),severity(fatal),asdf /* { dg-error "expected 'at', 'severity' or 'message' clause" } */ +#pragma omp error at(compilation) at(compilation) /* { dg-error "too many 'at' clauses" } */ +#pragma omp error severity(fatal) severity(warning) /* { dg-error "too many 'severity' clauses" } */ +#pragma omp error message("foo") message("foo") /* { dg-error "too many 'message' clauses" } */ +#pragma omp error at(execution) /* { dg-error "'#pragma omp error' with 'at\\\(execution\\\)' clause may only be used in compound statements" } */ + +struct S +{ + #pragma omp error at(execution) message("foo")/* { dg-error "'#pragma omp error' with 'at\\\(execution\\\)' clause may only be used in compound statements" } */ + int s; +}; + +int +foo (int i, int x, const char *msg) +{ + #pragma omp error message(msg) /* { dg-error "'pragma omp error' encountered: " } */ + if (x) + #pragma omp error at(execution) /* { dg-error "'#pragma omp error' with 'at\\\(execution\\\)' clause may only be used in compound statements" } */ + i++; + if (x) + ; + else + #pragma omp error at(execution) severity(warning) /* { dg-error "'#pragma omp error' with 'at\\\(execution\\\)' clause may only be used in compound statements" } */ + i++; + switch (0) + #pragma omp error severity(fatal) at(execution) /* { dg-error "'#pragma omp error' with 'at\\\(execution\\\)' clause may only be used in compound statements" } */ + ; + while (0) + #pragma omp error at(execution)message("42 - 1") /* { dg-error "'#pragma omp error' with 'at\\\(execution\\\)' clause may only be used in compound statements" } */ + i++; + lab: + #pragma omp error severity(warning) message("bar") at(execution) /* { dg-error "'#pragma omp error' with 'at\\\(execution\\\)' clause may only be used in compound statements" } */ + i++; + return i; +} diff --git a/gcc/testsuite/g++.dg/gomp/attrs-1.C b/gcc/testsuite/g++.dg/gomp/attrs-1.C index 435d54f..cd20845 100644 --- a/gcc/testsuite/g++.dg/gomp/attrs-1.C +++ b/gcc/testsuite/g++.dg/gomp/attrs-1.C @@ -109,9 +109,11 @@ baz (int d, int m, int i1, int i2, int p, int *idp, int s, void bar (int d, int m, int i1, int i2, int i3, int p, int *idp, int s, - int nte, int tl, int nth, int g, int nta, int fi, int pp, int *q, int *dd, int ntm) + int nte, int tl, int nth, int g, int nta, int fi, int pp, int *q, int *dd, int ntm, + const char *msg) { [[omp::directive (nothing)]]; + [[omp::directive (error at (execution) severity (warning) message (msg))]]; [[omp::directive (for simd private (p) firstprivate (f) lastprivate (l) linear (ll:1) reduction(+:r) schedule(static, 4) collapse(1) nowait safelen(8) simdlen(4) aligned(q: 32) nontemporal(ntm) if(i1) order(concurrent) allocate (f))]] diff --git a/gcc/testsuite/g++.dg/gomp/attrs-13.C b/gcc/testsuite/g++.dg/gomp/attrs-13.C new file mode 100644 index 0000000..35e2435c --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/attrs-13.C @@ -0,0 +1,34 @@ +// { dg-do compile { target c++11 } } + +[[omp::directive(error)]]; // { dg-error "'pragma omp error' encountered" } +[[omp::directive(error, at(compilation))]]; // { dg-error "'pragma omp error' encountered" } +[[omp::directive(error severity(fatal))]]; // { dg-error "'pragma omp error' encountered" } +[[omp::directive(error, message("my msg"))]]; // { dg-error "'pragma omp error' encountered: my msg" } +[[omp::directive(error severity(warning)message("another message")at(compilation))]]; // { dg-warning "'pragma omp error' encountered: another message" } + +int +foo (int i, int x) +{ + [[omp::directive(error)]]; // { dg-error "'pragma omp error' encountered" } + [[omp::directive(error, at(compilation))]]; // { dg-error "'pragma omp error' encountered" } + [[omp::directive(error severity(fatal))]]; // { dg-error "'pragma omp error' encountered" } + [[omp::directive(error, message("42 / 1"))]]; // { dg-error "'pragma omp error' encountered: 42 / 1" } + [[omp::directive(error severity(warning) message("bar") at(compilation))]]; // { dg-warning "'pragma omp error' encountered: bar" } + if (x) + [[omp::directive(error)]]; // { dg-error "'pragma omp error' encountered" } + i++; + if (x) + ; + else + [[omp::directive(error at(compilation))]]; // { dg-error "'pragma omp error' encountered" } + i++; + switch (0) + [[omp::directive(error, severity(fatal))]]; // { dg-error "'pragma omp error' encountered" } + while (0) + [[omp::directive(error, message("42 - 1"))]]; // { dg-error "'pragma omp error' encountered: 42 - 1" } + i++; + lab: + [[omp::directive(error, severity(warning) message("bar"), at(compilation))]]; // { dg-warning "'pragma omp error' encountered: bar" } + i++; + return i; +} diff --git a/gcc/testsuite/g++.dg/gomp/attrs-2.C b/gcc/testsuite/g++.dg/gomp/attrs-2.C index bea657f..5c54905 100644 --- a/gcc/testsuite/g++.dg/gomp/attrs-2.C +++ b/gcc/testsuite/g++.dg/gomp/attrs-2.C @@ -109,9 +109,11 @@ baz (int d, int m, int i1, int i2, int p, int *idp, int s, void bar (int d, int m, int i1, int i2, int i3, int p, int *idp, int s, - int nte, int tl, int nth, int g, int nta, int fi, int pp, int *q, int *dd, int ntm) + int nte, int tl, int nth, int g, int nta, int fi, int pp, int *q, int *dd, int ntm, + const char *msg) { [[omp::directive (nothing)]]; + [[omp::directive (error, at (execution), severity (warning), message (msg))]]; [[omp::directive (for simd, private (p),firstprivate (f),lastprivate (l),linear (ll:1),reduction(+:r),schedule(static, 4),collapse(1),nowait, safelen(8),simdlen(4),aligned(q: 32),nontemporal(ntm),if(i1),order(concurrent),allocate (f))]] diff --git a/gcc/testsuite/g++.dg/gomp/error-1.C b/gcc/testsuite/g++.dg/gomp/error-1.C new file mode 100644 index 0000000..a636550 --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/error-1.C @@ -0,0 +1,42 @@ +// { dg-do compile { target c++17 } } + +void +foo () +{ + if constexpr (false) + { + #pragma omp error // { dg-bogus "'pragma omp error' encountered" } + } + else + { + #pragma omp error at(compilation) severity(warning) message("foo") // { dg-warning "'pragma omp error' encountered: foo" } + } + if constexpr (true) + { + #pragma omp error message("bar") // { dg-error "'pragma omp error' encountered: bar" } + } + else + { + #pragma omp error message("baz") // { dg-bogus "'pragma omp error' encountered" } + } +} + +template +bool +bar (T x) +{ + #pragma omp error at(execution) message (x) + return false; +} + +bool a = bar ("foo"); + +template +bool +baz (T x) +{ + #pragma omp error at(execution) message (x) // { dg-error "could not convert" } + return false; +} + +bool b = baz (L"foo"); -- cgit v1.1 From 77167196fe8cf840a69913e7739d39ae0df2b074 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Fri, 20 Aug 2021 12:12:51 +0200 Subject: Fortran: Add OpenMP's error directive Fortran part to the C/C++ implementation of commit r12-3040-g0d973c0a0d90a0a302e7eda1a4d9709be3c5b102 gcc/fortran/ChangeLog: * dump-parse-tree.c (show_omp_clauses): Handle 'at', 'severity' and 'message' clauses. (show_omp_node, show_code_node): Handle EXEC_OMP_ERROR. * gfortran.h (gfc_statement): Add ST_OMP_ERROR. (gfc_omp_severity_type, gfc_omp_at_type): New. (gfc_omp_clauses): Add 'at', 'severity' and 'message' clause; use more bitfields + ENUM_BITFIELD. (gfc_exec_op): Add EXEC_OMP_ERROR. * match.h (gfc_match_omp_error): New. * openmp.c (enum omp_mask1): Add OMP_CLAUSE_(AT,SEVERITY,MESSAGE). (gfc_match_omp_clauses): Handle new clauses. (OMP_ERROR_CLAUSES, gfc_match_omp_error): New. (resolve_omp_clauses): Resolve new clauses. (omp_code_to_statement, gfc_resolve_omp_directive): Handle EXEC_OMP_ERROR. * parse.c (decode_omp_directive, next_statement, gfc_ascii_statement): Handle 'omp error'. * resolve.c (gfc_resolve_blocks): Likewise. * st.c (gfc_free_statement): Likewise. * trans-openmp.c (gfc_trans_omp_error): Likewise. (gfc_trans_omp_directive): Likewise. * trans.c (trans_code): Likewise. libgomp/ChangeLog: * testsuite/libgomp.fortran/error-1.f90: New test. gcc/testsuite/ChangeLog: * gfortran.dg/gomp/error-1.f90: New test. * gfortran.dg/gomp/error-2.f90: New test. * gfortran.dg/gomp/error-3.f90: New test. --- gcc/fortran/dump-parse-tree.c | 27 ++++++- gcc/fortran/gfortran.h | 58 +++++++++----- gcc/fortran/match.h | 1 + gcc/fortran/openmp.c | 124 ++++++++++++++++++++++++++++- gcc/fortran/parse.c | 10 ++- gcc/fortran/resolve.c | 2 + gcc/fortran/st.c | 1 + gcc/fortran/trans-openmp.c | 34 ++++++++ gcc/fortran/trans.c | 1 + gcc/testsuite/gfortran.dg/gomp/error-1.f90 | 51 ++++++++++++ gcc/testsuite/gfortran.dg/gomp/error-2.f90 | 15 ++++ gcc/testsuite/gfortran.dg/gomp/error-3.f90 | 88 ++++++++++++++++++++ 12 files changed, 387 insertions(+), 25 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/gomp/error-1.f90 create mode 100644 gcc/testsuite/gfortran.dg/gomp/error-2.f90 create mode 100644 gcc/testsuite/gfortran.dg/gomp/error-3.f90 (limited to 'gcc') diff --git a/gcc/fortran/dump-parse-tree.c b/gcc/fortran/dump-parse-tree.c index 92d9f9e..c75a0a9 100644 --- a/gcc/fortran/dump-parse-tree.c +++ b/gcc/fortran/dump-parse-tree.c @@ -1908,6 +1908,26 @@ show_omp_clauses (gfc_omp_clauses *omp_clauses) fputc (' ', dumpfile); fputs (memorder, dumpfile); } + if (omp_clauses->at != OMP_AT_UNSET) + { + if (omp_clauses->at != OMP_AT_COMPILATION) + fputs (" AT (COMPILATION)", dumpfile); + else + fputs (" AT (EXECUTION)", dumpfile); + } + if (omp_clauses->severity != OMP_SEVERITY_UNSET) + { + if (omp_clauses->severity != OMP_SEVERITY_FATAL) + fputs (" SEVERITY (FATAL)", dumpfile); + else + fputs (" SEVERITY (WARNING)", dumpfile); + } + if (omp_clauses->message) + { + fputs (" ERROR (", dumpfile); + show_expr (omp_clauses->message); + fputc (')', dumpfile); + } } /* Show a single OpenMP or OpenACC directive node and everything underneath it @@ -1950,8 +1970,9 @@ show_omp_node (int level, gfc_code *c) case EXEC_OMP_DISTRIBUTE_SIMD: name = "DISTRIBUTE SIMD"; break; case EXEC_OMP_DO: name = "DO"; break; case EXEC_OMP_DO_SIMD: name = "DO SIMD"; break; - case EXEC_OMP_LOOP: name = "LOOP"; break; + case EXEC_OMP_ERROR: name = "ERROR"; break; case EXEC_OMP_FLUSH: name = "FLUSH"; break; + case EXEC_OMP_LOOP: name = "LOOP"; break; case EXEC_OMP_MASKED: name = "MASKED"; break; case EXEC_OMP_MASKED_TASKLOOP: name = "MASKED TASKLOOP"; break; case EXEC_OMP_MASKED_TASKLOOP_SIMD: name = "MASKED TASKLOOP SIMD"; break; @@ -2045,6 +2066,7 @@ show_omp_node (int level, gfc_code *c) case EXEC_OMP_DISTRIBUTE_SIMD: case EXEC_OMP_DO: case EXEC_OMP_DO_SIMD: + case EXEC_OMP_ERROR: case EXEC_OMP_LOOP: case EXEC_OMP_ORDERED: case EXEC_OMP_MASKED: @@ -2135,7 +2157,7 @@ show_omp_node (int level, gfc_code *c) || c->op == EXEC_OACC_ENTER_DATA || c->op == EXEC_OACC_EXIT_DATA || c->op == EXEC_OMP_TARGET_UPDATE || c->op == EXEC_OMP_TARGET_ENTER_DATA || c->op == EXEC_OMP_TARGET_EXIT_DATA || c->op == EXEC_OMP_SCAN - || c->op == EXEC_OMP_DEPOBJ + || c->op == EXEC_OMP_DEPOBJ || c->op == EXEC_OMP_ERROR || (c->op == EXEC_OMP_ORDERED && c->block == NULL)) return; if (c->op == EXEC_OMP_SECTIONS || c->op == EXEC_OMP_PARALLEL_SECTIONS) @@ -3268,6 +3290,7 @@ show_code_node (int level, gfc_code *c) case EXEC_OMP_DISTRIBUTE_SIMD: case EXEC_OMP_DO: case EXEC_OMP_DO_SIMD: + case EXEC_OMP_ERROR: case EXEC_OMP_FLUSH: case EXEC_OMP_LOOP: case EXEC_OMP_MASKED: diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h index a7d82ae..4b26cb4 100644 --- a/gcc/fortran/gfortran.h +++ b/gcc/fortran/gfortran.h @@ -281,7 +281,8 @@ enum gfc_statement ST_OMP_PARALLEL_MASKED_TASKLOOP_SIMD, ST_OMP_END_PARALLEL_MASKED_TASKLOOP_SIMD, ST_OMP_MASKED_TASKLOOP, ST_OMP_END_MASKED_TASKLOOP, ST_OMP_MASKED_TASKLOOP_SIMD, - ST_OMP_END_MASKED_TASKLOOP_SIMD, ST_OMP_SCOPE, ST_OMP_END_SCOPE, ST_NONE + ST_OMP_END_MASKED_TASKLOOP_SIMD, ST_OMP_SCOPE, ST_OMP_END_SCOPE, + ST_OMP_ERROR, ST_NONE }; /* Types of interfaces that we can have. Assignment interfaces are @@ -776,6 +777,20 @@ enum gfc_omp_device_type OMP_DEVICE_TYPE_ANY }; +enum gfc_omp_severity_type +{ + OMP_SEVERITY_UNSET, + OMP_SEVERITY_WARNING, + OMP_SEVERITY_FATAL +}; + +enum gfc_omp_at_type +{ + OMP_AT_UNSET, + OMP_AT_COMPILATION, + OMP_AT_EXECUTION +}; + /* Structure and list of supported extension attributes. */ typedef enum { @@ -1446,26 +1461,11 @@ enum gfc_omp_bind_type typedef struct gfc_omp_clauses { + gfc_omp_namelist *lists[OMP_LIST_NUM]; struct gfc_expr *if_expr; struct gfc_expr *final_expr; struct gfc_expr *num_threads; - gfc_omp_namelist *lists[OMP_LIST_NUM]; - enum gfc_omp_sched_kind sched_kind; - enum gfc_omp_device_type device_type; struct gfc_expr *chunk_size; - enum gfc_omp_default_sharing default_sharing; - enum gfc_omp_defaultmap defaultmap[OMP_DEFAULTMAP_CAT_NUM]; - int collapse, orderedc; - bool nowait, ordered, untied, mergeable; - bool inbranch, notinbranch, nogroup; - bool sched_simd, sched_monotonic, sched_nonmonotonic; - bool simd, threads, depend_source, destroy, order_concurrent, capture; - enum gfc_omp_atomic_op atomic_op; - enum gfc_omp_memorder memorder; - enum gfc_omp_cancel_kind cancel; - enum gfc_omp_proc_bind_kind proc_bind; - enum gfc_omp_depend_op depobj_update; - enum gfc_omp_bind_type bind; struct gfc_expr *safelen_expr; struct gfc_expr *simdlen_expr; struct gfc_expr *num_teams; @@ -1479,9 +1479,28 @@ typedef struct gfc_omp_clauses struct gfc_expr *detach; struct gfc_expr *depobj; struct gfc_expr *if_exprs[OMP_IF_LAST]; - enum gfc_omp_sched_kind dist_sched_kind; struct gfc_expr *dist_chunk_size; + struct gfc_expr *message; const char *critical_name; + enum gfc_omp_default_sharing default_sharing; + enum gfc_omp_atomic_op atomic_op; + enum gfc_omp_defaultmap defaultmap[OMP_DEFAULTMAP_CAT_NUM]; + int collapse, orderedc; + unsigned nowait:1, ordered:1, untied:1, mergeable:1; + unsigned inbranch:1, notinbranch:1, nogroup:1; + unsigned sched_simd:1, sched_monotonic:1, sched_nonmonotonic:1; + unsigned simd:1, threads:1, depend_source:1, destroy:1, order_concurrent:1; + unsigned capture:1; + ENUM_BITFIELD (gfc_omp_sched_kind) sched_kind:3; + ENUM_BITFIELD (gfc_omp_device_type) device_type:2; + ENUM_BITFIELD (gfc_omp_memorder) memorder:3; + ENUM_BITFIELD (gfc_omp_cancel_kind) cancel:3; + ENUM_BITFIELD (gfc_omp_proc_bind_kind) proc_bind:3; + ENUM_BITFIELD (gfc_omp_depend_op) depobj_update:3; + ENUM_BITFIELD (gfc_omp_bind_type) bind:2; + ENUM_BITFIELD (gfc_omp_at_type) at:2; + ENUM_BITFIELD (gfc_omp_severity_type) severity:2; + ENUM_BITFIELD (gfc_omp_sched_kind) dist_sched_kind:3; /* OpenACC. */ struct gfc_expr *async_expr; @@ -2768,7 +2787,8 @@ enum gfc_exec_op EXEC_OMP_TEAMS_LOOP, EXEC_OMP_TARGET_PARALLEL_LOOP, EXEC_OMP_TARGET_TEAMS_LOOP, EXEC_OMP_MASKED, EXEC_OMP_PARALLEL_MASKED, EXEC_OMP_PARALLEL_MASKED_TASKLOOP, EXEC_OMP_PARALLEL_MASKED_TASKLOOP_SIMD, - EXEC_OMP_MASKED_TASKLOOP, EXEC_OMP_MASKED_TASKLOOP_SIMD, EXEC_OMP_SCOPE + EXEC_OMP_MASKED_TASKLOOP, EXEC_OMP_MASKED_TASKLOOP_SIMD, EXEC_OMP_SCOPE, + EXEC_OMP_ERROR }; typedef struct gfc_code diff --git a/gcc/fortran/match.h b/gcc/fortran/match.h index 5127b4b..92fd127 100644 --- a/gcc/fortran/match.h +++ b/gcc/fortran/match.h @@ -168,6 +168,7 @@ match gfc_match_omp_distribute_simd (void); match gfc_match_omp_do (void); match gfc_match_omp_do_simd (void); match gfc_match_omp_loop (void); +match gfc_match_omp_error (void); match gfc_match_omp_flush (void); match gfc_match_omp_masked (void); match gfc_match_omp_masked_taskloop (void); diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c index fd219dc..2380866 100644 --- a/gcc/fortran/openmp.c +++ b/gcc/fortran/openmp.c @@ -28,6 +28,7 @@ along with GCC; see the file COPYING3. If not see #include "constructor.h" #include "diagnostic.h" #include "gomp-constants.h" +#include "target-memory.h" /* For gfc_encode_character. */ /* Match an end of OpenMP directive. End of OpenMP directive is optional whitespace, followed by '\n' or comment '!'. */ @@ -848,6 +849,9 @@ enum omp_mask1 OMP_CLAUSE_AFFINITY, /* OpenMP 5.0. */ OMP_CLAUSE_BIND, /* OpenMP 5.0. */ OMP_CLAUSE_FILTER, /* OpenMP 5.1. */ + OMP_CLAUSE_AT, /* OpenMP 5.1. */ + OMP_CLAUSE_MESSAGE, /* OpenMP 5.1. */ + OMP_CLAUSE_SEVERITY, /* OpenMP 5.1. */ OMP_CLAUSE_NOWAIT, /* This must come last. */ OMP_MASK1_LAST @@ -1293,6 +1297,7 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, const omp_mask mask, bool first = true, bool needs_space = true, bool openacc = false) { + bool error = false; gfc_omp_clauses *c = gfc_get_omp_clauses (); locus old_loc; /* Determine whether we're dealing with an OpenACC directive that permits @@ -1392,6 +1397,22 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, const omp_mask mask, } continue; } + if ((mask & OMP_CLAUSE_AT) + && c->at == OMP_AT_UNSET + && gfc_match ("at ( ") == MATCH_YES) + { + if (gfc_match ("compilation )") == MATCH_YES) + c->at = OMP_AT_COMPILATION; + else if (gfc_match ("execution )") == MATCH_YES) + c->at = OMP_AT_EXECUTION; + else + { + gfc_error ("Expected COMPILATION or EXECUTION in AT clause " + "at %C"); + goto error; + } + continue; + } if ((mask & OMP_CLAUSE_ASYNC) && !c->async && gfc_match ("async") == MATCH_YES) @@ -1616,7 +1637,7 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, const omp_mask mask, else gfc_error ("DEFAULTMAP at %C but prior DEFAULTMAP for " "category %s", pcategory); - goto end; + goto error; } } c->defaultmap[category] = behavior; @@ -2074,6 +2095,10 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, const omp_mask mask, c->mergeable = needs_space = true; continue; } + if ((mask & OMP_CLAUSE_MESSAGE) + && !c->message + && gfc_match ("message ( %e )", &c->message) == MATCH_YES) + continue; break; case 'n': if ((mask & OMP_CLAUSE_NO_CREATE) @@ -2402,6 +2427,22 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, const omp_mask mask, c->simd = needs_space = true; continue; } + if ((mask & OMP_CLAUSE_SEVERITY) + && c->severity == OMP_SEVERITY_UNSET + && gfc_match ("severity ( ") == MATCH_YES) + { + if (gfc_match ("fatal )") == MATCH_YES) + c->severity = OMP_SEVERITY_FATAL; + else if (gfc_match ("warning )") == MATCH_YES) + c->severity = OMP_SEVERITY_WARNING; + else + { + gfc_error ("Expected FATAL or WARNING in SEVERITY clause " + "at %C"); + goto error; + } + continue; + } break; case 't': if ((mask & OMP_CLAUSE_TASK_REDUCTION) @@ -2553,7 +2594,7 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, const omp_mask mask, } end: - if (gfc_match_omp_eos () != MATCH_YES) + if (error || gfc_match_omp_eos () != MATCH_YES) { if (!gfc_error_flag_test ()) gfc_error ("Failed to match clause at %C"); @@ -2563,6 +2604,10 @@ end: *cp = c; return MATCH_YES; + +error: + error = true; + goto end; } @@ -3208,6 +3253,9 @@ cleanup: | OMP_CLAUSE_MEMORDER) #define OMP_MASKED_CLAUSES \ (omp_mask (OMP_CLAUSE_FILTER)) +#define OMP_ERROR_CLAUSES \ + (omp_mask (OMP_CLAUSE_AT) | OMP_CLAUSE_MESSAGE | OMP_CLAUSE_SEVERITY) + static match @@ -3432,6 +3480,66 @@ gfc_match_omp_target_parallel_loop (void) match +gfc_match_omp_error (void) +{ + locus loc = gfc_current_locus; + match m = match_omp (EXEC_OMP_ERROR, OMP_ERROR_CLAUSES); + if (m != MATCH_YES) + return m; + + gfc_omp_clauses *c = new_st.ext.omp_clauses; + if (c->severity == OMP_SEVERITY_UNSET) + c->severity = OMP_SEVERITY_FATAL; + if (new_st.ext.omp_clauses->at == OMP_AT_EXECUTION) + return MATCH_YES; + if (c->message + && (!gfc_resolve_expr (c->message) + || c->message->ts.type != BT_CHARACTER + || c->message->ts.kind != gfc_default_character_kind + || c->message->rank != 0)) + { + gfc_error ("MESSAGE clause at %L requires a scalar default-kind " + "CHARACTER expression", + &new_st.ext.omp_clauses->message->where); + return MATCH_ERROR; + } + if (c->message && !gfc_is_constant_expr (c->message)) + { + gfc_error ("Constant character expression required in MESSAGE clause " + "at %L", &new_st.ext.omp_clauses->message->where); + return MATCH_ERROR; + } + if (c->message) + { + const char *msg = G_("$OMP ERROR encountered at %L: %s"); + gcc_assert (c->message->expr_type == EXPR_CONSTANT); + gfc_charlen_t slen = c->message->value.character.length; + int i = gfc_validate_kind (BT_CHARACTER, gfc_default_character_kind, + false); + size_t size = slen * gfc_character_kinds[i].bit_size / 8; + unsigned char *s = XCNEWVAR (unsigned char, size + 1); + gfc_encode_character (gfc_default_character_kind, slen, + c->message->value.character.string, + (unsigned char *) s, size); + s[size] = '\0'; + if (c->severity == OMP_SEVERITY_WARNING) + gfc_warning_now (0, msg, &loc, s); + else + gfc_error_now (msg, &loc, s); + free (s); + } + else + { + const char *msg = G_("$OMP ERROR encountered at %L"); + if (c->severity == OMP_SEVERITY_WARNING) + gfc_warning_now (0, msg, &loc); + else + gfc_error_now (msg, &loc); + } + return MATCH_YES; +} + +match gfc_match_omp_flush (void) { gfc_omp_namelist *list = NULL; @@ -6463,6 +6571,15 @@ resolve_omp_clauses (gfc_code *code, gfc_omp_clauses *omp_clauses, if (omp_clauses->depend_source && code->op != EXEC_OMP_ORDERED) gfc_error ("SOURCE dependence type only allowed " "on ORDERED directive at %L", &code->loc); + if (omp_clauses->message) + { + gfc_expr *expr = omp_clauses->message; + if (!gfc_resolve_expr (expr) + || expr->ts.kind != gfc_default_character_kind + || expr->ts.type != BT_CHARACTER || expr->rank != 0) + gfc_error ("MESSAGE clause at %L requires a scalar default-kind " + "CHARACTER expression", &expr->where); + } if (!openacc && code && omp_clauses->lists[OMP_LIST_MAP] == NULL @@ -7461,6 +7578,8 @@ omp_code_to_statement (gfc_code *code) return ST_OMP_CANCEL; case EXEC_OMP_CANCELLATION_POINT: return ST_OMP_CANCELLATION_POINT; + case EXEC_OMP_ERROR: + return ST_OMP_ERROR; case EXEC_OMP_FLUSH: return ST_OMP_FLUSH; case EXEC_OMP_DISTRIBUTE: @@ -7971,6 +8090,7 @@ gfc_resolve_omp_directive (gfc_code *code, gfc_namespace *ns) resolve_omp_do (code); break; case EXEC_OMP_CANCEL: + case EXEC_OMP_ERROR: case EXEC_OMP_MASKED: case EXEC_OMP_PARALLEL_WORKSHARE: case EXEC_OMP_PARALLEL: diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c index d004732..d37a0b5 100644 --- a/gcc/fortran/parse.c +++ b/gcc/fortran/parse.c @@ -908,6 +908,7 @@ decode_omp_directive (void) matcho ("do", gfc_match_omp_do, ST_OMP_DO); break; case 'e': + matcho ("error", gfc_match_omp_error, ST_OMP_ERROR); matcho ("end atomic", gfc_match_omp_eos_error, ST_OMP_END_ATOMIC); matcho ("end critical", gfc_match_omp_end_critical, ST_OMP_END_CRITICAL); matchs ("end distribute parallel do simd", gfc_match_omp_eos_error, @@ -1183,6 +1184,9 @@ decode_omp_directive (void) prog_unit->omp_target_seen = true; break; } + case ST_OMP_ERROR: + if (new_st.ext.omp_clauses->at != OMP_AT_EXECUTION) + return ST_NONE; default: break; } @@ -1654,7 +1658,7 @@ next_statement (void) case ST_OMP_BARRIER: case ST_OMP_TASKWAIT: case ST_OMP_TASKYIELD: \ case ST_OMP_CANCEL: case ST_OMP_CANCELLATION_POINT: case ST_OMP_DEPOBJ: \ case ST_OMP_TARGET_UPDATE: case ST_OMP_TARGET_ENTER_DATA: \ - case ST_OMP_TARGET_EXIT_DATA: case ST_OMP_ORDERED_DEPEND: \ + case ST_OMP_TARGET_EXIT_DATA: case ST_OMP_ORDERED_DEPEND: case ST_OMP_ERROR: \ case ST_ERROR_STOP: case ST_OMP_SCAN: case ST_SYNC_ALL: \ case ST_SYNC_IMAGES: case ST_SYNC_MEMORY: case ST_LOCK: case ST_UNLOCK: \ case ST_FORM_TEAM: case ST_CHANGE_TEAM: \ @@ -1716,7 +1720,6 @@ next_statement (void) case ST_OMP_DECLARE_TARGET: case ST_OMP_DECLARE_REDUCTION: \ case ST_OMP_REQUIRES: case ST_OACC_ROUTINE: case ST_OACC_DECLARE - /* Block end statements. Errors associated with interchanging these are detected in gfc_match_end(). */ @@ -2544,6 +2547,9 @@ gfc_ascii_statement (gfc_statement st) case ST_OMP_END_WORKSHARE: p = "!$OMP END WORKSHARE"; break; + case ST_OMP_ERROR: + p = "!$OMP ERROR"; + break; case ST_OMP_FLUSH: p = "!$OMP FLUSH"; break; diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 117062b..5b9ba43 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -10817,6 +10817,7 @@ gfc_resolve_blocks (gfc_code *b, gfc_namespace *ns) case EXEC_OMP_DISTRIBUTE_SIMD: case EXEC_OMP_DO: case EXEC_OMP_DO_SIMD: + case EXEC_OMP_ERROR: case EXEC_OMP_LOOP: case EXEC_OMP_MASKED: case EXEC_OMP_MASKED_TASKLOOP: @@ -12254,6 +12255,7 @@ start: case EXEC_OMP_DISTRIBUTE_SIMD: case EXEC_OMP_DO: case EXEC_OMP_DO_SIMD: + case EXEC_OMP_ERROR: case EXEC_OMP_LOOP: case EXEC_OMP_MASTER: case EXEC_OMP_MASTER_TASKLOOP: diff --git a/gcc/fortran/st.c b/gcc/fortran/st.c index 7d87709..6bf730c 100644 --- a/gcc/fortran/st.c +++ b/gcc/fortran/st.c @@ -225,6 +225,7 @@ gfc_free_statement (gfc_code *p) case EXEC_OMP_DISTRIBUTE_SIMD: case EXEC_OMP_DO: case EXEC_OMP_DO_SIMD: + case EXEC_OMP_ERROR: case EXEC_OMP_LOOP: case EXEC_OMP_END_SINGLE: case EXEC_OMP_MASKED_TASKLOOP: diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c index e0a0014..91888f3 100644 --- a/gcc/fortran/trans-openmp.c +++ b/gcc/fortran/trans-openmp.c @@ -5369,6 +5369,38 @@ gfc_trans_omp_depobj (gfc_code *code) } static tree +gfc_trans_omp_error (gfc_code *code) +{ + stmtblock_t block; + gfc_se se; + tree len, message; + bool fatal = code->ext.omp_clauses->severity == OMP_SEVERITY_FATAL; + tree fndecl = builtin_decl_explicit (fatal ? BUILT_IN_GOMP_ERROR + : BUILT_IN_GOMP_WARNING); + gfc_start_block (&block); + gfc_init_se (&se, NULL ); + if (!code->ext.omp_clauses->message) + { + message = null_pointer_node; + len = build_int_cst (size_type_node, 0); + } + else + { + gfc_conv_expr (&se, code->ext.omp_clauses->message); + message = se.expr; + if (!POINTER_TYPE_P (TREE_TYPE (message))) + /* To ensure an ARRAY_TYPE is not passed as such. */ + message = gfc_build_addr_expr (NULL, message); + len = se.string_length; + } + gfc_add_block_to_block (&block, &se.pre); + gfc_add_expr_to_block (&block, build_call_expr_loc (input_location, fndecl, + 2, message, len)); + gfc_add_block_to_block (&block, &se.post); + return gfc_finish_block (&block); +} + +static tree gfc_trans_omp_flush (gfc_code *code) { tree call; @@ -7096,6 +7128,8 @@ gfc_trans_omp_directive (gfc_code *code) return gfc_trans_omp_distribute (code, NULL); case EXEC_OMP_DO_SIMD: return gfc_trans_omp_do_simd (code, NULL, NULL, NULL_TREE); + case EXEC_OMP_ERROR: + return gfc_trans_omp_error (code); case EXEC_OMP_FLUSH: return gfc_trans_omp_flush (code); case EXEC_OMP_MASKED: diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c index 80b724d0..eb5682a 100644 --- a/gcc/fortran/trans.c +++ b/gcc/fortran/trans.c @@ -2155,6 +2155,7 @@ trans_code (gfc_code * code, tree cond) case EXEC_OMP_DO: case EXEC_OMP_DO_SIMD: case EXEC_OMP_LOOP: + case EXEC_OMP_ERROR: case EXEC_OMP_FLUSH: case EXEC_OMP_MASKED: case EXEC_OMP_MASKED_TASKLOOP: diff --git a/gcc/testsuite/gfortran.dg/gomp/error-1.f90 b/gcc/testsuite/gfortran.dg/gomp/error-1.f90 new file mode 100644 index 0000000..0ee0b4b --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/error-1.f90 @@ -0,0 +1,51 @@ +! { dg-additional-options "-ffree-line-length-none" } +module m +!$omp error ! { dg-error ".OMP ERROR encountered at .1." } +!$omp error at(compilation) ! { dg-error ".OMP ERROR encountered at .1." } +!$omp error severity(fatal) ! { dg-error ".OMP ERROR encountered at .1." } +!$omp error message("my msg") ! { dg-error ".OMP ERROR encountered at .1.: my msg" } +!$omp error severity(warning)message("another message")at(compilation) ! { dg-warning ".OMP ERROR encountered at .1.: another message" } + +type S + !$omp error ! { dg-error ".OMP ERROR encountered at .1." } + !$omp error at(compilation) ! { dg-error ".OMP ERROR encountered at .1." } + !$omp error severity(fatal) ! { dg-error ".OMP ERROR encountered at .1." } + !$omp error message("42") ! { dg-error ".OMP ERROR encountered at .1.: 42" } + !$omp error severity(warning), message("foo"), at(compilation) ! { dg-warning ".OMP ERROR encountered at .1.: foo" } + integer s +end type S +end module m + +integer function foo (i, x) + integer :: i + logical :: x + !$omp error ! { dg-error ".OMP ERROR encountered at .1." } + !$omp error at(compilation) ! { dg-error ".OMP ERROR encountered at .1." } + !$omp error severity(fatal) ! { dg-error ".OMP ERROR encountered at .1." } + !$omp error message("42 / 1") ! { dg-error ".OMP ERROR encountered at .1.: 42 / 1" } + !$omp error severity(warning) message("bar") at(compilation) ! { dg-warning ".OMP ERROR encountered at .1.: bar" } + if (x) then + !$omp error ! { dg-error ".OMP ERROR encountered at .1." } + i = i + 1 + end if + if (x) then + ; + else + !$omp error at(compilation) ! { dg-error ".OMP ERROR encountered at .1." } + i = i + 1 + end if + select case (.false.) + !$omp error severity(fatal) ! { dg-error ".OMP ERROR encountered at .1." } + case default + ! + end select + do while (.false.) + !$omp error message("42 - 1") ! { dg-error ".OMP ERROR encountered at .1.: 42 - 1" } + i = i + 1 + end do + lab: + !$omp error severity(warning) message("bar") at(compilation) ! { dg-warning ".OMP ERROR encountered at .1.: bar" } + i++; + foo = i + return +end diff --git a/gcc/testsuite/gfortran.dg/gomp/error-2.f90 b/gcc/testsuite/gfortran.dg/gomp/error-2.f90 new file mode 100644 index 0000000..718e82c --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/error-2.f90 @@ -0,0 +1,15 @@ +subroutine foo (x, msg1, msg2) + integer x + character(len=*) :: msg1, msg2 + if (x == 0) then + !$omp error at(execution) + else if (x == 1) then + !$omp error severity (warning), at (execution) + else if (x == 2) then + !$omp error at ( execution ) severity (fatal) message ("baz") + else if (x == 3) then + !$omp error severity(warning) message (msg1) at(execution) + else + !$omp error message (msg2), at(execution), severity(fatal) + end if +end diff --git a/gcc/testsuite/gfortran.dg/gomp/error-3.f90 b/gcc/testsuite/gfortran.dg/gomp/error-3.f90 new file mode 100644 index 0000000..67948cd --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/error-3.f90 @@ -0,0 +1,88 @@ +module m +!$omp error asdf ! { dg-error "Failed to match clause" } +!$omp error at ! { dg-error "Failed to match clause" } +!$omp error at( ! { dg-error "Expected COMPILATION or EXECUTION in AT clause at" } +!$omp error at(runtime) ! { dg-error "Expected COMPILATION or EXECUTION in AT clause at" } +!$omp error at(+ ! { dg-error "Expected COMPILATION or EXECUTION in AT clause at" } +!$omp error at(compilation ! { dg-error "Expected COMPILATION or EXECUTION in AT clause at" } +!$omp error severity ! { dg-error "Failed to match clause" } +!$omp error severity( ! { dg-error "Expected FATAL or WARNING in SEVERITY clause at" } +!$omp error severity(error) ! { dg-error "Expected FATAL or WARNING in SEVERITY clause at" } +!$omp error severity(- ! { dg-error "Expected FATAL or WARNING in SEVERITY clause at" } +!$omp error severity(fatal ! { dg-error "Expected FATAL or WARNING in SEVERITY clause at" } +!$omp error message ! { dg-error "Failed to match clause" } +!$omp error message( ! { dg-error "Invalid character in name" } +!$omp error message(0 ! { dg-error "Failed to match clause" } +!$omp error message("foo" ! { dg-error "Failed to match clause" } + +!$omp error at(compilation) at(compilation) ! { dg-error "Failed to match clause at" } +!$omp error severity(fatal) severity(warning) ! { dg-error "Failed to match clause at" } +!$omp error message("foo") message("foo") ! { dg-error "Failed to match clause at" } +!$omp error message("foo"),at(compilation),severity(fatal),asdf ! { dg-error "Failed to match clause" } + +!$omp error at(execution) ! { dg-error "Unexpected !.OMP ERROR statement in MODULE" } + +end module + +module m2 +character(len=10) :: msg +!$omp error message(1) ! { dg-error "MESSAGE clause at .1. requires a scalar default-kind CHARACTER expression" } +!$omp error message(1.2) ! { dg-error "MESSAGE clause at .1. requires a scalar default-kind CHARACTER expression" } +!$omp error message(4_"foo") ! { dg-error "MESSAGE clause at .1. requires a scalar default-kind CHARACTER expression" } +!$omp error message(["bar","bar"]) ! { dg-error "MESSAGE clause at .1. requires a scalar default-kind CHARACTER expression" } +!$omp error message(msg) ! { dg-error "Constant character expression required in MESSAGE clause" } + +type S + !$omp error at(execution) message("foo")! { dg-error "Unexpected !.OMP ERROR statement at" } + integer s +end type +end module + +subroutine bar +character(len=10) :: msg +!$omp error at(execution) message(1) ! { dg-error "MESSAGE clause at .1. requires a scalar default-kind CHARACTER expression" } +!$omp error at(execution) message(1.2) ! { dg-error "MESSAGE clause at .1. requires a scalar default-kind CHARACTER expression" } +!$omp error at(execution) message(4_"foo") ! { dg-error "MESSAGE clause at .1. requires a scalar default-kind CHARACTER expression" } +!$omp error at(execution) message(["bar","bar"]) ! { dg-error "MESSAGE clause at .1. requires a scalar default-kind CHARACTER expression" } +!$omp error at(execution) message(msg) ! OK + +end + +integer function foo (i, x, msg) + integer :: i + logical :: x + character(len=*) :: msg + !$omp error message(msg) ! { dg-error "Constant character expression required in MESSAGE clause" } + if (x) then + !$omp error at(execution) ! OK + end if + i = i + 1 + if (x) then + ; + else + !$omp error at(execution) severity(warning) ! OK + end if + i = i + 1 + select case (.false.) + !$omp error severity(fatal) at(execution) ! { dg-error "Expected a CASE or END SELECT statement following SELECT CASE" } + end select + do while (.false.) + !$omp error at(execution)message("42 - 1") ! OK + i = i + 1 + end do +99 continue + !$omp error severity(warning) message("bar") at(execution) ! OK + i = i + 1 + foo = i +end + + +subroutine foobar + if (.true.) & ! { dg-error "Syntax error in IF-clause after" } + !$omp error at(execution) + + continue + + if (.true.) & ! { dg-error "Syntax error in IF-clause after" } + !$omp error ! { dg-error ".OMP ERROR encountered at" } +end -- cgit v1.1 From 37744f8260857005c8409c9e2e633a05c768a7dd Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Fri, 20 Aug 2021 11:32:00 +0200 Subject: Refactor BB splitting of DRs for SLP group analysis This uses the group_id computed to ensure DRs in different BBs do not get merged into a DR group. To achieve this we seed the group from the BB index when group_ids are not computed and we make sure to bump the group_id when advancing to the next BB for BB SLP analysis. This paves the way for relaxing the grouping for BB vectorization by adjusting its group_id computation. 2021-08-20 Richard Biener * tree-vect-data-refs.c (dr_group_sort_cmp): Do not compare BBs. (vect_analyze_data_ref_accesses): Likewise. Assign the BB index as group_id when dataref_groups were not computed. * tree-vect-slp.c (vect_slp_bbs): Bump current_group when we advace to the next BB. --- gcc/tree-vect-data-refs.c | 21 ++++++++------------- gcc/tree-vect-slp.c | 2 ++ 2 files changed, 10 insertions(+), 13 deletions(-) (limited to 'gcc') diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index b7dde07..37f46d1 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -2831,12 +2831,6 @@ dr_group_sort_cmp (const void *dra_, const void *drb_) if (dra == drb) return 0; - /* DRs in different basic-blocks never belong to the same group. */ - int bb_index1 = gimple_bb (DR_STMT (dra))->index; - int bb_index2 = gimple_bb (DR_STMT (drb))->index; - if (bb_index1 != bb_index2) - return bb_index1 < bb_index2 ? -1 : 1; - /* Different group IDs lead never belong to the same group. */ if (dra_pair.second != drb_pair.second) return dra_pair.second < drb_pair.second ? -1 : 1; @@ -2963,7 +2957,13 @@ vect_analyze_data_ref_accesses (vec_info *vinfo, datarefs_copy.create (datarefs.length ()); for (unsigned i = 0; i < datarefs.length (); i++) { - int group_id = dataref_groups ? (*dataref_groups)[i] : 0; + int group_id; + /* If the caller computed DR grouping use that, otherwise group by + basic blocks. */ + if (dataref_groups) + group_id = (*dataref_groups)[i]; + else + group_id = gimple_bb (DR_STMT (datarefs[i]))->index; datarefs_copy.quick_push (data_ref_pair (datarefs[i], group_id)); } datarefs_copy.qsort (dr_group_sort_cmp); @@ -2999,13 +2999,8 @@ vect_analyze_data_ref_accesses (vec_info *vinfo, matters we can push those to a worklist and re-iterate over them. The we can just skip ahead to the next DR here. */ - /* DRs in a different BBs should not be put into the same + /* DRs in a different DR group should not be put into the same interleaving group. */ - int bb_index1 = gimple_bb (DR_STMT (dra))->index; - int bb_index2 = gimple_bb (DR_STMT (drb))->index; - if (bb_index1 != bb_index2) - break; - if (dra_group_id != drb_group_id) break; diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index 4dcc70c..d2f6a16 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -5985,6 +5985,8 @@ vect_slp_bbs (const vec &bbs) &dataref_groups, current_group)) ++current_group; } + /* New BBs always start a new DR group. */ + ++current_group; } return vect_slp_region (bbs, datarefs, &dataref_groups, insns); -- cgit v1.1 From 12f22906d3c025e7edb60e3264dc9cd27a49e3e1 Mon Sep 17 00:00:00 2001 From: Harald Anlauf Date: Fri, 20 Aug 2021 13:38:00 +0200 Subject: Fortran - use temporary char buffer for passing HOST_WIDE_INT to gfc_error gcc/fortran/ChangeLog: PR fortran/100950 * simplify.c (substring_has_constant_len): Fix format string of gfc_error, pass HOST_WIDE_INT bounds values via char buffer. --- gcc/fortran/simplify.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'gcc') diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c index 492867e..eaabbff 100644 --- a/gcc/fortran/simplify.c +++ b/gcc/fortran/simplify.c @@ -4552,11 +4552,12 @@ substring_has_constant_len (gfc_expr *e) if (istart <= iend) { + char buffer[21]; if (istart < 1) { - gfc_error ("Substring start index (" HOST_WIDE_INT_PRINT_DEC - ") at %L below 1", - istart, &ref->u.ss.start->where); + sprintf (buffer, HOST_WIDE_INT_PRINT_DEC, istart); + gfc_error ("Substring start index (%s) at %L below 1", + buffer, &ref->u.ss.start->where); return false; } @@ -4567,9 +4568,9 @@ substring_has_constant_len (gfc_expr *e) length = gfc_mpz_get_hwi (ref->u.ss.length->length->value.integer); if (iend > length) { - gfc_error ("Substring end index (" HOST_WIDE_INT_PRINT_DEC - ") at %L exceeds string length", - iend, &ref->u.ss.end->where); + sprintf (buffer, HOST_WIDE_INT_PRINT_DEC, iend); + gfc_error ("Substring end index (%s) at %L exceeds string length", + buffer, &ref->u.ss.end->where); return false; } length = iend - istart + 1; -- cgit v1.1 From 1b507b1e3c58c063b9cf803dff80c28d4626cb5d Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Fri, 20 Aug 2021 15:43:32 +0200 Subject: c-format.c/Fortran: Support %wd / host-wide integer in gfc_error This patch adds support for the 'll' (long double) and 'w' (HOST_WIDE_INT) length modifiers to the Fortran FE diagnostic function (gfc_error, gfc_warning, ...) gcc/c-family/ChangeLog: * c-format.c (gcc_gfc_length_specs): Add 'll' and 'w'. (gcc_gfc_char_table): Add T9L_LL and T9L_ULL to "di" and "u", respecitively; fill with BADLEN to match size of 'types'. (get_init_dynamic_hwi): Split off from ... (init_dynamic_diag_info): ... here. Call it. (init_dynamic_gfc_info): Call it. gcc/fortran/ChangeLog: * error.c (error_uinteger): Take 'long long unsigned' instead of 'long unsigned' as argumpent. (error_integer): Take 'long long' instead of 'long'. (error_hwuint, error_hwint): New. (error_print): Update to handle 'll' and 'w' length modifiers. * simplify.c (substring_has_constant_len): Use '%wd' in gfc_error. --- gcc/c-family/c-format.c | 142 +++++++++++++++++++++++++----------------------- gcc/fortran/error.c | 106 +++++++++++++++++++++++++++++++++--- gcc/fortran/simplify.c | 11 ++-- 3 files changed, 178 insertions(+), 81 deletions(-) (limited to 'gcc') diff --git a/gcc/c-family/c-format.c b/gcc/c-family/c-format.c index 6fd0bb3..b4cb765a 100644 --- a/gcc/c-family/c-format.c +++ b/gcc/c-family/c-format.c @@ -546,10 +546,11 @@ static const format_length_info strfmon_length_specs[] = }; -/* For now, the Fortran front-end routines only use l as length modifier. */ +/* Length modifiers used by the fortran/error.c routines. */ static const format_length_info gcc_gfc_length_specs[] = { - { "l", FMT_LEN_l, STD_C89, NO_FMT, 0 }, + { "l", FMT_LEN_l, STD_C89, "ll", FMT_LEN_ll, STD_C89, 0 }, + { "w", FMT_LEN_w, STD_C89, NO_FMT, 0 }, { NO_FMT, NO_FMT, 0 } }; @@ -821,10 +822,10 @@ static const format_char_info gcc_cxxdiag_char_table[] = static const format_char_info gcc_gfc_char_table[] = { /* C89 conversion specifiers. */ - { "di", 0, STD_C89, { T89_I, BADLEN, BADLEN, T89_L, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "", NULL }, - { "u", 0, STD_C89, { T89_UI, BADLEN, BADLEN, T89_UL, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "", NULL }, - { "c", 0, STD_C89, { T89_I, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "", NULL }, - { "s", 1, STD_C89, { T89_C, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "cR", NULL }, + { "di", 0, STD_C89, { T89_I, BADLEN, BADLEN, T89_L, T9L_LL, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "", NULL }, + { "u", 0, STD_C89, { T89_UI, BADLEN, BADLEN, T89_UL, T9L_ULL, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "", NULL }, + { "c", 0, STD_C89, { T89_I, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "", NULL }, + { "s", 1, STD_C89, { T89_C, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "cR", NULL }, /* gfc conversion specifiers. */ @@ -4843,12 +4844,73 @@ init_dynamic_asm_fprintf_info (void) } } +static const format_length_info* +get_init_dynamic_hwi (void) +{ + static tree hwi; + static format_length_info *diag_ls; + + if (!hwi) + { + unsigned int i; + + /* Find the underlying type for HOST_WIDE_INT. For the 'w' + length modifier to work, one must have issued: "typedef + HOST_WIDE_INT __gcc_host_wide_int__;" in one's source code + prior to using that modifier. */ + if ((hwi = maybe_get_identifier ("__gcc_host_wide_int__"))) + { + hwi = identifier_global_value (hwi); + if (hwi) + { + if (TREE_CODE (hwi) != TYPE_DECL) + { + error ("%<__gcc_host_wide_int__%> is not defined as a type"); + hwi = 0; + } + else + { + hwi = DECL_ORIGINAL_TYPE (hwi); + gcc_assert (hwi); + if (hwi != long_integer_type_node + && hwi != long_long_integer_type_node) + { + error ("%<__gcc_host_wide_int__%> is not defined" + " as % or %"); + hwi = 0; + } + } + } + } + if (!diag_ls) + diag_ls = (format_length_info *) + xmemdup (gcc_diag_length_specs, + sizeof (gcc_diag_length_specs), + sizeof (gcc_diag_length_specs)); + if (hwi) + { + /* HOST_WIDE_INT must be one of 'long' or 'long long'. */ + i = find_length_info_modifier_index (diag_ls, 'w'); + if (hwi == long_integer_type_node) + diag_ls[i].index = FMT_LEN_l; + else if (hwi == long_long_integer_type_node) + diag_ls[i].index = FMT_LEN_ll; + else + gcc_unreachable (); + } + } + return diag_ls; +} + /* Determine the type of a "locus" in the code being compiled for use in GCC's __gcc_gfc__ custom format attribute. You must have set dynamic_format_types before calling this function. */ static void init_dynamic_gfc_info (void) { + dynamic_format_types[gcc_gfc_format_type].length_char_specs + = get_init_dynamic_hwi (); + if (!locus) { static format_char_info *gfc_fci; @@ -4985,67 +5047,13 @@ init_dynamic_diag_info (void) || local_event_ptr_node == void_type_node) local_event_ptr_node = get_named_type ("diagnostic_event_id_t"); - static tree hwi; - - if (!hwi) - { - static format_length_info *diag_ls; - unsigned int i; - - /* Find the underlying type for HOST_WIDE_INT. For the 'w' - length modifier to work, one must have issued: "typedef - HOST_WIDE_INT __gcc_host_wide_int__;" in one's source code - prior to using that modifier. */ - if ((hwi = maybe_get_identifier ("__gcc_host_wide_int__"))) - { - hwi = identifier_global_value (hwi); - if (hwi) - { - if (TREE_CODE (hwi) != TYPE_DECL) - { - error ("%<__gcc_host_wide_int__%> is not defined as a type"); - hwi = 0; - } - else - { - hwi = DECL_ORIGINAL_TYPE (hwi); - gcc_assert (hwi); - if (hwi != long_integer_type_node - && hwi != long_long_integer_type_node) - { - error ("%<__gcc_host_wide_int__%> is not defined" - " as % or %"); - hwi = 0; - } - } - } - } - - /* Assign the new data for use. */ - - /* All the GCC diag formats use the same length specs. */ - if (!diag_ls) - dynamic_format_types[gcc_diag_format_type].length_char_specs = - dynamic_format_types[gcc_tdiag_format_type].length_char_specs = - dynamic_format_types[gcc_cdiag_format_type].length_char_specs = - dynamic_format_types[gcc_cxxdiag_format_type].length_char_specs = - dynamic_format_types[gcc_dump_printf_format_type].length_char_specs = - diag_ls = (format_length_info *) - xmemdup (gcc_diag_length_specs, - sizeof (gcc_diag_length_specs), - sizeof (gcc_diag_length_specs)); - if (hwi) - { - /* HOST_WIDE_INT must be one of 'long' or 'long long'. */ - i = find_length_info_modifier_index (diag_ls, 'w'); - if (hwi == long_integer_type_node) - diag_ls[i].index = FMT_LEN_l; - else if (hwi == long_long_integer_type_node) - diag_ls[i].index = FMT_LEN_ll; - else - gcc_unreachable (); - } - } + /* All the GCC diag formats use the same length specs. */ + dynamic_format_types[gcc_diag_format_type].length_char_specs = + dynamic_format_types[gcc_tdiag_format_type].length_char_specs = + dynamic_format_types[gcc_cdiag_format_type].length_char_specs = + dynamic_format_types[gcc_cxxdiag_format_type].length_char_specs = + dynamic_format_types[gcc_dump_printf_format_type].length_char_specs + = get_init_dynamic_hwi (); /* It's safe to "re-initialize these to the same values. */ dynamic_format_types[gcc_diag_format_type].conversion_specs = diff --git a/gcc/fortran/error.c b/gcc/fortran/error.c index 529d97f..5e6e873 100644 --- a/gcc/fortran/error.c +++ b/gcc/fortran/error.c @@ -136,7 +136,7 @@ error_string (const char *p) #define IBUF_LEN 60 static void -error_uinteger (unsigned long int i) +error_uinteger (unsigned long long int i) { char *p, int_buf[IBUF_LEN]; @@ -156,13 +156,50 @@ error_uinteger (unsigned long int i) } static void -error_integer (long int i) +error_integer (long long int i) { - unsigned long int u; + unsigned long long int u; if (i < 0) { - u = (unsigned long int) -i; + u = (unsigned long long int) -i; + error_char ('-'); + } + else + u = i; + + error_uinteger (u); +} + + +static void +error_hwuint (unsigned HOST_WIDE_INT i) +{ + char *p, int_buf[IBUF_LEN]; + + p = int_buf + IBUF_LEN - 1; + *p-- = '\0'; + + if (i == 0) + *p-- = '0'; + + while (i > 0) + { + *p-- = i % 10 + '0'; + i = i / 10; + } + + error_string (p + 1); +} + +static void +error_hwint (HOST_WIDE_INT i) +{ + unsigned HOST_WIDE_INT u; + + if (i < 0) + { + u = (unsigned HOST_WIDE_INT) -i; error_char ('-'); } else @@ -482,8 +519,8 @@ static void ATTRIBUTE_GCC_GFC(2,0) error_print (const char *type, const char *format0, va_list argp) { enum { TYPE_CURRENTLOC, TYPE_LOCUS, TYPE_INTEGER, TYPE_UINTEGER, - TYPE_LONGINT, TYPE_ULONGINT, TYPE_CHAR, TYPE_STRING, - NOTYPE }; + TYPE_LONGINT, TYPE_ULONGINT, TYPE_LLONGINT, TYPE_ULLONGINT, + TYPE_HWINT, TYPE_HWUINT, TYPE_CHAR, TYPE_STRING, NOTYPE }; struct { int type; @@ -494,6 +531,10 @@ error_print (const char *type, const char *format0, va_list argp) unsigned int uintval; long int longintval; unsigned long int ulongintval; + long long int llongintval; + unsigned long long int ullongintval; + HOST_WIDE_INT hwintval; + unsigned HOST_WIDE_INT hwuintval; char charval; const char * stringval; } u; @@ -577,7 +618,17 @@ error_print (const char *type, const char *format0, va_list argp) case 'l': c = *format++; - if (c == 'u') + if (c == 'l') + { + c = *format++; + if (c == 'u') + arg[pos].type = TYPE_ULLONGINT; + else if (c == 'i' || c == 'd') + arg[pos].type = TYPE_LLONGINT; + else + gcc_unreachable (); + } + else if (c == 'u') arg[pos].type = TYPE_ULONGINT; else if (c == 'i' || c == 'd') arg[pos].type = TYPE_LONGINT; @@ -585,6 +636,16 @@ error_print (const char *type, const char *format0, va_list argp) gcc_unreachable (); break; + case 'w': + c = *format++; + if (c == 'u') + arg[pos].type = TYPE_HWUINT; + else if (c == 'i' || c == 'd') + arg[pos].type = TYPE_HWINT; + else + gcc_unreachable (); + break; + case 'c': arg[pos].type = TYPE_CHAR; break; @@ -649,6 +710,22 @@ error_print (const char *type, const char *format0, va_list argp) arg[pos].u.ulongintval = va_arg (argp, unsigned long int); break; + case TYPE_LLONGINT: + arg[pos].u.llongintval = va_arg (argp, long long int); + break; + + case TYPE_ULLONGINT: + arg[pos].u.ullongintval = va_arg (argp, unsigned long long int); + break; + + case TYPE_HWINT: + arg[pos].u.hwintval = va_arg (argp, HOST_WIDE_INT); + break; + + case TYPE_HWUINT: + arg[pos].u.hwuintval = va_arg (argp, unsigned HOST_WIDE_INT); + break; + case TYPE_CHAR: arg[pos].u.charval = (char) va_arg (argp, int); break; @@ -725,12 +802,27 @@ error_print (const char *type, const char *format0, va_list argp) case 'l': format++; + if (*format == 'l') + { + format++; + if (*format == 'u') + error_uinteger (spec[n++].u.ullongintval); + else + error_integer (spec[n++].u.llongintval); + } if (*format == 'u') error_uinteger (spec[n++].u.ulongintval); else error_integer (spec[n++].u.longintval); break; + case 'w': + format++; + if (*format == 'u') + error_hwuint (spec[n++].u.hwintval); + else + error_hwint (spec[n++].u.hwuintval); + break; } } diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c index eaabbff..4cb73e8 100644 --- a/gcc/fortran/simplify.c +++ b/gcc/fortran/simplify.c @@ -4552,12 +4552,10 @@ substring_has_constant_len (gfc_expr *e) if (istart <= iend) { - char buffer[21]; if (istart < 1) { - sprintf (buffer, HOST_WIDE_INT_PRINT_DEC, istart); - gfc_error ("Substring start index (%s) at %L below 1", - buffer, &ref->u.ss.start->where); + gfc_error ("Substring start index (%wd) at %L below 1", + istart, &ref->u.ss.start->where); return false; } @@ -4568,9 +4566,8 @@ substring_has_constant_len (gfc_expr *e) length = gfc_mpz_get_hwi (ref->u.ss.length->length->value.integer); if (iend > length) { - sprintf (buffer, HOST_WIDE_INT_PRINT_DEC, iend); - gfc_error ("Substring end index (%s) at %L exceeds string length", - buffer, &ref->u.ss.end->where); + gfc_error ("Substring end index (%wd) at %L exceeds string length", + iend, &ref->u.ss.end->where); return false; } length = iend - istart + 1; -- cgit v1.1 From 5f80c6270de6ac79d819de50048b32351a6b97c3 Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Fri, 20 Aug 2021 11:19:05 -0400 Subject: Further improvements to constant shifts for the H8 gcc/ * config/h8300/h8300.c (shift_alg_hi): Improve arithmetic shift right by 15 bits for H8/300H and H8/S. Improve logical shifts by 12 bits for H8/S. (shift_alg_si): Improve arithmetic right shift by 28-30 bits for H8/300H. Improve arithmetic shift right by 15 bits for H8/S. Improve logical shifts by 27 bits for H8/S. (get_shift_alg): Corresponding changes. (h8300_option_override): Revert to loops for -Os when profitable. --- gcc/config/h8300/h8300.c | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) (limited to 'gcc') diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c index 0c4e508..8ccacec 100644 --- a/gcc/config/h8300/h8300.c +++ b/gcc/config/h8300/h8300.c @@ -213,9 +213,9 @@ static enum shift_alg shift_alg_hi[2][3][16] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 10 11 12 13 14 15 */ { INL, INL, INL, INL, INL, INL, INL, INL, - SPC, SPC, SPC, SPC, SPC, ROT, ROT, ROT }, /* SHIFT_ASHIFT */ + SPC, SPC, SPC, SPC, ROT, ROT, ROT, ROT }, /* SHIFT_ASHIFT */ { INL, INL, INL, INL, INL, INL, INL, INL, - SPC, SPC, SPC, SPC, SPC, ROT, ROT, ROT }, /* SHIFT_LSHIFTRT */ + SPC, SPC, SPC, SPC, ROT, ROT, ROT, ROT }, /* SHIFT_LSHIFTRT */ { INL, INL, INL, INL, INL, INL, INL, INL, SPC, SPC, SPC, SPC, SPC, SPC, SPC, SPC }, /* SHIFT_ASHIFTRT */ } @@ -237,9 +237,9 @@ static enum shift_alg shift_alg_si[2][3][32] = { SPC, SPC, SPC, SPC, SPC, SPC, SPC, SPC, SPC, SPC, SPC, SPC, SPC, SPC, SPC, SPC }, /* SHIFT_LSHIFTRT */ { INL, INL, INL, INL, INL, INL, INL, LOP, - SPC, LOP, LOP, LOP, LOP, LOP, LOP, LOP, + SPC, LOP, LOP, LOP, LOP, LOP, LOP, SPC, SPC, SPC, SPC, SPC, SPC, SPC, SPC, SPC, - SPC, SPC, SPC, SPC, LOP, LOP, LOP, SPC }, /* SHIFT_ASHIFTRT */ + SPC, SPC, SPC, SPC, SPC, SPC, SPC, SPC }, /* SHIFT_ASHIFTRT */ }, { /* TARGET_H8300S */ @@ -256,7 +256,7 @@ static enum shift_alg shift_alg_si[2][3][32] = { SPC, SPC, SPC, SPC, SPC, SPC, SPC, SPC, SPC, SPC, SPC, SPC, SPC, SPC, SPC, SPC }, /* SHIFT_LSHIFTRT */ { INL, INL, INL, INL, INL, INL, INL, INL, - INL, INL, INL, INL, INL, INL, INL, LOP, + INL, INL, INL, INL, INL, INL, INL, SPC, SPC, SPC, SPC, SPC, SPC, SPC, SPC, SPC, SPC, SPC, SPC, SPC, SPC, SPC, SPC, SPC }, /* SHIFT_ASHIFTRT */ } @@ -372,6 +372,9 @@ h8300_option_override (void) shift_alg_si[H8_300H][SHIFT_ASHIFTRT][25] = SHIFT_LOOP; shift_alg_si[H8_300H][SHIFT_ASHIFTRT][26] = SHIFT_LOOP; shift_alg_si[H8_300H][SHIFT_ASHIFTRT][27] = SHIFT_LOOP; + shift_alg_si[H8_300H][SHIFT_ASHIFTRT][28] = SHIFT_LOOP; + shift_alg_si[H8_300H][SHIFT_ASHIFTRT][29] = SHIFT_LOOP; + shift_alg_si[H8_300H][SHIFT_ASHIFTRT][30] = SHIFT_LOOP; /* H8S */ shift_alg_hi[H8_S][SHIFT_ASHIFTRT][14] = SHIFT_LOOP; @@ -3830,6 +3833,10 @@ get_shift_alg (enum shift_type shift_type, enum shift_mode shift_mode, } else if (count == 15) { + /* The basic idea here is to use the shift-by-16 idiom to make things + small and efficient. Of course, that loses one bit that we need, + so we stuff the bit into C, shift by 16, then rotate the bit + back in. */ switch (shift_type) { case SHIFT_ASHIFT: @@ -3841,7 +3848,9 @@ get_shift_alg (enum shift_type shift_type, enum shift_mode shift_mode, info->cc_special = OLD_CC_SET_ZNV; goto end; case SHIFT_ASHIFTRT: - gcc_unreachable (); + info->special = "shll.w\t%f0\n\tmov.w\t%e0,%f0\n\texts.l\t%S0\n\trotxl.l\t%S0"; + info->cc_special = OLD_CC_SET_ZNV; + goto end; } } else if (count >= 16 && count <= 23) @@ -3863,6 +3872,23 @@ get_shift_alg (enum shift_type shift_type, enum shift_mode shift_mode, goto end; } } + else if (TARGET_H8300S && count == 27) + { + switch (shift_type) + { + case SHIFT_ASHIFT: + info->special = "sub.w\t%e0,%e0\n\trotr.l\t#2,%S0\n\trotr.l\t#2,%S0\n\trotr.l\t%S0\n\tsub.w\t%f0,%f0"; + goto end; + case SHIFT_LSHIFTRT: + info->special = "sub.w\t%f0,%f0\n\trotl.l\t#2,%S0\n\trotl.l\t#2,%S0\n\trotl.l\t%S0\n\textu.l\t%S0"; + goto end; + case SHIFT_ASHIFTRT: + info->remainder = count - 24; + info->special = "mov.w\t%e0,%f0\n\tmov.b\t%t0,%s0\n\texts.w\t%f0\n\texts.l\t%S0"; + info->cc_special = OLD_CC_SET_ZNV; + goto end; + } + } else if (count >= 24 && count <= 27) { info->remainder = count - 24; -- cgit v1.1 From 7cad8a8f9f7bfa8e98f6a0615541f589fd1d3fc1 Mon Sep 17 00:00:00 2001 From: Serge Belyshev Date: Fri, 16 Jul 2021 10:52:33 +0300 Subject: configure: drop version checks for in-tree gas [PR91602] Special-casing checks for in-tree gas features is unnecessary since r100007 which made configure-gcc depend on all-gas, and thus making alternate code path in gcc_GAS_CHECK_FEATURE for in-tree gas redundant. Along the way this fixes PR 91602, which is caused by incorrect guess of leb128 support presence in RISC-V. First patch removes alternate code path in gcc_GAS_CHECK_FEATURE and related code, the rest are further cleanups. Patches 2 and 3 in series make no functional changes, thus configure is unchanged. gcc/ChangeLog: PR target/91602 * acinclude.m4 (_gcc_COMPUTE_GAS_VERSION, _gcc_GAS_VERSION_GTE_IFELSE) (gcc_GAS_VERSION_GTE_IFELSE): Remove. (gcc_GAS_CHECK_FEATURE): Do not handle in-tree case specially. * configure.ac: Remove gcc_cv_gas_major_version, gcc_cv_gas_minor_version. Remove remaining checks for in-tree assembler. * configure: Regenerate. --- gcc/acinclude.m4 | 66 +-------- gcc/configure | 414 ++++++++----------------------------------------------- gcc/configure.ac | 26 +--- 3 files changed, 61 insertions(+), 445 deletions(-) (limited to 'gcc') diff --git a/gcc/acinclude.m4 b/gcc/acinclude.m4 index f9f6a07..e038990 100644 --- a/gcc/acinclude.m4 +++ b/gcc/acinclude.m4 @@ -442,63 +442,6 @@ AC_DEFINE_UNQUOTED(HAVE_INITFINI_ARRAY_SUPPORT, [Define 0/1 if .init_array/.fini_array sections are available and working.]) ]) -dnl # _gcc_COMPUTE_GAS_VERSION -dnl # Used by gcc_GAS_VERSION_GTE_IFELSE -dnl # -dnl # WARNING: -dnl # gcc_cv_as_gas_srcdir must be defined before this. -dnl # This gross requirement will go away eventually. -AC_DEFUN([_gcc_COMPUTE_GAS_VERSION], -[gcc_cv_as_bfd_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/bfd -for f in $gcc_cv_as_bfd_srcdir/configure \ - $gcc_cv_as_gas_srcdir/configure \ - $gcc_cv_as_gas_srcdir/configure.ac \ - $gcc_cv_as_gas_srcdir/Makefile.in ; do - gcc_cv_gas_version=`sed -n -e 's/^[[ ]]*VERSION=[[^0-9A-Za-z_]]*\([[0-9]]*\.[[0-9]]*.*\)/VERSION=\1/p' < $f` - if test x$gcc_cv_gas_version != x; then - break - fi -done -case $gcc_cv_gas_version in - VERSION=[[0-9]]*) ;; - *) AC_MSG_ERROR([[cannot find version of in-tree assembler]]);; -esac -gcc_cv_gas_major_version=`expr "$gcc_cv_gas_version" : "VERSION=\([[0-9]]*\)"` -gcc_cv_gas_minor_version=`expr "$gcc_cv_gas_version" : "VERSION=[[0-9]]*\.\([[0-9]]*\)"` -gcc_cv_gas_patch_version=`expr "$gcc_cv_gas_version" : "VERSION=[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)"` -case $gcc_cv_gas_patch_version in - "") gcc_cv_gas_patch_version="0" ;; -esac -gcc_cv_gas_vers=`expr \( \( $gcc_cv_gas_major_version \* 1000 \) \ - + $gcc_cv_gas_minor_version \) \* 1000 \ - + $gcc_cv_gas_patch_version` -]) []dnl # _gcc_COMPUTE_GAS_VERSION - -dnl # gcc_GAS_VERSION_GTE_IFELSE([elf,] major, minor, patchlevel, -dnl # [command_if_true = :], [command_if_false = :]) -dnl # Check to see if the version of GAS is greater than or -dnl # equal to the specified version. -dnl # -dnl # The first ifelse() shortens the shell code if the patchlevel -dnl # is unimportant (the usual case). The others handle missing -dnl # commands. Note that the tests are structured so that the most -dnl # common version number cases are tested first. -AC_DEFUN([_gcc_GAS_VERSION_GTE_IFELSE], -[ifelse([$1], elf, - [if test $in_tree_gas_is_elf = yes \ - &&], - [if]) test $gcc_cv_gas_vers -ge `expr \( \( $2 \* 1000 \) + $3 \) \* 1000 + $4` - then dnl -ifelse([$5],,:,[$5])[]dnl -ifelse([$6],,,[ - else $6]) -fi]) - -AC_DEFUN([gcc_GAS_VERSION_GTE_IFELSE], -[AC_REQUIRE([_gcc_COMPUTE_GAS_VERSION])dnl -ifelse([$1], elf, [_gcc_GAS_VERSION_GTE_IFELSE($@)], - [_gcc_GAS_VERSION_GTE_IFELSE(,$@)])]) - dnl # gcc_GAS_FLAGS dnl # Used by gcc_GAS_CHECK_FEATURE dnl # @@ -531,9 +474,7 @@ dnl gcc_GAS_CHECK_FEATURE(description, cv, [[elf,]major,minor,patchlevel], dnl [extra switches to as], [assembler input], dnl [extra testing logic], [command if feature available]) dnl -dnl Checks for an assembler feature. If we are building an in-tree -dnl gas, the feature is available if the associated assembler version -dnl is greater than or equal to major.minor.patchlevel. If not, then +dnl Checks for an assembler feature. dnl ASSEMBLER INPUT is fed to the assembler and the feature is available dnl if assembly succeeds. If EXTRA TESTING LOGIC is not the empty string, dnl then it is run instead of simply setting CV to "yes" - it is responsible @@ -542,10 +483,7 @@ AC_DEFUN([gcc_GAS_CHECK_FEATURE], [AC_REQUIRE([gcc_GAS_FLAGS])dnl AC_CACHE_CHECK([assembler for $1], [$2], [[$2]=no - ifelse([$3],,,[dnl - if test $in_tree_gas = yes; then - gcc_GAS_VERSION_GTE_IFELSE($3, [[$2]=yes]) - el])if test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then AS_ECHO([ifelse(m4_substr([$5],0,1),[$], "[$5]", '[$5]')]) > conftest.s if AC_TRY_COMMAND([$gcc_cv_as $gcc_cv_as_flags $4 -o conftest.o conftest.s >&AS_MESSAGE_LOG_FD]) then diff --git a/gcc/configure b/gcc/configure index a2d1003..97395ed 100755 --- a/gcc/configure +++ b/gcc/configure @@ -22842,8 +22842,6 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu # If build != host, and we aren't building gas in-tree, we identify a # build->target assembler and hope that it will have the same features # as the host->target assembler we'll be using. -gcc_cv_gas_major_version= -gcc_cv_gas_minor_version= gcc_cv_as_gas_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/gas if ${gcc_cv_as+:} false; then : @@ -22913,52 +22911,6 @@ case "$ORIGINAL_AS_FOR_TARGET" in ;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking what assembler to use" >&5 -$as_echo_n "checking what assembler to use... " >&6; } -if test "$gcc_cv_as" = ../gas/as-new$build_exeext; then - # Single tree build which includes gas. We want to prefer it - # over whatever linker top-level may have detected, since - # we'll use what we're building after installation anyway. - { $as_echo "$as_me:${as_lineno-$LINENO}: result: newly built gas" >&5 -$as_echo "newly built gas" >&6; } - in_tree_gas=yes - gcc_cv_as_bfd_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/bfd -for f in $gcc_cv_as_bfd_srcdir/configure \ - $gcc_cv_as_gas_srcdir/configure \ - $gcc_cv_as_gas_srcdir/configure.ac \ - $gcc_cv_as_gas_srcdir/Makefile.in ; do - gcc_cv_gas_version=`sed -n -e 's/^[ ]*VERSION=[^0-9A-Za-z_]*\([0-9]*\.[0-9]*.*\)/VERSION=\1/p' < $f` - if test x$gcc_cv_gas_version != x; then - break - fi -done -case $gcc_cv_gas_version in - VERSION=[0-9]*) ;; - *) as_fn_error $? "cannot find version of in-tree assembler" "$LINENO" 5;; -esac -gcc_cv_gas_major_version=`expr "$gcc_cv_gas_version" : "VERSION=\([0-9]*\)"` -gcc_cv_gas_minor_version=`expr "$gcc_cv_gas_version" : "VERSION=[0-9]*\.\([0-9]*\)"` -gcc_cv_gas_patch_version=`expr "$gcc_cv_gas_version" : "VERSION=[0-9]*\.[0-9]*\.\([0-9]*\)"` -case $gcc_cv_gas_patch_version in - "") gcc_cv_gas_patch_version="0" ;; -esac -gcc_cv_gas_vers=`expr \( \( $gcc_cv_gas_major_version \* 1000 \) \ - + $gcc_cv_gas_minor_version \) \* 1000 \ - + $gcc_cv_gas_patch_version` - - in_tree_gas_is_elf=no - if grep 'obj_format = elf' ../gas/Makefile > /dev/null \ - || (grep 'obj_format = multi' ../gas/Makefile \ - && grep 'extra_objects =.* obj-elf' ../gas/Makefile) > /dev/null - then - in_tree_gas_is_elf=yes - fi -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as" >&5 -$as_echo "$gcc_cv_as" >&6; } - in_tree_gas=no -fi - default_ld= # Check whether --enable-ld was given. if test "${enable_ld+set}" = set; then : @@ -23582,11 +23534,7 @@ if ${gcc_cv_as_balign_and_p2align+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_balign_and_p2align=no - if test $in_tree_gas = yes; then - if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 6 \) \* 1000 + 0` - then gcc_cv_as_balign_and_p2align=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo '.balign 4 .p2align 2' > conftest.s if { ac_try='$gcc_cv_as $gcc_cv_as_flags -o conftest.o conftest.s >&5' @@ -23619,11 +23567,7 @@ if ${gcc_cv_as_max_skip_p2align+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_max_skip_p2align=no - if test $in_tree_gas = yes; then - if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 8 \) \* 1000 + 0` - then gcc_cv_as_max_skip_p2align=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo '.p2align 4,,7' > conftest.s if { ac_try='$gcc_cv_as $gcc_cv_as_flags -o conftest.o conftest.s >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 @@ -23655,11 +23599,7 @@ if ${gcc_cv_as_literal16+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_literal16=no - if test $in_tree_gas = yes; then - if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 8 \) \* 1000 + 0` - then gcc_cv_as_literal16=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo '.literal16' > conftest.s if { ac_try='$gcc_cv_as $gcc_cv_as_flags -o conftest.o conftest.s >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 @@ -23691,12 +23631,7 @@ if ${gcc_cv_as_subsection_m1+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_subsection_m1=no - if test $in_tree_gas = yes; then - if test $in_tree_gas_is_elf = yes \ - && test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 9 \) \* 1000 + 0` - then gcc_cv_as_subsection_m1=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo 'conftest_label1: .word 0 .subsection -1 conftest_label2: .word 0 @@ -23739,11 +23674,7 @@ if ${gcc_cv_as_weak+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_weak=no - if test $in_tree_gas = yes; then - if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 2 \) \* 1000 + 0` - then gcc_cv_as_weak=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo ' .weak foobar' > conftest.s if { ac_try='$gcc_cv_as $gcc_cv_as_flags -o conftest.o conftest.s >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 @@ -23775,11 +23706,7 @@ if ${gcc_cv_as_weakref+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_weakref=no - if test $in_tree_gas = yes; then - if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 17 \) \* 1000 + 0` - then gcc_cv_as_weakref=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo ' .weakref foobar, barfnot' > conftest.s if { ac_try='$gcc_cv_as $gcc_cv_as_flags -o conftest.o conftest.s >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 @@ -23811,11 +23738,7 @@ if ${gcc_cv_as_nsubspa_comdat+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_nsubspa_comdat=no - if test $in_tree_gas = yes; then - if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 15 \) \* 1000 + 91` - then gcc_cv_as_nsubspa_comdat=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo ' .SPACE $TEXT$ .NSUBSPA $CODE$,COMDAT' > conftest.s if { ac_try='$gcc_cv_as $gcc_cv_as_flags -o conftest.o conftest.s >&5' @@ -23864,12 +23787,7 @@ if ${gcc_cv_as_hidden+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_hidden=no - if test $in_tree_gas = yes; then - if test $in_tree_gas_is_elf = yes \ - && test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 13 \) \* 1000 + 0` - then gcc_cv_as_hidden=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo "$conftest_s" > conftest.s if { ac_try='$gcc_cv_as $gcc_cv_as_flags -o conftest.o conftest.s >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 @@ -24322,12 +24240,7 @@ if ${gcc_cv_as_leb128+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_leb128=no - if test $in_tree_gas = yes; then - if test $in_tree_gas_is_elf = yes \ - && test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 11 \) \* 1000 + 0` - then gcc_cv_as_leb128=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo ' .data .uleb128 L2 - L1 L1: @@ -24612,12 +24525,7 @@ if ${gcc_cv_as_eh_frame+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_eh_frame=no - if test $in_tree_gas = yes; then - if test $in_tree_gas_is_elf = yes \ - && test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 12 \) \* 1000 + 0` - then gcc_cv_as_eh_frame=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo ' .text .LFB1: .4byte 0 @@ -24716,11 +24624,7 @@ if ${gcc_cv_as_section_exclude_e+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_section_exclude_e=no - if test $in_tree_gas = yes; then - if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 22 \) \* 1000 + 51` - then gcc_cv_as_section_exclude_e=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo '.section foo1,"e" .byte 0,0,0,0' > conftest.s if { ac_try='$gcc_cv_as $gcc_cv_as_flags --fatal-warnings -o conftest.o conftest.s >&5' @@ -24807,12 +24711,7 @@ if ${gcc_cv_as_shf_gnu_retain+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_shf_gnu_retain=no - if test $in_tree_gas = yes; then - if test $in_tree_gas_is_elf = yes \ - && test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 36 \) \* 1000 + 0` - then gcc_cv_as_shf_gnu_retain=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo '.section .foo,"awR",%progbits .byte 0' > conftest.s if { ac_try='$gcc_cv_as $gcc_cv_as_flags --fatal-warnings -o conftest.o conftest.s >&5' @@ -24858,11 +24757,7 @@ if ${gcc_cv_as_section_link_order+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_section_link_order=no - if test $in_tree_gas = yes; then - if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 35 \) \* 1000 + 0` - then gcc_cv_as_section_link_order=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo '.section .foo,"a" .byte 0 .section __patchable_function_entries,"awo",%progbits,.foo @@ -24900,12 +24795,7 @@ if ${gcc_cv_as_shf_merge+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_shf_merge=no - if test $in_tree_gas = yes; then - if test $in_tree_gas_is_elf = yes \ - && test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 12 \) \* 1000 + 0` - then gcc_cv_as_shf_merge=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo '.section .rodata.str, "aMS", @progbits, 1' > conftest.s if { ac_try='$gcc_cv_as $gcc_cv_as_flags --fatal-warnings -o conftest.o conftest.s >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 @@ -24933,12 +24823,7 @@ if ${gcc_cv_as_shf_merge+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_shf_merge=no - if test $in_tree_gas = yes; then - if test $in_tree_gas_is_elf = yes \ - && test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 12 \) \* 1000 + 0` - then gcc_cv_as_shf_merge=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo '.section .rodata.str, "aMS", %progbits, 1' > conftest.s if { ac_try='$gcc_cv_as $gcc_cv_as_flags --fatal-warnings -o conftest.o conftest.s >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 @@ -25021,12 +24906,7 @@ if ${gcc_cv_as_comdat_group+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_comdat_group=no - if test $in_tree_gas = yes; then - if test $in_tree_gas_is_elf = yes \ - && test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 16 \) \* 1000 + 0` - then gcc_cv_as_comdat_group=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo '.section .text,"axG",@progbits,.foo,comdat' > conftest.s if { ac_try='$gcc_cv_as $gcc_cv_as_flags --fatal-warnings -o conftest.o conftest.s >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 @@ -25057,12 +24937,7 @@ if ${gcc_cv_as_comdat_group_percent+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_comdat_group_percent=no - if test $in_tree_gas = yes; then - if test $in_tree_gas_is_elf = yes \ - && test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 16 \) \* 1000 + 0` - then gcc_cv_as_comdat_group_percent=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo '.section .text,"axG",%progbits,.foo,comdat' > conftest.s if { ac_try='$gcc_cv_as $gcc_cv_as_flags --fatal-warnings -o conftest.o conftest.s >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 @@ -25239,11 +25114,7 @@ if ${gcc_cv_as_is_stmt+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_is_stmt=no - if test $in_tree_gas = yes; then - if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 16 \) \* 1000 + 92` - then gcc_cv_as_is_stmt=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo ' .text .file 1 "conf.c" .loc 1 1 0 is_stmt 1' > conftest.s @@ -25277,11 +25148,7 @@ if ${gcc_cv_as_discriminator+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_discriminator=no - if test $in_tree_gas = yes; then - if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 19 \) \* 1000 + 51` - then gcc_cv_as_discriminator=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo ' .text .file 1 "conf.c" .loc 1 1 0 discriminator 1' > conftest.s @@ -25821,11 +25688,7 @@ if ${gcc_cv_as_tls+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_tls=no - if test $in_tree_gas = yes; then - if test $gcc_cv_gas_vers -ge `expr \( \( $tls_first_major \* 1000 \) + $tls_first_minor \) \* 1000 + 0` - then gcc_cv_as_tls=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo "$conftest_s" > conftest.s if { ac_try='$gcc_cv_as $gcc_cv_as_flags $tls_as_opt -o conftest.o conftest.s >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 @@ -26237,11 +26100,7 @@ if ${gcc_cv_as_alpha_explicit_relocs+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_alpha_explicit_relocs=no - if test $in_tree_gas = yes; then - if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 12 \) \* 1000 + 0` - then gcc_cv_as_alpha_explicit_relocs=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo ' .set nomacro .text extbl $3, $2, $3 !lituse_bytoff!1 @@ -26284,11 +26143,7 @@ if ${gcc_cv_as_alpha_jsrdirect_relocs+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_alpha_jsrdirect_relocs=no - if test $in_tree_gas = yes; then - if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 16 \) \* 1000 + 90` - then gcc_cv_as_alpha_jsrdirect_relocs=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo ' .set nomacro .text ldq $27, a($29) !literal!1 @@ -26485,11 +26340,7 @@ if ${gcc_cv_as_cris_no_mul_bug+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_cris_no_mul_bug=no - if test $in_tree_gas = yes; then - if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 15 \) \* 1000 + 91` - then gcc_cv_as_cris_no_mul_bug=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo '.text' > conftest.s if { ac_try='$gcc_cv_as $gcc_cv_as_flags -no-mul-bug-abort -o conftest.o conftest.s >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 @@ -26964,11 +26815,7 @@ if ${gcc_cv_as_comm_has_align+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_comm_has_align=no - if test $in_tree_gas = yes; then - if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 19 \) \* 1000 + 52` - then gcc_cv_as_comm_has_align=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo '.comm foo,1,32' > conftest.s if { ac_try='$gcc_cv_as $gcc_cv_as_flags -o conftest.o conftest.s >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 @@ -27001,11 +26848,7 @@ if ${gcc_cv_as_ix86_pe_secrel32+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_ix86_pe_secrel32=no - if test $in_tree_gas = yes; then - if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 15 \) \* 1000 + 91` - then gcc_cv_as_ix86_pe_secrel32=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo '.text foo: nop .data @@ -27047,11 +26890,7 @@ if ${gcc_cv_as_section_has_align+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_section_has_align=no - if test $in_tree_gas = yes; then - if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 20 \) \* 1000 + 1` - then gcc_cv_as_section_has_align=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo '.section lto_test,"dr0"' > conftest.s if { ac_try='$gcc_cv_as $gcc_cv_as_flags -fatal-warnings -o conftest.o conftest.s >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 @@ -27752,11 +27591,7 @@ if ${gcc_cv_as_ix86_gotoff_in_data+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_ix86_gotoff_in_data=no - if test $in_tree_gas = yes; then - if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 11 \) \* 1000 + 0` - then gcc_cv_as_ix86_gotoff_in_data=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo ' .text .L0: nop @@ -27850,11 +27685,7 @@ if ${gcc_cv_as_ia64_ltoffx_ldxmov_relocs+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_ia64_ltoffx_ldxmov_relocs=no - if test $in_tree_gas = yes; then - if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 14 \) \* 1000 + 0` - then gcc_cv_as_ia64_ltoffx_ldxmov_relocs=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo ' .text addl r15 = @ltoffx(x#), gp ;; @@ -27942,11 +27773,7 @@ if ${gcc_cv_as_powerpc_mfcrf+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_powerpc_mfcrf=no - if test $in_tree_gas = yes; then - if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 14 \) \* 1000 + 0` - then gcc_cv_as_powerpc_mfcrf=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo "$conftest_s" > conftest.s if { ac_try='$gcc_cv_as $gcc_cv_as_flags -o conftest.o conftest.s >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 @@ -27991,11 +27818,7 @@ if ${gcc_cv_as_powerpc_rel16+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_powerpc_rel16=no - if test $in_tree_gas = yes; then - if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 17 \) \* 1000 + 0` - then gcc_cv_as_powerpc_rel16=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo "$conftest_s" > conftest.s if { ac_try='$gcc_cv_as $gcc_cv_as_flags -a32 -o conftest.o conftest.s >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 @@ -28036,11 +27859,7 @@ if ${gcc_cv_as_powerpc_vsx+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_powerpc_vsx=no - if test $in_tree_gas = yes; then - if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 19 \) \* 1000 + 2` - then gcc_cv_as_powerpc_vsx=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo "$conftest_s" > conftest.s if { ac_try='$gcc_cv_as $gcc_cv_as_flags -a32 -o conftest.o conftest.s >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 @@ -28072,11 +27891,7 @@ if ${gcc_cv_as_powerpc_gnu_attribute+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_powerpc_gnu_attribute=no - if test $in_tree_gas = yes; then - if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 18 \) \* 1000 + 0` - then gcc_cv_as_powerpc_gnu_attribute=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo '.gnu_attribute 4,1' > conftest.s if { ac_try='$gcc_cv_as $gcc_cv_as_flags -o conftest.o conftest.s >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 @@ -28108,11 +27923,7 @@ if ${gcc_cv_as_powerpc_entry_markers+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_powerpc_entry_markers=no - if test $in_tree_gas = yes; then - if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 26 \) \* 1000 + 0` - then gcc_cv_as_powerpc_entry_markers=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo ' .reloc .,R_PPC64_ENTRY; nop' > conftest.s if { ac_try='$gcc_cv_as $gcc_cv_as_flags -a64 --fatal-warnings -o conftest.o conftest.s >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 @@ -28144,11 +27955,7 @@ if ${gcc_cv_as_powerpc_pltseq_markers+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_powerpc_pltseq_markers=no - if test $in_tree_gas = yes; then - if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 31 \) \* 1000 + 0` - then gcc_cv_as_powerpc_pltseq_markers=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo ' .reloc .,R_PPC_PLTSEQ; nop' > conftest.s if { ac_try='$gcc_cv_as $gcc_cv_as_flags -a32 --fatal-warnings -o conftest.o conftest.s >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 @@ -28182,11 +27989,7 @@ if ${gcc_cv_as_aix_ref+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_aix_ref=no - if test $in_tree_gas = yes; then - if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 21 \) \* 1000 + 0` - then gcc_cv_as_aix_ref=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo ' .csect stuff[rw] stuff: .long 1 @@ -28223,11 +28026,7 @@ if ${gcc_cv_as_aix_dwloc+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_aix_dwloc=no - if test $in_tree_gas = yes; then - if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 21 \) \* 1000 + 0` - then gcc_cv_as_aix_dwloc=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo ' .dwsect 0xA0000 Lframe..0: .vbyte 4,Lframe..0 @@ -28266,11 +28065,7 @@ if ${gcc_cv_as_mips_explicit_relocs+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_mips_explicit_relocs=no - if test $in_tree_gas = yes; then - if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 14 \) \* 1000 + 0` - then gcc_cv_as_mips_explicit_relocs=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo ' lw $4,%gp_rel(foo)($4)' > conftest.s if { ac_try='$gcc_cv_as $gcc_cv_as_flags -o conftest.o conftest.s >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 @@ -28303,11 +28098,7 @@ if ${gcc_cv_as_mips_no_shared+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_mips_no_shared=no - if test $in_tree_gas = yes; then - if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 16 \) \* 1000 + 0` - then gcc_cv_as_mips_no_shared=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo 'nop' > conftest.s if { ac_try='$gcc_cv_as $gcc_cv_as_flags -mno-shared -o conftest.o conftest.s >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 @@ -28339,11 +28130,7 @@ if ${gcc_cv_as_mips_gnu_attribute+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_mips_gnu_attribute=no - if test $in_tree_gas = yes; then - if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 18 \) \* 1000 + 0` - then gcc_cv_as_mips_gnu_attribute=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo '.gnu_attribute 4,1' > conftest.s if { ac_try='$gcc_cv_as $gcc_cv_as_flags -o conftest.o conftest.s >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 @@ -28444,11 +28231,7 @@ if ${gcc_cv_as_mips_dtprelword+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_mips_dtprelword=no - if test $in_tree_gas = yes; then - if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 18 \) \* 1000 + 0` - then gcc_cv_as_mips_dtprelword=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo '.section .tdata,"awT",@progbits x: .word 2 @@ -28652,11 +28435,7 @@ if ${gcc_cv_as_msp430_gnu_attribute+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_msp430_gnu_attribute=no - if test $in_tree_gas = yes; then - if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 33 \) \* 1000 + 50` - then gcc_cv_as_msp430_gnu_attribute=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo '.gnu_attribute 4,1' > conftest.s if { ac_try='$gcc_cv_as $gcc_cv_as_flags -o conftest.o conftest.s >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 @@ -28687,11 +28466,7 @@ if ${gcc_cv_as_msp430_mspabi_attribute+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_msp430_mspabi_attribute=no - if test $in_tree_gas = yes; then - if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 33 \) \* 1000 + 50` - then gcc_cv_as_msp430_mspabi_attribute=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo '.mspabi_attribute 4,2' > conftest.s if { ac_try='$gcc_cv_as $gcc_cv_as_flags -o conftest.o conftest.s >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 @@ -28766,11 +28541,7 @@ if ${gcc_cv_as_riscv_attribute+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_riscv_attribute=no - if test $in_tree_gas = yes; then - if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 32 \) \* 1000 + 0` - then gcc_cv_as_riscv_attribute=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo '.attribute stack_align,4' > conftest.s if { ac_try='$gcc_cv_as $gcc_cv_as_flags -o conftest.o conftest.s >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 @@ -28865,11 +28636,7 @@ if ${gcc_cv_as_s390_gnu_attribute+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_s390_gnu_attribute=no - if test $in_tree_gas = yes; then - if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 18 \) \* 1000 + 0` - then gcc_cv_as_s390_gnu_attribute=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo '.gnu_attribute 8,1' > conftest.s if { ac_try='$gcc_cv_as $gcc_cv_as_flags -o conftest.o conftest.s >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 @@ -28900,11 +28667,7 @@ if ${gcc_cv_as_s390_machine_machinemode+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_s390_machine_machinemode=no - if test $in_tree_gas = yes; then - if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 24 \) \* 1000 + 0` - then gcc_cv_as_s390_machine_machinemode=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo ' .machinemode push .machinemode pop .machine push @@ -28938,11 +28701,7 @@ if ${gcc_cv_as_s390_architecture_modifiers+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_s390_architecture_modifiers=no - if test $in_tree_gas = yes; then - if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 26 \) \* 1000 + 0` - then gcc_cv_as_s390_architecture_modifiers=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo ' .machine z13+vx ' > conftest.s if { ac_try='$gcc_cv_as $gcc_cv_as_flags -o conftest.o conftest.s >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 @@ -28973,11 +28732,7 @@ if ${gcc_cv_as_s390_vector_loadstore_alignment_hints+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_s390_vector_loadstore_alignment_hints=no - if test $in_tree_gas = yes; then - if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 31 \) \* 1000 + 0` - then gcc_cv_as_s390_vector_loadstore_alignment_hints=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo ' vl %v24,0(%r15),3 ' > conftest.s if { ac_try='$gcc_cv_as $gcc_cv_as_flags -o conftest.o conftest.s >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 @@ -29240,12 +28995,7 @@ if ${gcc_cv_as_dwarf2_debug_line+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_dwarf2_debug_line=no - if test $in_tree_gas = yes; then - if test $in_tree_gas_is_elf = yes \ - && test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 11 \) \* 1000 + 0` - then gcc_cv_as_dwarf2_debug_line=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo "$conftest_s" > conftest.s if { ac_try='$gcc_cv_as $gcc_cv_as_flags -o conftest.o conftest.s >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 @@ -29329,12 +29079,7 @@ if ${gcc_cv_as_dwarf2_debug_view+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_dwarf2_debug_view=no - if test $in_tree_gas = yes; then - if test $in_tree_gas_is_elf = yes \ - && test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 27 \) \* 1000 + 0` - then gcc_cv_as_dwarf2_debug_view=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo "$conftest_s" > conftest.s if { ac_try='$gcc_cv_as $gcc_cv_as_flags -o conftest.o conftest.s >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 @@ -29368,12 +29113,7 @@ if ${gcc_cv_as_gdwarf2_flag+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_gdwarf2_flag=no - if test $in_tree_gas = yes; then - if test $in_tree_gas_is_elf = yes \ - && test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 11 \) \* 1000 + 0` - then gcc_cv_as_gdwarf2_flag=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo "$insn" > conftest.s if { ac_try='$gcc_cv_as $gcc_cv_as_flags --gdwarf2 -o conftest.o conftest.s >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 @@ -29405,12 +29145,7 @@ if ${gcc_cv_as_gdwarf_5_flag+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_gdwarf_5_flag=no - if test $in_tree_gas = yes; then - if test $in_tree_gas_is_elf = yes \ - && test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 36 \) \* 1000 + 0` - then gcc_cv_as_gdwarf_5_flag=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo "$insn" > conftest.s if { ac_try='$gcc_cv_as $gcc_cv_as_flags --gdwarf-5 -o conftest.o conftest.s >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 @@ -29614,12 +29349,7 @@ if ${gcc_cv_as_debug_line_32_flag+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_debug_line_32_flag=no - if test $in_tree_gas = yes; then - if test $in_tree_gas_is_elf = yes \ - && test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 36 \) \* 1000 + 0` - then gcc_cv_as_debug_line_32_flag=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo "$conftest_s" > conftest.s if { ac_try='$gcc_cv_as $gcc_cv_as_flags -o conftest.o conftest.s >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 @@ -29649,12 +29379,7 @@ if ${gcc_cv_as_debug_line_64_flag+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_debug_line_64_flag=no - if test $in_tree_gas = yes; then - if test $in_tree_gas_is_elf = yes \ - && test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 36 \) \* 1000 + 0` - then gcc_cv_as_debug_line_64_flag=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo "$conftest_s" > conftest.s if { ac_try='$gcc_cv_as $gcc_cv_as_flags -o conftest.o conftest.s >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 @@ -29686,12 +29411,7 @@ if ${gcc_cv_as_dwarf_4_debug_line_flag+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_dwarf_4_debug_line_flag=no - if test $in_tree_gas = yes; then - if test $in_tree_gas_is_elf = yes \ - && test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 36 \) \* 1000 + 0` - then gcc_cv_as_dwarf_4_debug_line_flag=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo "$conftest_s" > conftest.s if { ac_try='$gcc_cv_as $gcc_cv_as_flags --gdwarf-4 -o conftest.o conftest.s >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 @@ -29827,12 +29547,7 @@ if ${gcc_cv_as_gstabs_flag+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_gstabs_flag=no - if test $in_tree_gas = yes; then - if test $in_tree_gas_is_elf = yes \ - && test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 11 \) \* 1000 + 0` - then gcc_cv_as_gstabs_flag=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo "$insn" > conftest.s if { ac_try='$gcc_cv_as $gcc_cv_as_flags --gstabs -o conftest.o conftest.s >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 @@ -29864,11 +29579,7 @@ if ${gcc_cv_as_debug_prefix_map_flag+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_debug_prefix_map_flag=no - if test $in_tree_gas = yes; then - if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 18 \) \* 1000 + 0` - then gcc_cv_as_debug_prefix_map_flag=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo "$insn" > conftest.s if { ac_try='$gcc_cv_as $gcc_cv_as_flags --debug-prefix-map /a=/b -o conftest.o conftest.s >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 @@ -30053,12 +29764,7 @@ if ${gcc_cv_as_gnu_unique_object+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_gnu_unique_object=no - if test $in_tree_gas = yes; then - if test $in_tree_gas_is_elf = yes \ - && test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 19 \) \* 1000 + 52` - then gcc_cv_as_gnu_unique_object=yes -fi - elif test x$gcc_cv_as != x; then + if test x$gcc_cv_as != x; then $as_echo '.type foo, '$target_type_format_char'gnu_unique_object' > conftest.s if { ac_try='$gcc_cv_as $gcc_cv_as_flags -o conftest.o conftest.s >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 @@ -30102,11 +29808,7 @@ if ${gcc_cv_as_line_zero+:} false; then : $as_echo_n "(cached) " >&6 else gcc_cv_as_line_zero=no - if test $in_tree_gas = yes; then - if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 16 \) \* 1000 + 91` - then gcc_cv_as_line_zero=yes -fi - elif test "x$gcc_cv_as" != x; then + if test "x$gcc_cv_as" != x; then { echo '# 1 "test.s" 1'; echo '# 0 "" 2'; } > conftest.s if { ac_try='$gcc_cv_as -o conftest.o conftest.s >&5 2>conftest.out' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 diff --git a/gcc/configure.ac b/gcc/configure.ac index ad8fa5a..89f0875 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -2556,8 +2556,6 @@ AC_SUBST(enable_fast_install) # If build != host, and we aren't building gas in-tree, we identify a # build->target assembler and hope that it will have the same features # as the host->target assembler we'll be using. -gcc_cv_gas_major_version= -gcc_cv_gas_minor_version= gcc_cv_as_gas_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/gas m4_pattern_allow([AS_FOR_TARGET])dnl @@ -2584,26 +2582,6 @@ case "$ORIGINAL_AS_FOR_TARGET" in *) AC_CONFIG_FILES(as:exec-tool.in, [chmod +x as]) ;; esac -AC_MSG_CHECKING(what assembler to use) -if test "$gcc_cv_as" = ../gas/as-new$build_exeext; then - # Single tree build which includes gas. We want to prefer it - # over whatever linker top-level may have detected, since - # we'll use what we're building after installation anyway. - AC_MSG_RESULT(newly built gas) - in_tree_gas=yes - _gcc_COMPUTE_GAS_VERSION - in_tree_gas_is_elf=no - if grep 'obj_format = elf' ../gas/Makefile > /dev/null \ - || (grep 'obj_format = multi' ../gas/Makefile \ - && grep 'extra_objects =.* obj-elf' ../gas/Makefile) > /dev/null - then - in_tree_gas_is_elf=yes - fi -else - AC_MSG_RESULT($gcc_cv_as) - in_tree_gas=no -fi - default_ld= AC_ARG_ENABLE(ld, [[ --enable-ld[=ARG] build ld [ARG={default,yes,no}]]], @@ -5904,9 +5882,7 @@ fi AC_CACHE_CHECK([assembler for tolerance to line number 0], [gcc_cv_as_line_zero], [gcc_cv_as_line_zero=no - if test $in_tree_gas = yes; then - gcc_GAS_VERSION_GTE_IFELSE(2, 16, 91, [gcc_cv_as_line_zero=yes]) - elif test "x$gcc_cv_as" != x; then + if test "x$gcc_cv_as" != x; then { echo '# 1 "test.s" 1'; echo '# 0 "" 2'; } > conftest.s if AC_TRY_COMMAND([$gcc_cv_as -o conftest.o conftest.s >&AS_MESSAGE_LOG_FD 2>conftest.out]) && test "x`cat conftest.out`" = x -- cgit v1.1 From e0b6d0b39c69372e4a66f44d218e0244bb549d83 Mon Sep 17 00:00:00 2001 From: Serge Belyshev Date: Tue, 20 Jul 2021 09:52:55 +0300 Subject: configure: remove version argument from gcc_GAS_CHECK_FEATURE gcc/ChangeLog: * acinclude.m4 (gcc_GAS_CHECK_FEATURE): Remove third argument and ... * configure.ac: ... update all callers. --- gcc/acinclude.m4 | 16 ++-- gcc/configure.ac | 224 +++++++++++++++++++++++++++---------------------------- 2 files changed, 120 insertions(+), 120 deletions(-) (limited to 'gcc') diff --git a/gcc/acinclude.m4 b/gcc/acinclude.m4 index e038990..082fa16 100644 --- a/gcc/acinclude.m4 +++ b/gcc/acinclude.m4 @@ -470,7 +470,7 @@ AC_DEFUN([gcc_GAS_FLAGS], esac]) ]) -dnl gcc_GAS_CHECK_FEATURE(description, cv, [[elf,]major,minor,patchlevel], +dnl gcc_GAS_CHECK_FEATURE(description, cv, dnl [extra switches to as], [assembler input], dnl [extra testing logic], [command if feature available]) dnl @@ -484,23 +484,23 @@ AC_DEFUN([gcc_GAS_CHECK_FEATURE], AC_CACHE_CHECK([assembler for $1], [$2], [[$2]=no if test x$gcc_cv_as != x; then - AS_ECHO([ifelse(m4_substr([$5],0,1),[$], "[$5]", '[$5]')]) > conftest.s - if AC_TRY_COMMAND([$gcc_cv_as $gcc_cv_as_flags $4 -o conftest.o conftest.s >&AS_MESSAGE_LOG_FD]) + AS_ECHO([ifelse(m4_substr([$4],0,1),[$], "[$4]", '[$4]')]) > conftest.s + if AC_TRY_COMMAND([$gcc_cv_as $gcc_cv_as_flags $3 -o conftest.o conftest.s >&AS_MESSAGE_LOG_FD]) then - ifelse([$6],, [$2]=yes, [$6]) + ifelse([$5],, [$2]=yes, [$5]) else echo "configure: failed program was" >&AS_MESSAGE_LOG_FD cat conftest.s >&AS_MESSAGE_LOG_FD fi rm -f conftest.o conftest.s fi]) -ifelse([$7],,,[dnl +ifelse([$6],,,[dnl if test $[$2] = yes; then - $7 + $6 fi]) -ifelse([$8],,,[dnl +ifelse([$7],,,[dnl if test $[$2] != yes; then - $8 + $7 fi])]) dnl GCC_TARGET_TEMPLATE(KEY) diff --git a/gcc/configure.ac b/gcc/configure.ac index 89f0875..bc24648d 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -2884,27 +2884,27 @@ esac # Figure out what assembler alignment features are present. gcc_GAS_CHECK_FEATURE([.balign and .p2align], gcc_cv_as_balign_and_p2align, - [2,6,0],, + , [.balign 4 .p2align 2],, [AC_DEFINE(HAVE_GAS_BALIGN_AND_P2ALIGN, 1, [Define if your assembler supports .balign and .p2align.])]) gcc_GAS_CHECK_FEATURE([.p2align with maximum skip], gcc_cv_as_max_skip_p2align, - [2,8,0],, + , [.p2align 4,,7],, [AC_DEFINE(HAVE_GAS_MAX_SKIP_P2ALIGN, 1, [Define if your assembler supports specifying the maximum number of bytes to skip when using the GAS .p2align command.])]) gcc_GAS_CHECK_FEATURE([.literal16], gcc_cv_as_literal16, - [2,8,0],, + , [.literal16],, [AC_DEFINE(HAVE_GAS_LITERAL16, 1, [Define if your assembler supports .literal16.])]) gcc_GAS_CHECK_FEATURE([working .subsection -1], gcc_cv_as_subsection_m1, - [elf,2,9,0],, + , [conftest_label1: .word 0 .subsection -1 conftest_label2: .word 0 @@ -2923,17 +2923,17 @@ conftest_label2: .word 0 emitting at the beginning of your section.])]) gcc_GAS_CHECK_FEATURE([.weak], gcc_cv_as_weak, - [2,2,0],, + , [ .weak foobar],, [AC_DEFINE(HAVE_GAS_WEAK, 1, [Define if your assembler supports .weak.])]) gcc_GAS_CHECK_FEATURE([.weakref], gcc_cv_as_weakref, - [2,17,0],, + , [ .weakref foobar, barfnot],, [AC_DEFINE(HAVE_GAS_WEAKREF, 1, [Define if your assembler supports .weakref.])]) gcc_GAS_CHECK_FEATURE([.nsubspa comdat], gcc_cv_as_nsubspa_comdat, - [2,15,91],, + , [ .SPACE $TEXT$ .NSUBSPA $CODE$,COMDAT],, [AC_DEFINE(HAVE_GAS_NSUBSPA_COMDAT, 1, [Define if your assembler supports .nsubspa comdat option.])]) @@ -2955,7 +2955,7 @@ foobar:' ;; esac gcc_GAS_CHECK_FEATURE([.hidden], gcc_cv_as_hidden, - [elf,2,13,0],, [$conftest_s]) + , [$conftest_s]) case "${target}" in *-*-darwin*) # Darwin as has some visibility support, though with a different syntax. @@ -3174,7 +3174,7 @@ gcc_AC_INITFINI_ARRAY # Older versions of GAS and some non-GNU assemblers, have a bugs handling # these directives, even when they appear to accept them. gcc_GAS_CHECK_FEATURE([.sleb128 and .uleb128], gcc_cv_as_leb128, - [elf,2,11,0],, + , [ .data .uleb128 L2 - L1 L1: @@ -3213,7 +3213,7 @@ gcc_fn_eh_frame_ro () { # Check if we have assembler support for unwind directives. gcc_GAS_CHECK_FEATURE([cfi directives], gcc_cv_as_cfi_directive, - ,, + , [ .text .cfi_startproc .cfi_offset 0, 0 @@ -3269,7 +3269,7 @@ gcc_GAS_CHECK_FEATURE([cfi directives], gcc_cv_as_cfi_directive, esac]) if test $gcc_cv_as_cfi_directive = yes && test x$gcc_cv_objdump != x; then gcc_GAS_CHECK_FEATURE([working cfi advance], gcc_cv_as_cfi_advance_working, - ,, + , [ .text .cfi_startproc .cfi_adjust_cfa_offset 64 @@ -3294,7 +3294,7 @@ AC_DEFINE_UNQUOTED(HAVE_GAS_CFI_DIRECTIVE, GCC_TARGET_TEMPLATE(HAVE_GAS_CFI_PERSONALITY_DIRECTIVE) gcc_GAS_CHECK_FEATURE([cfi personality directive], - gcc_cv_as_cfi_personality_directive, ,, + gcc_cv_as_cfi_personality_directive,, [ .text .cfi_startproc .cfi_personality 0, symbol @@ -3304,7 +3304,7 @@ AC_DEFINE_UNQUOTED(HAVE_GAS_CFI_PERSONALITY_DIRECTIVE, [Define 0/1 if your assembler supports .cfi_personality.]) gcc_GAS_CHECK_FEATURE([cfi sections directive], - gcc_cv_as_cfi_sections_directive, ,, + gcc_cv_as_cfi_sections_directive,, [ .text .cfi_sections .debug_frame, .eh_frame .cfi_startproc @@ -3333,7 +3333,7 @@ AC_DEFINE_UNQUOTED(HAVE_GAS_CFI_SECTIONS_DIRECTIVE, # GAS versions up to and including 2.11.0 may mis-optimize # .eh_frame data. gcc_GAS_CHECK_FEATURE(eh_frame optimization, gcc_cv_as_eh_frame, - [elf,2,12,0],, + , [ .text .LFB1: .4byte 0 @@ -3404,7 +3404,7 @@ fi # Test if the assembler supports the section flag 'e' or #exclude for # specifying an excluded section. gcc_GAS_CHECK_FEATURE([section exclude flag], gcc_cv_as_section_exclude_e, - [2,22,51], [--fatal-warnings], + [--fatal-warnings], [.section foo1,"e" .byte 0,0,0,0]) if test $gcc_cv_as_section_exclude_e = no; then @@ -3421,7 +3421,7 @@ if test $gcc_cv_as_section_exclude_e = no; then esac ;; esac - gcc_GAS_CHECK_FEATURE([section exclude flag], gcc_cv_as_section_exclude_hash,,, + gcc_GAS_CHECK_FEATURE([section exclude flag], gcc_cv_as_section_exclude_hash,, [$conftest_s .byte 0,0,0,0]) fi @@ -3440,7 +3440,7 @@ case "${target}" in ;; *) gcc_GAS_CHECK_FEATURE([section 'R' flag], gcc_cv_as_shf_gnu_retain, - [elf,2,36,0], [--fatal-warnings], + [--fatal-warnings], [.section .foo,"awR",%progbits .byte 0]) ;; @@ -3460,7 +3460,7 @@ case "${target}" in ;; *) gcc_GAS_CHECK_FEATURE([section 'o' flag], gcc_cv_as_section_link_order, - [2,35,0], [--fatal-warnings], + [--fatal-warnings], [.section .foo,"a" .byte 0 .section __patchable_function_entries,"awo",%progbits,.foo @@ -3472,11 +3472,11 @@ AC_DEFINE_UNQUOTED(HAVE_GAS_SECTION_LINK_ORDER, [Define 0/1 if your assembler supports 'o' flag in .section directive.]) gcc_GAS_CHECK_FEATURE(section merging support, gcc_cv_as_shf_merge, - [elf,2,12,0], [--fatal-warnings], + [--fatal-warnings], [.section .rodata.str, "aMS", @progbits, 1]) if test $gcc_cv_as_shf_merge = no; then gcc_GAS_CHECK_FEATURE(section merging support, gcc_cv_as_shf_merge, - [elf,2,12,0], [--fatal-warnings], + [--fatal-warnings], [.section .rodata.str, "aMS", %progbits, 1]) fi AC_DEFINE_UNQUOTED(HAVE_GAS_SHF_MERGE, @@ -3498,14 +3498,14 @@ AC_DEFINE_UNQUOTED(HAVE_LD_ALIGNED_SHF_MERGE, [`if test $gcc_cv_ld_aligned_shf_merge = yes; then echo 1; else echo 0; fi`], [Define 0/1 if your linker supports the SHF_MERGE flag with section alignment > 1.]) -gcc_GAS_CHECK_FEATURE([stabs directive], gcc_cv_as_stabs_directive, ,, +gcc_GAS_CHECK_FEATURE([stabs directive], gcc_cv_as_stabs_directive,, [.stabs "gcc2_compiled.",60,0,0,0],, [AC_DEFINE(HAVE_AS_STABS_DIRECTIVE, 1, [Define if your assembler supports .stabs.])]) gcc_GAS_CHECK_FEATURE([COMDAT group support (GNU as)], gcc_cv_as_comdat_group, - [elf,2,16,0], [--fatal-warnings], + [--fatal-warnings], [.section .text,"axG",@progbits,.foo,comdat]) if test $gcc_cv_as_comdat_group = yes; then gcc_cv_as_comdat_group_percent=no @@ -3513,7 +3513,7 @@ if test $gcc_cv_as_comdat_group = yes; then else gcc_GAS_CHECK_FEATURE([COMDAT group support (GNU as, %type)], gcc_cv_as_comdat_group_percent, - [elf,2,16,0], [--fatal-warnings], + [--fatal-warnings], [.section .text,"axG",%progbits,.foo,comdat]) if test $gcc_cv_as_comdat_group_percent = yes; then gcc_cv_as_comdat_group_group=no @@ -3541,7 +3541,7 @@ else esac gcc_GAS_CHECK_FEATURE([COMDAT group support (Sun as, .group)], gcc_cv_as_comdat_group_group, - ,, [$conftest_s]) + , [$conftest_s]) ;; esac if test -z "${gcc_cv_as_comdat_group_group+set}"; then @@ -3637,7 +3637,7 @@ esac gcc_GAS_CHECK_FEATURE([line table is_stmt support], gcc_cv_as_is_stmt, - [2,16,92],, + , [ .text .file 1 "conf.c" .loc 1 1 0 is_stmt 1],, @@ -3646,7 +3646,7 @@ gcc_GAS_CHECK_FEATURE([line table is_stmt support], gcc_GAS_CHECK_FEATURE([line table discriminator support], gcc_cv_as_discriminator, - [2,19,51],, + , [ .text .file 1 "conf.c" .loc 1 1 0 discriminator 1],, @@ -4162,7 +4162,7 @@ elif test -z "$tls_first_major"; then : # If we don't have a check, assume no support. else gcc_GAS_CHECK_FEATURE(thread-local storage support, gcc_cv_as_tls, - [$tls_first_major,$tls_first_minor,0], [$tls_as_opt], [$conftest_s],, + [$tls_as_opt], [$conftest_s],, [set_have_as_tls=yes]) fi if test $set_have_as_tls = yes ; then @@ -4342,7 +4342,7 @@ AC_MSG_RESULT($gcc_cv_lto_plugin) case "$target_os" in darwin*) gcc_GAS_CHECK_FEATURE([-mmacosx-version-min option], - gcc_cv_as_mmacosx_version_min,, + gcc_cv_as_mmacosx_version_min, [-mmacosx-version-min=10.1], [.text],, [AC_DEFINE(HAVE_AS_MMACOSX_VERSION_MIN_OPTION, 1, [Define if your Mac OS X assembler supports the -mmacos-version-min option.])]) @@ -4353,7 +4353,7 @@ esac case "$target" in aarch64*-*-*) - gcc_GAS_CHECK_FEATURE([-mabi option], gcc_cv_as_aarch64_mabi,, + gcc_GAS_CHECK_FEATURE([-mabi option], gcc_cv_as_aarch64_mabi, [-mabi=lp64], [.text],,,) if test x$gcc_cv_as_aarch64_mabi = xyes; then AC_DEFINE(HAVE_AS_MABI_OPTION, 1, @@ -4380,7 +4380,7 @@ case "$target" in fi fi # Check if we have binutils support for relocations types needed by -fpic - gcc_GAS_CHECK_FEATURE([-fpic relocs], gcc_cv_as_aarch64_picreloc,,, + gcc_GAS_CHECK_FEATURE([-fpic relocs], gcc_cv_as_aarch64_picreloc,, [ .text ldr x0, [[x2, #:gotpage_lo15:globalsym]] @@ -4460,7 +4460,7 @@ AS_HELP_STRING([--disable-fix-cortex-a53-843419], # All TARGET_ABI_OSF targets. alpha*-*-linux* | alpha*-*-*bsd*) gcc_GAS_CHECK_FEATURE([explicit relocation support], - gcc_cv_as_alpha_explicit_relocs, [2,12,0],, + gcc_cv_as_alpha_explicit_relocs,, [ .set nomacro .text extbl $3, $2, $3 !lituse_bytoff!1 @@ -4477,7 +4477,7 @@ AS_HELP_STRING([--disable-fix-cortex-a53-843419], [AC_DEFINE(HAVE_AS_EXPLICIT_RELOCS, 1, [Define if your assembler supports explicit relocations.])]) gcc_GAS_CHECK_FEATURE([jsrdirect relocation support], - gcc_cv_as_alpha_jsrdirect_relocs, [2,16,90],, + gcc_cv_as_alpha_jsrdirect_relocs,, [ .set nomacro .text ldq $27, a($29) !literal!1 @@ -4487,18 +4487,18 @@ AS_HELP_STRING([--disable-fix-cortex-a53-843419], ;; avr-*-*) - gcc_GAS_CHECK_FEATURE([--mlink-relax option], gcc_cv_as_avr_mlink_relax,, + gcc_GAS_CHECK_FEATURE([--mlink-relax option], gcc_cv_as_avr_mlink_relax, [--mlink-relax], [.text],, [AC_DEFINE(HAVE_AS_AVR_MLINK_RELAX_OPTION, 1, [Define if your avr assembler supports --mlink-relax option.])]) - gcc_GAS_CHECK_FEATURE([-mrmw option], gcc_cv_as_avr_mrmw,, + gcc_GAS_CHECK_FEATURE([-mrmw option], gcc_cv_as_avr_mrmw, [-mrmw], [.text],, [AC_DEFINE(HAVE_AS_AVR_MRMW_OPTION, 1, [Define if your avr assembler supports -mrmw option.])]) gcc_GAS_CHECK_FEATURE([__gcc_isr pseudo instruction], - gcc_cv_as_avr_mgccisr,, + gcc_cv_as_avr_mgccisr, [-mgcc-isr], [.text __gcc_isr 1 __gcc_isr 2 @@ -4546,20 +4546,20 @@ EOF cris-*-*) gcc_GAS_CHECK_FEATURE([-no-mul-bug-abort option], - gcc_cv_as_cris_no_mul_bug,[2,15,91], + gcc_cv_as_cris_no_mul_bug, [-no-mul-bug-abort], [.text],, [AC_DEFINE(HAVE_AS_NO_MUL_BUG_ABORT_OPTION, 1, [Define if your assembler supports the -no-mul-bug-abort option.])]) ;; sparc*-*-*) - gcc_GAS_CHECK_FEATURE([-relax option], gcc_cv_as_sparc_relax,, + gcc_GAS_CHECK_FEATURE([-relax option], gcc_cv_as_sparc_relax, [-relax], [.text],, [AC_DEFINE(HAVE_AS_RELAX_OPTION, 1, [Define if your assembler supports -relax option.])]) gcc_GAS_CHECK_FEATURE([GOTDATA_OP relocs], - gcc_cv_as_sparc_gotdata_op,, + gcc_cv_as_sparc_gotdata_op, [-K PIC], [.text .align 4 @@ -4585,7 +4585,7 @@ bar: [Define if your assembler and linker support GOTDATA_OP relocs.])]) gcc_GAS_CHECK_FEATURE([unaligned pcrel relocs], - gcc_cv_as_sparc_ua_pcrel,, + gcc_cv_as_sparc_ua_pcrel, [-K PIC], [.text foo: @@ -4603,7 +4603,7 @@ foo: [Define if your assembler and linker support unaligned PC relative relocs.]) gcc_GAS_CHECK_FEATURE([unaligned pcrel relocs against hidden symbols], - gcc_cv_as_sparc_ua_pcrel_hidden,, + gcc_cv_as_sparc_ua_pcrel_hidden, [-K PIC], [.data .align 4 @@ -4631,7 +4631,7 @@ foo: ]) # unaligned pcrel relocs gcc_GAS_CHECK_FEATURE([offsetable %lo()], - gcc_cv_as_sparc_offsetable_lo10,, + gcc_cv_as_sparc_offsetable_lo10, [-xarch=v9], [.text or %g1, %lo(ab) + 12, %g1 @@ -4645,7 +4645,7 @@ foo: [Define if your assembler supports offsetable %lo().])]) gcc_GAS_CHECK_FEATURE([FMAF, HPC, and VIS 3.0 instructions], - gcc_cv_as_sparc_fmaf,, + gcc_cv_as_sparc_fmaf, [-xarch=v9d], [.text .register %g2, #scratch @@ -4659,7 +4659,7 @@ foo: [Define if your assembler supports FMAF, HPC, and VIS 3.0 instructions.])]) gcc_GAS_CHECK_FEATURE([SPARC4 instructions], - gcc_cv_as_sparc_sparc4,, + gcc_cv_as_sparc_sparc4, [-xarch=sparc4], [.text .register %g2, #scratch @@ -4677,7 +4677,7 @@ foo: [Define if your assembler supports SPARC4 instructions.])]) gcc_GAS_CHECK_FEATURE([SPARC5 and VIS 4.0 instructions], - gcc_cv_as_sparc_sparc5,, + gcc_cv_as_sparc_sparc5, [-xarch=sparc5], [.text .register %g2, #scratch @@ -4689,7 +4689,7 @@ foo: [Define if your assembler supports SPARC5 and VIS 4.0 instructions.])]) gcc_GAS_CHECK_FEATURE([SPARC6 instructions], - gcc_cv_as_sparc_sparc6,, + gcc_cv_as_sparc_sparc6, [-xarch=sparc6], [.text .register %g2, #scratch @@ -4701,7 +4701,7 @@ foo: [Define if your assembler supports SPARC6 instructions.])]) gcc_GAS_CHECK_FEATURE([LEON instructions], - gcc_cv_as_sparc_leon,, + gcc_cv_as_sparc_leon, [-Aleon], [.text .register %g2, #scratch @@ -4742,7 +4742,7 @@ changequote([,])dnl # definition is used unconditionally to initialise the default state of # the target option variable that governs usage of the feature. gcc_GAS_CHECK_FEATURE([.comm with alignment], gcc_cv_as_comm_has_align, - [2,19,52],,[.comm foo,1,32]) + ,[.comm foo,1,32]) AC_DEFINE_UNQUOTED(HAVE_GAS_ALIGNED_COMM, [`if test $gcc_cv_as_comm_has_align = yes; then echo 1; else echo 0; fi`], [Define if your assembler supports specifying the alignment @@ -4750,7 +4750,7 @@ changequote([,])dnl # Used for DWARF 2 in PE gcc_GAS_CHECK_FEATURE([.secrel32 relocs], gcc_cv_as_ix86_pe_secrel32, - [2,15,91],, + , [.text foo: nop .data @@ -4767,7 +4767,7 @@ foo: nop # but normally only after installation, so we warn but don't fail the # configure if LTO is enabled but the assembler does not support it. gcc_GAS_CHECK_FEATURE([.section with alignment], gcc_cv_as_section_has_align, - [2,20,1],-fatal-warnings,[.section lto_test,"dr0"]) + -fatal-warnings,[.section lto_test,"dr0"]) if test x$gcc_cv_as_section_has_align != xyes; then case ",$enable_languages," in *,lto,*) @@ -4787,50 +4787,50 @@ foo: nop ;; esac - gcc_GAS_CHECK_FEATURE([-xbrace_comment], gcc_cv_as_ix86_xbrace_comment,, + gcc_GAS_CHECK_FEATURE([-xbrace_comment], gcc_cv_as_ix86_xbrace_comment, [-xbrace_comment=no], [.text],, [AC_DEFINE(HAVE_AS_XBRACE_COMMENT_OPTION, 1, [Define if your assembler supports -xbrace_comment option.])]) gcc_GAS_CHECK_FEATURE([filds and fists mnemonics], - gcc_cv_as_ix86_filds,,, + gcc_cv_as_ix86_filds,, [filds (%ebp); fists (%ebp)],, [AC_DEFINE(HAVE_AS_IX86_FILDS, 1, [Define if your assembler uses filds and fists mnemonics.])]) gcc_GAS_CHECK_FEATURE([fildq and fistpq mnemonics], - gcc_cv_as_ix86_fildq,,, + gcc_cv_as_ix86_fildq,, [fildq (%ebp); fistpq (%ebp)],, [AC_DEFINE(HAVE_AS_IX86_FILDQ, 1, [Define if your assembler uses fildq and fistq mnemonics.])]) gcc_GAS_CHECK_FEATURE([cmov syntax], - gcc_cv_as_ix86_cmov_sun_syntax,,, + gcc_cv_as_ix86_cmov_sun_syntax,, [cmovl.l %edx, %eax],, [AC_DEFINE(HAVE_AS_IX86_CMOV_SUN_SYNTAX, 1, [Define if your assembler supports the Sun syntax for cmov.])]) gcc_GAS_CHECK_FEATURE([ffreep mnemonic], - gcc_cv_as_ix86_ffreep,,, + gcc_cv_as_ix86_ffreep,, [ffreep %st(1)],, [AC_DEFINE(HAVE_AS_IX86_FFREEP, 1, [Define if your assembler supports the ffreep mnemonic.])]) gcc_GAS_CHECK_FEATURE([.quad directive], - gcc_cv_as_ix86_quad,,, + gcc_cv_as_ix86_quad,, [.quad 0],, [AC_DEFINE(HAVE_AS_IX86_QUAD, 1, [Define if your assembler supports the .quad directive.])]) gcc_GAS_CHECK_FEATURE([sahf mnemonic], - gcc_cv_as_ix86_sahf,,, + gcc_cv_as_ix86_sahf,, [.code64 sahf],, [AC_DEFINE(HAVE_AS_IX86_SAHF, 1, [Define if your assembler supports the sahf mnemonic in 64bit mode.])]) gcc_GAS_CHECK_FEATURE([interunit movq mnemonic], - gcc_cv_as_ix86_interunit_movq,,, + gcc_cv_as_ix86_interunit_movq,, [.code64 movq %mm0, %rax movq %rax, %xmm0]) @@ -4839,19 +4839,19 @@ foo: nop [Define if your assembler supports interunit movq mnemonic.]) gcc_GAS_CHECK_FEATURE([hle prefixes], - gcc_cv_as_ix86_hle,,, + gcc_cv_as_ix86_hle,, [lock xacquire cmpxchg %esi, (%ecx)],, [AC_DEFINE(HAVE_AS_IX86_HLE, 1, [Define if your assembler supports HLE prefixes.])]) gcc_GAS_CHECK_FEATURE([swap suffix], - gcc_cv_as_ix86_swap,,, + gcc_cv_as_ix86_swap,, [movl.s %esp, %ebp],, [AC_DEFINE(HAVE_AS_IX86_SWAP, 1, [Define if your assembler supports the swap suffix.])]) gcc_GAS_CHECK_FEATURE([different section symbol subtraction], - gcc_cv_as_ix86_diff_sect_delta,,, + gcc_cv_as_ix86_diff_sect_delta,, [.section .rodata .L1: .long .L2-.L1 @@ -4863,7 +4863,7 @@ foo: nop [Define if your assembler supports the subtraction of symbols in different sections.])]) gcc_GAS_CHECK_FEATURE([rep and lock prefix], - gcc_cv_as_ix86_rep_lock_prefix,,, + gcc_cv_as_ix86_rep_lock_prefix,, [rep movsl rep ret rep nop @@ -4875,7 +4875,7 @@ foo: nop [Define if the assembler supports 'rep , lock '.])]) gcc_GAS_CHECK_FEATURE([ud2 mnemonic], - gcc_cv_as_ix86_ud2,,, + gcc_cv_as_ix86_ud2,, [ud2],, [AC_DEFINE(HAVE_AS_IX86_UD2, 1, [Define if your assembler supports the 'ud2' mnemonic.])]) @@ -4893,7 +4893,7 @@ foo: nop fi gcc_GAS_CHECK_FEATURE([R_386_TLS_GD_PLT reloc], - gcc_cv_as_ix86_tlsgdplt,, + gcc_cv_as_ix86_tlsgdplt, [$as_ix86_gas_32_opt], [call tls_gd@tlsgdplt], [if test x$gcc_cv_ld != x \ @@ -4911,7 +4911,7 @@ tls_ld: call tls_ld@tlsldmplt' gcc_GAS_CHECK_FEATURE([R_386_TLS_LDM_PLT reloc], - gcc_cv_as_ix86_tlsldmplt,, + gcc_cv_as_ix86_tlsldmplt, [$as_ix86_gas_32_opt], [$conftest_s], [if test x$gcc_cv_ld != x \ @@ -4935,7 +4935,7 @@ _start: .type value, @object value:' gcc_GAS_CHECK_FEATURE([R_386_TLS_LDM reloc], - gcc_cv_as_ix86_tlsldm,, + gcc_cv_as_ix86_tlsldm, [$as_ix86_gas_32_opt], [$conftest_s], [if test x$gcc_cv_ld != x && test x$gcc_cv_objdump != x \ @@ -4960,7 +4960,7 @@ _start: cmpl $0, bar@GOT jmp *_start@GOT' gcc_GAS_CHECK_FEATURE([R_386_GOT32X reloc], - gcc_cv_as_ix86_got32x,, + gcc_cv_as_ix86_got32x, [$as_ix86_gas_32_opt], [$conftest_s], [if test x$gcc_cv_ld != x && test x$gcc_cv_objdump != x \ @@ -4981,7 +4981,7 @@ _start: [Define 0/1 if your assembler and linker support @GOT.]) gcc_GAS_CHECK_FEATURE([GOTOFF in data], - gcc_cv_as_ix86_gotoff_in_data, [2,11,0], + gcc_cv_as_ix86_gotoff_in_data, [$as_ix86_gas_32_opt], [ .text .L0: @@ -5011,7 +5011,7 @@ ld: gd: .byte 0' gcc_GAS_CHECK_FEATURE([calling ___tls_get_addr via GOT], - gcc_cv_as_ix86_tls_get_addr_via_got,, + gcc_cv_as_ix86_tls_get_addr_via_got, [$as_ix86_gas_32_opt], [$conftest_s], [if test x$gcc_cv_ld != x \ @@ -5026,7 +5026,7 @@ gd: ia64*-*-*) gcc_GAS_CHECK_FEATURE([ltoffx and ldxmov relocs], - gcc_cv_as_ia64_ltoffx_ldxmov_relocs, [2,14,0],, + gcc_cv_as_ia64_ltoffx_ldxmov_relocs,, [ .text addl r15 = @ltoffx(x#), gp ;; @@ -5042,7 +5042,7 @@ gd: case $target in *-*-darwin*) gcc_GAS_CHECK_FEATURE([.machine directive support], - gcc_cv_as_machine_directive,,, + gcc_cv_as_machine_directive,, [ .machine ppc7400]) if test x$gcc_cv_as_machine_directive != xyes; then echo "*** This target requires an assembler supporting \".machine\"" >&2 @@ -5064,7 +5064,7 @@ gd: esac gcc_GAS_CHECK_FEATURE([mfcr field support], - gcc_cv_as_powerpc_mfcrf, [2,14,0],, + gcc_cv_as_powerpc_mfcrf,, [$conftest_s],, [AC_DEFINE(HAVE_AS_MFCRF, 1, [Define if your assembler supports mfcr field.])]) @@ -5083,7 +5083,7 @@ LCF0: esac gcc_GAS_CHECK_FEATURE([rel16 relocs], - gcc_cv_as_powerpc_rel16, [2,17,0], -a32, + gcc_cv_as_powerpc_rel16, -a32, [$conftest_s],, [AC_DEFINE(HAVE_AS_REL16, 1, [Define if your assembler supports R_PPC_REL16 relocs.])]) @@ -5098,25 +5098,25 @@ LCF0: esac gcc_GAS_CHECK_FEATURE([vector-scalar support], - gcc_cv_as_powerpc_vsx, [2,19,2], -a32, + gcc_cv_as_powerpc_vsx, -a32, [$conftest_s],, [AC_DEFINE(HAVE_AS_VSX, 1, [Define if your assembler supports VSX instructions.])]) gcc_GAS_CHECK_FEATURE([.gnu_attribute support], - gcc_cv_as_powerpc_gnu_attribute, [2,18,0],, + gcc_cv_as_powerpc_gnu_attribute,, [.gnu_attribute 4,1],, [AC_DEFINE(HAVE_AS_GNU_ATTRIBUTE, 1, [Define if your assembler supports .gnu_attribute.])]) gcc_GAS_CHECK_FEATURE([prologue entry point marker support], - gcc_cv_as_powerpc_entry_markers, [2,26,0],-a64 --fatal-warnings, + gcc_cv_as_powerpc_entry_markers,-a64 --fatal-warnings, [ .reloc .,R_PPC64_ENTRY; nop],, [AC_DEFINE(HAVE_AS_ENTRY_MARKERS, 1, [Define if your assembler supports the R_PPC64_ENTRY relocation.])]) gcc_GAS_CHECK_FEATURE([plt sequence marker support], - gcc_cv_as_powerpc_pltseq_markers, [2,31,0],-a32 --fatal-warnings, + gcc_cv_as_powerpc_pltseq_markers,-a32 --fatal-warnings, [ .reloc .,R_PPC_PLTSEQ; nop],, [AC_DEFINE(HAVE_AS_PLTSEQ, 1, [Define if your assembler supports R_PPC*_PLTSEQ relocations.])]) @@ -5124,7 +5124,7 @@ LCF0: case $target in *-*-aix*) gcc_GAS_CHECK_FEATURE([AIX .ref support], - gcc_cv_as_aix_ref, [2,21,0],, + gcc_cv_as_aix_ref,, [ .csect stuff[[rw]] stuff: .long 1 @@ -5135,7 +5135,7 @@ LCF0: [Define if your assembler supports .ref])]) gcc_GAS_CHECK_FEATURE([AIX DWARF location lists section support], - gcc_cv_as_aix_dwloc, [2,21,0],, + gcc_cv_as_aix_dwloc,, [ .dwsect 0xA0000 Lframe..0: .vbyte 4,Lframe..0 @@ -5148,7 +5148,7 @@ LCF0: mips*-*-*) gcc_GAS_CHECK_FEATURE([explicit relocation support], - gcc_cv_as_mips_explicit_relocs, [2,14,0],, + gcc_cv_as_mips_explicit_relocs,, [ lw $4,%gp_rel(foo)($4)],, [if test x$target_cpu_default = x then target_cpu_default=MASK_EXPLICIT_RELOCS @@ -5156,18 +5156,18 @@ LCF0: fi]) gcc_GAS_CHECK_FEATURE([-mno-shared support], - gcc_cv_as_mips_no_shared, [2,16,0], [-mno-shared], [nop],, + gcc_cv_as_mips_no_shared,[-mno-shared], [nop],, [AC_DEFINE(HAVE_AS_NO_SHARED, 1, [Define if the assembler understands -mno-shared.])]) gcc_GAS_CHECK_FEATURE([.gnu_attribute support], - gcc_cv_as_mips_gnu_attribute, [2,18,0],, + gcc_cv_as_mips_gnu_attribute,, [.gnu_attribute 4,1],, [AC_DEFINE(HAVE_AS_GNU_ATTRIBUTE, 1, [Define if your assembler supports .gnu_attribute.])]) gcc_GAS_CHECK_FEATURE([.module support], - gcc_cv_as_mips_dot_module,,[-32], + gcc_cv_as_mips_dot_module,[-32], [.module mips2 .module fp=xx],, [AC_DEFINE(HAVE_AS_DOT_MODULE, 1, @@ -5179,13 +5179,13 @@ LCF0: fi gcc_GAS_CHECK_FEATURE([.micromips support], - gcc_cv_as_micromips_support,,[--fatal-warnings], + gcc_cv_as_micromips_support,[--fatal-warnings], [.set micromips],, [AC_DEFINE(HAVE_GAS_MICROMIPS, 1, [Define if your assembler supports the .set micromips directive])]) gcc_GAS_CHECK_FEATURE([.dtprelword support], - gcc_cv_as_mips_dtprelword, [2,18,0],, + gcc_cv_as_mips_dtprelword,, [.section .tdata,"awT",@progbits x: .word 2 @@ -5195,7 +5195,7 @@ x: [Define if your assembler supports .dtprelword.])]) gcc_GAS_CHECK_FEATURE([DSPR1 mult with four accumulators support], - gcc_cv_as_mips_dspr1_mult,,, + gcc_cv_as_mips_dspr1_mult,, [ .set mips32r2 .set nodspr2 .set dsp @@ -5290,7 +5290,7 @@ pointers into PC-relative form.]) fi gcc_GAS_CHECK_FEATURE([-mnan= support], - gcc_cv_as_mips_nan,, + gcc_cv_as_mips_nan, [-mnan=2008],,, [AC_DEFINE(HAVE_AS_NAN, 1, [Define if the assembler understands -mnan=.])]) @@ -5304,12 +5304,12 @@ pointers into PC-relative form.]) # Earlier GAS versions generically support .gnu_attribute, but the # msp430 assembler will not do anything with it. gcc_GAS_CHECK_FEATURE([.gnu_attribute support], - gcc_cv_as_msp430_gnu_attribute, [2,33,50],, + gcc_cv_as_msp430_gnu_attribute,, [.gnu_attribute 4,1],, [AC_DEFINE(HAVE_AS_GNU_ATTRIBUTE, 1, [Define if your assembler supports .gnu_attribute.])]) gcc_GAS_CHECK_FEATURE([.mspabi_attribute support], - gcc_cv_as_msp430_mspabi_attribute, [2,33,50],, + gcc_cv_as_msp430_mspabi_attribute,, [.mspabi_attribute 4,2],, [AC_DEFINE(HAVE_AS_MSPABI_ATTRIBUTE, 1, [Define if your assembler supports .mspabi_attribute.])]) @@ -5322,7 +5322,7 @@ configured with --enable-newlib-nano-formatted-io.]) # Versions 2.33 and earlier lacked support for the %gotoff relocation # syntax that is documented in the ABI specification. gcc_GAS_CHECK_FEATURE([support for %gotoff relocations in constant data], - gcc_cv_as_nios2_gotoff_relocation,,, + gcc_cv_as_nios2_gotoff_relocation,, [ .extern foo .data .long %gotoff(foo)],, @@ -5331,29 +5331,29 @@ configured with --enable-newlib-nano-formatted-io.]) ;; riscv*-*-*) gcc_GAS_CHECK_FEATURE([.attribute support], - gcc_cv_as_riscv_attribute, [2,32,0],, + gcc_cv_as_riscv_attribute,, [.attribute stack_align,4],, [AC_DEFINE(HAVE_AS_RISCV_ATTRIBUTE, 1, [Define if your assembler supports .attribute.])]) gcc_GAS_CHECK_FEATURE([-misa-spec= support], - gcc_cv_as_riscv_isa_spec,, + gcc_cv_as_riscv_isa_spec, [-misa-spec=2.2],,, [AC_DEFINE(HAVE_AS_MISA_SPEC, 1, [Define if the assembler understands -misa-spec=.])]) gcc_GAS_CHECK_FEATURE([-march=rv32i_zifencei support], - gcc_cv_as_riscv_march_zifencei,, + gcc_cv_as_riscv_march_zifencei, [-march=rv32i_zifencei],,, [AC_DEFINE(HAVE_AS_MARCH_ZIFENCEI, 1, [Define if the assembler understands -march=rv*_zifencei.])]) ;; s390*-*-*) gcc_GAS_CHECK_FEATURE([.gnu_attribute support], - gcc_cv_as_s390_gnu_attribute, [2,18,0],, + gcc_cv_as_s390_gnu_attribute,, [.gnu_attribute 8,1],, [AC_DEFINE(HAVE_AS_GNU_ATTRIBUTE, 1, [Define if your assembler supports .gnu_attribute.])]) gcc_GAS_CHECK_FEATURE([.machine and .machinemode support], - gcc_cv_as_s390_machine_machinemode, [2,24,0],, + gcc_cv_as_s390_machine_machinemode,, [ .machinemode push .machinemode pop .machine push @@ -5361,17 +5361,17 @@ configured with --enable-newlib-nano-formatted-io.]) [AC_DEFINE(HAVE_AS_MACHINE_MACHINEMODE, 1, [Define if your assembler supports .machine and .machinemode.])]) gcc_GAS_CHECK_FEATURE([architecture modifiers support], - gcc_cv_as_s390_architecture_modifiers, [2,26,0],, + gcc_cv_as_s390_architecture_modifiers,, [ .machine z13+vx ],, [AC_DEFINE(HAVE_AS_ARCHITECTURE_MODIFIERS, 1, [Define if your assembler supports architecture modifiers.])]) gcc_GAS_CHECK_FEATURE([vector load/store alignment hints], - gcc_cv_as_s390_vector_loadstore_alignment_hints, [2,31,0],, + gcc_cv_as_s390_vector_loadstore_alignment_hints,, [ vl %v24,0(%r15),3 ],, [AC_DEFINE(HAVE_AS_VECTOR_LOADSTORE_ALIGNMENT_HINTS, 1, [Define if your assembler supports vl/vst/vlm/vstm with an optional alignment hint argument.])]) gcc_GAS_CHECK_FEATURE([vector load/store alignment hints on z13], - gcc_cv_as_s390_vector_loadstore_alignment_hints_on_z13,, [-mzarch -march=z13], + gcc_cv_as_s390_vector_loadstore_alignment_hints_on_z13, [-mzarch -march=z13], [ vl %v24,0(%r15),3 ],, [AC_DEFINE(HAVE_AS_VECTOR_LOADSTORE_ALIGNMENT_HINTS_ON_Z13, 1, [Define if your assembler supports vl/vst/vlm/vstm with an optional alignment hint argument on z13.])]) @@ -5473,7 +5473,7 @@ if test x"$insn" != x; then $insn" gcc_GAS_CHECK_FEATURE([dwarf2 debug_line support], gcc_cv_as_dwarf2_debug_line, - [elf,2,11,0],, [$conftest_s], + , [$conftest_s], [if test x$gcc_cv_objdump != x \ && $gcc_cv_objdump -h conftest.o 2> /dev/null \ | grep debug_line > /dev/null 2>&1; then @@ -5489,7 +5489,7 @@ if test x"$insn" != x; then # by DW_AT_decl_file. Approximate this test by testing if # the assembler bitches if the same index is assigned twice. gcc_GAS_CHECK_FEATURE([buggy dwarf2 .file directive], - gcc_cv_as_dwarf2_file_buggy,,, + gcc_cv_as_dwarf2_file_buggy,, [ .file 1 "foo.s" .file 1 "bar.s"]) @@ -5510,7 +5510,7 @@ if test x"$insn" != x; then " gcc_GAS_CHECK_FEATURE([dwarf2 debug_view support], gcc_cv_as_dwarf2_debug_view, - [elf,2,27,0],,[$conftest_s],, + ,[$conftest_s],, [AC_DEFINE(HAVE_AS_DWARF2_DEBUG_VIEW, 1, [Define if your assembler supports views in dwarf2 .loc directives.])]) fi @@ -5518,13 +5518,13 @@ if test x"$insn" != x; then gcc_GAS_CHECK_FEATURE([--gdwarf2 option], gcc_cv_as_gdwarf2_flag, - [elf,2,11,0], [--gdwarf2], [$insn],, + [--gdwarf2], [$insn],, [AC_DEFINE(HAVE_AS_GDWARF2_DEBUG_FLAG, 1, [Define if your assembler supports the --gdwarf2 option.])]) gcc_GAS_CHECK_FEATURE([--gdwarf-5 option], gcc_cv_as_gdwarf_5_flag, - [elf,2,36,0], [--gdwarf-5], [$insn], + [--gdwarf-5], [$insn], [if test x$gcc_cv_objdump != x \ && $gcc_cv_objdump -Wi conftest.o 2>&1 \ | grep DW_TAG_compile_unit > /dev/null 2>&1; then @@ -5702,19 +5702,19 @@ foo: if test $dwarf4_addr_size = 4; then gcc_GAS_CHECK_FEATURE([assembly of compiler generated 32-bit .debug_line], gcc_cv_as_debug_line_32_flag, - [elf,2,36,0], [], [$conftest_s],, + [], [$conftest_s],, [dwarf4_success=yes]) else gcc_GAS_CHECK_FEATURE([assembly of compiler generated 64-bit .debug_line], gcc_cv_as_debug_line_64_flag, - [elf,2,36,0], [], [$conftest_s],, + [], [$conftest_s],, [dwarf4_success=yes]) fi if test $dwarf4_success = yes; then dwarf4_success=no gcc_GAS_CHECK_FEATURE([--gdwarf-4 not refusing compiler generated .debug_line], gcc_cv_as_dwarf_4_debug_line_flag, - [elf,2,36,0], [--gdwarf-4], [$conftest_s],, + [--gdwarf-4], [$conftest_s],, [dwarf4_success=yes]) break fi @@ -5743,7 +5743,7 @@ foo: " dwarf4_success=no gcc_GAS_CHECK_FEATURE([--gdwarf-4 with the APP marker], - gcc_cv_as_dwarf_4_app_flag,, + gcc_cv_as_dwarf_4_app_flag, [--gdwarf-4], [$conftest_s],, [dwarf4_success=yes]) fi @@ -5758,7 +5758,7 @@ foo: .file 1 \"foo.c\" " gcc_GAS_CHECK_FEATURE([working --gdwarf-4/--gdwarf-5 for all sources], - gcc_cv_as_working_gdwarf_n_flag,, + gcc_cv_as_working_gdwarf_n_flag, [--gdwarf-4], [$conftest_s], [changequote(,)dnl @@ -5779,19 +5779,19 @@ foo: gcc_GAS_CHECK_FEATURE([--gstabs option], gcc_cv_as_gstabs_flag, - [elf,2,11,0], [--gstabs], [$insn],, + [--gstabs], [$insn],, [AC_DEFINE(HAVE_AS_GSTABS_DEBUG_FLAG, 1, [Define if your assembler supports the --gstabs option.])]) gcc_GAS_CHECK_FEATURE([--debug-prefix-map option], gcc_cv_as_debug_prefix_map_flag, - [2,18,0], [--debug-prefix-map /a=/b], [$insn],, + [--debug-prefix-map /a=/b], [$insn],, [AC_DEFINE(HAVE_AS_DEBUG_PREFIX_MAP, 1, [Define if your assembler supports the --debug-prefix-map option.])]) fi gcc_GAS_CHECK_FEATURE([compressed debug sections], - gcc_cv_as_compress_debug,,,, + gcc_cv_as_compress_debug,,, [# gas compiled without zlib cannot compress debug sections and warns # about it, but still exits successfully. So check for this, too. if $gcc_cv_as --compress-debug-sections -o conftest.o conftest.s 2>&1 | grep -i warning > /dev/null @@ -5822,7 +5822,7 @@ AC_DEFINE_UNQUOTED(AS_NO_COMPRESS_DEBUG_OPTION, "$gcc_cv_as_no_compress_debug_op [Define to the assembler option to disable compressed debug sections.]) gcc_GAS_CHECK_FEATURE([.lcomm with alignment], gcc_cv_as_lcomm_with_alignment, - ,, + , [.lcomm bar,4,16],, [AC_DEFINE(HAVE_GAS_LCOMM_WITH_ALIGNMENT, 1, [Define if your assembler supports .lcomm with an alignment field.])]) @@ -5868,7 +5868,7 @@ AC_ARG_ENABLE(gnu-unique-object, Valid choices are 'yes' and 'no'.]) ;; esac], [gcc_GAS_CHECK_FEATURE([gnu_unique_object], gcc_cv_as_gnu_unique_object, - [elf,2,19,52],, + , [.type foo, '$target_type_format_char'gnu_unique_object],, # We need to unquote above to to use the definition from config.gcc. # Also check for ld.so support, i.e. glibc 2.11 or higher. -- cgit v1.1 From 1918f4b7ac5089eeb97c65954a8bc466e8139691 Mon Sep 17 00:00:00 2001 From: Serge Belyshev Date: Tue, 20 Jul 2021 10:34:08 +0300 Subject: configure: fixup formatting from previous change gcc/ChangeLog: * configure.ac: Fixup formatting. --- gcc/configure.ac | 71 +++++++++++++++++++++----------------------------------- 1 file changed, 27 insertions(+), 44 deletions(-) (limited to 'gcc') diff --git a/gcc/configure.ac b/gcc/configure.ac index bc24648d..393a2ba 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -2883,28 +2883,24 @@ case "$ORIGINAL_DSYMUTIL_FOR_TARGET" in esac # Figure out what assembler alignment features are present. -gcc_GAS_CHECK_FEATURE([.balign and .p2align], gcc_cv_as_balign_and_p2align, - , +gcc_GAS_CHECK_FEATURE([.balign and .p2align], gcc_cv_as_balign_and_p2align,, [.balign 4 .p2align 2],, [AC_DEFINE(HAVE_GAS_BALIGN_AND_P2ALIGN, 1, [Define if your assembler supports .balign and .p2align.])]) -gcc_GAS_CHECK_FEATURE([.p2align with maximum skip], gcc_cv_as_max_skip_p2align, - , +gcc_GAS_CHECK_FEATURE([.p2align with maximum skip], gcc_cv_as_max_skip_p2align,, [.p2align 4,,7],, [AC_DEFINE(HAVE_GAS_MAX_SKIP_P2ALIGN, 1, [Define if your assembler supports specifying the maximum number of bytes to skip when using the GAS .p2align command.])]) -gcc_GAS_CHECK_FEATURE([.literal16], gcc_cv_as_literal16, - , +gcc_GAS_CHECK_FEATURE([.literal16], gcc_cv_as_literal16,, [.literal16],, [AC_DEFINE(HAVE_GAS_LITERAL16, 1, [Define if your assembler supports .literal16.])]) -gcc_GAS_CHECK_FEATURE([working .subsection -1], gcc_cv_as_subsection_m1, - , +gcc_GAS_CHECK_FEATURE([working .subsection -1], gcc_cv_as_subsection_m1,, [conftest_label1: .word 0 .subsection -1 conftest_label2: .word 0 @@ -2922,18 +2918,15 @@ conftest_label2: .word 0 [Define if your assembler supports .subsection and .subsection -1 starts emitting at the beginning of your section.])]) -gcc_GAS_CHECK_FEATURE([.weak], gcc_cv_as_weak, - , +gcc_GAS_CHECK_FEATURE([.weak], gcc_cv_as_weak,, [ .weak foobar],, [AC_DEFINE(HAVE_GAS_WEAK, 1, [Define if your assembler supports .weak.])]) -gcc_GAS_CHECK_FEATURE([.weakref], gcc_cv_as_weakref, - , +gcc_GAS_CHECK_FEATURE([.weakref], gcc_cv_as_weakref,, [ .weakref foobar, barfnot],, [AC_DEFINE(HAVE_GAS_WEAKREF, 1, [Define if your assembler supports .weakref.])]) -gcc_GAS_CHECK_FEATURE([.nsubspa comdat], gcc_cv_as_nsubspa_comdat, - , +gcc_GAS_CHECK_FEATURE([.nsubspa comdat], gcc_cv_as_nsubspa_comdat,, [ .SPACE $TEXT$ .NSUBSPA $CODE$,COMDAT],, [AC_DEFINE(HAVE_GAS_NSUBSPA_COMDAT, 1, [Define if your assembler supports .nsubspa comdat option.])]) @@ -2954,8 +2947,7 @@ case "${target}" in foobar:' ;; esac -gcc_GAS_CHECK_FEATURE([.hidden], gcc_cv_as_hidden, - , [$conftest_s]) +gcc_GAS_CHECK_FEATURE([.hidden], gcc_cv_as_hidden,, [$conftest_s]) case "${target}" in *-*-darwin*) # Darwin as has some visibility support, though with a different syntax. @@ -3173,8 +3165,7 @@ gcc_AC_INITFINI_ARRAY # Check if we have .[us]leb128, and support symbol arithmetic with it. # Older versions of GAS and some non-GNU assemblers, have a bugs handling # these directives, even when they appear to accept them. -gcc_GAS_CHECK_FEATURE([.sleb128 and .uleb128], gcc_cv_as_leb128, - , +gcc_GAS_CHECK_FEATURE([.sleb128 and .uleb128], gcc_cv_as_leb128,, [ .data .uleb128 L2 - L1 L1: @@ -3212,8 +3203,7 @@ gcc_fn_eh_frame_ro () { } # Check if we have assembler support for unwind directives. -gcc_GAS_CHECK_FEATURE([cfi directives], gcc_cv_as_cfi_directive, - , +gcc_GAS_CHECK_FEATURE([cfi directives], gcc_cv_as_cfi_directive,, [ .text .cfi_startproc .cfi_offset 0, 0 @@ -3268,8 +3258,7 @@ gcc_GAS_CHECK_FEATURE([cfi directives], gcc_cv_as_cfi_directive, ;; esac]) if test $gcc_cv_as_cfi_directive = yes && test x$gcc_cv_objdump != x; then -gcc_GAS_CHECK_FEATURE([working cfi advance], gcc_cv_as_cfi_advance_working, - , +gcc_GAS_CHECK_FEATURE([working cfi advance], gcc_cv_as_cfi_advance_working,, [ .text .cfi_startproc .cfi_adjust_cfa_offset 64 @@ -3332,8 +3321,7 @@ AC_DEFINE_UNQUOTED(HAVE_GAS_CFI_SECTIONS_DIRECTIVE, # GAS versions up to and including 2.11.0 may mis-optimize # .eh_frame data. -gcc_GAS_CHECK_FEATURE(eh_frame optimization, gcc_cv_as_eh_frame, - , +gcc_GAS_CHECK_FEATURE(eh_frame optimization, gcc_cv_as_eh_frame,, [ .text .LFB1: .4byte 0 @@ -3636,8 +3624,7 @@ case "${target}" in esac gcc_GAS_CHECK_FEATURE([line table is_stmt support], - gcc_cv_as_is_stmt, - , + gcc_cv_as_is_stmt,, [ .text .file 1 "conf.c" .loc 1 1 0 is_stmt 1],, @@ -3645,8 +3632,7 @@ gcc_GAS_CHECK_FEATURE([line table is_stmt support], [Define if your assembler supports the .loc is_stmt sub-directive.])]) gcc_GAS_CHECK_FEATURE([line table discriminator support], - gcc_cv_as_discriminator, - , + gcc_cv_as_discriminator,, [ .text .file 1 "conf.c" .loc 1 1 0 discriminator 1],, @@ -4741,16 +4727,15 @@ changequote([,])dnl # Recent binutils allows the three-operand form of ".comm" on PE. This # definition is used unconditionally to initialise the default state of # the target option variable that governs usage of the feature. - gcc_GAS_CHECK_FEATURE([.comm with alignment], gcc_cv_as_comm_has_align, - ,[.comm foo,1,32]) + gcc_GAS_CHECK_FEATURE([.comm with alignment], gcc_cv_as_comm_has_align,, + [.comm foo,1,32]) AC_DEFINE_UNQUOTED(HAVE_GAS_ALIGNED_COMM, [`if test $gcc_cv_as_comm_has_align = yes; then echo 1; else echo 0; fi`], [Define if your assembler supports specifying the alignment of objects allocated using the GAS .comm command.]) # Used for DWARF 2 in PE gcc_GAS_CHECK_FEATURE([.secrel32 relocs], - gcc_cv_as_ix86_pe_secrel32, - , + gcc_cv_as_ix86_pe_secrel32,, [.text foo: nop .data @@ -5472,8 +5457,8 @@ if test x"$insn" != x; then .loc 1 3 0 $insn" gcc_GAS_CHECK_FEATURE([dwarf2 debug_line support], - gcc_cv_as_dwarf2_debug_line, - , [$conftest_s], + gcc_cv_as_dwarf2_debug_line,, + [$conftest_s], [if test x$gcc_cv_objdump != x \ && $gcc_cv_objdump -h conftest.o 2> /dev/null \ | grep debug_line > /dev/null 2>&1; then @@ -5509,8 +5494,8 @@ if test x"$insn" != x; then .uleb128 .LVU1 " gcc_GAS_CHECK_FEATURE([dwarf2 debug_view support], - gcc_cv_as_dwarf2_debug_view, - ,[$conftest_s],, + gcc_cv_as_dwarf2_debug_view,, + [$conftest_s],, [AC_DEFINE(HAVE_AS_DWARF2_DEBUG_VIEW, 1, [Define if your assembler supports views in dwarf2 .loc directives.])]) fi @@ -5701,13 +5686,13 @@ foo: dwarf4_success=no if test $dwarf4_addr_size = 4; then gcc_GAS_CHECK_FEATURE([assembly of compiler generated 32-bit .debug_line], - gcc_cv_as_debug_line_32_flag, - [], [$conftest_s],, + gcc_cv_as_debug_line_32_flag,, + [$conftest_s],, [dwarf4_success=yes]) else gcc_GAS_CHECK_FEATURE([assembly of compiler generated 64-bit .debug_line], - gcc_cv_as_debug_line_64_flag, - [], [$conftest_s],, + gcc_cv_as_debug_line_64_flag,, + [$conftest_s],, [dwarf4_success=yes]) fi if test $dwarf4_success = yes; then @@ -5821,8 +5806,7 @@ AC_DEFINE_UNQUOTED(AS_COMPRESS_DEBUG_OPTION, "$gcc_cv_as_compress_debug_option", AC_DEFINE_UNQUOTED(AS_NO_COMPRESS_DEBUG_OPTION, "$gcc_cv_as_no_compress_debug_option", [Define to the assembler option to disable compressed debug sections.]) -gcc_GAS_CHECK_FEATURE([.lcomm with alignment], gcc_cv_as_lcomm_with_alignment, - , +gcc_GAS_CHECK_FEATURE([.lcomm with alignment], gcc_cv_as_lcomm_with_alignment,, [.lcomm bar,4,16],, [AC_DEFINE(HAVE_GAS_LCOMM_WITH_ALIGNMENT, 1, [Define if your assembler supports .lcomm with an alignment field.])]) @@ -5867,8 +5851,7 @@ AC_ARG_ENABLE(gnu-unique-object, *) AC_MSG_ERROR(['$enable_gnu_unique_object' is an invalid value for --enable-gnu-unique-object. Valid choices are 'yes' and 'no'.]) ;; esac], - [gcc_GAS_CHECK_FEATURE([gnu_unique_object], gcc_cv_as_gnu_unique_object, - , + [gcc_GAS_CHECK_FEATURE([gnu_unique_object], gcc_cv_as_gnu_unique_object,, [.type foo, '$target_type_format_char'gnu_unique_object],, # We need to unquote above to to use the definition from config.gcc. # Also check for ld.so support, i.e. glibc 2.11 or higher. -- cgit v1.1 From 9b24c20cb3af3a917cd7bf804e08ac3ef9defb10 Mon Sep 17 00:00:00 2001 From: Serge Belyshev Date: Tue, 20 Jul 2021 10:12:57 +0300 Subject: configure: remove gas versions from tls check gcc/ChangeLog: * configure.ac (thread-local storage support): Remove tls_first_major and tls_first_minor. Use "$conftest_s" to check support. * configure: Regenerate. --- gcc/configure | 58 +------------------------------------------------------- gcc/configure.ac | 58 +------------------------------------------------------- 2 files changed, 2 insertions(+), 114 deletions(-) (limited to 'gcc') diff --git a/gcc/configure b/gcc/configure index 97395ed..500e3f6 100755 --- a/gcc/configure +++ b/gcc/configure @@ -25191,8 +25191,6 @@ fi # Thread-local storage - the check is heavily parameterized. conftest_s= -tls_first_major= -tls_first_minor= tls_as_opt= case "$target" in alpha*-*-*) @@ -25214,15 +25212,11 @@ foo: .long 25 ldah $2,foo($29) !tprelhi lda $3,foo($2) !tprello lda $4,foo($29) !tprel' - tls_first_major=2 - tls_first_minor=13 tls_as_opt=--fatal-warnings ;; arc*-*-*) conftest_s=' add_s r0,r0, @foo@tpoff' - tls_first_major=2 - tls_first_minor=23 ;; cris-*-*|crisv32-*-*) conftest_s=' @@ -25231,8 +25225,6 @@ x: .long 25 .text move.d x:IE,$r10 nop' - tls_first_major=2 - tls_first_minor=20 tls_as_opt=--fatal-warnings ;; frv*-*-*) @@ -25241,8 +25233,6 @@ x: .long 25 x: .long 25 .text call #gettlsoff(x)' - tls_first_major=2 - tls_first_minor=14 ;; hppa*-*-linux*) conftest_s=' @@ -25269,8 +25259,6 @@ foo: .long 25 mfctl %cr27,%t1 addil LR%foo-$tls_leoff$,%t1 ldo RR%foo-$tls_leoff$(%r1),%t2' - tls_first_major=2 - tls_first_minor=15 tls_as_opt=--fatal-warnings ;; arm*-*-*) @@ -25283,8 +25271,6 @@ foo: .long 25 .word foo(tlsgd) .word foo(tlsldm) .word foo(tlsldo)' - tls_first_major=2 - tls_first_minor=17 ;; i[34567]86-*-* | x86_64-*-*) case "$target" in @@ -25298,8 +25284,6 @@ foo: .long 25 if test x$on_solaris = xyes && test x$gas_flag = xno; then conftest_s=' .section .tdata,"awt",@progbits' - tls_first_major=0 - tls_first_minor=0 tls_section_flag=t $as_echo "#define TLS_SECTION_ASM_FLAG 't'" >>confdefs.h @@ -25307,8 +25291,6 @@ $as_echo "#define TLS_SECTION_ASM_FLAG 't'" >>confdefs.h else conftest_s=' .section ".tdata","awT",@progbits' - tls_first_major=2 - tls_first_minor=14 tls_section_flag=T tls_as_opt="--fatal-warnings" fi @@ -25367,8 +25349,6 @@ foo: data8 25 addl r20 = @tprel(foo#), gp adds r22 = @tprel(foo#), r13 movl r24 = @tprel(foo#)' - tls_first_major=2 - tls_first_minor=13 tls_as_opt=--fatal-warnings ;; microblaze*-*-*) @@ -25379,8 +25359,6 @@ x: .text addik r5,r20,x@TLSGD addik r5,r20,x@TLSLDM' - tls_first_major=2 - tls_first_minor=20 tls_as_opt='--fatal-warnings' ;; mips*-*-*) @@ -25396,8 +25374,6 @@ x: lw $4, %gottprel(x)($28) lui $4, %tprel_hi(x) addiu $4, $4, %tprel_lo(x)' - tls_first_major=2 - tls_first_minor=16 tls_as_opt='-32 --fatal-warnings' ;; m68k-*-*) @@ -25412,15 +25388,11 @@ foo: move.l x@TLSLDO(%a5),%a0 move.l x@TLSIE(%a5),%a0 move.l x@TLSLE(%a5),%a0' - tls_first_major=2 - tls_first_minor=19 tls_as_opt='--fatal-warnings' ;; nios2-*-*) conftest_s=' .section ".tdata","awT",@progbits' - tls_first_major=2 - tls_first_minor=23 tls_as_opt="--fatal-warnings" ;; aarch64*-*-*) @@ -25432,8 +25404,6 @@ foo: .long 25 add x0, x0, #:tlsgd_lo12:x bl __tls_get_addr nop' - tls_first_major=2 - tls_first_minor=20 tls_as_opt='--fatal-warnings' ;; or1k*-*-*) @@ -25444,8 +25414,6 @@ foo: .long 25 l.movhi r3, tpoffha(foo) l.add r3, r3, r10 l.lwz r4, tpofflo(foo)(r3)' - tls_first_major=2 - tls_first_minor=30 tls_as_opt=--fatal-warnings ;; powerpc-ibm-aix*) @@ -25463,8 +25431,6 @@ LC..1: .csect a[TL],4 a: .space 4' - tls_first_major=0 - tls_first_minor=0 ;; powerpc64*-*-*) conftest_s=' @@ -25496,8 +25462,6 @@ x3: .space 8 add 9,9,3 bl .__tls_get_addr nop' - tls_first_major=2 - tls_first_minor=14 tls_as_opt="-a64 --fatal-warnings" ;; powerpc*-*-*) @@ -25522,8 +25486,6 @@ x3: .space 4 addi 9,2,x1@tprel addis 9,2,x2@tprel@ha addi 9,9,x2@tprel@l' - tls_first_major=2 - tls_first_minor=14 tls_as_opt="-a32 --fatal-warnings" ;; riscv*-*-*) @@ -25533,8 +25495,6 @@ x: .word 2 .text la.tls.gd a0,x call __tls_get_addr' - tls_first_major=2 - tls_first_minor=21 tls_as_opt='--fatal-warnings' ;; s390-*-*) @@ -25552,8 +25512,6 @@ foo: .long 25 l %r1,0(%r1):tls_load:foo bas %r14,0(%r1,%r13):tls_gdcall:foo bas %r14,0(%r1,%r13):tls_ldcall:foo' - tls_first_major=2 - tls_first_minor=14 tls_as_opt="-m31 --fatal-warnings" ;; s390x-*-*) @@ -25570,8 +25528,6 @@ foo: .long 25 larl %r1,foo@INDNTPOFF brasl %r14,__tls_get_offset@PLT:tls_gdcall:foo brasl %r14,__tls_get_offset@PLT:tls_ldcall:foo' - tls_first_major=2 - tls_first_minor=14 tls_as_opt="-m64 -Aesame --fatal-warnings" ;; sh-*-* | sh[123456789lbe]*-*-*) @@ -25584,8 +25540,6 @@ foo: .long 25 .long foo@DTPOFF .long foo@GOTTPOFF .long foo@TPOFF' - tls_first_major=2 - tls_first_minor=13 tls_as_opt=--fatal-warnings ;; sparc*-*-*) @@ -25600,13 +25554,9 @@ foo: .long 25 if test x$on_solaris = xyes && test x$gas_flag = xno; then conftest_s=' .section ".tdata",#alloc,#write,#tls' - tls_first_major=0 - tls_first_minor=0 else conftest_s=' .section ".tdata","awT",@progbits' - tls_first_major=2 - tls_first_minor=14 tls_as_opt="-32 --fatal-warnings" fi conftest_s="$conftest_s @@ -25643,8 +25593,6 @@ foo: .long 25 addli r0, zero, tls_ie(foo) auli r0, r0, tls_ie_ha16(foo) addli r0, r0, tls_ie_lo16(foo)' - tls_first_major=2 - tls_first_minor=22 tls_as_opt="--fatal-warnings" ;; tilegx*-*-*) @@ -25658,8 +25606,6 @@ foo: .long 25 jal __tls_get_addr shl16insli r0, zero, hw1_last_tls_ie(foo) shl16insli r0, r0, hw0_tls_ie(foo)' - tls_first_major=2 - tls_first_minor=22 tls_as_opt="--fatal-warnings" ;; xtensa*-*-*) @@ -25670,8 +25616,6 @@ foo: .long 25 movi a8, foo@TLSFUNC movi a10, foo@TLSARG callx8.tls a8, foo@TLSCALL' - tls_first_major=2 - tls_first_minor=19 ;; esac set_have_as_tls=no @@ -25679,7 +25623,7 @@ if test "x$enable_tls" = xno ; then : # TLS explicitly disabled. elif test "x$enable_tls" = xyes ; then set_have_as_tls=yes # TLS explicitly enabled. -elif test -z "$tls_first_major"; then +elif test -z "$conftest_s"; then : # If we don't have a check, assume no support. else { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for thread-local storage support" >&5 diff --git a/gcc/configure.ac b/gcc/configure.ac index 393a2ba..c651db7 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -3653,8 +3653,6 @@ esac], []) # Thread-local storage - the check is heavily parameterized. conftest_s= -tls_first_major= -tls_first_minor= tls_as_opt= case "$target" in changequote(,)dnl @@ -3677,15 +3675,11 @@ foo: .long 25 ldah $2,foo($29) !tprelhi lda $3,foo($2) !tprello lda $4,foo($29) !tprel' - tls_first_major=2 - tls_first_minor=13 tls_as_opt=--fatal-warnings ;; arc*-*-*) conftest_s=' add_s r0,r0, @foo@tpoff' - tls_first_major=2 - tls_first_minor=23 ;; cris-*-*|crisv32-*-*) conftest_s=' @@ -3694,8 +3688,6 @@ x: .long 25 .text move.d x:IE,$r10 nop' - tls_first_major=2 - tls_first_minor=20 tls_as_opt=--fatal-warnings ;; frv*-*-*) @@ -3704,8 +3696,6 @@ x: .long 25 x: .long 25 .text call #gettlsoff(x)' - tls_first_major=2 - tls_first_minor=14 ;; hppa*-*-linux*) conftest_s=' @@ -3732,8 +3722,6 @@ foo: .long 25 mfctl %cr27,%t1 addil LR%foo-$tls_leoff$,%t1 ldo RR%foo-$tls_leoff$(%r1),%t2' - tls_first_major=2 - tls_first_minor=15 tls_as_opt=--fatal-warnings ;; arm*-*-*) @@ -3746,8 +3734,6 @@ foo: .long 25 .word foo(tlsgd) .word foo(tlsldm) .word foo(tlsldo)' - tls_first_major=2 - tls_first_minor=17 ;; i[34567]86-*-* | x86_64-*-*) case "$target" in @@ -3761,8 +3747,6 @@ foo: .long 25 if test x$on_solaris = xyes && test x$gas_flag = xno; then conftest_s=' .section .tdata,"awt",@progbits' - tls_first_major=0 - tls_first_minor=0 tls_section_flag=t changequote([,])dnl AC_DEFINE(TLS_SECTION_ASM_FLAG, 't', @@ -3771,8 +3755,6 @@ changequote(,)dnl else conftest_s=' .section ".tdata","awT",@progbits' - tls_first_major=2 - tls_first_minor=14 tls_section_flag=T tls_as_opt="--fatal-warnings" fi @@ -3831,8 +3813,6 @@ foo: data8 25 addl r20 = @tprel(foo#), gp adds r22 = @tprel(foo#), r13 movl r24 = @tprel(foo#)' - tls_first_major=2 - tls_first_minor=13 tls_as_opt=--fatal-warnings ;; microblaze*-*-*) @@ -3843,8 +3823,6 @@ x: .text addik r5,r20,x@TLSGD addik r5,r20,x@TLSLDM' - tls_first_major=2 - tls_first_minor=20 tls_as_opt='--fatal-warnings' ;; mips*-*-*) @@ -3860,8 +3838,6 @@ x: lw $4, %gottprel(x)($28) lui $4, %tprel_hi(x) addiu $4, $4, %tprel_lo(x)' - tls_first_major=2 - tls_first_minor=16 tls_as_opt='-32 --fatal-warnings' ;; m68k-*-*) @@ -3876,15 +3852,11 @@ foo: move.l x@TLSLDO(%a5),%a0 move.l x@TLSIE(%a5),%a0 move.l x@TLSLE(%a5),%a0' - tls_first_major=2 - tls_first_minor=19 tls_as_opt='--fatal-warnings' ;; nios2-*-*) conftest_s=' .section ".tdata","awT",@progbits' - tls_first_major=2 - tls_first_minor=23 tls_as_opt="--fatal-warnings" ;; aarch64*-*-*) @@ -3896,8 +3868,6 @@ foo: .long 25 add x0, x0, #:tlsgd_lo12:x bl __tls_get_addr nop' - tls_first_major=2 - tls_first_minor=20 tls_as_opt='--fatal-warnings' ;; or1k*-*-*) @@ -3908,8 +3878,6 @@ foo: .long 25 l.movhi r3, tpoffha(foo) l.add r3, r3, r10 l.lwz r4, tpofflo(foo)(r3)' - tls_first_major=2 - tls_first_minor=30 tls_as_opt=--fatal-warnings ;; powerpc-ibm-aix*) @@ -3927,8 +3895,6 @@ LC..1: .csect a[TL],4 a: .space 4' - tls_first_major=0 - tls_first_minor=0 ;; powerpc64*-*-*) conftest_s=' @@ -3960,8 +3926,6 @@ x3: .space 8 add 9,9,3 bl .__tls_get_addr nop' - tls_first_major=2 - tls_first_minor=14 tls_as_opt="-a64 --fatal-warnings" ;; powerpc*-*-*) @@ -3986,8 +3950,6 @@ x3: .space 4 addi 9,2,x1@tprel addis 9,2,x2@tprel@ha addi 9,9,x2@tprel@l' - tls_first_major=2 - tls_first_minor=14 tls_as_opt="-a32 --fatal-warnings" ;; riscv*-*-*) @@ -3997,8 +3959,6 @@ x: .word 2 .text la.tls.gd a0,x call __tls_get_addr' - tls_first_major=2 - tls_first_minor=21 tls_as_opt='--fatal-warnings' ;; s390-*-*) @@ -4016,8 +3976,6 @@ foo: .long 25 l %r1,0(%r1):tls_load:foo bas %r14,0(%r1,%r13):tls_gdcall:foo bas %r14,0(%r1,%r13):tls_ldcall:foo' - tls_first_major=2 - tls_first_minor=14 tls_as_opt="-m31 --fatal-warnings" ;; s390x-*-*) @@ -4034,8 +3992,6 @@ foo: .long 25 larl %r1,foo@INDNTPOFF brasl %r14,__tls_get_offset@PLT:tls_gdcall:foo brasl %r14,__tls_get_offset@PLT:tls_ldcall:foo' - tls_first_major=2 - tls_first_minor=14 tls_as_opt="-m64 -Aesame --fatal-warnings" ;; sh-*-* | sh[123456789lbe]*-*-*) @@ -4048,8 +4004,6 @@ foo: .long 25 .long foo@DTPOFF .long foo@GOTTPOFF .long foo@TPOFF' - tls_first_major=2 - tls_first_minor=13 tls_as_opt=--fatal-warnings ;; sparc*-*-*) @@ -4064,13 +4018,9 @@ foo: .long 25 if test x$on_solaris = xyes && test x$gas_flag = xno; then conftest_s=' .section ".tdata",#alloc,#write,#tls' - tls_first_major=0 - tls_first_minor=0 else conftest_s=' .section ".tdata","awT",@progbits' - tls_first_major=2 - tls_first_minor=14 tls_as_opt="-32 --fatal-warnings" fi conftest_s="$conftest_s @@ -4107,8 +4057,6 @@ foo: .long 25 addli r0, zero, tls_ie(foo) auli r0, r0, tls_ie_ha16(foo) addli r0, r0, tls_ie_lo16(foo)' - tls_first_major=2 - tls_first_minor=22 tls_as_opt="--fatal-warnings" ;; tilegx*-*-*) @@ -4122,8 +4070,6 @@ foo: .long 25 jal __tls_get_addr shl16insli r0, zero, hw1_last_tls_ie(foo) shl16insli r0, r0, hw0_tls_ie(foo)' - tls_first_major=2 - tls_first_minor=22 tls_as_opt="--fatal-warnings" ;; xtensa*-*-*) @@ -4134,8 +4080,6 @@ foo: .long 25 movi a8, foo@TLSFUNC movi a10, foo@TLSARG callx8.tls a8, foo@TLSCALL' - tls_first_major=2 - tls_first_minor=19 ;; changequote([,])dnl esac @@ -4144,7 +4088,7 @@ if test "x$enable_tls" = xno ; then : # TLS explicitly disabled. elif test "x$enable_tls" = xyes ; then set_have_as_tls=yes # TLS explicitly enabled. -elif test -z "$tls_first_major"; then +elif test -z "$conftest_s"; then : # If we don't have a check, assume no support. else gcc_GAS_CHECK_FEATURE(thread-local storage support, gcc_cv_as_tls, -- cgit v1.1 From 7c9e1645836d7746838acebb7018b1774490ab5c Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 21 Aug 2021 00:16:29 +0000 Subject: Daily bump. --- gcc/ChangeLog | 104 ++++++++++++++++++++++++++++++++++++++++++++++++ gcc/DATESTAMP | 2 +- gcc/c-family/ChangeLog | 16 ++++++++ gcc/c/ChangeLog | 11 +++++ gcc/cp/ChangeLog | 13 ++++++ gcc/fortran/ChangeLog | 48 ++++++++++++++++++++++ gcc/testsuite/ChangeLog | 22 ++++++++++ 7 files changed, 215 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7be1a77..69fdc62 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,107 @@ +2021-08-20 Serge Belyshev + + * configure.ac (thread-local storage support): Remove tls_first_major + and tls_first_minor. Use "$conftest_s" to check support. + * configure: Regenerate. + +2021-08-20 Serge Belyshev + + * configure.ac: Fixup formatting. + +2021-08-20 Serge Belyshev + + * acinclude.m4 (gcc_GAS_CHECK_FEATURE): Remove third argument and ... + * configure.ac: ... update all callers. + +2021-08-20 Serge Belyshev + + PR target/91602 + * acinclude.m4 (_gcc_COMPUTE_GAS_VERSION, _gcc_GAS_VERSION_GTE_IFELSE) + (gcc_GAS_VERSION_GTE_IFELSE): Remove. + (gcc_GAS_CHECK_FEATURE): Do not handle in-tree case specially. + * configure.ac: Remove gcc_cv_gas_major_version, gcc_cv_gas_minor_version. + Remove remaining checks for in-tree assembler. + * configure: Regenerate. + +2021-08-20 Jeff Law + + * config/h8300/h8300.c (shift_alg_hi): Improve arithmetic shift right + by 15 bits for H8/300H and H8/S. Improve logical shifts by 12 + bits for H8/S. + (shift_alg_si): Improve arithmetic right shift by 28-30 bits for + H8/300H. Improve arithmetic shift right by 15 bits for H8/S. + Improve logical shifts by 27 bits for H8/S. + (get_shift_alg): Corresponding changes. + (h8300_option_override): Revert to loops for -Os when profitable. + +2021-08-20 Richard Biener + + * tree-vect-data-refs.c (dr_group_sort_cmp): Do not compare + BBs. + (vect_analyze_data_ref_accesses): Likewise. Assign the BB + index as group_id when dataref_groups were not computed. + * tree-vect-slp.c (vect_slp_bbs): Bump current_group when + we advace to the next BB. + +2021-08-20 Jakub Jelinek + + * omp-builtins.def (BUILT_IN_GOMP_WARNING, BUILT_IN_GOMP_ERROR): New + builtins. + +2021-08-20 Martin Liska + + PR gcov-profile/89961 + * gcov.c (make_gcov_file_name): Rewrite using std::string. + (mangle_name): Simplify, do not used the second argument. + (strip_extention): New function. + (get_md5sum): Likewise. + (get_gcov_intermediate_filename): Handle properly -p and -x + options. + (output_gcov_file): Use string type. + (generate_results): Likewise. + (md5sum_to_hex): Remove. + +2021-08-20 Michael Meissner + + * config/rs6000/altivec.md (UNSPEC_XXEVAL): Move to vsx.md. + (UNSPEC_XXSPLTIW): Move to vsx.md. + (UNSPEC_XXSPLTID): Move to vsx.md. + (UNSPEC_XXSPLTI32DX): Move to vsx.md. + (UNSPEC_XXBLEND): Move to vsx.md. + (UNSPEC_XXPERMX): Move to vsx.md. + (VM3): Move to vsx.md. + (VM3_char): Move to vsx.md. + (xxspltiw_v4si): Move to vsx.md. + (xxspltiw_v4sf): Move to vsx.md. + (xxspltiw_v4sf_inst): Move to vsx.md. + (xxspltidp_v2df): Move to vsx.md. + (xxspltidp_v2df_inst): Move to vsx.md. + (xxsplti32dx_v4si_inst): Move to vsx.md. + (xxsplti32dx_v4sf): Move to vsx.md. + (xxsplti32dx_v4sf_inst): Move to vsx.md. + (xxblend_): Move to vsx.md. + (xxpermx): Move to vsx.md. + (xxpermx_inst): Move to vsx.md. + * config/rs6000/vsx.md (UNSPEC_XXEVAL): Move from altivec.md. + (UNSPEC_XXSPLTIW): Move from altivec.md. + (UNSPEC_XXSPLTID): Move from altivec.md. + (UNSPEC_XXSPLTI32DX): Move from altivec.md. + (UNSPEC_XXBLEND): Move from altivec.md. + (UNSPEC_XXPERMX): Move from altivec.md. + (VM3): Move from altivec.md. + (VM3_char): Move from altivec.md. + (xxspltiw_v4si): Move from altivec.md. + (xxspltiw_v4sf): Move from altivec.md. + (xxspltiw_v4sf_inst): Move from altivec.md. + (xxspltidp_v2df): Move from altivec.md. + (xxspltidp_v2df_inst): Move from altivec.md. + (xxsplti32dx_v4si_inst): Move from altivec.md. + (xxsplti32dx_v4sf): Move from altivec.md. + (xxsplti32dx_v4sf_inst): Move from altivec.md. + (xxblend_): Move from altivec.md. + (xxpermx): Move from altivec.md. + (xxpermx_inst): Move from altivec.md. + 2021-08-19 Roger Sayle * tree-vect-generic.c (expand_vector_operations_1): Use either diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index a095191..550c2a6 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20210820 +20210821 diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index ab566ba..873d7ab 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,19 @@ +2021-08-20 Tobias Burnus + + * c-format.c (gcc_gfc_length_specs): Add 'll' and 'w'. + (gcc_gfc_char_table): Add T9L_LL and T9L_ULL to + "di" and "u", respecitively; fill with BADLEN to match + size of 'types'. + (get_init_dynamic_hwi): Split off from ... + (init_dynamic_diag_info): ... here. Call it. + (init_dynamic_gfc_info): Call it. + +2021-08-20 Jakub Jelinek + + * c-pragma.h (enum pragma_kind): Add PRAGMA_OMP_ERROR. + * c-pragma.c (omp_pragmas): Add error directive. + * c-omp.c (omp_directives): Uncomment error directive entry. + 2021-08-18 Jakub Jelinek * c-pragma.h (enum pragma_kind): Add PRAGMA_OMP_NOTHING. diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 1b13446..e5e12b3 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,14 @@ +2021-08-20 Jakub Jelinek + + * c-parser.c (c_parser_omp_error): New function. + (c_parser_pragma): Handle PRAGMA_OMP_ERROR. + +2021-08-20 Jakub Jelinek + + * c-parser.c (c_parser_omp_clause_depend_sink): Reject spurious + comma at the end of list. + (c_parser_omp_requires): Likewise. + 2021-08-19 Jakub Jelinek * c-parser.c (c_parser_omp_requires): Don't call diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f50c36c..d496202 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,16 @@ +2021-08-20 Jakub Jelinek + + * parser.c (cp_parser_handle_statement_omp_attributes): Determine if + PRAGMA_OMP_ERROR directive is C_OMP_DIR_STANDALONE. + (cp_parser_omp_error): New function. + (cp_parser_pragma): Handle PRAGMA_OMP_ERROR. + +2021-08-20 Jakub Jelinek + + * parser.c (cp_parser_omp_clause_depend_sink): Reject spurious + comma at the end of list. Don't parse closing paren here... + (cp_parser_omp_clause_depend): ... but here instead. + 2021-08-19 Patrick Palka PR c++/101803 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 8bf8cde..7da56e7 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,51 @@ +2021-08-20 Tobias Burnus + + * error.c + (error_uinteger): Take 'long long unsigned' instead + of 'long unsigned' as argumpent. + (error_integer): Take 'long long' instead of 'long'. + (error_hwuint, error_hwint): New. + (error_print): Update to handle 'll' and 'w' + length modifiers. + * simplify.c (substring_has_constant_len): Use '%wd' + in gfc_error. + +2021-08-20 Harald Anlauf + + PR fortran/100950 + * simplify.c (substring_has_constant_len): Fix format string of + gfc_error, pass HOST_WIDE_INT bounds values via char buffer. + +2021-08-20 Tobias Burnus + + * dump-parse-tree.c (show_omp_clauses): Handle 'at', 'severity' + and 'message' clauses. + (show_omp_node, show_code_node): Handle EXEC_OMP_ERROR. + * gfortran.h (gfc_statement): Add ST_OMP_ERROR. + (gfc_omp_severity_type, gfc_omp_at_type): New. + (gfc_omp_clauses): Add 'at', 'severity' and 'message' clause; + use more bitfields + ENUM_BITFIELD. + (gfc_exec_op): Add EXEC_OMP_ERROR. + * match.h (gfc_match_omp_error): New. + * openmp.c (enum omp_mask1): Add OMP_CLAUSE_(AT,SEVERITY,MESSAGE). + (gfc_match_omp_clauses): Handle new clauses. + (OMP_ERROR_CLAUSES, gfc_match_omp_error): New. + (resolve_omp_clauses): Resolve new clauses. + (omp_code_to_statement, gfc_resolve_omp_directive): Handle + EXEC_OMP_ERROR. + * parse.c (decode_omp_directive, next_statement, + gfc_ascii_statement): Handle 'omp error'. + * resolve.c (gfc_resolve_blocks): Likewise. + * st.c (gfc_free_statement): Likewise. + * trans-openmp.c (gfc_trans_omp_error): Likewise. + (gfc_trans_omp_directive): Likewise. + * trans.c (trans_code): Likewise. + +2021-08-20 Jakub Jelinek + + * types.def (BT_FN_VOID_CONST_PTR_SIZE): New DEF_FUNCTION_TYPE_2. + * f95-lang.c (ATTR_COLD_NORETURN_NOTHROW_LEAF_LIST): Define. + 2021-08-19 Harald Anlauf PR fortran/100950 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7e37eaa..0c8f274 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,25 @@ +2021-08-20 Tobias Burnus + + * gfortran.dg/gomp/error-1.f90: New test. + * gfortran.dg/gomp/error-2.f90: New test. + * gfortran.dg/gomp/error-3.f90: New test. + +2021-08-20 Jakub Jelinek + + * c-c++-common/gomp/error-1.c: New test. + * c-c++-common/gomp/error-2.c: New test. + * c-c++-common/gomp/error-3.c: New test. + * g++.dg/gomp/attrs-1.C (bar): Add error directive test. + * g++.dg/gomp/attrs-2.C (bar): Add error directive test. + * g++.dg/gomp/attrs-13.C: New test. + * g++.dg/gomp/error-1.C: New test. + +2021-08-20 Jakub Jelinek + + * c-c++-common/gomp/sink-5.c: New test. + * c-c++-common/gomp/requires-3.c: Add test for spurious comma + at the end of pragma line. + 2021-08-19 Roger Sayle * c-c++-common/Wunused-var-16.c: Add an extra check that ~0 -- cgit v1.1 From e92d0ff6b5e6d4b95c04fc3e326d40efeb136086 Mon Sep 17 00:00:00 2001 From: Ankur Saini Date: Thu, 19 Aug 2021 19:54:56 +0530 Subject: analyzer: Fix PR analyzer/101980 2021-08-19 Ankur Saini gcc/analyzer/ChangeLog: PR analyzer/101980 * diagnostic-manager.cc (diagnostic_manager::prune_for_sm_diagnostic): Use caller_model only when the supergraph_edge doesn't exixt. (diagnostic_manager::prune_for_sm_diagnostic): Likewise. * engine.cc (exploded_graph::create_dynamic_call): Rename to... (exploded_graph::maybe_create_dynamic_call): ...this, return call creation status. (exploded_graph::process_node): Handle calls which were not dynamically discovered. * exploded-graph.h (exploded_graph::create_dynamic_call): Rename to... (exploded_graph::maybe_create_dynamic_call): ...this. * region-model.cc (region_model::update_for_gcall): New param, use it to push call to frame. (region_model::update_for_call_superedge): Pass callee function to update_for_gcall. * region-model.h (region_model::update_for_gcall): New param. gcc/testsuite/ChangeLog: PR analyzer/101980 * gcc.dg/analyzer/function-ptr-2.c : Add issue for double 'free'. * gcc.dg/analyzer/malloc-callbacks.c : Fix xfail testcase. --- gcc/analyzer/diagnostic-manager.cc | 40 +++++++++++++++++-- gcc/analyzer/engine.cc | 49 +++++++++++++----------- gcc/analyzer/exploded-graph.h | 14 +++---- gcc/analyzer/region-model.cc | 17 +++++--- gcc/analyzer/region-model.h | 3 +- gcc/testsuite/gcc.dg/analyzer/function-ptr-2.c | 5 +-- gcc/testsuite/gcc.dg/analyzer/malloc-callbacks.c | 2 +- 7 files changed, 85 insertions(+), 45 deletions(-) (limited to 'gcc') diff --git a/gcc/analyzer/diagnostic-manager.cc b/gcc/analyzer/diagnostic-manager.cc index 06e7510..89b5d1e 100644 --- a/gcc/analyzer/diagnostic-manager.cc +++ b/gcc/analyzer/diagnostic-manager.cc @@ -2099,7 +2099,22 @@ diagnostic_manager::prune_for_sm_diagnostic (checker_path *path, = event->m_eedge.m_src->get_state ().m_region_model; tree callee_var = callee_model->get_representative_tree (sval); callsite_expr expr; - tree caller_var = caller_model->get_representative_tree (sval); + + tree caller_var; + if(event->m_sedge) + { + const callgraph_superedge& cg_superedge + = event->get_callgraph_superedge (); + if (cg_superedge.m_cedge) + caller_var + = cg_superedge.map_expr_from_callee_to_caller (callee_var, + &expr); + else + callee_var = callee_model->get_representative_tree (sval); + } + else + caller_var = caller_model->get_representative_tree (sval); + if (caller_var) { if (get_logger ()) @@ -2121,11 +2136,28 @@ diagnostic_manager::prune_for_sm_diagnostic (checker_path *path, if (sval) { return_event *event = (return_event *)base_event; + const region_model *caller_model + = event->m_eedge.m_dest->get_state ().m_region_model; + tree caller_var = caller_model->get_representative_tree (sval); + const region_model *callee_model + = event->m_eedge.m_src->get_state ().m_region_model; callsite_expr expr; - const region_model *callee_model - = event->m_eedge.m_src->get_state ().m_region_model; - tree callee_var = callee_model->get_representative_tree (sval); + tree callee_var; + if (event->m_sedge) + { + const callgraph_superedge& cg_superedge + = event->get_callgraph_superedge (); + if (cg_superedge.m_cedge) + callee_var + = cg_superedge.map_expr_from_caller_to_callee (caller_var, + &expr); + else + callee_var = callee_model->get_representative_tree (sval); + } + else + callee_var = callee_model->get_representative_tree (sval); + if (callee_var) { if (get_logger ()) diff --git a/gcc/analyzer/engine.cc b/gcc/analyzer/engine.cc index 461de9c..e66ca4e 100644 --- a/gcc/analyzer/engine.cc +++ b/gcc/analyzer/engine.cc @@ -3033,14 +3033,14 @@ state_change_requires_new_enode_p (const program_state &old_state, Some example such calls are dynamically dispatched calls to virtual functions or calls that happen via function pointer. */ -void -exploded_graph::create_dynamic_call (const gcall *call, - tree fn_decl, - exploded_node *node, - program_state next_state, - program_point &next_point, - uncertainty_t *uncertainty, - logger *logger) +bool +exploded_graph::maybe_create_dynamic_call (const gcall *call, + tree fn_decl, + exploded_node *node, + program_state next_state, + program_point &next_point, + uncertainty_t *uncertainty, + logger *logger) { LOG_FUNC (logger); @@ -3049,8 +3049,8 @@ exploded_graph::create_dynamic_call (const gcall *call, if (fun) { const supergraph &sg = this->get_supergraph (); - supernode * sn_entry = sg.get_node_for_function_entry (fun); - supernode * sn_exit = sg.get_node_for_function_exit (fun); + supernode *sn_entry = sg.get_node_for_function_entry (fun); + supernode *sn_exit = sg.get_node_for_function_exit (fun); program_point new_point = program_point::before_supernode (sn_entry, @@ -3075,8 +3075,10 @@ exploded_graph::create_dynamic_call (const gcall *call, if (enode) add_edge (node,enode, NULL, new dynamic_call_info_t (call)); + return true; } - } + } + return false; } /* The core of exploded_graph::process_worklist (the main analysis loop), @@ -3338,22 +3340,23 @@ exploded_graph::process_node (exploded_node *node) point.get_stmt()); region_model *model = state.m_region_model; + bool call_discovered = false; if (tree fn_decl = model->get_fndecl_for_call(call,&ctxt)) - create_dynamic_call (call, - fn_decl, - node, - next_state, - next_point, - &uncertainty, - logger); - else + call_discovered = maybe_create_dynamic_call (call, + fn_decl, + node, + next_state, + next_point, + &uncertainty, + logger); + if (!call_discovered) { - /* An unknown function was called at this point, in such - case, don't terminate the analysis of the current - function. + /* An unknown function or a special function was called + at this point, in such case, don't terminate the + analysis of the current function. - The analyzer handles calls to unknown functions while + The analyzer handles calls to such functions while analysing the stmt itself, so the the function call must have been handled by the anlyzer till now. */ exploded_node *next diff --git a/gcc/analyzer/exploded-graph.h b/gcc/analyzer/exploded-graph.h index 192a4b3..6890e84 100644 --- a/gcc/analyzer/exploded-graph.h +++ b/gcc/analyzer/exploded-graph.h @@ -816,13 +816,13 @@ public: bool maybe_process_run_of_before_supernode_enodes (exploded_node *node); void process_node (exploded_node *node); - void create_dynamic_call (const gcall *call, - tree fn_decl, - exploded_node *node, - program_state next_state, - program_point &next_point, - uncertainty_t *uncertainty, - logger *logger); + bool maybe_create_dynamic_call (const gcall *call, + tree fn_decl, + exploded_node *node, + program_state next_state, + program_point &next_point, + uncertainty_t *uncertainty, + logger *logger); exploded_node *get_or_create_node (const program_point &point, const program_state &state, diff --git a/gcc/analyzer/region-model.cc b/gcc/analyzer/region-model.cc index 822e893..9870007 100644 --- a/gcc/analyzer/region-model.cc +++ b/gcc/analyzer/region-model.cc @@ -3178,7 +3178,8 @@ region_model::maybe_update_for_edge (const superedge &edge, void region_model::update_for_gcall (const gcall *call_stmt, - region_model_context *ctxt) + region_model_context *ctxt, + function *callee) { /* Build a vec of argument svalues, using the current top frame for resolving tree expressions. */ @@ -3190,10 +3191,14 @@ region_model::update_for_gcall (const gcall *call_stmt, arg_svals.quick_push (get_rvalue (arg, ctxt)); } - /* Get the function * from the call. */ - tree fn_decl = get_fndecl_for_call (call_stmt,ctxt); - function *fun = DECL_STRUCT_FUNCTION (fn_decl); - push_frame (fun, &arg_svals, ctxt); + if(!callee) + { + /* Get the function * from the gcall. */ + tree fn_decl = get_fndecl_for_call (call_stmt,ctxt); + callee = DECL_STRUCT_FUNCTION (fn_decl); + } + + push_frame (callee, &arg_svals, ctxt); } /* Pop the top-most frame_region from the stack, and copy the return @@ -3228,7 +3233,7 @@ region_model::update_for_call_superedge (const call_superedge &call_edge, region_model_context *ctxt) { const gcall *call_stmt = call_edge.get_call_stmt (); - update_for_gcall (call_stmt,ctxt); + update_for_gcall (call_stmt, ctxt, call_edge.get_callee_function ()); } /* Extract calling information from the return superedge and update the model diff --git a/gcc/analyzer/region-model.h b/gcc/analyzer/region-model.h index e40264e..a734f9f 100644 --- a/gcc/analyzer/region-model.h +++ b/gcc/analyzer/region-model.h @@ -609,7 +609,8 @@ class region_model rejected_constraint **out); void update_for_gcall (const gcall *call_stmt, - region_model_context *ctxt); + region_model_context *ctxt, + function *callee = NULL); void update_for_return_gcall (const gcall *call_stmt, region_model_context *ctxt); diff --git a/gcc/testsuite/gcc.dg/analyzer/function-ptr-2.c b/gcc/testsuite/gcc.dg/analyzer/function-ptr-2.c index 411b1b3..fd25e3b 100644 --- a/gcc/testsuite/gcc.dg/analyzer/function-ptr-2.c +++ b/gcc/testsuite/gcc.dg/analyzer/function-ptr-2.c @@ -6,9 +6,10 @@ typedef void (*fn_ptr_t) (void *); void calls_free (void *victim) { - free (victim); + free (victim); /* { dg-warning "double-'free' of 'victim'" } */ } + void no_op (void *ptr) { @@ -25,7 +26,6 @@ void test_1 (void *ptr) fn_ptr (ptr); fn_ptr (ptr); } -// TODO: issue a double-'free' warning at 2nd call to fn_ptr. /* As above, but with an extra indirection to try to thwart the optimizer. */ @@ -41,4 +41,3 @@ void test_2 (void *ptr, fn_ptr_t *fn_ptr) (*fn_ptr) (ptr); (*fn_ptr) (ptr); } -// TODO: issue a double-'free' warning at 2nd call to fn_ptr. diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-callbacks.c b/gcc/testsuite/gcc.dg/analyzer/malloc-callbacks.c index 901ca5c..53c75fd 100644 --- a/gcc/testsuite/gcc.dg/analyzer/malloc-callbacks.c +++ b/gcc/testsuite/gcc.dg/analyzer/malloc-callbacks.c @@ -69,7 +69,7 @@ int *test_5 (void) static void __attribute__((noinline)) called_by_test_6a (void *ptr) { - free (ptr); /* { dg-warning "double-'free'" "" { xfail *-*-* } } */ + free (ptr); /* { dg-warning "double-'free'"} */ } static deallocator_t __attribute__((noinline)) -- cgit v1.1 From 5aae6fd9f4bd61030c79762b9474f52e8fa00dd8 Mon Sep 17 00:00:00 2001 From: John David Anglin Date: Sat, 21 Aug 2021 17:25:13 +0000 Subject: Don't warn when alignment of global common data exceeds maximum alignment. 2021-08-21 John David Anglin gcc/ChangeLog: * config/pa/pa.c (pa_asm_output_aligned_common): Remove warning. --- gcc/config/pa/pa.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'gcc') diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index 46194ba..0614302 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -9080,9 +9080,7 @@ pa_asm_output_aligned_common (FILE *stream, max_common_align = TARGET_64BIT ? 128 : (size >= 4096 ? 256 : 64); if (align > max_common_align) { - warning (0, "alignment (%u) for %s exceeds maximum alignment " - "for global common data. Using %u", - align / BITS_PER_UNIT, name, max_common_align / BITS_PER_UNIT); + /* Alignment exceeds maximum alignment for global common data. */ align = max_common_align; } -- cgit v1.1 From 304ec0d1d9f177e059e695fbe11d93f99f6f14e0 Mon Sep 17 00:00:00 2001 From: Dragan Mladjenovic Date: Tue, 24 Jul 2018 20:05:08 +0200 Subject: [MIPS] Remove TARGET_ASM_FUNCTION_RODATA_SECTION Since 'Remove obsolete IRIX 6.5 support' [1] we only use gp-relative jump-tables for PIC code. We can fall back to default behaviour for asm_function_rodata_section. [1] https://gcc.gnu.org/ml/libstdc++/2012-03/msg00067.html 2018-06-04 Dragan Mladjenovic gcc/ * config/mips/mips.c (mips_function_rodata_section, TARGET_ASM_FUNCTION_RODATA_SECTION): Removed. --- gcc/config/mips/mips.c | 38 -------------------------------------- 1 file changed, 38 deletions(-) (limited to 'gcc') diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 89d1be6..39666d6 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -9306,42 +9306,6 @@ mips_select_rtx_section (machine_mode mode, rtx x, return default_elf_select_rtx_section (mode, x, align); } -/* Implement TARGET_ASM_FUNCTION_RODATA_SECTION. - - The complication here is that, with the combination TARGET_ABICALLS - && !TARGET_ABSOLUTE_ABICALLS && !TARGET_GPWORD, jump tables will use - absolute addresses, and should therefore not be included in the - read-only part of a DSO. Handle such cases by selecting a normal - data section instead of a read-only one. The logic apes that in - default_function_rodata_section. */ - -static section * -mips_function_rodata_section (tree decl, bool) -{ - if (!TARGET_ABICALLS || TARGET_ABSOLUTE_ABICALLS || TARGET_GPWORD) - return default_function_rodata_section (decl, false); - - if (decl && DECL_SECTION_NAME (decl)) - { - const char *name = DECL_SECTION_NAME (decl); - if (DECL_COMDAT_GROUP (decl) && startswith (name, ".gnu.linkonce.t.")) - { - char *rname = ASTRDUP (name); - rname[14] = 'd'; - return get_section (rname, SECTION_LINKONCE | SECTION_WRITE, decl); - } - else if (flag_function_sections - && flag_data_sections - && startswith (name, ".text.")) - { - char *rname = ASTRDUP (name); - memcpy (rname + 1, "data", 4); - return get_section (rname, SECTION_WRITE, decl); - } - } - return data_section; -} - /* Implement TARGET_IN_SMALL_DATA_P. */ static bool @@ -22606,8 +22570,6 @@ mips_asm_file_end (void) #define TARGET_ASM_FUNCTION_EPILOGUE mips_output_function_epilogue #undef TARGET_ASM_SELECT_RTX_SECTION #define TARGET_ASM_SELECT_RTX_SECTION mips_select_rtx_section -#undef TARGET_ASM_FUNCTION_RODATA_SECTION -#define TARGET_ASM_FUNCTION_RODATA_SECTION mips_function_rodata_section #undef TARGET_SCHED_INIT #define TARGET_SCHED_INIT mips_sched_init -- cgit v1.1 From 4be4fa4ec7ffa16cb2b0e24f656ee0fcdf23b3e0 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sun, 22 Aug 2021 00:16:40 +0000 Subject: Daily bump. --- gcc/ChangeLog | 9 +++++++++ gcc/DATESTAMP | 2 +- gcc/analyzer/ChangeLog | 21 +++++++++++++++++++++ gcc/testsuite/ChangeLog | 6 ++++++ 4 files changed, 37 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 69fdc62..cc510af 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2021-08-21 Dragan Mladjenovic + + * config/mips/mips.c (mips_function_rodata_section, + TARGET_ASM_FUNCTION_RODATA_SECTION): Removed. + +2021-08-21 John David Anglin + + * config/pa/pa.c (pa_asm_output_aligned_common): Remove warning. + 2021-08-20 Serge Belyshev * configure.ac (thread-local storage support): Remove tls_first_major diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 550c2a6..ff97480 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20210821 +20210822 diff --git a/gcc/analyzer/ChangeLog b/gcc/analyzer/ChangeLog index 0b483cc..da90011 100644 --- a/gcc/analyzer/ChangeLog +++ b/gcc/analyzer/ChangeLog @@ -1,3 +1,24 @@ +2021-08-21 Ankur Saini + + PR analyzer/101980 + * diagnostic-manager.cc + (diagnostic_manager::prune_for_sm_diagnostic): Use + caller_model only when the supergraph_edge doesn't exixt. + (diagnostic_manager::prune_for_sm_diagnostic): + Likewise. + * engine.cc (exploded_graph::create_dynamic_call): Rename to... + (exploded_graph::maybe_create_dynamic_call): ...this, return call + creation status. + (exploded_graph::process_node): Handle calls which were not dynamically + discovered. + * exploded-graph.h (exploded_graph::create_dynamic_call): Rename to... + (exploded_graph::maybe_create_dynamic_call): ...this. + * region-model.cc (region_model::update_for_gcall): New param, use it + to push call to frame. + (region_model::update_for_call_superedge): Pass callee function to + update_for_gcall. + * region-model.h (region_model::update_for_gcall): New param. + 2021-08-18 Ankur Saini PR analyzer/97114 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0c8f274..ebea99d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2021-08-21 Ankur Saini + + PR analyzer/101980 + * gcc.dg/analyzer/function-ptr-2.c : Add issue for double 'free'. + * gcc.dg/analyzer/malloc-callbacks.c : Fix xfail testcase. + 2021-08-20 Tobias Burnus * gfortran.dg/gomp/error-1.f90: New test. -- cgit v1.1 From 9b08f7764cecd16cba84944f2a8b67a7f73a7ce7 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Sun, 22 Aug 2021 20:57:19 +0200 Subject: Clear EAF_NOCLOBBER for indirect calls gcc/ChangeLog: 2021-08-22 Jan Hubicka Martin Liska PR middle-end/101949 * ipa-modref.c (analyze_ssa_name_flags): Indirect call implies ~EAF_NOCLOBBER. gcc/testsuite/ChangeLog: 2021-08-22 Jan Hubicka Martin Liska * gcc.dg/lto/pr101949_0.c: New test. * gcc.dg/lto/pr101949_1.c: New test. --- gcc/ipa-modref.c | 9 +++++++++ gcc/testsuite/gcc.dg/lto/pr101949_0.c | 20 ++++++++++++++++++++ gcc/testsuite/gcc.dg/lto/pr101949_1.c | 4 ++++ 3 files changed, 33 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/lto/pr101949_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/pr101949_1.c (limited to 'gcc') diff --git a/gcc/ipa-modref.c b/gcc/ipa-modref.c index fafd804..5491538 100644 --- a/gcc/ipa-modref.c +++ b/gcc/ipa-modref.c @@ -1700,6 +1700,15 @@ analyze_ssa_name_flags (tree name, vec &lattice, int depth, else if (gcall *call = dyn_cast (use_stmt)) { tree callee = gimple_call_fndecl (call); + + /* IPA PTA internally it treats calling a function as "writing" to + the argument space of all functions the function pointer points to + (PR101949). We can not drop EAF_NOCLOBBER only when ipa-pta + is on since that would allow propagation of this from -fno-ipa-pta + to -fipa-pta functions. */ + if (gimple_call_fn (use_stmt) == name) + lattice[index].merge (~EAF_NOCLOBBER); + /* Return slot optimization would require bit of propagation; give up for now. */ if (gimple_call_return_slot_opt_p (call) diff --git a/gcc/testsuite/gcc.dg/lto/pr101949_0.c b/gcc/testsuite/gcc.dg/lto/pr101949_0.c new file mode 100644 index 0000000..142dffe --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr101949_0.c @@ -0,0 +1,20 @@ +/* { dg-lto-do run } */ +/* { dg-lto-options { "-O2 -fipa-pta -flto -flto-partition=1to1" } } */ + +extern int bar (int (*)(int *), int *); + +static int x; + +static int __attribute__ ((noinline)) foo (int *p) +{ + *p = 1; + x = 0; + return *p; +} + +int main () +{ + if (bar (foo, &x) != 0) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/lto/pr101949_1.c b/gcc/testsuite/gcc.dg/lto/pr101949_1.c new file mode 100644 index 0000000..871d15c --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr101949_1.c @@ -0,0 +1,4 @@ +int __attribute__((noinline,noclone)) bar (int (*fn)(int *), int *p) +{ + return fn (p); +} -- cgit v1.1 From 972eab51f53d1db26864ec7d62d40c2ff83407ec Mon Sep 17 00:00:00 2001 From: Martin Uecker Date: Sun, 22 Aug 2021 23:47:58 +0200 Subject: Correct treatment of qualifiers for pointers to arrays for C2X [PR98397] 2021-08-22 Martin Uecker gcc/c/ PR c/98397 * c-typeck.c (comp_target_types): Change pedwarn to pedwarn_c11 for pointers to arrays with qualifiers. (build_conditional_expr): For C23 don't lose qualifiers for pointers to arrays when the other pointer is a void pointer. Update warnings. (convert_for_assignment): Update warnings for C2X when converting from void* with qualifiers to a pointer to array with the same qualifiers. gcc/testsuite/ PR c/98397 * gcc.dg/c11-qual-1.c: New test. * gcc.dg/c2x-qual-1.c: New test. * gcc.dg/c2x-qual-2.c: New test. * gcc.dg/c2x-qual-3.c: New test. * gcc.dg/c2x-qual-4.c: New test. * gcc.dg/c2x-qual-5.c: New test. * gcc.dg/c2x-qual-6.c: New test. * gcc.dg/c2x-qual-7.c: New test. * gcc.dg/pointer-array-quals-1.c: Remove unnecessary flag. * gcc.dg/pointer-array-quals-2.c: Remove unnecessary flag. --- gcc/c/c-typeck.c | 188 +++++++++++++-------------- gcc/testsuite/gcc.dg/c11-qual-1.c | 11 ++ gcc/testsuite/gcc.dg/c2x-qual-1.c | 30 +++++ gcc/testsuite/gcc.dg/c2x-qual-2.c | 30 +++++ gcc/testsuite/gcc.dg/c2x-qual-3.c | 30 +++++ gcc/testsuite/gcc.dg/c2x-qual-4.c | 105 +++++++++++++++ gcc/testsuite/gcc.dg/c2x-qual-5.c | 101 ++++++++++++++ gcc/testsuite/gcc.dg/c2x-qual-6.c | 114 ++++++++++++++++ gcc/testsuite/gcc.dg/c2x-qual-7.c | 16 +++ gcc/testsuite/gcc.dg/pointer-array-quals-1.c | 2 +- gcc/testsuite/gcc.dg/pointer-array-quals-2.c | 2 +- 11 files changed, 532 insertions(+), 97 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/c11-qual-1.c create mode 100644 gcc/testsuite/gcc.dg/c2x-qual-1.c create mode 100644 gcc/testsuite/gcc.dg/c2x-qual-2.c create mode 100644 gcc/testsuite/gcc.dg/c2x-qual-3.c create mode 100644 gcc/testsuite/gcc.dg/c2x-qual-4.c create mode 100644 gcc/testsuite/gcc.dg/c2x-qual-5.c create mode 100644 gcc/testsuite/gcc.dg/c2x-qual-6.c create mode 100644 gcc/testsuite/gcc.dg/c2x-qual-7.c (limited to 'gcc') diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index 0c07af61..d9f26d6 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -1328,8 +1328,8 @@ comp_target_types (location_t location, tree ttl, tree ttr) val = comptypes_check_enum_int (mvl, mvr, &enum_and_int_p); if (val == 1 && val_ped != 1) - pedwarn (location, OPT_Wpedantic, "pointers to arrays with different qualifiers " - "are incompatible in ISO C"); + pedwarn_c11 (location, OPT_Wpedantic, "invalid use of pointers to arrays with different qualifiers " + "in ISO C before C2X"); if (val == 2) pedwarn (location, OPT_Wpedantic, "types are not quite compatible"); @@ -5406,39 +5406,41 @@ build_conditional_expr (location_t colon_loc, tree ifexp, bool ifexp_bcp, "used in conditional expression"); return error_mark_node; } - else if (VOID_TYPE_P (TREE_TYPE (type1)) - && !TYPE_ATOMIC (TREE_TYPE (type1))) - { - if ((TREE_CODE (TREE_TYPE (type2)) == ARRAY_TYPE) - && (TYPE_QUALS (strip_array_types (TREE_TYPE (type2))) - & ~TYPE_QUALS (TREE_TYPE (type1)))) - warning_at (colon_loc, OPT_Wdiscarded_array_qualifiers, - "pointer to array loses qualifier " - "in conditional expression"); - - if (TREE_CODE (TREE_TYPE (type2)) == FUNCTION_TYPE) + else if ((VOID_TYPE_P (TREE_TYPE (type1)) + && !TYPE_ATOMIC (TREE_TYPE (type1))) + || (VOID_TYPE_P (TREE_TYPE (type2)) + && !TYPE_ATOMIC (TREE_TYPE (type2)))) + { + tree t1 = TREE_TYPE (type1); + tree t2 = TREE_TYPE (type2); + if (!(VOID_TYPE_P (t1) + && !TYPE_ATOMIC (t1))) + { + /* roles are swapped */ + t1 = t2; + t2 = TREE_TYPE (type1); + } + tree t2_stripped = strip_array_types (t2); + if ((TREE_CODE (t2) == ARRAY_TYPE) + && (TYPE_QUALS (t2_stripped) & ~TYPE_QUALS (t1))) + { + if (!flag_isoc2x) + warning_at (colon_loc, OPT_Wdiscarded_array_qualifiers, + "pointer to array loses qualifier " + "in conditional expression"); + else if (warn_c11_c2x_compat > 0) + warning_at (colon_loc, OPT_Wc11_c2x_compat, + "pointer to array loses qualifier " + "in conditional expression in ISO C before C2X"); + } + if (TREE_CODE (t2) == FUNCTION_TYPE) pedwarn (colon_loc, OPT_Wpedantic, "ISO C forbids conditional expr between " "% and function pointer"); - result_type = build_pointer_type (qualify_type (TREE_TYPE (type1), - TREE_TYPE (type2))); - } - else if (VOID_TYPE_P (TREE_TYPE (type2)) - && !TYPE_ATOMIC (TREE_TYPE (type2))) - { - if ((TREE_CODE (TREE_TYPE (type1)) == ARRAY_TYPE) - && (TYPE_QUALS (strip_array_types (TREE_TYPE (type1))) - & ~TYPE_QUALS (TREE_TYPE (type2)))) - warning_at (colon_loc, OPT_Wdiscarded_array_qualifiers, - "pointer to array loses qualifier " - "in conditional expression"); - - if (TREE_CODE (TREE_TYPE (type1)) == FUNCTION_TYPE) - pedwarn (colon_loc, OPT_Wpedantic, - "ISO C forbids conditional expr between " - "% and function pointer"); - result_type = build_pointer_type (qualify_type (TREE_TYPE (type2), - TREE_TYPE (type1))); + /* for array, use qualifiers of element type */ + if (flag_isoc2x) + t2 = t2_stripped; + result_type = build_pointer_type (qualify_type (t1, t2)); } /* Objective-C pointer comparisons are a bit more lenient. */ else if (objc_have_common_type (type1, type2, -3, NULL_TREE)) @@ -6797,27 +6799,40 @@ convert_for_assignment (location_t location, location_t expr_loc, tree type, /* This macro is used to emit diagnostics to ensure that all format strings are complete sentences, visible to gettext and checked at - compile time. It is the same as PEDWARN_FOR_ASSIGNMENT but with an - extra parameter to enumerate qualifiers. */ -#define PEDWARN_FOR_QUALIFIERS(LOCATION, PLOC, OPT, AR, AS, IN, RE, QUALS) \ + compile time. It can be called with 'pedwarn' or 'warning_at'. */ +#define WARNING_FOR_QUALIFIERS(PEDWARN, LOCATION, PLOC, OPT, AR, AS, IN, RE, QUALS) \ do { \ switch (errtype) \ { \ case ic_argpass: \ - { \ - auto_diagnostic_group d; \ - if (pedwarn (PLOC, OPT, AR, parmnum, rname, QUALS)) \ - inform_for_arg (fundecl, (PLOC), parmnum, type, rhstype); \ - } \ + { \ + auto_diagnostic_group d; \ + if (PEDWARN) { \ + if (pedwarn (PLOC, OPT, AR, parmnum, rname, QUALS)) \ + inform_for_arg (fundecl, (PLOC), parmnum, type, rhstype); \ + } else { \ + if (warning_at (PLOC, OPT, AR, parmnum, rname, QUALS)) \ + inform_for_arg (fundecl, (PLOC), parmnum, type, rhstype); \ + } \ + } \ break; \ case ic_assign: \ - pedwarn (LOCATION, OPT, AS, QUALS); \ + if (PEDWARN) \ + pedwarn (LOCATION, OPT, AS, QUALS); \ + else \ + warning_at (LOCATION, OPT, AS, QUALS); \ break; \ case ic_init: \ - pedwarn (LOCATION, OPT, IN, QUALS); \ + if (PEDWARN) \ + pedwarn (LOCATION, OPT, IN, QUALS); \ + else \ + warning_at (LOCATION, OPT, IN, QUALS); \ break; \ case ic_return: \ - pedwarn (LOCATION, OPT, RE, QUALS); \ + if (PEDWARN) \ + pedwarn (LOCATION, OPT, RE, QUALS); \ + else \ + warning_at (LOCATION, OPT, RE, QUALS); \ break; \ default: \ gcc_unreachable (); \ @@ -6826,32 +6841,11 @@ convert_for_assignment (location_t location, location_t expr_loc, tree type, /* This macro is used to emit diagnostics to ensure that all format strings are complete sentences, visible to gettext and checked at - compile time. It is the same as PEDWARN_FOR_QUALIFIERS but uses - warning_at instead of pedwarn. */ -#define WARNING_FOR_QUALIFIERS(LOCATION, PLOC, OPT, AR, AS, IN, RE, QUALS) \ - do { \ - switch (errtype) \ - { \ - case ic_argpass: \ - { \ - auto_diagnostic_group d; \ - if (warning_at (PLOC, OPT, AR, parmnum, rname, QUALS)) \ - inform_for_arg (fundecl, (PLOC), parmnum, type, rhstype); \ - } \ - break; \ - case ic_assign: \ - warning_at (LOCATION, OPT, AS, QUALS); \ - break; \ - case ic_init: \ - warning_at (LOCATION, OPT, IN, QUALS); \ - break; \ - case ic_return: \ - warning_at (LOCATION, OPT, RE, QUALS); \ - break; \ - default: \ - gcc_unreachable (); \ - } \ - } while (0) + compile time. It is the same as PEDWARN_FOR_ASSIGNMENT but with an + extra parameter to enumerate qualifiers. */ +#define PEDWARN_FOR_QUALIFIERS(LOCATION, PLOC, OPT, AR, AS, IN, RE, QUALS) \ + WARNING_FOR_QUALIFIERS (true, LOCATION, PLOC, OPT, AR, AS, IN, RE, QUALS) + if (TREE_CODE (rhs) == EXCESS_PRECISION_EXPR) rhs = TREE_OPERAND (rhs, 0); @@ -7370,17 +7364,18 @@ convert_for_assignment (location_t location, location_t expr_loc, tree type, if (TYPE_QUALS_NO_ADDR_SPACE_NO_ATOMIC (ttr) & ~TYPE_QUALS_NO_ADDR_SPACE_NO_ATOMIC (ttl)) - WARNING_FOR_QUALIFIERS (location, expr_loc, - OPT_Wdiscarded_array_qualifiers, - G_("passing argument %d of %qE discards " + WARNING_FOR_QUALIFIERS (flag_isoc2x, + location, expr_loc, + OPT_Wdiscarded_array_qualifiers, + G_("passing argument %d of %qE discards " "%qv qualifier from pointer target type"), - G_("assignment discards %qv qualifier " + G_("assignment discards %qv qualifier " "from pointer target type"), - G_("initialization discards %qv qualifier " + G_("initialization discards %qv qualifier " "from pointer target type"), - G_("return discards %qv qualifier from " + G_("return discards %qv qualifier from " "pointer target type"), - TYPE_QUALS (ttr) & ~TYPE_QUALS (ttl)); + TYPE_QUALS (ttr) & ~TYPE_QUALS (ttl)); } else if (pedantic && ((VOID_TYPE_P (ttl) && TREE_CODE (ttr) == FUNCTION_TYPE) @@ -7403,28 +7398,31 @@ convert_for_assignment (location_t location, location_t expr_loc, tree type, else if (TREE_CODE (ttr) != FUNCTION_TYPE && TREE_CODE (ttl) != FUNCTION_TYPE) { + /* Assignments between atomic and non-atomic objects are OK. */ + bool warn_quals_ped = TYPE_QUALS_NO_ADDR_SPACE_NO_ATOMIC (ttr) + & ~TYPE_QUALS_NO_ADDR_SPACE_NO_ATOMIC (ttl); + bool warn_quals = TYPE_QUALS_NO_ADDR_SPACE_NO_ATOMIC (ttr) + & ~TYPE_QUALS_NO_ADDR_SPACE_NO_ATOMIC (strip_array_types (ttl)); + /* Don't warn about loss of qualifier for conversions from qualified void* to pointers to arrays with corresponding - qualifier on the element type. */ - if (!pedantic) - ttl = strip_array_types (ttl); + qualifier on the element type (except for pedantic before C23). */ + if (warn_quals || (warn_quals_ped && pedantic && !flag_isoc2x)) + PEDWARN_FOR_QUALIFIERS (location, expr_loc, + OPT_Wdiscarded_qualifiers, + G_("passing argument %d of %qE discards " + "%qv qualifier from pointer target type"), + G_("assignment discards %qv qualifier " + "from pointer target type"), + G_("initialization discards %qv qualifier " + "from pointer target type"), + G_("return discards %qv qualifier from " + "pointer target type"), + TYPE_QUALS (ttr) & ~TYPE_QUALS (ttl)); + else if (warn_quals_ped) + pedwarn_c11 (location, OPT_Wc11_c2x_compat, + "array with qualifier on the element is not qualified before C2X"); - /* Assignments between atomic and non-atomic objects are OK. */ - if (TYPE_QUALS_NO_ADDR_SPACE_NO_ATOMIC (ttr) - & ~TYPE_QUALS_NO_ADDR_SPACE_NO_ATOMIC (ttl)) - { - PEDWARN_FOR_QUALIFIERS (location, expr_loc, - OPT_Wdiscarded_qualifiers, - G_("passing argument %d of %qE discards " - "%qv qualifier from pointer target type"), - G_("assignment discards %qv qualifier " - "from pointer target type"), - G_("initialization discards %qv qualifier " - "from pointer target type"), - G_("return discards %qv qualifier from " - "pointer target type"), - TYPE_QUALS (ttr) & ~TYPE_QUALS (ttl)); - } /* If this is not a case of ignoring a mismatch in signedness, no warning. */ else if (VOID_TYPE_P (ttl) || VOID_TYPE_P (ttr) diff --git a/gcc/testsuite/gcc.dg/c11-qual-1.c b/gcc/testsuite/gcc.dg/c11-qual-1.c new file mode 100644 index 0000000..f731e06 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c11-qual-1.c @@ -0,0 +1,11 @@ +/* Test that qualifiers are lost in tertiary operator for pointers to arrays before C2X, PR98397 */ +/* { dg-do compile } */ +/* { dg-options "-std=c11 -pedantic-errors -Wno-discarded-array-qualifiers" } */ + +void foo(void) +{ + const int (*u)[1]; + void *v; + _Static_assert(_Generic(1 ? u : v, const void*: 0, void*: 1), "qualifier not lost"); + _Static_assert(_Generic(1 ? v : u, const void*: 0, void*: 1), "qualifier not lost"); +} diff --git a/gcc/testsuite/gcc.dg/c2x-qual-1.c b/gcc/testsuite/gcc.dg/c2x-qual-1.c new file mode 100644 index 0000000..4d33db1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c2x-qual-1.c @@ -0,0 +1,30 @@ +/* Tests related to qualifiers and pointers to arrays in C2X, PR98397 */ +/* { dg-do compile } */ +/* { dg-options "-std=c2x -pedantic-errors" } */ + +/* test that qualifiers are preserved in tertiary operator for pointers to arrays in C2X */ + +void f(void) +{ + const int (*u)[1]; + void *v; + _Static_assert(_Generic(1 ? u : v, const void*: 1, void*: 0), "lost qualifier"); + _Static_assert(_Generic(1 ? v : u, const void*: 1, void*: 0), "lost qualifier"); +} + +/* test that assignment of unqualified to qualified pointers works as expected */ + +void g(void) +{ + int (*x)[3]; + const int (*p)[3] = x; +} + +/* test that assignment of qualified void pointers works as expected */ + +void h(void) +{ + const void* x; + const int (*p)[3] = x; +} + diff --git a/gcc/testsuite/gcc.dg/c2x-qual-2.c b/gcc/testsuite/gcc.dg/c2x-qual-2.c new file mode 100644 index 0000000..f60a5b1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c2x-qual-2.c @@ -0,0 +1,30 @@ +/* Tests related to qualifiers and pointers to arrays in C2X, PR98397 */ +/* { dg-do compile } */ +/* { dg-options "-std=c2x -Wc11-c2x-compat" } */ + +/* test that qualifiers are preserved in tertiary operator for pointers to arrays in C2X */ + +void f(void) +{ + const int (*u)[1]; + void *v; + _Static_assert(_Generic(1 ? u : v, const void*: 1, void*: 0), "lost qualifier"); /* { dg-warning "pointer to array loses qualifier in conditional" } */ + _Static_assert(_Generic(1 ? v : u, const void*: 1, void*: 0), "lost qualifier"); /* { dg-warning "pointer to array loses qualifier in conditional" } */ +} + +/* test that assignment of unqualified to qualified pointers works as expected */ + +void g(void) +{ + int (*x)[3]; + const int (*p)[3] = x; /* { dg-warning "arrays with different qualifiers" } */ +} + +/* test that assignment of qualified void pointers works as expected */ + +void h(void) +{ + const void* x; + const int (*p)[3] = x; /* { dg-warning "array with qualifier on the element is not qualified before C2X" } */ +} + diff --git a/gcc/testsuite/gcc.dg/c2x-qual-3.c b/gcc/testsuite/gcc.dg/c2x-qual-3.c new file mode 100644 index 0000000..31896fcb --- /dev/null +++ b/gcc/testsuite/gcc.dg/c2x-qual-3.c @@ -0,0 +1,30 @@ +/* Tests related to qualifiers and pointers to arrays in C2X, PR98397 */ +/* { dg-do compile } */ +/* { dg-options "-std=c2x -Wc11-c2x-compat -pedantic-errors" } */ + +/* test that qualifiers are preserved in tertiary operator for pointers to arrays in C2X */ + +void f(void) +{ + const int (*u)[1]; + void *v; + _Static_assert(_Generic(1 ? u : v, const void*: 1, void*: 0), "lost qualifier"); /* { dg-warning "pointer to array loses qualifier in conditional" } */ + _Static_assert(_Generic(1 ? v : u, const void*: 1, void*: 0), "lost qualifier"); /* { dg-warning "pointer to array loses qualifier in conditional" } */ +} + +/* test that assignment of unqualified to qualified pointers works as expected */ + +void g(void) +{ + int (*x)[3]; + const int (*p)[3] = x; /* { dg-warning "arrays with different qualifiers" } */ +} + +/* test that assignment of qualified void pointers works as expected */ + +void h(void) +{ + const void* x; + const int (*p)[3] = x; /* { dg-warning "array with qualifier on the element is not qualified before C2X" } */ +} + diff --git a/gcc/testsuite/gcc.dg/c2x-qual-4.c b/gcc/testsuite/gcc.dg/c2x-qual-4.c new file mode 100644 index 0000000..93b4723 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c2x-qual-4.c @@ -0,0 +1,105 @@ +/* { dg-do compile } */ +/* { dg-options "-std=c2x" } */ +void tvoid(void* x); +void transpose0(double* out, const double* in) { } +void transpose1(double out[2][2], const double in[2][2]) { } +void transpose2(double out[2][2][2], const double in[2][2][2]) { } +// return +int (*y2(const int x[3][3]))[3] { return x; } /* { dg-warning "return discards 'const' qualifier from pointer target type" } */ +const int (*y3(int x[3][3]))[3] { return x; } +void test(void) +{ + double x0[2]; + double y0[2]; + const double z0[4]; + double x1[2][2]; + double y1[2][2]; + double o1[2][3]; + const double z1[2][2]; + double x2[2][2][2]; + double y2[2][2][2]; + double o2[2][2][3]; + const double z2[2][2][2]; + // void pointers + tvoid(x0); + tvoid(x1); + tvoid(x2); + tvoid(z0); /* { dg-warning "passing argument 1 of 'tvoid' discards 'const' qualifier from pointer target type" } */ + tvoid(z1); /* { dg-warning "passing argument 1 of 'tvoid' discards 'const' qualifier from pointer target type" } */ + tvoid(z2); /* { dg-warning "passing argument 1 of 'tvoid' discards 'const' qualifier from pointer target type" } */ + void* p; + const void* pc; + p = x0; + p = x1; + p = x2; + p = z0; /* { dg-warning "assignment discards 'const' qualifier from pointer target type" } */ + p = z1; /* { dg-warning "assignment discards 'const' qualifier from pointer target type" } */ + p = z2; /* { dg-warning "assignment discards 'const' qualifier from pointer target type" } */ + pc = x0; + pc = x1; + pc = x2; + pc = z0; + pc = z1; + pc = z2; + transpose0(pc, p); /* { dg-warning "passing argument 1 of 'transpose0' discards 'const' qualifier from pointer target type" } */ + transpose1(pc, p); /* { dg-warning "passing argument 1 of 'transpose1' discards 'const' qualifier from pointer target type" } */ + transpose2(pc, p); /* { dg-warning "passing argument 1 of 'transpose2' discards 'const' qualifier from pointer target type" } */ + transpose0(p, pc); + transpose1(p, pc); + transpose2(p, pc); + // passing as arguments + transpose0(y0, x0); + transpose1(y1, x1); + transpose2(y2, x2); + // initialization + const double (*u0p) = x0; + const double (*u1p)[2] = x1; + const double (*u2p)[2][2] = x2; + double (*v0p) = z0; /* { dg-warning "initialization discards 'const' qualifier from pointer target type" } */ + double (*v1p)[2] = z1; /* { dg-warning "initialization discards 'const' qualifier from pointer target type" } */ + double (*v2p)[2][2] = z2; /* { dg-warning "initialization discards 'const' qualifier from pointer target type" } */ + // subtraction + &(x0[1]) - &(z0[0]); + &(x1[1]) - &(z1[0]); + &(x2[1]) - &(z2[0]); + // comparison + x0 == z0; + x1 == z1; + x2 == z2; + x0 < z0; + x1 < z1; + x2 < z2; + x0 > z0; + x1 > z1; + x2 > z2; + // assignment + u0p = x0; + u1p = x1; + u2p = x2; + v0p = z0; /* { dg-warning "assignment discards 'const' qualifier from pointer target type" } */ + v1p = z1; /* { dg-warning "assignment discards 'const' qualifier from pointer target type" } */ + v2p = z2; /* { dg-warning "assignment discards 'const' qualifier from pointer target type" } */ + // conditional expressions + (void)(1 ? x0 : z0); + (void)(1 ? x1 : z1); + (void)(1 ? x2 : z2); + (void)(1 ? x0 : x1); /* { dg-warning "pointer type mismatch in conditional expression" } */ + (void)(1 ? x1 : x2); /* { dg-warning "pointer type mismatch in conditional expression" } */ + (void)(1 ? x2 : x0); /* { dg-warning "pointer type mismatch in conditional expression" } */ + v0p = (1 ? z0 : v0p); /* { dg-warning "assignment discards 'const' qualifier from pointer target type" } */ + v1p = (1 ? z1 : v1p); /* { dg-warning "assignment discards 'const' qualifier from pointer target type" } */ + v2p = (1 ? z2 : v2p); /* { dg-warning "assignment discards 'const' qualifier from pointer target type" } */ + v0p = (1 ? x0 : u0p); /* { dg-warning "assignment discards 'const' qualifier from pointer target type" } */ + v1p = (1 ? x1 : u1p); /* { dg-warning "assignment discards 'const' qualifier from pointer target type" } */ + v2p = (1 ? x2 : u2p); /* { dg-warning "assignment discards 'const' qualifier from pointer target type" } */ + (1 ? x0 : z0)[0] = 1; /* { dg-error "assignment of read-only location" } */ + (1 ? x1 : z1)[0][0] = 1; /* { dg-error "assignment of read-only location" } */ + (1 ? x2 : z2)[0][0][0] = 1; /* { dg-error "assignment of read-only location" } */ + v0p = (1 ? p : z0); /* { dg-warning "assignment discards 'const' qualifier from pointer target type" } */ + v1p = (1 ? p : z1); /* { dg-warning "assignment discards 'const' qualifier from pointer target type" } */ + v2p = (1 ? p : z2); /* { dg-warning "assignment discards 'const' qualifier from pointer target type" } */ + v0p = (1 ? pc : x0); /* { dg-warning "assignment discards 'const' qualifier from pointer target type" } */ + v1p = (1 ? pc : x1); /* { dg-warning "assignment discards 'const' qualifier from pointer target type" } */ + v2p = (1 ? pc : x2); /* { dg-warning "assignment discards 'const' qualifier from pointer target type" } */ +} + diff --git a/gcc/testsuite/gcc.dg/c2x-qual-5.c b/gcc/testsuite/gcc.dg/c2x-qual-5.c new file mode 100644 index 0000000..0801fa0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c2x-qual-5.c @@ -0,0 +1,101 @@ +/* { dg-do compile } */ +/* { dg-options "-std=c2x -pedantic-errors" } */ +void tvoid(void* x); +void transpose0(double* out, const double* in) { } +void transpose1(double out[2][2], const double in[2][2]) { } +void transpose2(double out[2][2][2], const double in[2][2][2]) { } +// return +int (*x2(const int x[3][3]))[3] { return x; } /* { dg-error "return discards" } */ +const int (*x3(int x[3][3]))[3] { return x; } +void test(void) +{ + double x0[2]; + double y0[2]; + const double z0[4]; + double x1[2][2]; + double y1[2][2]; + double o1[2][3]; + const double z1[2][2]; + double x2[2][2][2]; + double y2[2][2][2]; + double o2[2][2][3]; + const double z2[2][2][2]; + // void pointers + tvoid(z0); /* { dg-error "passing argument 1 of 'tvoid' discards 'const' qualifier from pointer target type" } */ + tvoid(z1); /* { dg-error "passing argument 1 of 'tvoid' discards 'const' qualifier from pointer target type" } */ + tvoid(z2); /* { dg-error "passing argument 1 of 'tvoid' discards 'const' qualifier from pointer target type" } */ + void* p; + const void* pc; + p = x0; + p = x1; + p = x2; + p = z0; /* { dg-error "assignment discards 'const' qualifier from pointer target type" } */ + p = z1; /* { dg-error "assignment discards 'const' qualifier from pointer target type" } */ + p = z2; /* { dg-error "assignment discards 'const' qualifier from pointer target type" } */ + pc = x0; + pc = x1; + pc = x2; + pc = z0; + pc = z1; + pc = z2; + transpose0(pc, p); /* { dg-error "passing argument 1 of 'transpose0' discards 'const' qualifier from pointer target type" } */ + transpose1(pc, p); /* { dg-error "passing argument 1 of 'transpose1' discards 'const' qualifier from pointer target type" } */ + transpose2(pc, p); /* { dg-error "passing argument 1 of 'transpose2' discards 'const' qualifier from pointer target type" } */ + transpose0(p, pc); + transpose1(p, pc); + transpose2(p, pc); + // passing as arguments + transpose0(y0, x0); + transpose1(y1, o1); /* { dg-error "passing argument 2 of 'transpose1' from incompatible pointer type" } */ + transpose1(y1, x1); + transpose2(y2, o2); /* { dg-error "passing argument 2 of 'transpose2' from incompatible pointer type" } */ + transpose2(y2, x2); + // initialization + const double (*x0p) = x0; + const double (*x1p)[2] = x1; + const double (*x2p)[2][2] = x2; + double (*v0p) = z0; /* { dg-error "initialization discards 'const' qualifier from pointer target type" } */ + double (*v1p)[2] = z1; /* { dg-error "initialization discards" } */ + double (*v2p)[2][2] = z2; /* { dg-error "initialization discards" } */ + // assignment + x0p = x0; + x1p = x1; + x2p = x2; + // subtraction + &(x0[1]) - &(z0[0]); + &(x1[1]) - &(z1[0]); + &(x2[1]) - &(z2[0]); + // comparison + x0 == z0; + x1 == z1; + x2 == z2; + x0 < z0; + x1 < z1; + x2 < z2; + x0 > z0; + x1 > z1; + x2 > z2; + // conditional expressions + (void)(1 ? x0 : z0); + (void)(1 ? x1 : z1); + (void)(1 ? x2 : z2); + (void)(1 ? x0 : x1); /* { dg-error "pointer type mismatch in conditional expression" } */ + (void)(1 ? x1 : x2); /* { dg-error "pointer type mismatch in conditional expression" } */ + (void)(1 ? x2 : x0); /* { dg-error "pointer type mismatch in conditional expression" } */ + v0p = (1 ? z0 : v0p); /* { dg-error "assignment discards 'const' qualifier from pointer target type" } */ + v1p = (1 ? z1 : v1p); /* { dg-error "assignment discards" } */ + v2p = (1 ? z2 : v2p); /* { dg-error "assignment discards" } */ + v0p = (1 ? x0 : x0p); /* { dg-error "assignment discards 'const' qualifier from pointer target type" } */ + v1p = (1 ? x1 : x1p); /* { dg-error "assignment discards" } */ + v2p = (1 ? x2 : x2p); /* { dg-error "assignment discards" } */ + (1 ? x0 : z0)[0] = 1; /* { dg-error "assignment of read-only location" } */ + (1 ? x1 : z1)[0][0] = 1; /* { dg-error "assignment of read-only location" } */ + (1 ? x2 : z2)[0][0][0] = 1; /* { dg-error "assignment of read-only location" } */ + v0p = (1 ? p : z0); /* { dg-error "assignment discards 'const' qualifier from pointer target type" } */ + v1p = (1 ? p : z1); /* { dg-error "assignment discards 'const' qualifier from pointer target type" } */ + v2p = (1 ? p : z2); /* { dg-error "assignment discards 'const' qualifier from pointer target type" } */ + v0p = (1 ? pc : x0); /* { dg-error "assignment discards 'const' qualifier from pointer target type" } */ + v1p = (1 ? pc : x1); /* { dg-error "assignment discards 'const' qualifier from pointer target type" } */ + v2p = (1 ? pc : x2); /* { dg-error "assignment discards 'const' qualifier from pointer target type" } */ +} + diff --git a/gcc/testsuite/gcc.dg/c2x-qual-6.c b/gcc/testsuite/gcc.dg/c2x-qual-6.c new file mode 100644 index 0000000..9c91e20 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c2x-qual-6.c @@ -0,0 +1,114 @@ +/* { dg-do compile } */ +/* { dg-options "-std=c2x -Wc11-c2x-compat -pedantic-errors" } */ +void tvoid(void* x); +void transpose0(double* out, const double* in) { } +void transpose1(double out[2][2], const double in[2][2]) { } +void transpose2(double out[2][2][2], const double in[2][2][2]) { } +// return +int (*x2(const int x[3][3]))[3] { return x; } /* { dg-warning "before C2X" } */ + /* { dg-error "return discards" "" { target *-*-* } .-1 } */ +const int (*x3(int x[3][3]))[3] { return x; } /* { dg-warning "before C2X" } */ +void test(void) +{ + double x0[2]; + double y0[2]; + const double z0[4]; + double x1[2][2]; + double y1[2][2]; + double o1[2][3]; + const double z1[2][2]; + double x2[2][2][2]; + double y2[2][2][2]; + double o2[2][2][3]; + const double z2[2][2][2]; + // void pointers + tvoid(z0); /* { dg-error "passing argument 1 of 'tvoid' discards 'const' qualifier from pointer target type" } */ + tvoid(z1); /* { dg-error "passing argument 1 of 'tvoid' discards 'const' qualifier from pointer target type" } */ + tvoid(z2); /* { dg-error "passing argument 1 of 'tvoid' discards 'const' qualifier from pointer target type" } */ + void* p; + const void* pc; + p = x0; + p = x1; + p = x2; + p = z0; /* { dg-error "assignment discards 'const' qualifier from pointer target type" } */ + p = z1; /* { dg-error "assignment discards 'const' qualifier from pointer target type" } */ + p = z2; /* { dg-error "assignment discards 'const' qualifier from pointer target type" } */ + pc = x0; + pc = x1; + pc = x2; + pc = z0; + pc = z1; + pc = z2; + transpose0(pc, p); /* { dg-error "passing argument 1 of 'transpose0' discards 'const' qualifier from pointer target type" } */ + transpose1(pc, p); /* { dg-error "passing argument 1 of 'transpose1' discards 'const' qualifier from pointer target type" } */ + transpose2(pc, p); /* { dg-error "passing argument 1 of 'transpose2' discards 'const' qualifier from pointer target type" } */ + transpose0(p, pc); + transpose1(p, pc); /* { dg-warning "before C2X" } */ + transpose2(p, pc); /* { dg-warning "before C2X" } */ + // passing as arguments + transpose0(y0, x0); + transpose1(y1, o1); /* { dg-error "passing argument 2 of 'transpose1' from incompatible pointer type" } */ + transpose1(y1, x1); /* { dg-warning "before C2X" } */ + transpose2(y2, o2); /* { dg-error "passing argument 2 of 'transpose2' from incompatible pointer type" } */ + transpose2(y2, x2); /* { dg-warning "before C2X" } */ + // initialization + const double (*x0p) = x0; + const double (*x1p)[2] = x1; /* { dg-warning "before C2X" } */ + const double (*x2p)[2][2] = x2; /* { dg-warning "before C2X" } */ + double (*v0p) = z0; /* { dg-error "initialization discards 'const' qualifier from pointer target type" } */ + double (*v1p)[2] = z1; /* { dg-warning "before C2X" } */ + /* { dg-error "initialization discards" "" { target *-*-* } .-1 } */ + double (*v2p)[2][2] = z2; /* { dg-warning "before C2X" } */ + /* { dg-error "initialization discards" "" { target *-*-* } .-1 } */ + + // assignment + x0p = x0; + x1p = x1; /* { dg-warning "before C2X" } */ + x2p = x2; /* { dg-warning "before C2X" } */ + + // subtraction + &(x0[1]) - &(z0[0]); + &(x1[1]) - &(z1[0]); /* { dg-warning "before C2X" } */ + &(x2[1]) - &(z2[0]); /* { dg-warning "before C2X" } */ + // comparison + x0 == z0; + x1 == z1; /* { dg-warning "before C2X" } */ + x2 == z2; /* { dg-warning "before C2X" } */ + x0 < z0; + x1 < z1; /* { dg-warning "before C2X" } */ + x2 < z2; /* { dg-warning "before C2X" } */ + x0 > z0; + x1 > z1; /* { dg-warning "before C2X" } */ + x2 > z2; /* { dg-warning "before C2X" } */ + // conditional expressions + (void)(1 ? x0 : z0); + (void)(1 ? x1 : z1); /* { dg-warning "before C2X" } */ + (void)(1 ? x2 : z2); /* { dg-warning "before C2X" } */ + (void)(1 ? x0 : x1); /* { dg-error "pointer type mismatch in conditional expression" } */ + (void)(1 ? x1 : x2); /* { dg-error "pointer type mismatch in conditional expression" } */ + (void)(1 ? x2 : x0); /* { dg-error "pointer type mismatch in conditional expression" } */ + v0p = (1 ? z0 : v0p); /* { dg-error "assignment discards 'const' qualifier from pointer target type" } */ + v1p = (1 ? z1 : v1p); /* { dg-warning "before C2X" } */ + /* { dg-error "assignment discards" "" { target *-*-* } .-1 } */ + v2p = (1 ? z2 : v2p); /* { dg-warning "before C2X" } */ + /* { dg-error "assignment discards" "" { target *-*-* } .-1 } */ + v0p = (1 ? x0 : x0p); /* { dg-error "assignment discards 'const' qualifier from pointer target type" } */ + v1p = (1 ? x1 : x1p); /* { dg-error "assignment discards" } */ + /* { dg-warning "before C2X" "" { target *-*-* } .-1 } */ + v2p = (1 ? x2 : x2p); /* { dg-error "assignment discards" } */ + /* { dg-warning "before C2X" "" { target *-*-* } .-1 } */ + (1 ? x0 : z0)[0] = 1; /* { dg-error "assignment of read-only location" } */ + (1 ? x1 : z1)[0][0] = 1; /* { dg-error "assignment of read-only location" } */ + /* { dg-warning "before C2X" "" { target *-*-* } .-1 } */ + (1 ? x2 : z2)[0][0][0] = 1; /* { dg-error "assignment of read-only location" } */ + /* { dg-warning "before C2X" "" { target *-*-* } .-1 } */ + v0p = (1 ? p : z0); /* { dg-error "assignment discards 'const' qualifier from pointer target type" } */ + v1p = (1 ? p : z1); /* { dg-error "assignment discards 'const' qualifier from pointer target type" } */ + /* { dg-warning "before C2X" "" { target *-*-* } .-1 } */ + v2p = (1 ? p : z2); /* { dg-error "assignment discards 'const' qualifier from pointer target type" } */ + /* { dg-warning "before C2X" "" { target *-*-* } .-1 } */ + v0p = (1 ? pc : x0); /* { dg-error "assignment discards 'const' qualifier from pointer target type" } */ + v1p = (1 ? pc : x1); /* { dg-error "assignment discards 'const' qualifier from pointer target type" } */ + v2p = (1 ? pc : x2); /* { dg-error "assignment discards 'const' qualifier from pointer target type" } */ +} + diff --git a/gcc/testsuite/gcc.dg/c2x-qual-7.c b/gcc/testsuite/gcc.dg/c2x-qual-7.c new file mode 100644 index 0000000..5fe15e1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c2x-qual-7.c @@ -0,0 +1,16 @@ +/* Tests related to qualifiers and pointers to arrays in C2X, PR98397 */ +/* { dg-do compile } */ +/* { dg-options "-std=c2x -pedantic-errors" } */ + +/* test that _Atomic qualifier is not preserved in tertiary operator for pointers to arrays in C2X */ + +void f(void) +{ + _Atomic void *u; + void *v; + _Static_assert(_Generic(1 ? u : v, _Atomic void*: 0, void*: 1), "_Atomic should be removed"); + _Static_assert(_Generic(1 ? v : u, _Atomic void*: 0, void*: 1), "_Atomic should be removed"); +} + + + diff --git a/gcc/testsuite/gcc.dg/pointer-array-quals-1.c b/gcc/testsuite/gcc.dg/pointer-array-quals-1.c index 921a37e..498ab22 100644 --- a/gcc/testsuite/gcc.dg/pointer-array-quals-1.c +++ b/gcc/testsuite/gcc.dg/pointer-array-quals-1.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* Origin: Martin Uecker */ -/* { dg-options "-Wdiscarded-array-qualifiers" } */ +/* { dg-options "" } */ void tvoid(void* x); void transpose0(double* out, const double* in) { } void transpose1(double out[2][2], const double in[2][2]) { } diff --git a/gcc/testsuite/gcc.dg/pointer-array-quals-2.c b/gcc/testsuite/gcc.dg/pointer-array-quals-2.c index 30689c7..4c95d8a 100644 --- a/gcc/testsuite/gcc.dg/pointer-array-quals-2.c +++ b/gcc/testsuite/gcc.dg/pointer-array-quals-2.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-Wdiscarded-array-qualifiers -pedantic-errors" } */ +/* { dg-options "-pedantic-errors" } */ /* Origin: Martin Uecker */ void tvoid(void* x); void transpose0(double* out, const double* in) { } -- cgit v1.1 From 5b2876f96c16f43c7b4810237ac92bb8f9d18c01 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Mon, 23 Aug 2021 00:16:28 +0000 Subject: Daily bump. --- gcc/ChangeLog | 7 +++++++ gcc/DATESTAMP | 2 +- gcc/c/ChangeLog | 10 ++++++++++ gcc/testsuite/ChangeLog | 20 ++++++++++++++++++++ 4 files changed, 38 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index cc510af..b7a23d3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2021-08-22 Jan Hubicka + Martin Liska + + PR middle-end/101949 + * ipa-modref.c (analyze_ssa_name_flags): Indirect call implies + ~EAF_NOCLOBBER. + 2021-08-21 Dragan Mladjenovic * config/mips/mips.c (mips_function_rodata_section, diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index ff97480..d2e7bda 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20210822 +20210823 diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index e5e12b3..6ca524b 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,13 @@ +2021-08-22 Martin Uecker + + PR c/98397 + * c-typeck.c (comp_target_types): Change pedwarn to pedwarn_c11 + for pointers to arrays with qualifiers. + (build_conditional_expr): For C23 don't lose qualifiers for pointers + to arrays when the other pointer is a void pointer. Update warnings. + (convert_for_assignment): Update warnings for C2X when converting from + void* with qualifiers to a pointer to array with the same qualifiers. + 2021-08-20 Jakub Jelinek * c-parser.c (c_parser_omp_error): New function. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ebea99d..fa50fe5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,23 @@ +2021-08-22 Martin Uecker + + PR c/98397 + * gcc.dg/c11-qual-1.c: New test. + * gcc.dg/c2x-qual-1.c: New test. + * gcc.dg/c2x-qual-2.c: New test. + * gcc.dg/c2x-qual-3.c: New test. + * gcc.dg/c2x-qual-4.c: New test. + * gcc.dg/c2x-qual-5.c: New test. + * gcc.dg/c2x-qual-6.c: New test. + * gcc.dg/c2x-qual-7.c: New test. + * gcc.dg/pointer-array-quals-1.c: Remove unnecessary flag. + * gcc.dg/pointer-array-quals-2.c: Remove unnecessary flag. + +2021-08-22 Jan Hubicka + Martin Liska + + * gcc.dg/lto/pr101949_0.c: New test. + * gcc.dg/lto/pr101949_1.c: New test. + 2021-08-21 Ankur Saini PR analyzer/101980 -- cgit v1.1 From 4a4616e53f440e15d0f3e91e23b67a3b5c84dddf Mon Sep 17 00:00:00 2001 From: Jonathan Yong <10walls@gmail.com> Date: Sun, 22 Aug 2021 03:05:07 +0000 Subject: gcc.c-torture/execute: Fix tmpnam issue on Windows 2021-08-22 Jonathan Yong <10walls@gmail.com> gcc/testsuite/ChangeLog: * gcc.c-torture/execute/gcc_tmpnam.h: Fix tmpnam case on Windows where it can return a filename with "\" to indicate current directory. * gcc.c-torture/execute/fprintf-2.c: Use wrapper. * gcc.c-torture/execute/printf-2.c: Use wrapper. * gcc.c-torture/execute/user-printf.c: Use wrapper. Signed-off-by: Jonathan Yong <10walls@gmail.com> --- gcc/testsuite/gcc.c-torture/execute/fprintf-2.c | 3 ++- gcc/testsuite/gcc.c-torture/execute/gcc_tmpnam.h | 13 +++++++++++++ gcc/testsuite/gcc.c-torture/execute/printf-2.c | 3 ++- gcc/testsuite/gcc.c-torture/execute/user-printf.c | 3 ++- 4 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/execute/gcc_tmpnam.h (limited to 'gcc') diff --git a/gcc/testsuite/gcc.c-torture/execute/fprintf-2.c b/gcc/testsuite/gcc.c-torture/execute/fprintf-2.c index d8e19e7..00517d1 100644 --- a/gcc/testsuite/gcc.c-torture/execute/fprintf-2.c +++ b/gcc/testsuite/gcc.c-torture/execute/fprintf-2.c @@ -9,10 +9,11 @@ #include #include #include +#include "gcc_tmpnam.h" int main (void) { - char *tmpfname = tmpnam (0); + char *tmpfname = gcc_tmpnam (0); FILE *f = fopen (tmpfname, "w"); if (!f) { diff --git a/gcc/testsuite/gcc.c-torture/execute/gcc_tmpnam.h b/gcc/testsuite/gcc.c-torture/execute/gcc_tmpnam.h new file mode 100644 index 0000000..2136e6e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/gcc_tmpnam.h @@ -0,0 +1,13 @@ +#include +#ifndef GCC_TMPNAM +#define GCC_TMPNAM +static inline char *gcc_tmpnam(char *s) +{ + char *ret = tmpnam (s); + // Windows sometimes prepends a backslash to denote the current directory, + // so swallow that if it occurs + if (ret[0] == '\\') + ++ret; + return ret; +} +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/printf-2.c b/gcc/testsuite/gcc.c-torture/execute/printf-2.c index 4e7d8f7..2087bba 100644 --- a/gcc/testsuite/gcc.c-torture/execute/printf-2.c +++ b/gcc/testsuite/gcc.c-torture/execute/printf-2.c @@ -10,6 +10,7 @@ #include #include #include +#include "gcc_tmpnam.h" __attribute__ ((noipa)) void write_file (void) @@ -26,7 +27,7 @@ write_file (void) int main (void) { - char *tmpfname = tmpnam (0); + char *tmpfname = gcc_tmpnam (0); FILE *f = freopen (tmpfname, "w", stdout); if (!f) { diff --git a/gcc/testsuite/gcc.c-torture/execute/user-printf.c b/gcc/testsuite/gcc.c-torture/execute/user-printf.c index 42a3b17..bfee076 100644 --- a/gcc/testsuite/gcc.c-torture/execute/user-printf.c +++ b/gcc/testsuite/gcc.c-torture/execute/user-printf.c @@ -11,6 +11,7 @@ #include #include #include +#include "gcc_tmpnam.h" void __attribute__ ((format (printf, 1, 2), noipa)) user_print (const char *fmt, ...) @@ -23,7 +24,7 @@ user_print (const char *fmt, ...) int main (void) { - char *tmpfname = tmpnam (0); + char *tmpfname = gcc_tmpnam (0); FILE *f = freopen (tmpfname, "w", stdout); if (!f) { -- cgit v1.1 From f93f0868919ab32bfbc24adb40158298031a4d58 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Fri, 20 Aug 2021 22:52:57 +0800 Subject: mips: msa: truncate immediate shift amount [PR101922] When -mloongson-mmi is enabled, SHIFT_COUNT_TRUNCATED is turned off. This causes untruncated immediate shift amount outputed into the asm, and the GNU assembler refuses to assemble it. Truncate immediate shift amount when outputing the asm instruction to make GAS happy again. gcc/ PR target/101922 * config/mips/mips-protos.h (mips_msa_output_shift_immediate): Declare. * config/mips/mips.c (mips_msa_output_shift_immediate): New function. * config/mips/mips-msa.md (vashl3, vashr3, vlshr3): Call it. gcc/testsuite/ PR target/101922 * gcc.target/mips/pr101922.c: New test. --- gcc/config/mips/mips-msa.md | 27 ++++++++++++++++++--------- gcc/config/mips/mips-protos.h | 1 + gcc/config/mips/mips.c | 21 +++++++++++++++++++++ gcc/testsuite/gcc.target/mips/pr101922.c | 19 +++++++++++++++++++ 4 files changed, 59 insertions(+), 9 deletions(-) create mode 100644 gcc/testsuite/gcc.target/mips/pr101922.c (limited to 'gcc') diff --git a/gcc/config/mips/mips-msa.md b/gcc/config/mips/mips-msa.md index 3a67f25..d3b27d1 100644 --- a/gcc/config/mips/mips-msa.md +++ b/gcc/config/mips/mips-msa.md @@ -870,9 +870,12 @@ (match_operand:IMSA 1 "register_operand" "f,f") (match_operand:IMSA 2 "reg_or_vector_same_uimm6_operand" "f,Uuv6")))] "ISA_HAS_MSA" - "@ - srl.\t%w0,%w1,%w2 - srli.\t%w0,%w1,%E2" +{ + if (which_alternative == 0) + return "srl.\t%w0,%w1,%w2"; + + return mips_msa_output_shift_immediate("srli.\t%w0,%w1,%E2", operands); +} [(set_attr "type" "simd_shift") (set_attr "mode" "")]) @@ -882,9 +885,12 @@ (match_operand:IMSA 1 "register_operand" "f,f") (match_operand:IMSA 2 "reg_or_vector_same_uimm6_operand" "f,Uuv6")))] "ISA_HAS_MSA" - "@ - sra.\t%w0,%w1,%w2 - srai.\t%w0,%w1,%E2" +{ + if (which_alternative == 0) + return "sra.\t%w0,%w1,%w2"; + + return mips_msa_output_shift_immediate("srai.\t%w0,%w1,%E2", operands); +} [(set_attr "type" "simd_shift") (set_attr "mode" "")]) @@ -894,9 +900,12 @@ (match_operand:IMSA 1 "register_operand" "f,f") (match_operand:IMSA 2 "reg_or_vector_same_uimm6_operand" "f,Uuv6")))] "ISA_HAS_MSA" - "@ - sll.\t%w0,%w1,%w2 - slli.\t%w0,%w1,%E2" +{ + if (which_alternative == 0) + return "sll.\t%w0,%w1,%w2"; + + return mips_msa_output_shift_immediate("slli.\t%w0,%w1,%E2", operands); +} [(set_attr "type" "simd_shift") (set_attr "mode" "")]) diff --git a/gcc/config/mips/mips-protos.h b/gcc/config/mips/mips-protos.h index a5e4151..8d97eb3 100644 --- a/gcc/config/mips/mips-protos.h +++ b/gcc/config/mips/mips-protos.h @@ -317,6 +317,7 @@ extern const char *mips_output_sync_loop (rtx_insn *, rtx *); extern unsigned int mips_sync_loop_insns (rtx_insn *, rtx *); extern const char *mips_output_division (const char *, rtx *); extern const char *mips_msa_output_division (const char *, rtx *); +extern const char *mips_msa_output_shift_immediate (const char *, rtx *); extern const char *mips_output_probe_stack_range (rtx, rtx); extern bool mips_hard_regno_rename_ok (unsigned int, unsigned int); extern bool mips_linked_madd_p (rtx_insn *, rtx_insn *); diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 39666d6..2f7ffe8 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -14459,6 +14459,27 @@ mips_msa_output_division (const char *division, rtx *operands) } return s; } + +/* Return the assembly code for MSA immediate shift instructions, + which has the operands given by OPERANDS. Truncate the shift amount + to make GAS happy. */ + +const char * +mips_msa_output_shift_immediate (const char *shift, rtx *operands) +{ + rtx amount = operands[2]; + machine_mode mode = amount->mode; + + unsigned val = UINTVAL (CONST_VECTOR_ELT (amount, 0)); + val &= GET_MODE_UNIT_BITSIZE (mode) - 1; + if (!val) + return ""; + + rtx c = gen_int_mode (val, GET_MODE_INNER (mode)); + operands[2] = gen_const_vec_duplicate (mode, c); + + return shift; +} /* Return true if destination of IN_INSN is used as add source in OUT_INSN. Both IN_INSN and OUT_INSN are of type fmadd. Example: diff --git a/gcc/testsuite/gcc.target/mips/pr101922.c b/gcc/testsuite/gcc.target/mips/pr101922.c new file mode 100644 index 0000000..00a6e49 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/pr101922.c @@ -0,0 +1,19 @@ +/* PR target/101922 + This was triggering an assembler error with -O3 -mmsa -mloongson-mmi. */ + +/* { dg-do assemble } */ +/* { dg-options "-mmsa -mloongson-mmi" } */ + +typedef __INT8_TYPE__ i8; +typedef __INT32_TYPE__ i32; + +i8 d[16]; + +i32 f(i32 x) { + int i; + for (i = 0; i < 16; i++) { + i32 t = (i32) d[i] >> 31; + x &= t; + } + return x; +} -- cgit v1.1 From 59f38935d189027f172b4813a6056addaceb7cd3 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Mon, 23 Aug 2021 09:21:36 +0200 Subject: Improve return slot handling in ipa-modref gcc/ChangeLog: * ipa-modref.c (analyze_ssa_name_flags): Improve handling of return slot. gcc/testsuite/ChangeLog: * g++.dg/tree-ssa/modref-1.C: New test. --- gcc/ipa-modref.c | 23 ++++++++++------------- gcc/testsuite/g++.dg/tree-ssa/modref-1.C | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 13 deletions(-) create mode 100644 gcc/testsuite/g++.dg/tree-ssa/modref-1.C (limited to 'gcc') diff --git a/gcc/ipa-modref.c b/gcc/ipa-modref.c index 5491538..cb0a314 100644 --- a/gcc/ipa-modref.c +++ b/gcc/ipa-modref.c @@ -1709,19 +1709,8 @@ analyze_ssa_name_flags (tree name, vec &lattice, int depth, if (gimple_call_fn (use_stmt) == name) lattice[index].merge (~EAF_NOCLOBBER); - /* Return slot optimization would require bit of propagation; - give up for now. */ - if (gimple_call_return_slot_opt_p (call) - && gimple_call_lhs (call) != NULL_TREE - && TREE_ADDRESSABLE (TREE_TYPE (gimple_call_lhs (call)))) - { - if (dump_file) - fprintf (dump_file, "%*s Unhandled return slot opt\n", - depth * 4, ""); - lattice[index].merge (0); - } /* Recursion would require bit of propagation; give up for now. */ - else if (callee && !ipa && recursive_call_p (current_function_decl, + if (callee && !ipa && recursive_call_p (current_function_decl, callee)) lattice[index].merge (0); else @@ -1735,7 +1724,15 @@ analyze_ssa_name_flags (tree name, vec &lattice, int depth, /* Handle *name = func (...). */ if (gimple_call_lhs (call) && memory_access_to (gimple_call_lhs (call), name)) - lattice[index].merge_direct_store (); + { + lattice[index].merge_direct_store (); + /* Return slot optimization passes address of + LHS to callee via hidden parameter and this + may make LHS to escape. See PR 98499. */ + if (gimple_call_return_slot_opt_p (call) + && TREE_ADDRESSABLE (TREE_TYPE (gimple_call_lhs (call)))) + lattice[index].merge (EAF_NOREAD | EAF_DIRECT); + } /* We do not track accesses to the static chain (we could) so give up. */ diff --git a/gcc/testsuite/g++.dg/tree-ssa/modref-1.C b/gcc/testsuite/g++.dg/tree-ssa/modref-1.C new file mode 100644 index 0000000..c742dfe --- /dev/null +++ b/gcc/testsuite/g++.dg/tree-ssa/modref-1.C @@ -0,0 +1,32 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ +struct S { int a; char b[20]; S(); S(S const&); }; +volatile int global; + +__attribute__ ((noinline,noclone)) +struct S noescape (int *b) +{ + struct S a; + a.a = b!=0; + global = 1; + return a; +} + +void escape (struct S *p); + +__attribute__ ((noinline,noclone)) +int +test(int *b) +{ + struct S s = noescape (b); + escape (&s); + return *b; +} +int test2() +{ + int b=1234; + test (&b); + return b; +} +// ipa-modref should analyze parameter B of test as noescape. +// { dg-final { scan-tree-dump "return 1234" } } -- cgit v1.1 From 6f1a3668f5ee5152bdcca59843802e587339eda1 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Fri, 20 Aug 2021 14:11:00 +0200 Subject: ipa: add debug counter for IPA MODREF PTA gcc/ChangeLog: * dbgcnt.def (DEBUG_COUNTER): New counter. * gimple.c (gimple_call_arg_flags): Use it in IPA PTA. --- gcc/dbgcnt.def | 1 + gcc/gimple.c | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'gcc') diff --git a/gcc/dbgcnt.def b/gcc/dbgcnt.def index 2345899..c2bcc4e 100644 --- a/gcc/dbgcnt.def +++ b/gcc/dbgcnt.def @@ -175,6 +175,7 @@ DEBUG_COUNTER (ipa_cp_bits) DEBUG_COUNTER (ipa_cp_values) DEBUG_COUNTER (ipa_cp_vr) DEBUG_COUNTER (ipa_mod_ref) +DEBUG_COUNTER (ipa_mod_ref_pta) DEBUG_COUNTER (ipa_sra_params) DEBUG_COUNTER (ipa_sra_retvalues) DEBUG_COUNTER (ira_move) diff --git a/gcc/gimple.c b/gcc/gimple.c index 4e2653c..bed7ff9 100644 --- a/gcc/gimple.c +++ b/gcc/gimple.c @@ -48,7 +48,7 @@ along with GCC; see the file COPYING3. If not see #include "attr-fnspec.h" #include "ipa-modref-tree.h" #include "ipa-modref.h" - +#include "dbgcnt.h" /* All the tuples have their operand vector (if present) at the very bottom of the structure. Therefore, the offset required to find the @@ -1601,7 +1601,8 @@ gimple_call_arg_flags (const gcall *stmt, unsigned arg) if ((modref_flags & EAF_DIRECT) && !(flags & EAF_DIRECT)) modref_flags &= ~EAF_DIRECT; } - flags |= modref_flags; + if (dbg_cnt (ipa_mod_ref_pta)) + flags |= modref_flags; } } return flags; -- cgit v1.1 From 3bc75533d1f87f0617be6c1af98804f9127ec637 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Mon, 23 Aug 2021 10:16:24 +0200 Subject: openmp: Add support for strict modifier on grainsize/num_tasks clauses With strict: modifier on these clauses, the standard is explicit about how many iterations (and which) each generated task of taskloop directive should contain. For num_tasks it actually matches what we were already implementing, but for grainsize it does not (and even violates the old rule - without strict it requires that the number of iterations (unspecified which exactly) handled by each generated task is >= grainsize argument and < 2 * grainsize argument, with strict: it requires that each generated task handles exactly == grainsize argument iterations, except for the generated task handling the last iteration which can handles <= grainsize iterations). The following patch implements it for C and C++. 2021-08-23 Jakub Jelinek gcc/ * tree.h (OMP_CLAUSE_GRAINSIZE_STRICT): Define. (OMP_CLAUSE_NUM_TASKS_STRICT): Define. * tree-pretty-print.c (dump_omp_clause) : Print strict: modifier. * omp-expand.c (expand_task_call): Use GOMP_TASK_FLAG_STRICT in iflags if either grainsize or num_tasks clause has the strict modifier. gcc/c/ * c-parser.c (c_parser_omp_clause_num_tasks, c_parser_omp_clause_grainsize): Parse the optional strict: modifier. gcc/cp/ * parser.c (cp_parser_omp_clause_num_tasks, cp_parser_omp_clause_grainsize): Parse the optional strict: modifier. include/ * gomp-constants.h (GOMP_TASK_FLAG_STRICT): Define. libgomp/ * taskloop.c (GOMP_taskloop): Handle GOMP_TASK_FLAG_STRICT. * testsuite/libgomp.c-c++-common/taskloop-4.c (main): Fix up comment. * testsuite/libgomp.c-c++-common/taskloop-5.c: New test. --- gcc/c/c-parser.c | 34 ++++++++++++++++++++++++++++++++-- gcc/cp/parser.c | 38 ++++++++++++++++++++++++++++++++++++-- gcc/omp-expand.c | 8 +++++++- gcc/tree-pretty-print.c | 4 ++++ gcc/tree.h | 5 +++++ 5 files changed, 84 insertions(+), 5 deletions(-) (limited to 'gcc') diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index c578307..356cf25 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -13786,7 +13786,10 @@ c_parser_omp_clause_num_threads (c_parser *parser, tree list) } /* OpenMP 4.5: - num_tasks ( expression ) */ + num_tasks ( expression ) + + OpenMP 5.1: + num_tasks ( strict : expression ) */ static tree c_parser_omp_clause_num_tasks (c_parser *parser, tree list) @@ -13795,6 +13798,17 @@ c_parser_omp_clause_num_tasks (c_parser *parser, tree list) matching_parens parens; if (parens.require_open (parser)) { + bool strict = false; + if (c_parser_next_token_is (parser, CPP_NAME) + && c_parser_peek_2nd_token (parser)->type == CPP_COLON + && strcmp (IDENTIFIER_POINTER (c_parser_peek_token (parser)->value), + "strict") == 0) + { + strict = true; + c_parser_consume_token (parser); + c_parser_consume_token (parser); + } + location_t expr_loc = c_parser_peek_token (parser)->location; c_expr expr = c_parser_expr_no_commas (parser, NULL); expr = convert_lvalue_to_rvalue (expr_loc, expr, false, true); @@ -13824,6 +13838,7 @@ c_parser_omp_clause_num_tasks (c_parser *parser, tree list) c = build_omp_clause (num_tasks_loc, OMP_CLAUSE_NUM_TASKS); OMP_CLAUSE_NUM_TASKS_EXPR (c) = t; + OMP_CLAUSE_NUM_TASKS_STRICT (c) = strict; OMP_CLAUSE_CHAIN (c) = list; list = c; } @@ -13832,7 +13847,10 @@ c_parser_omp_clause_num_tasks (c_parser *parser, tree list) } /* OpenMP 4.5: - grainsize ( expression ) */ + grainsize ( expression ) + + OpenMP 5.1: + grainsize ( strict : expression ) */ static tree c_parser_omp_clause_grainsize (c_parser *parser, tree list) @@ -13841,6 +13859,17 @@ c_parser_omp_clause_grainsize (c_parser *parser, tree list) matching_parens parens; if (parens.require_open (parser)) { + bool strict = false; + if (c_parser_next_token_is (parser, CPP_NAME) + && c_parser_peek_2nd_token (parser)->type == CPP_COLON + && strcmp (IDENTIFIER_POINTER (c_parser_peek_token (parser)->value), + "strict") == 0) + { + strict = true; + c_parser_consume_token (parser); + c_parser_consume_token (parser); + } + location_t expr_loc = c_parser_peek_token (parser)->location; c_expr expr = c_parser_expr_no_commas (parser, NULL); expr = convert_lvalue_to_rvalue (expr_loc, expr, false, true); @@ -13870,6 +13899,7 @@ c_parser_omp_clause_grainsize (c_parser *parser, tree list) c = build_omp_clause (grainsize_loc, OMP_CLAUSE_GRAINSIZE); OMP_CLAUSE_GRAINSIZE_EXPR (c) = t; + OMP_CLAUSE_GRAINSIZE_STRICT (c) = strict; OMP_CLAUSE_CHAIN (c) = list; list = c; } diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 63c9503..a959c71 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -37237,7 +37237,10 @@ cp_parser_omp_clause_num_threads (cp_parser *parser, tree list, } /* OpenMP 4.5: - num_tasks ( expression ) */ + num_tasks ( expression ) + + OpenMP 5.1: + num_tasks ( strict : expression ) */ static tree cp_parser_omp_clause_num_tasks (cp_parser *parser, tree list, @@ -37249,6 +37252,19 @@ cp_parser_omp_clause_num_tasks (cp_parser *parser, tree list, if (!parens.require_open (parser)) return list; + bool strict = false; + if (cp_lexer_next_token_is (parser->lexer, CPP_NAME) + && cp_lexer_nth_token_is (parser->lexer, 2, CPP_COLON)) + { + tree id = cp_lexer_peek_token (parser->lexer)->u.value; + if (!strcmp (IDENTIFIER_POINTER (id), "strict")) + { + strict = true; + cp_lexer_consume_token (parser->lexer); + cp_lexer_consume_token (parser->lexer); + } + } + t = cp_parser_assignment_expression (parser); if (t == error_mark_node @@ -37262,13 +37278,17 @@ cp_parser_omp_clause_num_tasks (cp_parser *parser, tree list, c = build_omp_clause (location, OMP_CLAUSE_NUM_TASKS); OMP_CLAUSE_NUM_TASKS_EXPR (c) = t; + OMP_CLAUSE_NUM_TASKS_STRICT (c) = strict; OMP_CLAUSE_CHAIN (c) = list; return c; } /* OpenMP 4.5: - grainsize ( expression ) */ + grainsize ( expression ) + + OpenMP 5.1: + grainsize ( strict : expression ) */ static tree cp_parser_omp_clause_grainsize (cp_parser *parser, tree list, @@ -37280,6 +37300,19 @@ cp_parser_omp_clause_grainsize (cp_parser *parser, tree list, if (!parens.require_open (parser)) return list; + bool strict = false; + if (cp_lexer_next_token_is (parser->lexer, CPP_NAME) + && cp_lexer_nth_token_is (parser->lexer, 2, CPP_COLON)) + { + tree id = cp_lexer_peek_token (parser->lexer)->u.value; + if (!strcmp (IDENTIFIER_POINTER (id), "strict")) + { + strict = true; + cp_lexer_consume_token (parser->lexer); + cp_lexer_consume_token (parser->lexer); + } + } + t = cp_parser_assignment_expression (parser); if (t == error_mark_node @@ -37293,6 +37326,7 @@ cp_parser_omp_clause_grainsize (cp_parser *parser, tree list, c = build_omp_clause (location, OMP_CLAUSE_GRAINSIZE); OMP_CLAUSE_GRAINSIZE_EXPR (c) = t; + OMP_CLAUSE_GRAINSIZE_STRICT (c) = strict; OMP_CLAUSE_CHAIN (c) = list; return c; diff --git a/gcc/omp-expand.c b/gcc/omp-expand.c index c868b8c..66c64f5 100644 --- a/gcc/omp-expand.c +++ b/gcc/omp-expand.c @@ -791,13 +791,19 @@ expand_task_call (struct omp_region *region, basic_block bb, tree tclauses = gimple_omp_for_clauses (g); num_tasks = omp_find_clause (tclauses, OMP_CLAUSE_NUM_TASKS); if (num_tasks) - num_tasks = OMP_CLAUSE_NUM_TASKS_EXPR (num_tasks); + { + if (OMP_CLAUSE_NUM_TASKS_STRICT (num_tasks)) + iflags |= GOMP_TASK_FLAG_STRICT; + num_tasks = OMP_CLAUSE_NUM_TASKS_EXPR (num_tasks); + } else { num_tasks = omp_find_clause (tclauses, OMP_CLAUSE_GRAINSIZE); if (num_tasks) { iflags |= GOMP_TASK_FLAG_GRAINSIZE; + if (OMP_CLAUSE_GRAINSIZE_STRICT (num_tasks)) + iflags |= GOMP_TASK_FLAG_STRICT; num_tasks = OMP_CLAUSE_GRAINSIZE_EXPR (num_tasks); } else diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c index 0570fdc..e103d2c 100644 --- a/gcc/tree-pretty-print.c +++ b/gcc/tree-pretty-print.c @@ -1066,6 +1066,8 @@ dump_omp_clause (pretty_printer *pp, tree clause, int spc, dump_flags_t flags) case OMP_CLAUSE_GRAINSIZE: pp_string (pp, "grainsize("); + if (OMP_CLAUSE_GRAINSIZE_STRICT (clause)) + pp_string (pp, "strict:"); dump_generic_node (pp, OMP_CLAUSE_GRAINSIZE_EXPR (clause), spc, flags, false); pp_right_paren (pp); @@ -1073,6 +1075,8 @@ dump_omp_clause (pretty_printer *pp, tree clause, int spc, dump_flags_t flags) case OMP_CLAUSE_NUM_TASKS: pp_string (pp, "num_tasks("); + if (OMP_CLAUSE_NUM_TASKS_STRICT (clause)) + pp_string (pp, "strict:"); dump_generic_node (pp, OMP_CLAUSE_NUM_TASKS_EXPR (clause), spc, flags, false); pp_right_paren (pp); diff --git a/gcc/tree.h b/gcc/tree.h index 905417f..060a41f 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -1612,6 +1612,11 @@ class auto_suppress_location_wrappers #define OMP_CLAUSE_PRIORITY_EXPR(NODE) \ OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_PRIORITY),0) +#define OMP_CLAUSE_GRAINSIZE_STRICT(NODE) \ + TREE_PRIVATE (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_GRAINSIZE)) +#define OMP_CLAUSE_NUM_TASKS_STRICT(NODE) \ + TREE_PRIVATE (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_NUM_TASKS)) + /* OpenACC clause expressions */ #define OMP_CLAUSE_EXPR(NODE, CLAUSE) \ OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, CLAUSE), 0) -- cgit v1.1 From 63f68535550f77998ad907ba3d3be05a4324fbe8 Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Thu, 15 Jul 2021 12:57:18 +0000 Subject: arm: Fix multilib mapping for CDE extensions [PR100856] This is a followup to Srinath's recent patch: the newly added test is failing e.g. on arm-linux-gnueabihf without R/M profile multilibs. It is also failing on arm-eabi with R/M profile multilibs if the execution engine does not support v8.1-M instructions. The patch avoids this by adding check_effective_target_FUNC_multilib in target-supports.exp which effectively checks whether the target supports linking and execution, like what is already done for other ARM effective targets. pr100856.c is updated to use it instead of arm_v8_1m_main_cde_mve_ok (which makes the testcase a bit of a duplicate with check_effective_target_FUNC_multilib). In addition, I noticed that requiring MVE does not seem necessary and this enables the test to pass even when targeting a CPU without MVE: since the test does not involve actual CDE instructions, it can pass on other architecture versions. For instance, when requiring MVE, we have to use cortex-m55 under QEMU for the test to pass because the memset() that comes from v8.1-m.main+mve multilib uses LOB instructions (DLS) (memset is used during startup). Keeping arm_v8_1m_main_cde_mve_ok would mean we would enable the test provided we have the right multilibs, causing a runtime error if the simulator does not support LOB instructions (e.g. when targeting cortex-m7). I do not update sourcebuild.texi since the CDE effective targets are already collectively documented. Finally, the patch fixes two typos in comments. 2021-07-15 Christophe Lyon PR target/100856 gcc/ * config/arm/arm.opt: Fix typo. * config/arm/t-rmprofile: Fix typo. gcc/testsuite/ * gcc.target/arm/acle/pr100856.c: Use arm_v8m_main_cde_multilib and arm_v8m_main_cde. * lib/target-supports.exp: Add check_effective_target_FUNC_multilib for ARM CDE. --- gcc/config/arm/arm.opt | 2 +- gcc/config/arm/t-rmprofile | 2 +- gcc/testsuite/gcc.target/arm/acle/pr100856.c | 4 ++-- gcc/testsuite/lib/target-supports.exp | 18 ++++++++++++++++++ 4 files changed, 22 insertions(+), 4 deletions(-) (limited to 'gcc') diff --git a/gcc/config/arm/arm.opt b/gcc/config/arm/arm.opt index af478a9..7417b55 100644 --- a/gcc/config/arm/arm.opt +++ b/gcc/config/arm/arm.opt @@ -82,7 +82,7 @@ EnumValue Enum(arm_arch) String(native) Value(-1) DriverOnly ; Set to the name of target architecture which is required for -; multilib linking. This option is undocumented becuase it +; multilib linking. This option is undocumented because it ; should not be used by the users. mlibarch= Target RejectNegative JoinedOrMissing NoDWARFRecord DriverOnly Undocumented diff --git a/gcc/config/arm/t-rmprofile b/gcc/config/arm/t-rmprofile index 3e75fcc..a6036bf 100644 --- a/gcc/config/arm/t-rmprofile +++ b/gcc/config/arm/t-rmprofile @@ -54,7 +54,7 @@ MULTILIB_REQUIRED += mthumb/march=armv8.1-m.main+mve/mfloat-abi=hard MULTILIB_MATCHES += march?armv6s-m=march?armv6-m # For all MULITIB_MATCHES for v8-m and above add mlibarch? on the right hand side -# of = in the variant string instead of march?. This is needed becuase all the +# of = in the variant string instead of march?. This is needed because all the # MULITIB_MATCHES variant strings are compared with mlibarch option for multilib # linking. diff --git a/gcc/testsuite/gcc.target/arm/acle/pr100856.c b/gcc/testsuite/gcc.target/arm/acle/pr100856.c index 5bc030e..adbe1ab 100644 --- a/gcc/testsuite/gcc.target/arm/acle/pr100856.c +++ b/gcc/testsuite/gcc.target/arm/acle/pr100856.c @@ -1,6 +1,6 @@ /* { dg-do run } */ -/* { dg-require-effective-target arm_v8_1m_main_cde_mve_ok } */ -/* { dg-add-options arm_v8_1m_main_cde_mve } */ +/* { dg-require-effective-target arm_v8m_main_cde_multilib } */ +/* { dg-add-options arm_v8m_main_cde } */ #include "arm_cde.h" diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 44465b1..66ce48d 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -5518,6 +5518,24 @@ foreach { armfunc armflag armdef arminc } { global et_FUNC_flags return "$flags $et_FUNC_flags" } + + proc check_effective_target_FUNC_multilib { } { + if { ! [check_effective_target_FUNC_ok] } { + return 0; + } + return [check_runtime FUNC_multilib { + #if !(DEF) + #error "DEF failed" + #endif + #include + INC + int + main (void) + { + return 0; + } + } [add_options_for_FUNC ""]] + } }] } -- cgit v1.1 From ac3bcc813f26e6dc4c3b037d9d5c5a84f7f62cf4 Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Mon, 23 Aug 2021 09:47:14 +0000 Subject: arm: Fix __arm_vctp16q return type in arm_mve.h __arm_vctp16q actually returns mve_pred16_t rather than int64_t. 2021-08-23 Christophe Lyon gcc/ * config/arm/arm_mve.h: Fix __arm_vctp16q return type. --- gcc/config/arm/arm_mve.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/config/arm/arm_mve.h b/gcc/config/arm/arm_mve.h index 83f1003..e04d462 100644 --- a/gcc/config/arm/arm_mve.h +++ b/gcc/config/arm/arm_mve.h @@ -3524,7 +3524,7 @@ __arm_vaddlvq_u32 (uint32x4_t __a) return __builtin_mve_vaddlvq_uv4si (__a); } -__extension__ extern __inline int64_t +__extension__ extern __inline mve_pred16_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) __arm_vctp16q (uint32_t __a) { -- cgit v1.1 From b284053bb75661fc1bf13c275f3ba5364bb17608 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Mon, 23 Aug 2021 11:50:14 +0200 Subject: dwarf2out: Emit DW_AT_location for global register vars during early dwarf [PR101905] The following patch emits DW_AT_location for global register variables already during early dwarf, since usually late_global_decl hook isn't even called for those, as nothing needs to be emitted for them. 2021-08-23 Jakub Jelinek PR debug/101905 * dwarf2out.c (gen_variable_die): Add DW_AT_location for global register variables already during early_dwarf if possible. * gcc.dg/guality/pr101905.c: New test. --- gcc/dwarf2out.c | 21 ++++++++++++++++++++- gcc/testsuite/gcc.dg/guality/pr101905.c | 15 +++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/guality/pr101905.c (limited to 'gcc') diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index ba0a6d6..07a479f 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -24476,7 +24476,26 @@ gen_variable_die (tree decl, tree origin, dw_die_ref context_die) && DECL_RTL_SET_P (decl_or_origin)))) { if (early_dwarf) - add_pubname (decl_or_origin, var_die); + { + add_pubname (decl_or_origin, var_die); + /* For global register variables, emit DW_AT_location if possible + already during early_dwarf, as late_global_decl won't be usually + called. */ + if (DECL_HARD_REGISTER (decl_or_origin) + && TREE_STATIC (decl_or_origin) + && !decl_by_reference_p (decl_or_origin) + && !get_AT (var_die, DW_AT_location) + && !get_AT (var_die, DW_AT_const_value) + && DECL_RTL_SET_P (decl_or_origin) + && REG_P (DECL_RTL (decl_or_origin))) + { + dw_loc_descr_ref descr + = reg_loc_descriptor (DECL_RTL (decl_or_origin), + VAR_INIT_STATUS_INITIALIZED); + if (descr) + add_AT_loc (var_die, DW_AT_location, descr); + } + } else add_location_or_const_value_attribute (var_die, decl_or_origin, decl == NULL); diff --git a/gcc/testsuite/gcc.dg/guality/pr101905.c b/gcc/testsuite/gcc.dg/guality/pr101905.c new file mode 100644 index 0000000..71b7516 --- /dev/null +++ b/gcc/testsuite/gcc.dg/guality/pr101905.c @@ -0,0 +1,15 @@ +/* { dg-do run { target { { i?86-*-* x86_64-*-* } && lp64 } } } */ +/* { dg-options "-g -ffixed-r15" } */ +/* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */ + +register unsigned long long regVar asm ("r15"); + +int +main() +{ + regVar = 0xdeadbeefcafebabeULL; + asm ("nop" : "+r" (regVar)); + asm volatile ("nop"); /* { dg-final { gdb-test . "regVar" "0xdeadbeefcafebabeULL" } } */ + asm volatile ("nop" : : "r" (regVar)); + return 0; +} -- cgit v1.1 From 70c7ab5c487f392e04907ce8f22eb454b8d3c4ff Mon Sep 17 00:00:00 2001 From: liuhongt Date: Mon, 23 Aug 2021 17:00:36 +0800 Subject: Fix ICE. gcc/ChangeLog: PR target/102016 * config/i386/sse.md (*avx512f_pshufb_truncv8hiv8qi_1): Add TARGET_AVX512BW to condition. gcc/testsuite/ChangeLog: PR target/102016 * gcc.target/i386/pr102016.c: New test. --- gcc/config/i386/sse.md | 2 +- gcc/testsuite/gcc.target/i386/pr102016.c | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr102016.c (limited to 'gcc') diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md index 1388968..95f9582 100644 --- a/gcc/config/i386/sse.md +++ b/gcc/config/i386/sse.md @@ -11256,7 +11256,7 @@ (match_operand:V16QI 2 "pshufb_truncv8hiv8qi_operand")] UNSPEC_PSHUFB) 0) (parallel [(const_int 0)])))] - "TARGET_AVX512VL && ix86_pre_reload_split ()" + "TARGET_AVX512VL && TARGET_AVX512BW && ix86_pre_reload_split ()" "#" "&& 1" [(const_int 0)] diff --git a/gcc/testsuite/gcc.target/i386/pr102016.c b/gcc/testsuite/gcc.target/i386/pr102016.c new file mode 100644 index 0000000..2ff75cb --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr102016.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-mavx512vl -O2" } */ +typedef char v8qi __attribute__((vector_size (8))); +typedef char v16qi __attribute__((vector_size (16))); +v8qi +foo_wb_128 (v16qi x) +{ + return __builtin_shufflevector (x, x, + 0, 2, 4, 6, 8, 10, 12, 14); +} -- cgit v1.1 From ad665deeafd31238b537139385e1e80b40c10e0c Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 23 Aug 2021 09:57:05 +0200 Subject: tree-optimization/79334 - avoid PRE of possibly trapping array-ref This replicates tree-eh.c in_array_bound_p into VNs vn_reference_may_trap to fix hoisting of a possibly trapping ARRAY_REF across a call that might not return. 2021-08-23 Richard Biener PR tree-optimization/79334 * tree-ssa-sccvn.c (copy_reference_ops_from_ref): Record a type also for COMPONENT_REFs. (vn_reference_may_trap): Check ARRAY_REF with constant index against the array domain. * gcc.dg/torture/pr79334-0.c: New testcase. * gcc.dg/torture/pr79334-1.c: Likewise. --- gcc/testsuite/gcc.dg/torture/pr79334-0.c | 23 +++++++++++++++++++++++ gcc/testsuite/gcc.dg/torture/pr79334-1.c | 1 + gcc/tree-ssa-sccvn.c | 30 ++++++++++++++++++++++++++---- 3 files changed, 50 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr79334-0.c create mode 100644 gcc/testsuite/gcc.dg/torture/pr79334-1.c (limited to 'gcc') diff --git a/gcc/testsuite/gcc.dg/torture/pr79334-0.c b/gcc/testsuite/gcc.dg/torture/pr79334-0.c new file mode 100644 index 0000000..fa45a6d --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr79334-0.c @@ -0,0 +1,23 @@ +/* { dg-do run } */ +/* { dg-additional-sources "pr79334-1.c" } */ + +extern int d[][8]; + +static void __attribute__((noinline)) +func_that_exits (int flag) +{ + if (!flag) + __builtin_exit (0); +} + +int main () +{ + int e = 0; + while (1) + { + func_that_exits (e); + /* We do not know whether d[1024][0] will trap. */ + e = d[1024][0]; + } + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr79334-1.c b/gcc/testsuite/gcc.dg/torture/pr79334-1.c new file mode 100644 index 0000000..b1c8a27 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr79334-1.c @@ -0,0 +1 @@ +int d[1][8]; diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 82bd10b..bf87cee 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -914,9 +914,8 @@ copy_reference_ops_from_ref (tree ref, vec *result) break; case COMPONENT_REF: /* The field decl is enough to unambiguously specify the field, - a matching type is not necessary and a mismatching type - is always a spurious difference. */ - temp.type = NULL_TREE; + so use its type here. */ + temp.type = TREE_TYPE (TREE_OPERAND (ref, 1)); temp.op0 = TREE_OPERAND (ref, 1); temp.op1 = TREE_OPERAND (ref, 2); temp.reverse = (AGGREGATE_TYPE_P (TREE_TYPE (TREE_OPERAND (ref, 0))) @@ -5873,10 +5872,33 @@ vn_reference_may_trap (vn_reference_t ref) return true; break; case ARRAY_RANGE_REF: - case ARRAY_REF: if (TREE_CODE (op->op0) == SSA_NAME) return true; break; + case ARRAY_REF: + { + if (TREE_CODE (op->op0) != INTEGER_CST) + return true; + + /* !in_array_bounds */ + tree domain_type = TYPE_DOMAIN (ref->operands[i+1].type); + if (!domain_type) + return true; + + tree min = op->op1; + tree max = TYPE_MAX_VALUE (domain_type); + if (!min + || !max + || TREE_CODE (min) != INTEGER_CST + || TREE_CODE (max) != INTEGER_CST) + return true; + + if (tree_int_cst_lt (op->op0, min) + || tree_int_cst_lt (max, op->op0)) + return true; + + break; + } case MEM_REF: /* Nothing interesting in itself, the base is separate. */ break; -- cgit v1.1 From b320edc0c29c838b0090c3c9be14187d132f73f2 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Mon, 23 Aug 2021 11:52:06 +0200 Subject: bswap: Recognize (int) __builtin_bswap64 (arg) idioms or __builtin_bswap?? (arg) & mask [PR86723] The following patch recognizes in the bswap pass (only there for now, haven't done it for store merging pass yet) code sequences that can be handled by (int32) __builtin_bswap64 (arg), i.e. where we have 0x05060708 n->n with 64-bit non-memory argument (if it is memory, we can just load the 32-bit at 4 bytes into the address and n->n would be 0x01020304; and only 64 -> 32 bit, because 64 -> 16 bit or 32 -> 16 bit would mean only two bytes in the result and probably not worth it), and furthermore the case where we have in the 0x0102030405060708 etc. numbers some bytes 0 (i.e. known to contain zeros rather than source bytes), as long as we have at least two original bytes in the right positions (and no unknown bytes). This can be handled by __builtin_bswap64 (arg) & 0xff0000ffffff00ffULL etc. The latter change is the reason why counting the bswap messages doesn't work too well in optimize-bswap* tests anymore, while the pass iterates from end of basic block towards start, it will often match both the bswap at the end and some of the earlier bswaps with some masks (not a problem generally, we'll just DCE it away whenever possible). The pass right now doesn't handle __builtin_bswap* calls in the pattern matching (which is the reason why it operates backwards), but it uses FOR_EACH_BB_FN (bb, fun) order of handling blocks and matched sequences can span multiple blocks, so I was worried about cases like: void bar (unsigned long long); unsigned long long foo (unsigned long long value, int x) { unsigned long long tmp = (((value & 0x00000000000000ffull) << 56) | ((value & 0x000000000000ff00ull) << 40) | ((value & 0x00000000ff000000ull) << 8)); if (x) bar (tmp); return (tmp | ((value & 0x000000ff00000000ull) >> 8) | ((value & 0x0000ff0000000000ull) >> 24) | ((value & 0x0000000000ff0000ull) << 24) | ((value & 0x00ff000000000000ull) >> 40) | ((value & 0xff00000000000000ull) >> 56)); } but it seems we handle even that fine, while bb2 ending in GIMPLE_COND is processed first, we recognize there a __builtin_bswap64 (value) & mask1, in the last bb we recognize tmp | (__builtin_bswap64 (value) & mask2) and PRE optimizes that into t = __builtin_bswap64 (value); tmp = t & mask1; in the first bb and return t; in the last one. 2021-08-23 Jakub Jelinek PR tree-optimization/86723 * gimple-ssa-store-merging.c (find_bswap_or_nop_finalize): Add cast64_to_32 argument, set *cast64_to_32 to false, unless n is non-memory permutation of 64-bit src which only has bytes of 0 or [5..8] and n->range is 4. (find_bswap_or_nop): Add cast64_to_32 and mask arguments, adjust find_bswap_or_nop_finalize caller, support bswap with some bytes zeroed, as long as at least two bytes are not zeroed. (bswap_replace): Add mask argument and handle masking of bswap result. (maybe_optimize_vector_constructor): Adjust find_bswap_or_nop caller, punt if cast64_to_32 or mask is not all ones. (pass_optimize_bswap::execute): Adjust find_bswap_or_nop_finalize caller, for now punt if cast64_to_32. * gcc.dg/pr86723.c: New test. * gcc.target/i386/pr86723.c: New test. * gcc.dg/optimize-bswapdi-1.c: Use -fdump-tree-optimized instead of -fdump-tree-bswap and scan for number of __builtin_bswap64 calls. * gcc.dg/optimize-bswapdi-2.c: Likewise. * gcc.dg/optimize-bswapsi-1.c: Use -fdump-tree-optimized instead of -fdump-tree-bswap and scan for number of __builtin_bswap32 calls. * gcc.dg/optimize-bswapsi-5.c: Likewise. * gcc.dg/optimize-bswapsi-3.c: Likewise. Expect one __builtin_bswap32 call instead of zero. --- gcc/gimple-ssa-store-merging.c | 100 +++++++++++++++++++++++++----- gcc/testsuite/gcc.dg/optimize-bswapdi-1.c | 4 +- gcc/testsuite/gcc.dg/optimize-bswapdi-2.c | 4 +- gcc/testsuite/gcc.dg/optimize-bswapsi-1.c | 4 +- gcc/testsuite/gcc.dg/optimize-bswapsi-3.c | 4 +- gcc/testsuite/gcc.dg/optimize-bswapsi-5.c | 4 +- gcc/testsuite/gcc.dg/pr86723.c | 63 +++++++++++++++++++ gcc/testsuite/gcc.target/i386/pr86723.c | 52 ++++++++++++++++ 8 files changed, 208 insertions(+), 27 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/pr86723.c create mode 100644 gcc/testsuite/gcc.target/i386/pr86723.c (limited to 'gcc') diff --git a/gcc/gimple-ssa-store-merging.c b/gcc/gimple-ssa-store-merging.c index 5d3094b..781c02d 100644 --- a/gcc/gimple-ssa-store-merging.c +++ b/gcc/gimple-ssa-store-merging.c @@ -792,7 +792,7 @@ find_bswap_or_nop_1 (gimple *stmt, struct symbolic_number *n, int limit) void find_bswap_or_nop_finalize (struct symbolic_number *n, uint64_t *cmpxchg, - uint64_t *cmpnop) + uint64_t *cmpnop, bool *cast64_to_32) { unsigned rsize; uint64_t tmpn, mask; @@ -802,6 +802,7 @@ find_bswap_or_nop_finalize (struct symbolic_number *n, uint64_t *cmpxchg, according to the size of the symbolic number before using it. */ *cmpxchg = CMPXCHG; *cmpnop = CMPNOP; + *cast64_to_32 = false; /* Find real size of result (highest non-zero byte). */ if (n->base_addr) @@ -814,7 +815,27 @@ find_bswap_or_nop_finalize (struct symbolic_number *n, uint64_t *cmpxchg, if (n->range < (int) sizeof (int64_t)) { mask = ((uint64_t) 1 << (n->range * BITS_PER_MARKER)) - 1; - *cmpxchg >>= (64 / BITS_PER_MARKER - n->range) * BITS_PER_MARKER; + if (n->base_addr == NULL + && n->range == 4 + && int_size_in_bytes (TREE_TYPE (n->src)) == 8) + { + /* If all bytes in n->n are either 0 or in [5..8] range, this + might be a candidate for (unsigned) __builtin_bswap64 (src). + It is not worth it for (unsigned short) __builtin_bswap64 (src) + or (unsigned short) __builtin_bswap32 (src). */ + *cast64_to_32 = true; + for (tmpn = n->n; tmpn; tmpn >>= BITS_PER_MARKER) + if ((tmpn & MARKER_MASK) + && ((tmpn & MARKER_MASK) <= 4 || (tmpn & MARKER_MASK) > 8)) + { + *cast64_to_32 = false; + break; + } + } + if (*cast64_to_32) + *cmpxchg &= mask; + else + *cmpxchg >>= (64 / BITS_PER_MARKER - n->range) * BITS_PER_MARKER; *cmpnop &= mask; } @@ -837,6 +858,8 @@ find_bswap_or_nop_finalize (struct symbolic_number *n, uint64_t *cmpxchg, n->range = rsize; } + if (*cast64_to_32) + n->range = 8; n->range *= BITS_PER_UNIT; } @@ -849,7 +872,8 @@ find_bswap_or_nop_finalize (struct symbolic_number *n, uint64_t *cmpxchg, expression. */ gimple * -find_bswap_or_nop (gimple *stmt, struct symbolic_number *n, bool *bswap) +find_bswap_or_nop (gimple *stmt, struct symbolic_number *n, bool *bswap, + bool *cast64_to_32, uint64_t *mask) { tree type_size = TYPE_SIZE_UNIT (TREE_TYPE (gimple_get_lhs (stmt))); if (!tree_fits_uhwi_p (type_size)) @@ -929,17 +953,30 @@ find_bswap_or_nop (gimple *stmt, struct symbolic_number *n, bool *bswap) } uint64_t cmpxchg, cmpnop; - find_bswap_or_nop_finalize (n, &cmpxchg, &cmpnop); + find_bswap_or_nop_finalize (n, &cmpxchg, &cmpnop, cast64_to_32); /* A complete byte swap should make the symbolic number to start with the largest digit in the highest order byte. Unchanged symbolic number indicates a read with same endianness as target architecture. */ + *mask = ~(uint64_t) 0; if (n->n == cmpnop) *bswap = false; else if (n->n == cmpxchg) *bswap = true; else - return NULL; + { + int set = 0; + for (uint64_t msk = MARKER_MASK; msk; msk <<= BITS_PER_MARKER) + if ((n->n & msk) == 0) + *mask &= ~msk; + else if ((n->n & msk) == (cmpxchg & msk)) + set++; + else + return NULL; + if (set < 2) + return NULL; + *bswap = true; + } /* Useless bit manipulation performed by code. */ if (!n->base_addr && n->n == cmpnop && n->n_ops == 1) @@ -1024,10 +1061,10 @@ bswap_view_convert (gimple_stmt_iterator *gsi, tree type, tree val) tree bswap_replace (gimple_stmt_iterator gsi, gimple *ins_stmt, tree fndecl, tree bswap_type, tree load_type, struct symbolic_number *n, - bool bswap) + bool bswap, uint64_t mask) { tree src, tmp, tgt = NULL_TREE; - gimple *bswap_stmt; + gimple *bswap_stmt, *mask_stmt = NULL; tree_code conv_code = NOP_EXPR; gimple *cur_stmt = gsi_stmt (gsi); @@ -1247,6 +1284,15 @@ bswap_replace (gimple_stmt_iterator gsi, gimple *ins_stmt, tree fndecl, tgt = make_ssa_name (bswap_type); tmp = tgt; + if (mask != ~(uint64_t) 0) + { + tree m = build_int_cst (bswap_type, mask); + tmp = make_temp_ssa_name (bswap_type, NULL, "bswapdst"); + gimple_set_lhs (bswap_stmt, tmp); + mask_stmt = gimple_build_assign (tgt, BIT_AND_EXPR, tmp, m); + tmp = tgt; + } + /* Convert the result if necessary. */ if (!useless_type_conversion_p (TREE_TYPE (tgt), bswap_type)) { @@ -1260,7 +1306,7 @@ bswap_replace (gimple_stmt_iterator gsi, gimple *ins_stmt, tree fndecl, gsi_insert_after (&gsi, convert_stmt, GSI_SAME_STMT); } - gimple_set_lhs (bswap_stmt, tmp); + gimple_set_lhs (mask_stmt ? mask_stmt : bswap_stmt, tmp); if (dump_file) { @@ -1277,11 +1323,17 @@ bswap_replace (gimple_stmt_iterator gsi, gimple *ins_stmt, tree fndecl, if (cur_stmt) { + if (mask_stmt) + gsi_insert_after (&gsi, mask_stmt, GSI_SAME_STMT); gsi_insert_after (&gsi, bswap_stmt, GSI_SAME_STMT); gsi_remove (&gsi, true); } else - gsi_insert_before (&gsi, bswap_stmt, GSI_SAME_STMT); + { + gsi_insert_before (&gsi, bswap_stmt, GSI_SAME_STMT); + if (mask_stmt) + gsi_insert_before (&gsi, mask_stmt, GSI_SAME_STMT); + } return tgt; } @@ -1341,8 +1393,14 @@ maybe_optimize_vector_constructor (gimple *cur_stmt) return false; } - gimple *ins_stmt = find_bswap_or_nop (cur_stmt, &n, &bswap); - if (!ins_stmt || n.range != (unsigned HOST_WIDE_INT) sz) + bool cast64_to_32; + uint64_t mask; + gimple *ins_stmt = find_bswap_or_nop (cur_stmt, &n, &bswap, + &cast64_to_32, &mask); + if (!ins_stmt + || n.range != (unsigned HOST_WIDE_INT) sz + || cast64_to_32 + || mask != ~(uint64_t) 0) return false; if (bswap && !fndecl && n.range != 16) @@ -1351,7 +1409,7 @@ maybe_optimize_vector_constructor (gimple *cur_stmt) memset (&nop_stats, 0, sizeof (nop_stats)); memset (&bswap_stats, 0, sizeof (bswap_stats)); return bswap_replace (gsi_for_stmt (cur_stmt), ins_stmt, fndecl, - bswap_type, load_type, &n, bswap) != NULL_TREE; + bswap_type, load_type, &n, bswap, mask) != NULL_TREE; } /* Find manual byte swap implementations as well as load in a given @@ -1405,7 +1463,8 @@ pass_optimize_bswap::execute (function *fun) tree fndecl = NULL_TREE, bswap_type = NULL_TREE, load_type; enum tree_code code; struct symbolic_number n; - bool bswap; + bool bswap, cast64_to_32; + uint64_t mask; /* This gsi_prev (&gsi) is not part of the for loop because cur_stmt might be moved to a different basic block by bswap_replace and gsi @@ -1442,7 +1501,8 @@ pass_optimize_bswap::execute (function *fun) continue; } - ins_stmt = find_bswap_or_nop (cur_stmt, &n, &bswap); + ins_stmt = find_bswap_or_nop (cur_stmt, &n, &bswap, + &cast64_to_32, &mask); if (!ins_stmt) continue; @@ -1479,7 +1539,7 @@ pass_optimize_bswap::execute (function *fun) continue; if (bswap_replace (gsi_for_stmt (cur_stmt), ins_stmt, fndecl, - bswap_type, load_type, &n, bswap)) + bswap_type, load_type, &n, bswap, mask)) changed = true; } } @@ -2820,7 +2880,8 @@ imm_store_chain_info::try_coalesce_bswap (merged_store_group *merged_store, } uint64_t cmpxchg, cmpnop; - find_bswap_or_nop_finalize (&n, &cmpxchg, &cmpnop); + bool cast64_to_32; + find_bswap_or_nop_finalize (&n, &cmpxchg, &cmpnop, &cast64_to_32); /* A complete byte swap should make the symbolic number to start with the largest digit in the highest order byte. Unchanged symbolic @@ -2828,6 +2889,10 @@ imm_store_chain_info::try_coalesce_bswap (merged_store_group *merged_store, if (n.n != cmpnop && n.n != cmpxchg) return false; + /* For now. */ + if (cast64_to_32) + return false; + if (n.base_addr == NULL_TREE && !is_gimple_val (n.src)) return false; @@ -4161,7 +4226,8 @@ imm_store_chain_info::output_merged_store (merged_store_group *group) n->vuse = gimple_vuse (ins_stmt); } bswap_res = bswap_replace (gsi_start (seq), ins_stmt, fndecl, - bswap_type, load_type, n, bswap); + bswap_type, load_type, n, bswap, + ~(uint64_t) 0); gcc_assert (bswap_res); } diff --git a/gcc/testsuite/gcc.dg/optimize-bswapdi-1.c b/gcc/testsuite/gcc.dg/optimize-bswapdi-1.c index a4a3a79..56a2071b 100644 --- a/gcc/testsuite/gcc.dg/optimize-bswapdi-1.c +++ b/gcc/testsuite/gcc.dg/optimize-bswapdi-1.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-require-effective-target bswap } */ /* { dg-require-effective-target stdint_types } */ -/* { dg-options "-O2 -fdump-tree-bswap" } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ /* { dg-additional-options "-mzarch" { target s390*-*-* } } */ #include @@ -58,4 +58,4 @@ swap64_c (uint64_t x) } -/* { dg-final { scan-tree-dump-times "64 bit bswap implementation found at" 3 "bswap" } } */ +/* { dg-final { scan-tree-dump-times "= __builtin_bswap64 \\\(" 3 "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/optimize-bswapdi-2.c b/gcc/testsuite/gcc.dg/optimize-bswapdi-2.c index 89b251f..c6d9604 100644 --- a/gcc/testsuite/gcc.dg/optimize-bswapdi-2.c +++ b/gcc/testsuite/gcc.dg/optimize-bswapdi-2.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-require-effective-target bswap } */ /* { dg-require-effective-target stdint_types } */ -/* { dg-options "-O2 -fdump-tree-bswap" } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ /* { dg-additional-options "-mzarch" { target s390*-*-* } } */ #include @@ -23,4 +23,4 @@ swap64_c (uint64_t x) } -/* { dg-final { scan-tree-dump-times "64 bit bswap implementation found at" 1 "bswap" } } */ +/* { dg-final { scan-tree-dump-times "= __builtin_bswap64 \\\(" 1 "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/optimize-bswapsi-1.c b/gcc/testsuite/gcc.dg/optimize-bswapsi-1.c index c403d04..2d24f43 100644 --- a/gcc/testsuite/gcc.dg/optimize-bswapsi-1.c +++ b/gcc/testsuite/gcc.dg/optimize-bswapsi-1.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-require-effective-target bswap } */ /* { dg-require-effective-target stdint_types } */ -/* { dg-options "-O2 -fdump-tree-bswap" } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ /* { dg-additional-options "-march=z900" { target s390*-*-* } } */ #include @@ -89,4 +89,4 @@ swap32_f (unsigned in) return in; } -/* { dg-final { scan-tree-dump-times "32 bit bswap implementation found at" 6 "bswap" } } */ +/* { dg-final { scan-tree-dump-times "= __builtin_bswap32 \\\(" 6 "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/optimize-bswapsi-3.c b/gcc/testsuite/gcc.dg/optimize-bswapsi-3.c index 9418a83..7cd1b40 100644 --- a/gcc/testsuite/gcc.dg/optimize-bswapsi-3.c +++ b/gcc/testsuite/gcc.dg/optimize-bswapsi-3.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-require-effective-target bswap } */ /* { dg-require-effective-target stdint_types } */ -/* { dg-options "-O2 -fdump-tree-bswap" } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ /* { dg-additional-options "-march=z900" { target s390-*-* } } */ typedef int SItype __attribute__ ((mode (SI))); @@ -20,4 +20,4 @@ swap32 (SItype in) | (((in >> 24) & 0xFF) << 0); } -/* { dg-final { scan-tree-dump-not "32 bit bswap implementation found at" "bswap" } } */ +/* { dg-final { scan-tree-dump-times "= __builtin_bswap32 \\\(" 1 "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/optimize-bswapsi-5.c b/gcc/testsuite/gcc.dg/optimize-bswapsi-5.c index b4d8b9a..91a5284 100644 --- a/gcc/testsuite/gcc.dg/optimize-bswapsi-5.c +++ b/gcc/testsuite/gcc.dg/optimize-bswapsi-5.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-require-effective-target bswap } */ -/* { dg-options "-O2 -fdump-tree-bswap -fno-inline-functions" } */ +/* { dg-options "-O2 -fdump-tree-optimized -fno-inline-functions" } */ /* { dg-additional-options "-march=z900" { target s390-*-* } } */ struct L { unsigned int l[2]; }; @@ -28,4 +28,4 @@ bar (double a, struct L *p) foo (a, p); } -/* { dg-final { scan-tree-dump-times "32 bit bswap implementation found at" 2 "bswap" } } */ +/* { dg-final { scan-tree-dump-times "= __builtin_bswap32 \\\(" 2 "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/pr86723.c b/gcc/testsuite/gcc.dg/pr86723.c new file mode 100644 index 0000000..e3fd6b9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr86723.c @@ -0,0 +1,63 @@ +/* PR tree-optimization/86723 */ +/* { dg-do run { target { ilp32 || lp64 } } } */ +/* { dg-options "-O2" } */ + +__attribute__((noipa)) int +foo (unsigned long long value) +{ + return (((value & 0x00000000000000ffull) << 56) + | ((value & 0x000000000000ff00ull) << 40) + | ((value & 0x0000000000ff0000ull) << 24) + | ((value & 0x00000000ff000000ull) << 8) + | ((value & 0x000000ff00000000ull) >> 8) + | ((value & 0x0000ff0000000000ull) >> 24) + | ((value & 0x00ff000000000000ull) >> 40) + | ((value & 0xff00000000000000ull) >> 56)); +} + +__attribute__((noipa)) int +bar (unsigned long long value) +{ + return (((value & 0x000000ff00000000ull) >> 8) + | ((value & 0x0000ff0000000000ull) >> 24) + | ((value & 0x00ff000000000000ull) >> 40) + | ((value & 0xff00000000000000ull) >> 56)); +} + +__attribute__((noipa)) unsigned long long +baz (unsigned long long value) +{ + return (((value & 0x00000000000000ffull) << 56) + | ((value & 0x000000000000ff00ull) << 40) + | ((value & 0x00000000ff000000ull) << 8) + | ((value & 0x000000ff00000000ull) >> 8) + | ((value & 0x0000ff0000000000ull) >> 24) + | ((value & 0xff00000000000000ull) >> 56)); +} + +__attribute__((noipa)) unsigned int +qux (unsigned int value) +{ + return (((value & 0x000000ff) << 24) + | ((value & 0x00ff0000) >> 8) + | ((value & 0xff000000) >> 24)); +} + +__attribute__((noipa)) unsigned int +corge (unsigned int value) +{ + return (((value & 0x000000ff) << 24) + | ((value & 0xff000000) >> 24)); +} + +int +main () +{ + if (foo (0x0102030405060708ull) != 0x04030201 + || bar (0x0102030405060708ull) != 0x04030201 + || baz (0x0102030405060708ull) != 0x0807000504030001ull + || qux (0x01020304) != 0x04000201 + || corge (0x01020304) != 0x04000001) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/pr86723.c b/gcc/testsuite/gcc.target/i386/pr86723.c new file mode 100644 index 0000000..b61d750c --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr86723.c @@ -0,0 +1,52 @@ +/* PR tree-optimization/86723 */ +/* { dg-do compile { target lp64 } } */ +/* { dg-options "-O2" } */ +/* { dg-final { scan-assembler-times "\tbswap\t" 5 } } */ + +int +foo (unsigned long long value) +{ + return (((value & 0x00000000000000ffull) << 56) + | ((value & 0x000000000000ff00ull) << 40) + | ((value & 0x0000000000ff0000ull) << 24) + | ((value & 0x00000000ff000000ull) << 8) + | ((value & 0x000000ff00000000ull) >> 8) + | ((value & 0x0000ff0000000000ull) >> 24) + | ((value & 0x00ff000000000000ull) >> 40) + | ((value & 0xff00000000000000ull) >> 56)); +} + +int +bar (unsigned long long value) +{ + return (((value & 0x000000ff00000000ull) >> 8) + | ((value & 0x0000ff0000000000ull) >> 24) + | ((value & 0x00ff000000000000ull) >> 40) + | ((value & 0xff00000000000000ull) >> 56)); +} + +unsigned long long +baz (unsigned long long value) +{ + return (((value & 0x00000000000000ffull) << 56) + | ((value & 0x000000000000ff00ull) << 40) + | ((value & 0x00000000ff000000ull) << 8) + | ((value & 0x000000ff00000000ull) >> 8) + | ((value & 0x0000ff0000000000ull) >> 24) + | ((value & 0xff00000000000000ull) >> 56)); +} + +unsigned int +qux (unsigned int value) +{ + return (((value & 0x000000ff) << 24) + | ((value & 0x00ff0000) >> 8) + | ((value & 0xff000000) >> 24)); +} + +unsigned int +corge (unsigned int value) +{ + return (((value & 0x000000ff) << 24) + | ((value & 0xff000000) >> 24)); +} -- cgit v1.1