aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2022-08-01 05:53:37 +0200
committerMartin Liska <mliska@suse.cz>2022-08-01 05:53:37 +0200
commit89eca196c99645ee1abefcf8b4a9dd84edd87ad6 (patch)
tree185cc8907ce37e82132f395cb52611f029215355 /gcc
parent3a4cd5dc6faca8fed7fa256c4c06f4999b5a1f9c (diff)
parent4a7274ddc4970c1ad011343ed285d6219dffa396 (diff)
downloadgcc-89eca196c99645ee1abefcf8b4a9dd84edd87ad6.zip
gcc-89eca196c99645ee1abefcf8b4a9dd84edd87ad6.tar.gz
gcc-89eca196c99645ee1abefcf8b4a9dd84edd87ad6.tar.bz2
Merge branch 'master' into devel/sphinx
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog130
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/analyzer/ChangeLog19
-rw-r--r--gcc/analyzer/analyzer.opt4
-rw-r--r--gcc/analyzer/region-model-impl-calls.cc117
-rw-r--r--gcc/analyzer/region-model.cc6
-rw-r--r--gcc/analyzer/region-model.h1
-rw-r--r--gcc/analyzer/region.h52
-rw-r--r--gcc/analyzer/sm-malloc.cc1
-rw-r--r--gcc/analyzer/sm-taint.cc1
-rw-r--r--gcc/c-family/ChangeLog9
-rw-r--r--gcc/c-family/c-common.cc10
-rw-r--r--gcc/c-family/c-common.h8
-rw-r--r--gcc/c-family/c-opts.cc6
-rw-r--r--gcc/config.in8
-rw-r--r--gcc/config/gcn/gcn-valu.md18
-rw-r--r--gcc/config/gcn/gcn.md20
-rw-r--r--gcc/config/i386/i386-features.cc46
-rw-r--r--gcc/config/i386/i386.md20
-rw-r--r--gcc/config/loongarch/loongarch.h5
-rw-r--r--gcc/config/riscv/riscv.md69
-rw-r--r--gcc/config/xtensa/xtensa.cc1
-rw-r--r--gcc/config/xtensa/xtensa.md10
-rwxr-xr-xgcc/configure34
-rw-r--r--gcc/configure.ac8
-rw-r--r--gcc/cp/ChangeLog19
-rw-r--r--gcc/cp/constexpr.cc8
-rw-r--r--gcc/cp/parser.cc6
-rw-r--r--gcc/doc/implement-c.texi3
-rw-r--r--gcc/doc/invoke.texi72
-rw-r--r--gcc/fortran/ChangeLog28
-rw-r--r--gcc/fortran/check.cc23
-rw-r--r--gcc/fortran/match.cc24
-rw-r--r--gcc/fortran/match.h6
-rw-r--r--gcc/fortran/openmp.cc3
-rw-r--r--gcc/fortran/primary.cc14
-rw-r--r--gcc/gimple-ssa-warn-restrict.cc2
-rw-r--r--gcc/go/gofrontend/MERGE2
-rw-r--r--gcc/jit/ChangeLog76
-rw-r--r--gcc/jit/docs/internals/index.rst3
-rw-r--r--gcc/omp-expand.cc108
-rw-r--r--gcc/testsuite/ChangeLog68
-rw-r--r--gcc/testsuite/c-c++-common/gomp/atomic-32.c14
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/constexpr-lambda27.C26
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/putenv-1.c109
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr106422.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/pr106450.c14
-rw-r--r--gcc/testsuite/gcc.target/riscv/fle-ieee.c12
-rw-r--r--gcc/testsuite/gcc.target/riscv/fle-snan.c12
-rw-r--r--gcc/testsuite/gcc.target/riscv/fle.c12
-rw-r--r--gcc/testsuite/gcc.target/riscv/flef-ieee.c12
-rw-r--r--gcc/testsuite/gcc.target/riscv/flef-snan.c12
-rw-r--r--gcc/testsuite/gcc.target/riscv/flef.c12
-rw-r--r--gcc/testsuite/gcc.target/riscv/flt-ieee.c12
-rw-r--r--gcc/testsuite/gcc.target/riscv/flt-snan.c12
-rw-r--r--gcc/testsuite/gcc.target/riscv/flt.c12
-rw-r--r--gcc/testsuite/gcc.target/riscv/fltf-ieee.c12
-rw-r--r--gcc/testsuite/gcc.target/riscv/fltf-snan.c12
-rw-r--r--gcc/testsuite/gcc.target/riscv/fltf.c12
-rw-r--r--gcc/testsuite/gfortran.dg/associated_target_9a.f9027
-rw-r--r--gcc/testsuite/gfortran.dg/associated_target_9b.f9023
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/declare-simd-3.f9030
-rw-r--r--gcc/testsuite/gfortran.dg/literal_constants.f20
-rw-r--r--gcc/testsuite/gfortran.dg/literal_constants.f9024
-rw-r--r--gcc/tree-ssa-threadbackward.cc9
-rw-r--r--gcc/tree-ssa-threadupdate.cc4
-rw-r--r--gcc/tree-vect-patterns.cc6
-rw-r--r--gcc/tree.cc4
68 files changed, 1343 insertions, 195 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3fc56a6..22cf563 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,133 @@
+2022-07-31 Roger Sayle <roger@nextmovesoftware.com>
+
+ * config/i386/i386.md (define_expand <any_rotate>ti3): For
+ rotations by 64 bits use new rot[lr]64ti2_doubleword pattern.
+ (rot[lr]64ti2_doubleword): New post-reload splitter.
+
+2022-07-31 Roger Sayle <roger@nextmovesoftware.com>
+ H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/106450
+ * config/i386/i386-features.cc (timode_check_non_convertible_regs):
+ Do nothing if REGNO is set in the REGS bitmap, or is a hard reg.
+ (timode_remove_non_convertible_regs): Update comment.
+ Call timode_check_non_convertible_reg on all TImode register
+ DEFs and USEs in each instruction.
+
+2022-07-30 Takayuki 'January June' Suwa <jjsuwa_sys3175@yahoo.co.jp>
+
+ * config/xtensa/xtensa.md: Change hard register number used in
+ the split patterns for indirect sibling call fixups from 10 to 11,
+ the last free one for the CALL0 ABI.
+
+2022-07-30 Takayuki 'January June' Suwa <jjsuwa_sys3175@yahoo.co.jp>
+
+ * config/xtensa/xtensa.cc (xtensa_rtx_costs):
+ Add new case for IF_THEN_ELSE.
+
+2022-07-29 Andrew Stubbs <ams@codesourcery.com>
+
+ * config/gcn/gcn-valu.md (V_INT_noHI): New iterator.
+ (<expander><mode>3<exec>): Use V_INT_noHI.
+ (v<expander><mode>3<exec>): Likewise.
+
+2022-07-29 Andrew Stubbs <ams@codesourcery.com>
+
+ * config/gcn/gcn.md (one_cmpldi2): New.
+
+2022-07-29 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/105679
+ * tree-ssa-threadbackward.cc
+ (back_threader_profitability::profitable_path_p): Avoid threading
+ when the entry edge is probably never executed.
+
+2022-07-29 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/106422
+ * tree-ssa-threadupdate.cc (fwd_jt_path_registry::update_cfg):
+ Check whether we can copy thread blocks and cancel the thread if not.
+
+2022-07-29 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/106449
+ * omp-expand.cc (expand_omp_simd): Fix up handling of pointer
+ iterators in non-rectangular simd loops. Unshare fd->loops[i].n2
+ or n2 before regimplifying it inside of a condition.
+
+2022-07-29 Jakub Jelinek <jakub@redhat.com>
+
+ * omp-expand.cc (expand_omp_for_init_counts, expand_omp_for_init_vars,
+ extract_omp_for_update_vars, expand_omp_for_ordered_loops,
+ expand_omp_simd): Don't fold_convert second argument to
+ fold_build_pointer_plus to sizetype.
+
+2022-07-29 Lulu Cheng <chenglulu@loongson.cn>
+
+ * config.in: Regenerate.
+ * config/loongarch/loongarch.h (ASM_PREFERRED_EH_DATA_FORMAT):
+ Select the value of the macro definition according to whether
+ HAVE_AS_EH_FRAME_PCREL_ENCODING_SUPPORT is defined.
+ * configure: Regenerate.
+ * configure.ac: Reinstate HAVE_AS_EH_FRAME_PCREL_ENCODING_SUPPORT test.
+
+2022-07-29 Richard Biener <rguenther@suse.de>
+
+ * gimple-ssa-warn-restrict.cc (builtin_memref::set_base_and_offset):
+ Use CONVERT_EXPR_CODE_P.
+
+2022-07-29 Richard Biener <rguenther@suse.de>
+
+ * tree-vect-patterns.cc (vect_recog_bool_pattern): Use
+ get_vectype_for_scalar_type instead of
+ vect_get_vector_types_for_stmt.
+
+2022-07-28 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/105893
+ * doc/invoke.texi: Add -Wanalyzer-putenv-of-auto-var.
+
+2022-07-28 David Malcolm <dmalcolm@redhat.com>
+
+ * doc/invoke.texi (-fdiagnostics-show-cwe): Use uref rather than
+ url.
+ (Static Analyzer Options): Likewise. Add urefs for all of the
+ warnings that have associated CWE identifiers.
+
+2022-07-28 Maciej W. Rozycki <macro@embecosm.com>
+
+ * doc/implement-c.texi (Floating point implementation): Mention
+ `-fno-trapping-math' in the context of FENV_ACCESS pragma.
+ * doc/invoke.texi (Optimize Options): Clarify FENV_ACCESS pragma
+ implication in the descriptions of `-fno-trapping-math' and
+ `-frounding-math'.
+
+2022-07-28 Maciej W. Rozycki <macro@embecosm.com>
+
+ * config/riscv/riscv.md (UNSPECV_FSNVSNAN): New constant.
+ (QUIET_PATTERN): New int attribute.
+ (f<quiet_pattern>_quiet<ANYF:mode><X:mode>4): Emit the intended
+ RTL insns entirely within the preparation statements.
+ (*f<quiet_pattern>_quiet<ANYF:mode><X:mode>4_default)
+ (*f<quiet_pattern>_quiet<ANYF:mode><X:mode>4_snan): Remove
+ insns.
+ (*riscv_fsnvsnan<mode>2): New insn.
+
+2022-07-28 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/106457
+ * tree.cc (array_at_struct_end_p): Handle array objects
+ specially.
+
+2022-07-28 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/106099
+ * internal-fn.def (TRAP): New internal fn.
+ * internal-fn.h (expand_TRAP): Declare.
+ * internal-fn.cc (expand_TRAP): Define.
+ * gimple.cc (gimple_build_builtin_unreachable): For BUILT_IN_TRAP,
+ use internal fn rather than builtin.
+
2022-07-27 Andrew Carlotti <andrew.carlotti@arm.com>
* doc/loop.texi: Refer to LOOPS_HAVE_RECORDED_EXITS instead.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 12a0671..ed14e56 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20220728
+20220801
diff --git a/gcc/analyzer/ChangeLog b/gcc/analyzer/ChangeLog
index d10a5c8..d1cb3ad 100644
--- a/gcc/analyzer/ChangeLog
+++ b/gcc/analyzer/ChangeLog
@@ -1,3 +1,22 @@
+2022-07-28 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/105893
+ * analyzer.opt (Wanalyzer-putenv-of-auto-var): New.
+ * region-model-impl-calls.cc (class putenv_of_auto_var): New.
+ (region_model::impl_call_putenv): New.
+ * region-model.cc (region_model::on_call_pre): Handle putenv.
+ * region-model.h (region_model::impl_call_putenv): New decl.
+
+2022-07-28 David Malcolm <dmalcolm@redhat.com>
+
+ * sm-malloc.cc (free_of_non_heap::emit): Add comment about CWE.
+ * sm-taint.cc (tainted_size::emit): Likewise.
+
+2022-07-28 David Malcolm <dmalcolm@redhat.com>
+
+ * region.h: Add notes to the comment describing the region
+ class hierarchy.
+
2022-07-27 Immad Mir <mirimmad@outlook.com>
PR analyzer/106286
diff --git a/gcc/analyzer/analyzer.opt b/gcc/analyzer/analyzer.opt
index 5021376..808ff36 100644
--- a/gcc/analyzer/analyzer.opt
+++ b/gcc/analyzer/analyzer.opt
@@ -126,6 +126,10 @@ Wanalyzer-null-dereference
Common Var(warn_analyzer_null_dereference) Init(1) Warning
Warn about code paths in which a NULL pointer is dereferenced.
+Wanalyzer-putenv-of-auto-var
+Common Var(warn_analyzer_putenv_of_auto_var) Init(1) Warning
+Warn about code paths in which an on-stack buffer is passed to putenv.
+
Wanalyzer-shift-count-negative
Common Var(warn_analyzer_shift_count_negative) Init(1) Warning
Warn about code paths in which a shift with negative count is attempted.
diff --git a/gcc/analyzer/region-model-impl-calls.cc b/gcc/analyzer/region-model-impl-calls.cc
index 8c38e92..3f821ff 100644
--- a/gcc/analyzer/region-model-impl-calls.cc
+++ b/gcc/analyzer/region-model-impl-calls.cc
@@ -549,6 +549,123 @@ region_model::impl_call_memset (const call_details &cd)
fill_region (sized_dest_reg, fill_value_u8);
}
+/* A subclass of pending_diagnostic for complaining about 'putenv'
+ called on an auto var. */
+
+class putenv_of_auto_var
+: public pending_diagnostic_subclass<putenv_of_auto_var>
+{
+public:
+ putenv_of_auto_var (tree fndecl, const region *reg)
+ : m_fndecl (fndecl), m_reg (reg),
+ m_var_decl (reg->get_base_region ()->maybe_get_decl ())
+ {
+ }
+
+ const char *get_kind () const final override
+ {
+ return "putenv_of_auto_var";
+ }
+
+ bool operator== (const putenv_of_auto_var &other) const
+ {
+ return (m_fndecl == other.m_fndecl
+ && m_reg == other.m_reg
+ && same_tree_p (m_var_decl, other.m_var_decl));
+ }
+
+ int get_controlling_option () const final override
+ {
+ return OPT_Wanalyzer_putenv_of_auto_var;
+ }
+
+ bool emit (rich_location *rich_loc) final override
+ {
+ auto_diagnostic_group d;
+ diagnostic_metadata m;
+
+ /* SEI CERT C Coding Standard: "POS34-C. Do not call putenv() with a
+ pointer to an automatic variable as the argument". */
+ diagnostic_metadata::precanned_rule
+ rule ("POS34-C", "https://wiki.sei.cmu.edu/confluence/x/6NYxBQ");
+ m.add_rule (rule);
+
+ bool warned;
+ if (m_var_decl)
+ warned = warning_meta (rich_loc, m, get_controlling_option (),
+ "%qE on a pointer to automatic variable %qE",
+ m_fndecl, m_var_decl);
+ else
+ warned = warning_meta (rich_loc, m, get_controlling_option (),
+ "%qE on a pointer to an on-stack buffer",
+ m_fndecl);
+ if (warned)
+ {
+ if (m_var_decl)
+ inform (DECL_SOURCE_LOCATION (m_var_decl),
+ "%qE declared on stack here", m_var_decl);
+ inform (rich_loc->get_loc (), "perhaps use %qs rather than %qE",
+ "setenv", m_fndecl);
+ }
+
+ return warned;
+ }
+
+ label_text describe_final_event (const evdesc::final_event &ev) final override
+ {
+ if (m_var_decl)
+ return ev.formatted_print ("%qE on a pointer to automatic variable %qE",
+ m_fndecl, m_var_decl);
+ else
+ return ev.formatted_print ("%qE on a pointer to an on-stack buffer",
+ m_fndecl);
+ }
+
+ void mark_interesting_stuff (interesting_t *interest) final override
+ {
+ if (!m_var_decl)
+ interest->add_region_creation (m_reg->get_base_region ());
+ }
+
+private:
+ tree m_fndecl; // non-NULL
+ const region *m_reg; // non-NULL
+ tree m_var_decl; // could be NULL
+};
+
+/* Handle the on_call_pre part of "putenv".
+
+ In theory we could try to model the state of the environment variables
+ for the process; for now we merely complain about putenv of regions
+ on the stack. */
+
+void
+region_model::impl_call_putenv (const call_details &cd)
+{
+ tree fndecl = cd.get_fndecl_for_call ();
+ gcc_assert (fndecl);
+ region_model_context *ctxt = cd.get_ctxt ();
+ const svalue *ptr_sval = cd.get_arg_svalue (0);
+ const region *reg = deref_rvalue (ptr_sval, cd.get_arg_tree (0), ctxt);
+ m_store.mark_as_escaped (reg);
+ enum memory_space mem_space = reg->get_memory_space ();
+ switch (mem_space)
+ {
+ default:
+ gcc_unreachable ();
+ case MEMSPACE_UNKNOWN:
+ case MEMSPACE_CODE:
+ case MEMSPACE_GLOBALS:
+ case MEMSPACE_HEAP:
+ case MEMSPACE_READONLY_DATA:
+ break;
+ case MEMSPACE_STACK:
+ if (ctxt)
+ ctxt->warn (new putenv_of_auto_var (fndecl, reg));
+ break;
+ }
+}
+
/* Handle the on_call_pre part of "operator new". */
void
diff --git a/gcc/analyzer/region-model.cc b/gcc/analyzer/region-model.cc
index f7df2fc..a140f4d 100644
--- a/gcc/analyzer/region-model.cc
+++ b/gcc/analyzer/region-model.cc
@@ -1539,6 +1539,12 @@ region_model::on_call_pre (const gcall *call, region_model_context *ctxt,
impl_call_memset (cd);
return false;
}
+ else if (is_named_call_p (callee_fndecl, "putenv", call, 1)
+ && POINTER_TYPE_P (cd.get_arg_type (0)))
+ {
+ impl_call_putenv (cd);
+ return false;
+ }
else if (is_named_call_p (callee_fndecl, "strchr", call, 2)
&& POINTER_TYPE_P (cd.get_arg_type (0)))
{
diff --git a/gcc/analyzer/region-model.h b/gcc/analyzer/region-model.h
index 42f8abe..a9657e0 100644
--- a/gcc/analyzer/region-model.h
+++ b/gcc/analyzer/region-model.h
@@ -630,6 +630,7 @@ class region_model
void impl_call_malloc (const call_details &cd);
void impl_call_memcpy (const call_details &cd);
void impl_call_memset (const call_details &cd);
+ void impl_call_putenv (const call_details &cd);
void impl_call_realloc (const call_details &cd);
void impl_call_strchr (const call_details &cd);
void impl_call_strcpy (const call_details &cd);
diff --git a/gcc/analyzer/region.h b/gcc/analyzer/region.h
index 1067748..a5b3029 100644
--- a/gcc/analyzer/region.h
+++ b/gcc/analyzer/region.h
@@ -72,27 +72,37 @@ enum region_kind
region
space_region
- frame_region (RK_FRAME)
- globals_region (RK_GLOBALS)
- code_region (RK_CODE)
- stack_region (RK_STACK)
- heap_region (RK_HEAP)
- root_region (RK_ROOT)
- function_region (RK_FUNCTION)
- label_region (RK_LABEL)
- symbolic_region (RK_SYMBOLIC)
- decl_region (RK_DECL),
- field_region (RK_FIELD)
- element_region (RK_ELEMENT)
- offset_region (RK_OFFSET)
- sized_region (RK_SIZED)
- cast_region (RK_CAST)
- heap_allocated_region (RK_HEAP_ALLOCATED)
- alloca_region (RK_ALLOCA)
- string_region (RK_STRING)
- bit_range_region (RK_BIT_RANGE)
- var_arg_region (RK_VAR_ARG)
- unknown_region (RK_UNKNOWN). */
+ frame_region (RK_FRAME): a function frame on the stack
+ globals_region (RK_GLOBALS): holds globals variables (data and bss)
+ code_region (RK_CODE): represents the code segment, containing functions
+ stack_region (RK_STACK): a stack, containing all stack frames
+ heap_region (RK_HEAP): the heap, containing heap_allocated_regions
+ root_region (RK_ROOT): the top-level region
+ function_region (RK_FUNCTION): the code for a particular function
+ label_region (RK_LABEL): a particular label within a function
+ symbolic_region (RK_SYMBOLIC): dereferencing a symbolic pointer
+ decl_region (RK_DECL): the memory occupied by a particular global, local,
+ or SSA name
+ field_region (RK_FIELD): the memory occupied by a field within a struct
+ or union
+ element_region (RK_ELEMENT): an element within an array
+ offset_region (RK_OFFSET): a byte-offset within another region, for
+ handling pointer arithmetic as a region
+ sized_region (RK_SIZED): a subregion of symbolic size (in bytes)
+ within its parent
+ cast_region (RK_CAST): a region that views another region using a
+ different type
+ heap_allocated_region (RK_HEAP_ALLOCATED): an untyped region dynamically
+ allocated on the heap via
+ "malloc" or similar
+ alloca_region (RK_ALLOCA): an untyped region dynamically allocated on the
+ stack via "alloca"
+ string_region (RK_STRING): a region for a STRING_CST
+ bit_range_region (RK_BIT_RANGE): a region for a specific range of bits
+ within another region
+ var_arg_region (RK_VAR_ARG): a region for the N-th vararg within a
+ frame_region for a variadic call
+ unknown_region (RK_UNKNOWN): for handling unimplemented tree codes. */
/* Abstract base class for representing ways of accessing chunks of memory.
diff --git a/gcc/analyzer/sm-malloc.cc b/gcc/analyzer/sm-malloc.cc
index 608aceb..73c549f 100644
--- a/gcc/analyzer/sm-malloc.cc
+++ b/gcc/analyzer/sm-malloc.cc
@@ -1300,6 +1300,7 @@ public:
bool emit (rich_location *rich_loc) final override
{
+ /* "CWE-401: Missing Release of Memory after Effective Lifetime". */
diagnostic_metadata m;
m.add_cwe (401);
if (m_arg)
diff --git a/gcc/analyzer/sm-taint.cc b/gcc/analyzer/sm-taint.cc
index 51bfe06..549373b 100644
--- a/gcc/analyzer/sm-taint.cc
+++ b/gcc/analyzer/sm-taint.cc
@@ -435,6 +435,7 @@ public:
bool emit (rich_location *rich_loc) override
{
+ /* "CWE-129: Improper Validation of Array Index". */
diagnostic_metadata m;
m.add_cwe (129);
if (m_arg)
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 73e959d..68fc6e2 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,12 @@
+2022-07-31 Lewis Hyatt <lhyatt@gmail.com>
+
+ PR c++/66290
+ * c-common.h: Rename global done_lexing to
+ override_libcpp_locations.
+ * c-common.cc (c_cpp_diagnostic): Likewise.
+ * c-opts.cc (c_common_finish): Set override_libcpp_locations
+ (formerly done_lexing) immediately prior to calling cpp_finish ().
+
2022-07-27 Lewis Hyatt <lhyatt@gmail.com>
* c-ppoutput.cc (token_streamer::stream): Update input_location
diff --git a/gcc/c-family/c-common.cc b/gcc/c-family/c-common.cc
index 655c3ae..6e41ceb 100644
--- a/gcc/c-family/c-common.cc
+++ b/gcc/c-family/c-common.cc
@@ -284,9 +284,11 @@ int c_inhibit_evaluation_warnings;
be generated. */
bool in_late_binary_op;
-/* Whether lexing has been completed, so subsequent preprocessor
- errors should use the compiler's input_location. */
-bool done_lexing = false;
+/* Depending on which phase of processing we are in, we may need
+ to prefer input_location to libcpp's locations. (Specifically,
+ after the C++ lexer is done lexing tokens, but prior to calling
+ cpp_finish (), we need to do so. */
+bool override_libcpp_locations;
/* Information about how a function name is generated. */
struct fname_var_t
@@ -6681,7 +6683,7 @@ c_cpp_diagnostic (cpp_reader *pfile ATTRIBUTE_UNUSED,
default:
gcc_unreachable ();
}
- if (done_lexing)
+ if (override_libcpp_locations)
richloc->set_range (0, input_location, SHOW_RANGE_WITH_CARET);
diagnostic_set_info_translated (&diagnostic, msg, ap,
richloc, dlevel);
diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
index f906439..c06769b 100644
--- a/gcc/c-family/c-common.h
+++ b/gcc/c-family/c-common.h
@@ -767,10 +767,12 @@ extern int max_tinst_depth;
extern int c_inhibit_evaluation_warnings;
-/* Whether lexing has been completed, so subsequent preprocessor
- errors should use the compiler's input_location. */
+/* Depending on which phase of processing we are in, we may need
+ to prefer input_location to libcpp's locations. (Specifically,
+ after the C++ lexer is done lexing tokens, but prior to calling
+ cpp_finish (), we need to do so. */
-extern bool done_lexing;
+extern bool override_libcpp_locations;
/* C types are partitioned into three subsets: object, function, and
incomplete types. */
diff --git a/gcc/c-family/c-opts.cc b/gcc/c-family/c-opts.cc
index b9f01a6..4e14636 100644
--- a/gcc/c-family/c-opts.cc
+++ b/gcc/c-family/c-opts.cc
@@ -1281,6 +1281,12 @@ c_common_finish (void)
}
}
+ /* When we call cpp_finish (), it may generate some diagnostics using
+ locations it remembered from the preprocessing phase, e.g. for
+ -Wunused-macros. So inform c_cpp_diagnostic () not to override those
+ locations with input_location, which would be incorrect now. */
+ override_libcpp_locations = false;
+
/* For performance, avoid tearing down cpplib's internal structures
with cpp_destroy (). */
cpp_finish (parse_in, deps_stream);
diff --git a/gcc/config.in b/gcc/config.in
index 16bb963..413b2bd 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -404,13 +404,19 @@
#endif
+/* Define if your assembler supports eh_frame pcrel encoding. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_AS_EH_FRAME_PCREL_ENCODING_SUPPORT
+#endif
+
+
/* Define if your assembler supports the R_PPC64_ENTRY relocation. */
#ifndef USED_FOR_TARGET
#undef HAVE_AS_ENTRY_MARKERS
#endif
-/* Define if your assembler supports explicit relocations. */
+/* Define if your assembler supports explicit relocation. */
#ifndef USED_FOR_TARGET
#undef HAVE_AS_EXPLICIT_RELOCS
#endif
diff --git a/gcc/config/gcn/gcn-valu.md b/gcc/config/gcn/gcn-valu.md
index abe4620..8c33ae0 100644
--- a/gcc/config/gcn/gcn-valu.md
+++ b/gcc/config/gcn/gcn-valu.md
@@ -60,6 +60,8 @@
(define_mode_iterator V_INT_noQI
[V64HI V64SI V64DI])
+(define_mode_iterator V_INT_noHI
+ [V64SI V64DI])
; All of above
(define_mode_iterator V_ALL
@@ -2086,10 +2088,10 @@
})
(define_insn "<expander><mode>3<exec>"
- [(set (match_operand:V_SI 0 "register_operand" "= v")
- (shiftop:V_SI
- (match_operand:V_SI 1 "gcn_alu_operand" " v")
- (vec_duplicate:V_SI
+ [(set (match_operand:V_INT_noHI 0 "register_operand" "= v")
+ (shiftop:V_INT_noHI
+ (match_operand:V_INT_noHI 1 "gcn_alu_operand" " v")
+ (vec_duplicate:<VnSI>
(match_operand:SI 2 "gcn_alu_operand" "SvB"))))]
""
"v_<revmnemonic>0\t%0, %2, %1"
@@ -2117,10 +2119,10 @@
})
(define_insn "v<expander><mode>3<exec>"
- [(set (match_operand:V_SI 0 "register_operand" "=v")
- (shiftop:V_SI
- (match_operand:V_SI 1 "gcn_alu_operand" " v")
- (match_operand:V_SI 2 "gcn_alu_operand" "vB")))]
+ [(set (match_operand:V_INT_noHI 0 "register_operand" "=v")
+ (shiftop:V_INT_noHI
+ (match_operand:V_INT_noHI 1 "gcn_alu_operand" " v")
+ (match_operand:<VnSI> 2 "gcn_alu_operand" "vB")))]
""
"v_<revmnemonic>0\t%0, %2, %1"
[(set_attr "type" "vop2")
diff --git a/gcc/config/gcn/gcn.md b/gcc/config/gcn/gcn.md
index 033c170..70a769b 100644
--- a/gcc/config/gcn/gcn.md
+++ b/gcc/config/gcn/gcn.md
@@ -1676,6 +1676,26 @@
;; }}}
;; {{{ ALU: generic 64-bit
+(define_insn_and_split "one_cmpldi2"
+ [(set (match_operand:DI 0 "register_operand" "=Sg, v")
+ (not:DI (match_operand:DI 1 "gcn_alu_operand" "SgA,vSvDB")))
+ (clobber (match_scratch:BI 2 "=cs, X"))]
+ ""
+ "#"
+ "reload_completed"
+ [(parallel [(set (match_dup 3) (not:SI (match_dup 4)))
+ (clobber (match_dup 2))])
+ (parallel [(set (match_dup 5) (not:SI (match_dup 6)))
+ (clobber (match_dup 2))])]
+ {
+ operands[3] = gcn_operand_part (DImode, operands[0], 0);
+ operands[4] = gcn_operand_part (DImode, operands[1], 0);
+ operands[5] = gcn_operand_part (DImode, operands[0], 1);
+ operands[6] = gcn_operand_part (DImode, operands[1], 1);
+ }
+ [(set_attr "type" "mult")]
+)
+
(define_code_iterator vec_and_scalar64_com [and ior xor])
(define_insn_and_split "<expander>di3"
diff --git a/gcc/config/i386/i386-features.cc b/gcc/config/i386/i386-features.cc
index aa5de71..e4cc4a3 100644
--- a/gcc/config/i386/i386-features.cc
+++ b/gcc/config/i386/i386-features.cc
@@ -1808,6 +1808,11 @@ static void
timode_check_non_convertible_regs (bitmap candidates, bitmap regs,
unsigned int regno)
{
+ /* Do nothing if REGNO is already in REGS or is a hard reg. */
+ if (bitmap_bit_p (regs, regno)
+ || HARD_REGISTER_NUM_P (regno))
+ return;
+
for (df_ref def = DF_REG_DEF_CHAIN (regno);
def;
def = DF_REF_NEXT_REG (def))
@@ -1843,7 +1848,13 @@ timode_check_non_convertible_regs (bitmap candidates, bitmap regs,
}
}
-/* The TImode version of remove_non_convertible_regs. */
+/* For a given bitmap of insn UIDs scans all instructions and
+ remove insn from CANDIDATES in case it has both convertible
+ and not convertible definitions.
+
+ All insns in a bitmap are conversion candidates according to
+ scalar_to_vector_candidate_p. Currently it implies all insns
+ are single_set. */
static void
timode_remove_non_convertible_regs (bitmap candidates)
@@ -1857,25 +1868,20 @@ timode_remove_non_convertible_regs (bitmap candidates)
changed = false;
EXECUTE_IF_SET_IN_BITMAP (candidates, 0, id, bi)
{
- rtx def_set = single_set (DF_INSN_UID_GET (id)->insn);
- rtx dest = SET_DEST (def_set);
- rtx src = SET_SRC (def_set);
-
- if ((!REG_P (dest)
- || bitmap_bit_p (regs, REGNO (dest))
- || HARD_REGISTER_P (dest))
- && (!REG_P (src)
- || bitmap_bit_p (regs, REGNO (src))
- || HARD_REGISTER_P (src)))
- continue;
-
- if (REG_P (dest))
- timode_check_non_convertible_regs (candidates, regs,
- REGNO (dest));
-
- if (REG_P (src))
- timode_check_non_convertible_regs (candidates, regs,
- REGNO (src));
+ rtx_insn *insn = DF_INSN_UID_GET (id)->insn;
+ df_ref ref;
+
+ FOR_EACH_INSN_DEF (ref, insn)
+ if (!DF_REF_REG_MEM_P (ref)
+ && GET_MODE (DF_REF_REG (ref)) == TImode)
+ timode_check_non_convertible_regs (candidates, regs,
+ DF_REF_REGNO (ref));
+
+ FOR_EACH_INSN_USE (ref, insn)
+ if (!DF_REF_REG_MEM_P (ref)
+ && GET_MODE (DF_REF_REG (ref)) == TImode)
+ timode_check_non_convertible_regs (candidates, regs,
+ DF_REF_REGNO (ref));
}
EXECUTE_IF_SET_IN_BITMAP (regs, 0, id, bi)
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index fab6aed..f1158e1 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -13820,6 +13820,8 @@
if (const_1_to_63_operand (operands[2], VOIDmode))
emit_insn (gen_ix86_<insn>ti3_doubleword
(operands[0], operands[1], operands[2]));
+ else if (CONST_INT_P (operands[2]) && INTVAL (operands[2]) == 64)
+ emit_insn (gen_<insn>64ti2_doubleword (operands[0], operands[1]));
else
{
rtx amount = force_reg (QImode, operands[2]);
@@ -14045,6 +14047,24 @@
}
})
+(define_insn_and_split "<insn>64ti2_doubleword"
+ [(set (match_operand:TI 0 "register_operand" "=r,r,r")
+ (any_rotate:TI (match_operand:TI 1 "nonimmediate_operand" "0,r,o")
+ (const_int 64)))]
+ "TARGET_64BIT"
+ "#"
+ "&& reload_completed"
+ [(set (match_dup 0) (match_dup 3))
+ (set (match_dup 2) (match_dup 1))]
+{
+ split_double_mode (TImode, &operands[0], 2, &operands[0], &operands[2]);
+ if (rtx_equal_p (operands[0], operands[1]))
+ {
+ emit_insn (gen_swapdi (operands[0], operands[2]));
+ DONE;
+ }
+})
+
(define_mode_attr rorx_immediate_operand
[(SI "const_0_to_31_operand")
(DI "const_0_to_63_operand")])
diff --git a/gcc/config/loongarch/loongarch.h b/gcc/config/loongarch/loongarch.h
index 89a5bd7..8b12889 100644
--- a/gcc/config/loongarch/loongarch.h
+++ b/gcc/config/loongarch/loongarch.h
@@ -1127,8 +1127,13 @@ struct GTY (()) machine_function
};
#endif
+#ifdef HAVE_AS_EH_FRAME_PCREL_ENCODING_SUPPORT
+#define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \
+ (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4)
+#else
#define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \
(((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_absptr)
+#endif
/* Do emit .note.GNU-stack by default. */
#ifndef NEED_INDICATE_EXEC_STACK
diff --git a/gcc/config/riscv/riscv.md b/gcc/config/riscv/riscv.md
index aa43d5f..0796f91 100644
--- a/gcc/config/riscv/riscv.md
+++ b/gcc/config/riscv/riscv.md
@@ -57,6 +57,7 @@
;; Floating-point unspecs.
UNSPECV_FRFLAGS
UNSPECV_FSFLAGS
+ UNSPECV_FSNVSNAN
;; Interrupt handler instructions.
UNSPECV_MRET
@@ -360,6 +361,7 @@
;; Iterator and attributes for quiet comparisons.
(define_int_iterator QUIET_COMPARISON [UNSPEC_FLT_QUIET UNSPEC_FLE_QUIET])
(define_int_attr quiet_pattern [(UNSPEC_FLT_QUIET "lt") (UNSPEC_FLE_QUIET "le")])
+(define_int_attr QUIET_PATTERN [(UNSPEC_FLT_QUIET "LT") (UNSPEC_FLE_QUIET "LE")])
;; This code iterator allows signed and unsigned widening multiplications
;; to use the same template.
@@ -2326,39 +2328,31 @@
(set_attr "mode" "<UNITMODE>")])
(define_expand "f<quiet_pattern>_quiet<ANYF:mode><X:mode>4"
- [(parallel [(set (match_operand:X 0 "register_operand")
- (unspec:X
- [(match_operand:ANYF 1 "register_operand")
- (match_operand:ANYF 2 "register_operand")]
- QUIET_COMPARISON))
- (clobber (match_scratch:X 3))])]
- "TARGET_HARD_FLOAT")
-
-(define_insn "*f<quiet_pattern>_quiet<ANYF:mode><X:mode>4_default"
- [(set (match_operand:X 0 "register_operand" "=r")
- (unspec:X
- [(match_operand:ANYF 1 "register_operand" " f")
- (match_operand:ANYF 2 "register_operand" " f")]
- QUIET_COMPARISON))
- (clobber (match_scratch:X 3 "=&r"))]
- "TARGET_HARD_FLOAT && ! HONOR_SNANS (<ANYF:MODE>mode)"
- "frflags\t%3\n\tf<quiet_pattern>.<fmt>\t%0,%1,%2\n\tfsflags\t%3"
- [(set_attr "type" "fcmp")
- (set_attr "mode" "<UNITMODE>")
- (set (attr "length") (const_int 12))])
-
-(define_insn "*f<quiet_pattern>_quiet<ANYF:mode><X:mode>4_snan"
- [(set (match_operand:X 0 "register_operand" "=r")
- (unspec:X
- [(match_operand:ANYF 1 "register_operand" " f")
- (match_operand:ANYF 2 "register_operand" " f")]
- QUIET_COMPARISON))
- (clobber (match_scratch:X 3 "=&r"))]
- "TARGET_HARD_FLOAT && HONOR_SNANS (<ANYF:MODE>mode)"
- "frflags\t%3\n\tf<quiet_pattern>.<fmt>\t%0,%1,%2\n\tfsflags\t%3\n\tfeq.<fmt>\tzero,%1,%2"
- [(set_attr "type" "fcmp")
- (set_attr "mode" "<UNITMODE>")
- (set (attr "length") (const_int 16))])
+ [(set (match_operand:X 0 "register_operand")
+ (unspec:X [(match_operand:ANYF 1 "register_operand")
+ (match_operand:ANYF 2 "register_operand")]
+ QUIET_COMPARISON))]
+ "TARGET_HARD_FLOAT"
+{
+ rtx op0 = operands[0];
+ rtx op1 = operands[1];
+ rtx op2 = operands[2];
+ rtx tmp = gen_reg_rtx (SImode);
+ rtx cmp = gen_rtx_<QUIET_PATTERN> (<X:MODE>mode, op1, op2);
+ rtx frflags = gen_rtx_UNSPEC_VOLATILE (SImode, gen_rtvec (1, const0_rtx),
+ UNSPECV_FRFLAGS);
+ rtx fsflags = gen_rtx_UNSPEC_VOLATILE (SImode, gen_rtvec (1, tmp),
+ UNSPECV_FSFLAGS);
+
+ emit_insn (gen_rtx_SET (tmp, frflags));
+ emit_insn (gen_rtx_SET (op0, cmp));
+ emit_insn (fsflags);
+ if (HONOR_SNANS (<ANYF:MODE>mode))
+ emit_insn (gen_rtx_UNSPEC_VOLATILE (<ANYF:MODE>mode,
+ gen_rtvec (2, op1, op2),
+ UNSPECV_FSNVSNAN));
+ DONE;
+})
(define_insn "*seq_zero_<X:mode><GPR:mode>"
[(set (match_operand:GPR 0 "register_operand" "=r")
@@ -2766,6 +2760,15 @@
"TARGET_HARD_FLOAT"
"fsflags\t%0")
+(define_insn "*riscv_fsnvsnan<mode>2"
+ [(unspec_volatile [(match_operand:ANYF 0 "register_operand" "f")
+ (match_operand:ANYF 1 "register_operand" "f")]
+ UNSPECV_FSNVSNAN)]
+ "TARGET_HARD_FLOAT"
+ "feq.<fmt>\tzero,%0,%1"
+ [(set_attr "type" "fcmp")
+ (set_attr "mode" "<UNITMODE>")])
+
(define_insn "riscv_mret"
[(return)
(unspec_volatile [(const_int 0)] UNSPECV_MRET)]
diff --git a/gcc/config/xtensa/xtensa.cc b/gcc/config/xtensa/xtensa.cc
index a851a7a..6ac879c 100644
--- a/gcc/config/xtensa/xtensa.cc
+++ b/gcc/config/xtensa/xtensa.cc
@@ -4273,6 +4273,7 @@ xtensa_rtx_costs (rtx x, machine_mode mode, int outer_code,
case ZERO_EXTRACT:
case ZERO_EXTEND:
+ case IF_THEN_ELSE:
*total = COSTS_N_INSNS (1);
return true;
diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md
index 899ce27..1294aab 100644
--- a/gcc/config/xtensa/xtensa.md
+++ b/gcc/config/xtensa/xtensa.md
@@ -25,7 +25,7 @@
(A7_REG 7)
(A8_REG 8)
(A9_REG 9)
- (A10_REG 10)
+ (A11_REG 11)
(UNSPEC_NOP 2)
(UNSPEC_PLT 3)
@@ -2295,9 +2295,9 @@
"reload_completed
&& !TARGET_WINDOWED_ABI && SIBLING_CALL_P (insn)
&& ! call_used_or_fixed_reg_p (REGNO (operands[0]))"
- [(set (reg:SI A10_REG)
+ [(set (reg:SI A11_REG)
(match_dup 0))
- (call (mem:SI (reg:SI A10_REG))
+ (call (mem:SI (reg:SI A11_REG))
(match_dup 1))])
(define_expand "sibcall_value"
@@ -2328,10 +2328,10 @@
"reload_completed
&& !TARGET_WINDOWED_ABI && SIBLING_CALL_P (insn)
&& ! call_used_or_fixed_reg_p (REGNO (operands[1]))"
- [(set (reg:SI A10_REG)
+ [(set (reg:SI A11_REG)
(match_dup 1))
(set (match_dup 0)
- (call (mem:SI (reg:SI A10_REG))
+ (call (mem:SI (reg:SI A11_REG))
(match_dup 2)))])
(define_insn "entry"
diff --git a/gcc/configure b/gcc/configure
index 7eb9479..05efa5b 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -28838,6 +28838,40 @@ $as_echo "#define HAVE_AS_EXPLICIT_RELOCS 1" >>confdefs.h
fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for eh_frame pcrel encoding support" >&5
+$as_echo_n "checking assembler for eh_frame pcrel encoding support... " >&6; }
+if ${gcc_cv_as_loongarch_eh_frame_pcrel_encoding_support+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ gcc_cv_as_loongarch_eh_frame_pcrel_encoding_support=no
+ if test x$gcc_cv_as != x; then
+ $as_echo '.cfi_startproc
+ .cfi_personality 0x9b,a
+ .cfi_lsda 0x1b,b
+ .cfi_endproc' > 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
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }
+ then
+ gcc_cv_as_loongarch_eh_frame_pcrel_encoding_support=yes
+ else
+ echo "configure: failed program was" >&5
+ cat conftest.s >&5
+ fi
+ rm -f conftest.o conftest.s
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_loongarch_eh_frame_pcrel_encoding_support" >&5
+$as_echo "$gcc_cv_as_loongarch_eh_frame_pcrel_encoding_support" >&6; }
+if test $gcc_cv_as_loongarch_eh_frame_pcrel_encoding_support = yes; then
+
+$as_echo "#define HAVE_AS_EH_FRAME_PCREL_ENCODING_SUPPORT 1" >>confdefs.h
+
+fi
+
;;
s390*-*-*)
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for .gnu_attribute support" >&5
diff --git a/gcc/configure.ac b/gcc/configure.ac
index e5f708c..f70b6c2 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -5302,6 +5302,14 @@ x:
[a:pcalau12i $t0,%pc_hi20(a)],,
[AC_DEFINE(HAVE_AS_EXPLICIT_RELOCS, 1,
[Define if your assembler supports explicit relocation.])])
+ gcc_GAS_CHECK_FEATURE([eh_frame pcrel encoding support],
+ gcc_cv_as_loongarch_eh_frame_pcrel_encoding_support,,
+ [.cfi_startproc
+ .cfi_personality 0x9b,a
+ .cfi_lsda 0x1b,b
+ .cfi_endproc],,
+ [AC_DEFINE(HAVE_AS_EH_FRAME_PCREL_ENCODING_SUPPORT, 1,
+ [Define if your assembler supports eh_frame pcrel encoding.])])
;;
s390*-*-*)
gcc_GAS_CHECK_FEATURE([.gnu_attribute support],
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index a5ed51a..4d7761c2 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,22 @@
+2022-07-31 Lewis Hyatt <lhyatt@gmail.com>
+
+ PR c++/66290
+ * parser.cc (cp_lexer_new_main): Rename global done_lexing to
+ override_libcpp_locations.
+
+2022-07-31 Jason Merrill <jason@redhat.com>
+
+ PR c++/106369
+ * constexpr.cc (reduced_constant_expression_p): Return false
+ if a CONSTRUCTOR initializes an empty field.
+
+2022-07-29 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/106448
+ * parser.cc (cp_parser_omp_atomic): For simple cast followed by
+ CPP_QUERY token, don't try cp_parser_binary_operation if compare
+ is true.
+
2022-07-26 Marek Polacek <polacek@redhat.com>
PR c++/106311
diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc
index 5f7fc6f..5e0d339 100644
--- a/gcc/cp/constexpr.cc
+++ b/gcc/cp/constexpr.cc
@@ -3081,7 +3081,13 @@ reduced_constant_expression_p (tree t)
element. */
if (!reduced_constant_expression_p (e.value))
return false;
- /* Empty class field may or may not have an initializer. */
+ /* We want to remove initializers for empty fields in a struct to
+ avoid confusing output_constructor. */
+ if (is_empty_field (e.index)
+ && TREE_CODE (TREE_TYPE (t)) == RECORD_TYPE)
+ return false;
+ /* Check for non-empty fields between initialized fields when
+ CONSTRUCTOR_NO_CLEARING. */
for (; field && e.index != field;
field = next_subobject_field (DECL_CHAIN (field)))
if (!is_really_empty_class (TREE_TYPE (field),
diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc
index 4f67441..33926d2 100644
--- a/gcc/cp/parser.cc
+++ b/gcc/cp/parser.cc
@@ -755,7 +755,7 @@ cp_lexer_new_main (void)
/* Subsequent preprocessor diagnostics should use compiler
diagnostic functions to get the compiler source location. */
- done_lexing = true;
+ override_libcpp_locations = true;
maybe_check_all_macros (parse_in);
@@ -41535,7 +41535,9 @@ restart:
goto saw_error;
}
token = cp_lexer_peek_token (parser->lexer);
- if (token->type != CPP_SEMICOLON && !cp_tree_equal (lhs, rhs1))
+ if (token->type != CPP_SEMICOLON
+ && (!compare || token->type != CPP_QUERY)
+ && !cp_tree_equal (lhs, rhs1))
{
cp_parser_abort_tentative_parse (parser);
cp_parser_parse_tentatively (parser);
diff --git a/gcc/doc/implement-c.texi b/gcc/doc/implement-c.texi
index 93b8dda..c2088ff 100644
--- a/gcc/doc/implement-c.texi
+++ b/gcc/doc/implement-c.texi
@@ -339,7 +339,8 @@ This is subject to change.
7.6.1).}
This pragma is not implemented, but the default is to ``off'' unless
-@option{-frounding-math} is used in which case it is ``on''.
+@option{-frounding-math} is used and @option{-fno-trapping-math} is not
+in which case it is ``on''.
@item
@cite{Additional floating-point exceptions, rounding modes, environments,
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 21260ee..696ac2f 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -422,6 +422,7 @@ Objective-C and Objective-C++ Dialects}.
-Wno-analyzer-null-dereference @gol
-Wno-analyzer-possible-null-argument @gol
-Wno-analyzer-possible-null-dereference @gol
+-Wno-analyzer-putenv-of-auto-var @gol
-Wno-analyzer-shift-count-negative @gol
-Wno-analyzer-shift-count-overflow @gol
-Wno-analyzer-stale-setjmp-buffer @gol
@@ -5008,7 +5009,7 @@ the vertical bars and the ``char *'' and ``long int'' text).
@opindex fno-diagnostics-show-cwe
@opindex fdiagnostics-show-cwe
Diagnostic messages can optionally have an associated
-@url{https://cwe.mitre.org/index.html, CWE} identifier.
+@uref{https://cwe.mitre.org/index.html, CWE} identifier.
GCC itself only provides such metadata for some of the @option{-fanalyzer}
diagnostics. GCC plugins may also provide diagnostics with such metadata.
By default, if this information is present, it will be printed with
@@ -9724,6 +9725,7 @@ Enabling this option effectively enables the following warnings:
-Wanalyzer-null-dereference @gol
-Wanalyzer-possible-null-argument @gol
-Wanalyzer-possible-null-dereference @gol
+-Wanalyzer-putenv-of-auto-var @gol
-Wanalyzer-shift-count-negative @gol
-Wanalyzer-shift-count-overflow @gol
-Wanalyzer-stale-setjmp-buffer @gol
@@ -9771,7 +9773,7 @@ This diagnostic warns for paths through the code in which a pointer to
a buffer is assigned to point at a buffer with a size that is not a
multiple of @code{sizeof (*pointer)}.
-See @url{https://cwe.mitre.org/data/definitions/131.html, CWE-131: Incorrect Calculation of Buffer Size}.
+See @uref{https://cwe.mitre.org/data/definitions/131.html, CWE-131: Incorrect Calculation of Buffer Size}.
@item -Wno-analyzer-double-fclose
@opindex Wanalyzer-double-fclose
@@ -9782,6 +9784,8 @@ This warning requires @option{-fanalyzer}, which enables it; use
This diagnostic warns for paths through the code in which a @code{FILE *}
can have @code{fclose} called on it more than once.
+See @uref{https://cwe.mitre.org/data/definitions/1341.html, CWE-1341: Multiple Releases of Same Resource or Handle}.
+
@item -Wno-analyzer-double-free
@opindex Wanalyzer-double-free
@opindex Wno-analyzer-double-free
@@ -9792,6 +9796,8 @@ This diagnostic warns for paths through the code in which a pointer
can have a deallocator called on it more than once, either @code{free},
or a deallocator referenced by attribute @code{malloc}.
+See @uref{https://cwe.mitre.org/data/definitions/415.html, CWE-415: Double Free}.
+
@item -Wno-analyzer-exposure-through-output-file
@opindex Wanalyzer-exposure-through-output-file
@opindex Wno-analyzer-exposure-through-output-file
@@ -9803,6 +9809,8 @@ This diagnostic warns for paths through the code in which a
security-sensitive value is written to an output file
(such as writing a password to a log file).
+See @uref{https://cwe.mitre.org/data/definitions/532.html, CWE-532: Information Exposure Through Log Files}.
+
@item -Wno-analyzer-fd-access-mode-mismatch
@opindex Wanalyzer-fd-access-mode-mismatch
@opindex Wno-analyzer-fd-access-mode-mismatch
@@ -9829,6 +9837,8 @@ to disable it.
This diagnostic warns for paths through code in which a
file descriptor can be closed more than once.
+See @uref{https://cwe.mitre.org/data/definitions/1341.html, CWE-1341: Multiple Releases of Same Resource or Handle}.
+
@item -Wno-analyzer-fd-leak
@opindex Wanalyzer-fd-leak
@opindex Wno-analyzer-fd-leak
@@ -9839,6 +9849,8 @@ to disable it.
This diagnostic warns for paths through code in which an
open file descriptor is leaked.
+See @uref{https://cwe.mitre.org/data/definitions/775.html, CWE-775: Missing Release of File Descriptor or Handle after Effective Lifetime}.
+
@item -Wno-analyzer-fd-use-after-close
@opindex Wanalyzer-fd-use-after-close
@opindex Wno-analyzer-fd-use-after-close
@@ -9879,6 +9891,8 @@ to disable it.
This diagnostic warns for paths through the code in which a
@code{<stdio.h>} @code{FILE *} stream object is leaked.
+See @uref{https://cwe.mitre.org/data/definitions/775.html, CWE-775: Missing Release of File Descriptor or Handle after Effective Lifetime}.
+
@item -Wno-analyzer-free-of-non-heap
@opindex Wanalyzer-free-of-non-heap
@opindex Wno-analyzer-free-of-non-heap
@@ -9889,6 +9903,8 @@ to disable it.
This diagnostic warns for paths through the code in which @code{free}
is called on a non-heap pointer (e.g. an on-stack buffer, or a global).
+See @uref{https://cwe.mitre.org/data/definitions/590.html, CWE-590: Free of Memory not on the Heap}.
+
@item -Wno-analyzer-malloc-leak
@opindex Wanalyzer-malloc-leak
@opindex Wno-analyzer-malloc-leak
@@ -9900,6 +9916,8 @@ This diagnostic warns for paths through the code in which a
pointer allocated via an allocator is leaked: either @code{malloc},
or a function marked with attribute @code{malloc}.
+See @uref{https://cwe.mitre.org/data/definitions/401.html, CWE-401: Missing Release of Memory after Effective Lifetime}.
+
@item -Wno-analyzer-mismatching-deallocation
@opindex Wanalyzer-mismatching-deallocation
@opindex Wno-analyzer-mismatching-deallocation
@@ -9914,6 +9932,8 @@ will warn about mismatches between @code{free}, scalar @code{delete}
and vector @code{delete[]}, and those marked as allocator/deallocator
pairs using attribute @code{malloc}.
+See @uref{https://cwe.mitre.org/data/definitions/762.html, CWE-762: Mismatched Memory Management Routines}.
+
@item -Wno-analyzer-possible-null-argument
@opindex Wanalyzer-possible-null-argument
@opindex Wno-analyzer-possible-null-argument
@@ -9925,6 +9945,8 @@ possibly-NULL value is passed to a function argument marked
with @code{__attribute__((nonnull))} as requiring a non-NULL
value.
+See @uref{https://cwe.mitre.org/data/definitions/690.html, CWE-690: Unchecked Return Value to NULL Pointer Dereference}.
+
@item -Wno-analyzer-possible-null-dereference
@opindex Wanalyzer-possible-null-dereference
@opindex Wno-analyzer-possible-null-dereference
@@ -9934,6 +9956,8 @@ This warning requires @option{-fanalyzer}, which enables it; use
This diagnostic warns for paths through the code in which a
possibly-NULL value is dereferenced.
+See @uref{https://cwe.mitre.org/data/definitions/690.html, CWE-690: Unchecked Return Value to NULL Pointer Dereference}.
+
@item -Wno-analyzer-null-argument
@opindex Wanalyzer-null-argument
@opindex Wno-analyzer-null-argument
@@ -9945,6 +9969,8 @@ value known to be NULL is passed to a function argument marked
with @code{__attribute__((nonnull))} as requiring a non-NULL
value.
+See @uref{https://cwe.mitre.org/data/definitions/476.html, CWE-476: NULL Pointer Dereference}.
+
@item -Wno-analyzer-null-dereference
@opindex Wanalyzer-null-dereference
@opindex Wno-analyzer-null-dereference
@@ -9954,6 +9980,20 @@ This warning requires @option{-fanalyzer}, which enables it; use
This diagnostic warns for paths through the code in which a
value known to be NULL is dereferenced.
+See @uref{https://cwe.mitre.org/data/definitions/476.html, CWE-476: NULL Pointer Dereference}.
+
+@item -Wno-analyzer-putenv-of-auto-var
+@opindex Wanalyzer-putenv-of-auto-var
+@opindex Wno-analyzer-putenv-of-auto-var
+This warning requires @option{-fanalyzer}, which enables it; use
+@option{-Wno-analyzer-possible-null-dereference} to disable it.
+
+This diagnostic warns for paths through the code in which a
+call to @code{putenv} is passed a pointer to an automatic variable
+or an on-stack buffer.
+
+See @uref{https://wiki.sei.cmu.edu/confluence/x/6NYxBQ, POS34-C. Do not call putenv() with a pointer to an automatic variable as the argument}.
+
@item -Wno-analyzer-shift-count-negative
@opindex Wanalyzer-shift-count-negative
@opindex Wno-analyzer-shift-count-negative
@@ -10012,7 +10052,7 @@ of an allocation without being sanitized, so that an attacker could
inject an excessively large allocation and potentially cause a denial
of service attack.
-See @url{https://cwe.mitre.org/data/definitions/789.html, CWE-789: Memory Allocation with Excessive Size Value}.
+See @uref{https://cwe.mitre.org/data/definitions/789.html, CWE-789: Memory Allocation with Excessive Size Value}.
@item -Wno-analyzer-tainted-array-index
@opindex Wanalyzer-tainted-array-index
@@ -10026,7 +10066,7 @@ that could be under an attacker's control is used as the index
of an array access without being sanitized, so that an attacker
could inject an out-of-bounds access.
-See @url{https://cwe.mitre.org/data/definitions/129.html, CWE-129: Improper Validation of Array Index}.
+See @uref{https://cwe.mitre.org/data/definitions/129.html, CWE-129: Improper Validation of Array Index}.
@item -Wno-analyzer-tainted-divisor
@opindex Wanalyzer-tainted-divisor
@@ -10040,6 +10080,8 @@ that could be under an attacker's control is used as the divisor
in a division or modulus operation without being sanitized, so that
an attacker could inject a division-by-zero.
+See @uref{https://cwe.mitre.org/data/definitions/369.html, CWE-369: Divide By Zero}.
+
@item -Wno-analyzer-tainted-offset
@opindex Wanalyzer-tainted-offset
@opindex Wno-analyzer-tainted-offset
@@ -10052,7 +10094,7 @@ that could be under an attacker's control is used as a pointer offset
without being sanitized, so that an attacker could inject an out-of-bounds
access.
-See @url{https://cwe.mitre.org/data/definitions/823.html, CWE-823: Use of Out-of-range Pointer Offset}.
+See @uref{https://cwe.mitre.org/data/definitions/823.html, CWE-823: Use of Out-of-range Pointer Offset}.
@item -Wno-analyzer-tainted-size
@opindex Wanalyzer-tainted-size
@@ -10066,6 +10108,8 @@ that could be under an attacker's control is used as the size of
an operation such as @code{memset} without being sanitized, so that an
attacker could inject an out-of-bounds access.
+See @uref{https://cwe.mitre.org/data/definitions/129.html, CWE-129: Improper Validation of Array Index}.
+
@item -Wno-analyzer-unsafe-call-within-signal-handler
@opindex Wanalyzer-unsafe-call-within-signal-handler
@opindex Wno-analyzer-unsafe-call-within-signal-handler
@@ -10076,6 +10120,8 @@ This diagnostic warns for paths through the code in which a
function known to be async-signal-unsafe (such as @code{fprintf}) is
called from a signal handler.
+See @uref{https://cwe.mitre.org/data/definitions/479.html, CWE-479: Signal Handler Use of a Non-reentrant Function}.
+
@item -Wno-analyzer-use-after-free
@opindex Wanalyzer-use-after-free
@opindex Wno-analyzer-use-after-free
@@ -10086,6 +10132,8 @@ This diagnostic warns for paths through the code in which a
pointer is used after a deallocator is called on it: either @code{free},
or a deallocator referenced by attribute @code{malloc}.
+See @uref{https://cwe.mitre.org/data/definitions/416.html, CWE-416: Use After Free}.
+
@item -Wno-analyzer-use-of-pointer-in-stale-stack-frame
@opindex Wanalyzer-use-of-pointer-in-stale-stack-frame
@opindex Wno-analyzer-use-of-pointer-in-stale-stack-frame
@@ -10108,6 +10156,8 @@ the analyzer detects an attempt to use @code{va_arg} to extract a value
passed to a variadic call, but uses a type that does not match that of
the expression passed to the call.
+See @uref{https://cwe.mitre.org/data/definitions/686.html, CWE-686: Function Call With Incorrect Argument Type}.
+
@item -Wno-analyzer-va-list-exhausted
@opindex Wanalyzer-va-list-exhausted
@opindex Wno-analyzer-va-list-exhausted
@@ -10120,6 +10170,8 @@ the analyzer detects an attempt to use @code{va_arg} to access the next
value passed to a variadic call, but all of the values in the
@code{va_list} have already been consumed.
+See @uref{https://cwe.mitre.org/data/definitions/685.html, CWE-685: Function Call With Incorrect Number of Arguments}.
+
@item -Wno-analyzer-va-list-leak
@opindex Wanalyzer-va-list-leak
@opindex Wno-analyzer-va-list-leak
@@ -10176,6 +10228,8 @@ This warning requires @option{-fanalyzer}, which enables it; use
This diagnostic warns for paths through the code in which an uninitialized
value is used.
+See @uref{https://cwe.mitre.org/data/definitions/457.html, CWE-457: Use of Uninitialized Variable}.
+
@end table
Pertinent parameters for controlling the exploration are:
@@ -13637,6 +13691,11 @@ math functions.
The default is @option{-ftrapping-math}.
+Future versions of GCC may provide finer control of this setting
+using C99's @code{FENV_ACCESS} pragma. This command-line option
+will be used along with @option{-frounding-math} to specify the
+default state for @code{FENV_ACCESS}.
+
@item -frounding-math
@opindex frounding-math
Disable transformations and optimizations that assume default floating-point
@@ -13655,7 +13714,8 @@ This option is experimental and does not currently guarantee to
disable all GCC optimizations that are affected by rounding mode.
Future versions of GCC may provide finer control of this setting
using C99's @code{FENV_ACCESS} pragma. This command-line option
-will be used to specify the default state for @code{FENV_ACCESS}.
+will be used along with @option{-ftrapping-math} to specify the
+default state for @code{FENV_ACCESS}.
@item -fsignaling-nans
@opindex fsignaling-nans
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index acd60ff..74968c9 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,31 @@
+2022-07-31 Harald Anlauf <anlauf@gmx.de>
+ Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/92805
+ * match.cc (gfc_match_small_literal_int): Make gobbling of leading
+ whitespace optional.
+ (gfc_match_name): Likewise.
+ (gfc_match_char): Likewise.
+ * match.h (gfc_match_small_literal_int): Adjust prototype.
+ (gfc_match_name): Likewise.
+ (gfc_match_char): Likewise.
+ * primary.cc (match_kind_param): Match small literal int or name
+ without gobbling whitespace.
+ (get_kind): Do not skip over blanks.
+ (match_string_constant): Likewise.
+
+2022-07-31 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/77652
+ * check.cc (gfc_check_associated): Make the rank check of POINTER
+ vs. TARGET match the allowed forms of pointer assignment for the
+ selected Fortran standard.
+
+2022-07-29 Tobias Burnus <tobias@codesourcery.com>
+
+ * openmp.cc (resolve_omp_clauses): Permit assumed-size arrays
+ in uniform clause.
+
2022-07-26 Harald Anlauf <anlauf@gmx.de>
PR fortran/103504
diff --git a/gcc/fortran/check.cc b/gcc/fortran/check.cc
index 91d87a1..1da0b3c 100644
--- a/gcc/fortran/check.cc
+++ b/gcc/fortran/check.cc
@@ -1502,8 +1502,27 @@ gfc_check_associated (gfc_expr *pointer, gfc_expr *target)
t = false;
/* F2018 C838 explicitly allows an assumed-rank variable as the first
argument of intrinsic inquiry functions. */
- if (pointer->rank != -1 && !rank_check (target, 0, pointer->rank))
- t = false;
+ if (pointer->rank != -1 && pointer->rank != target->rank)
+ {
+ if (pointer->rank == 0 || target->rank == 0)
+ {
+ /* There exists no valid pointer assignment using bounds
+ remapping for scalar => array or array => scalar. */
+ if (!rank_check (target, 0, pointer->rank))
+ t = false;
+ }
+ else if (target->rank != 1)
+ {
+ if (!gfc_notify_std (GFC_STD_F2008, "Rank remapping target is not "
+ "rank 1 at %L", &target->where))
+ t = false;
+ }
+ else if ((gfc_option.allow_std & GFC_STD_F2003) == 0)
+ {
+ if (!rank_check (target, 0, pointer->rank))
+ t = false;
+ }
+ }
if (target->rank > 0 && target->ref)
{
for (i = 0; i < target->rank; i++)
diff --git a/gcc/fortran/match.cc b/gcc/fortran/match.cc
index 1aa3053..8b8b6e7 100644
--- a/gcc/fortran/match.cc
+++ b/gcc/fortran/match.cc
@@ -454,10 +454,11 @@ gfc_match_eos (void)
/* Match a literal integer on the input, setting the value on
MATCH_YES. Literal ints occur in kind-parameters as well as
old-style character length specifications. If cnt is non-NULL it
- will be set to the number of digits. */
+ will be set to the number of digits.
+ When gobble_ws is false, do not skip over leading blanks. */
match
-gfc_match_small_literal_int (int *value, int *cnt)
+gfc_match_small_literal_int (int *value, int *cnt, bool gobble_ws)
{
locus old_loc;
char c;
@@ -466,7 +467,8 @@ gfc_match_small_literal_int (int *value, int *cnt)
old_loc = gfc_current_locus;
*value = -1;
- gfc_gobble_whitespace ();
+ if (gobble_ws)
+ gfc_gobble_whitespace ();
c = gfc_next_ascii_char ();
if (cnt)
*cnt = 0;
@@ -608,17 +610,19 @@ gfc_match_label (void)
/* See if the current input looks like a name of some sort. Modifies
the passed buffer which must be GFC_MAX_SYMBOL_LEN+1 bytes long.
Note that options.cc restricts max_identifier_length to not more
- than GFC_MAX_SYMBOL_LEN. */
+ than GFC_MAX_SYMBOL_LEN.
+ When gobble_ws is false, do not skip over leading blanks. */
match
-gfc_match_name (char *buffer)
+gfc_match_name (char *buffer, bool gobble_ws)
{
locus old_loc;
int i;
char c;
old_loc = gfc_current_locus;
- gfc_gobble_whitespace ();
+ if (gobble_ws)
+ gfc_gobble_whitespace ();
c = gfc_next_ascii_char ();
if (!(ISALPHA (c) || (c == '_' && flag_allow_leading_underscore)))
@@ -1053,15 +1057,17 @@ cleanup:
/* Tries to match the next non-whitespace character on the input.
- This subroutine does not return MATCH_ERROR. */
+ This subroutine does not return MATCH_ERROR.
+ When gobble_ws is false, do not skip over leading blanks. */
match
-gfc_match_char (char c)
+gfc_match_char (char c, bool gobble_ws)
{
locus where;
where = gfc_current_locus;
- gfc_gobble_whitespace ();
+ if (gobble_ws)
+ gfc_gobble_whitespace ();
if (gfc_next_ascii_char () == c)
return MATCH_YES;
diff --git a/gcc/fortran/match.h b/gcc/fortran/match.h
index 495c93e..1f53e0c 100644
--- a/gcc/fortran/match.h
+++ b/gcc/fortran/match.h
@@ -45,14 +45,14 @@ extern gfc_access gfc_typebound_default_access;
match gfc_match_special_char (gfc_char_t *);
match gfc_match_space (void);
match gfc_match_eos (void);
-match gfc_match_small_literal_int (int *, int *);
+match gfc_match_small_literal_int (int *, int *, bool = true);
match gfc_match_st_label (gfc_st_label **);
match gfc_match_small_int (int *);
-match gfc_match_name (char *);
+match gfc_match_name (char *, bool = true);
match gfc_match_symbol (gfc_symbol **, int);
match gfc_match_sym_tree (gfc_symtree **, int);
match gfc_match_intrinsic_op (gfc_intrinsic_op *);
-match gfc_match_char (char);
+match gfc_match_char (char, bool = true);
match gfc_match (const char *, ...);
match gfc_match_iterator (gfc_iterator *, int);
match gfc_match_parens (void);
diff --git a/gcc/fortran/openmp.cc b/gcc/fortran/openmp.cc
index df9cdf4..a7eb6c3 100644
--- a/gcc/fortran/openmp.cc
+++ b/gcc/fortran/openmp.cc
@@ -7386,7 +7386,8 @@ resolve_omp_clauses (gfc_code *code, gfc_omp_clauses *omp_clauses,
|| code->op == EXEC_OACC_PARALLEL
|| code->op == EXEC_OACC_SERIAL))
check_array_not_assumed (n->sym, n->where, name);
- else if (n->sym->as && n->sym->as->type == AS_ASSUMED_SIZE)
+ else if (list != OMP_LIST_UNIFORM
+ && n->sym->as && n->sym->as->type == AS_ASSUMED_SIZE)
gfc_error ("Assumed size array %qs in %s clause at %L",
n->sym->name, name, &n->where);
if (n->sym->attr.in_namelist && !is_reduction)
diff --git a/gcc/fortran/primary.cc b/gcc/fortran/primary.cc
index 3f01f67..19f2e78 100644
--- a/gcc/fortran/primary.cc
+++ b/gcc/fortran/primary.cc
@@ -45,11 +45,11 @@ match_kind_param (int *kind, int *is_iso_c)
*is_iso_c = 0;
- m = gfc_match_small_literal_int (kind, NULL);
+ m = gfc_match_small_literal_int (kind, NULL, false);
if (m != MATCH_NO)
return m;
- m = gfc_match_name (name);
+ m = gfc_match_name (name, false);
if (m != MATCH_YES)
return m;
@@ -95,7 +95,7 @@ get_kind (int *is_iso_c)
*is_iso_c = 0;
- if (gfc_match_char ('_') != MATCH_YES)
+ if (gfc_match_char ('_', false) != MATCH_YES)
return -2;
m = match_kind_param (&kind, is_iso_c);
@@ -1074,17 +1074,9 @@ match_string_constant (gfc_expr **result)
c = gfc_next_char ();
}
- if (c == ' ')
- {
- gfc_gobble_whitespace ();
- c = gfc_next_char ();
- }
-
if (c != '_')
goto no_match;
- gfc_gobble_whitespace ();
-
c = gfc_next_char ();
if (c != '\'' && c != '"')
goto no_match;
diff --git a/gcc/gimple-ssa-warn-restrict.cc b/gcc/gimple-ssa-warn-restrict.cc
index 6b6097a..b7ed15c 100644
--- a/gcc/gimple-ssa-warn-restrict.cc
+++ b/gcc/gimple-ssa-warn-restrict.cc
@@ -430,7 +430,7 @@ builtin_memref::set_base_and_offset (tree expr)
else if (is_gimple_assign (stmt))
{
tree_code code = gimple_assign_rhs_code (stmt);
- if (code == NOP_EXPR)
+ if (CONVERT_EXPR_CODE_P (code))
{
tree rhs = gimple_assign_rhs1 (stmt);
if (POINTER_TYPE_P (TREE_TYPE (rhs)))
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index 2f2fafd..ca79704 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-a62f20ae78ddd41be682dde8cab075ca4f5dbb2a
+d53e8a0e94e34dc609e34dd5e404debda2640cfb
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
diff --git a/gcc/jit/ChangeLog b/gcc/jit/ChangeLog
index 581f682..df8bf40 100644
--- a/gcc/jit/ChangeLog
+++ b/gcc/jit/ChangeLog
@@ -1,3 +1,79 @@
+2022-07-28 David Malcolm <dmalcolm@redhat.com>
+
+ * docs/internals/index.rst: Remove reference to ".c" extensions
+ of source files.
+
+2022-07-28 Martin Liška <mliska@suse.cz>
+
+ * docs/cp/intro/tutorial02.rst:
+ Shorten the assembly example so that there is not slider.
+ * docs/cp/intro/tutorial04.rst: Likewise.
+ * docs/intro/tutorial02.rst: Likewise.
+ * docs/intro/tutorial04.rst: Likewise.
+ * docs/topics/contexts.rst: Likewise.
+
+2022-07-28 marxin <mliska@suse.cz>
+
+ * docs/index.rst: Remove reference to module index
+ as we don't emit any.
+
+2022-07-28 marxin <mliska@suse.cz>
+
+ * docs/cp/intro/tutorial02.rst: Use :expr:`type *` for pointers to a type
+ * docs/cp/topics/asm.rst: Likewise.
+ * docs/cp/topics/contexts.rst: Likewise.
+ * docs/cp/topics/expressions.rst: Likewise.
+ * docs/cp/topics/functions.rst: Likewise.
+ * docs/cp/topics/objects.rst: Likewise.
+ * docs/intro/tutorial02.rst: Likewise.
+ * docs/intro/tutorial03.rst: Likewise.
+ * docs/intro/tutorial04.rst: Likewise.
+ * docs/intro/tutorial05.rst: Likewise.
+ * docs/topics/compilation.rst: Likewise.
+ * docs/topics/contexts.rst: Likewise.
+ * docs/topics/objects.rst: Likewise.
+
+2022-07-28 marxin <mliska@suse.cz>
+
+ * docs/cp/intro/tutorial04.rst: Use list-table.
+ * docs/intro/tutorial04.rst: Likewise.
+ * docs/intro/tutorial05.rst: Likewise.
+ * docs/topics/compilation.rst: Likewise.
+ * docs/topics/expressions.rst: Likewise.
+ * docs/topics/types.rst: Likewise.
+
+2022-07-28 marxin <mliska@suse.cz>
+
+ * docs/cp/topics/expressions.rst: Compact so that the generated
+ output is also more compact.
+
+2022-07-28 marxin <mliska@suse.cz>
+
+ * docs/cp/intro/tutorial02.rst: Use proper reference.
+ * docs/cp/topics/contexts.rst: Likewise.
+ * docs/cp/topics/functions.rst: Put `class` directive before a
+ function as it is not allowed declaring a class in a fn.
+ * docs/cp/topics/types.rst: Add template keyword.
+ * docs/examples/tut04-toyvm/toyvm.c (toyvm_function_compile):
+ Add removed comment used for code snippet ending detection.
+ * docs/intro/tutorial04.rst: Fix to match the real comment.
+
+2022-07-28 marxin <mliska@suse.cz>
+
+ * docs/cp/topics/expressions.rst: Use :expr: for basic types.
+ * docs/topics/compilation.rst: Likewise.
+ * docs/topics/expressions.rst: Likewise.
+ * docs/topics/function-pointers.rst: Likewise.
+
+2022-07-28 marxin <mliska@suse.cz>
+
+ * docs/conf.py: Add needs_sphinx = '3.0' where c:type was added.
+ * docs/index.rst: Remove note about it.
+ * docs/topics/compilation.rst: Use enum directive and reference.
+ * docs/topics/contexts.rst: Likewise.
+ * docs/topics/expressions.rst: Likewise.
+ * docs/topics/functions.rst: Likewise.
+
2022-07-14 Jonathan Wakely <jwakely@redhat.com>
* jit-recording.h (recording::memento): Define copy constructor
diff --git a/gcc/jit/docs/internals/index.rst b/gcc/jit/docs/internals/index.rst
index 9200181..092380c 100644
--- a/gcc/jit/docs/internals/index.rst
+++ b/gcc/jit/docs/internals/index.rst
@@ -291,8 +291,7 @@ For example:
Overview of code structure
--------------------------
-The library is implemented in C++. The source files have the ``.c``
-extension for legacy reasons.
+The library is implemented in C++.
* ``libgccjit.cc`` implements the API entrypoints. It performs error
checking, then calls into classes of the gcc::jit::recording namespace
diff --git a/gcc/omp-expand.cc b/gcc/omp-expand.cc
index 1023c56..936adff 100644
--- a/gcc/omp-expand.cc
+++ b/gcc/omp-expand.cc
@@ -2267,8 +2267,7 @@ expand_omp_for_init_counts (struct omp_for_data *fd, gimple_stmt_iterator *gsi,
else if (POINTER_TYPE_P (itype))
{
gcc_assert (integer_onep (fd->loops[i].m1));
- t = fold_convert (sizetype,
- unshare_expr (fd->loops[i].n1));
+ t = unshare_expr (fd->loops[i].n1);
n1 = fold_build_pointer_plus (vs[i - fd->loops[i].outer], t);
}
else
@@ -2291,8 +2290,7 @@ expand_omp_for_init_counts (struct omp_for_data *fd, gimple_stmt_iterator *gsi,
else if (POINTER_TYPE_P (itype))
{
gcc_assert (integer_onep (fd->loops[i].m2));
- t = fold_convert (sizetype,
- unshare_expr (fd->loops[i].n2));
+ t = unshare_expr (fd->loops[i].n2);
n2 = fold_build_pointer_plus (vs[i - fd->loops[i].outer], t);
}
else
@@ -2353,8 +2351,7 @@ expand_omp_for_init_counts (struct omp_for_data *fd, gimple_stmt_iterator *gsi,
tree step = fold_convert (itype,
unshare_expr (fd->loops[i].step));
if (POINTER_TYPE_P (TREE_TYPE (vs[i])))
- t = fold_build_pointer_plus (vs[i],
- fold_convert (sizetype, step));
+ t = fold_build_pointer_plus (vs[i], step);
else
t = fold_build2 (PLUS_EXPR, itype, vs[i], step);
t = force_gimple_operand_gsi (&gsi2, t, true, NULL_TREE,
@@ -2794,8 +2791,7 @@ expand_omp_for_init_vars (struct omp_for_data *fd, gimple_stmt_iterator *gsi,
else if (POINTER_TYPE_P (itype))
{
gcc_assert (integer_onep (fd->loops[j].m1));
- t = fold_convert (sizetype,
- unshare_expr (fd->loops[j].n1));
+ t = unshare_expr (fd->loops[j].n1);
n1 = fold_build_pointer_plus (vs[j - fd->loops[j].outer], t);
}
else
@@ -2818,8 +2814,7 @@ expand_omp_for_init_vars (struct omp_for_data *fd, gimple_stmt_iterator *gsi,
else if (POINTER_TYPE_P (itype))
{
gcc_assert (integer_onep (fd->loops[j].m2));
- t = fold_convert (sizetype,
- unshare_expr (fd->loops[j].n2));
+ t = unshare_expr (fd->loops[j].n2);
n2 = fold_build_pointer_plus (vs[j - fd->loops[j].outer], t);
}
else
@@ -2895,8 +2890,7 @@ expand_omp_for_init_vars (struct omp_for_data *fd, gimple_stmt_iterator *gsi,
tree step
= fold_convert (itype, unshare_expr (fd->loops[j].step));
if (POINTER_TYPE_P (vtype))
- t = fold_build_pointer_plus (vs[j], fold_convert (sizetype,
- step));
+ t = fold_build_pointer_plus (vs[j], step);
else
t = fold_build2 (PLUS_EXPR, itype, vs[j], step);
}
@@ -2959,8 +2953,7 @@ expand_omp_for_init_vars (struct omp_for_data *fd, gimple_stmt_iterator *gsi,
= fold_convert (itype, unshare_expr (fd->loops[j].step));
t = fold_build2 (MULT_EXPR, itype, t, t2);
if (POINTER_TYPE_P (vtype))
- t = fold_build_pointer_plus (n1,
- fold_convert (sizetype, t));
+ t = fold_build_pointer_plus (n1, t);
else
t = fold_build2 (PLUS_EXPR, itype, n1, t);
}
@@ -2970,8 +2963,7 @@ expand_omp_for_init_vars (struct omp_for_data *fd, gimple_stmt_iterator *gsi,
t = fold_build2 (MULT_EXPR, itype, t,
fold_convert (itype, fd->loops[j].step));
if (POINTER_TYPE_P (vtype))
- t = fold_build_pointer_plus (fd->loops[j].n1,
- fold_convert (sizetype, t));
+ t = fold_build_pointer_plus (fd->loops[j].n1, t);
else
t = fold_build2 (PLUS_EXPR, itype, fd->loops[j].n1, t);
}
@@ -3035,9 +3027,8 @@ expand_omp_for_init_vars (struct omp_for_data *fd, gimple_stmt_iterator *gsi,
if (POINTER_TYPE_P (itype))
{
gcc_assert (integer_onep (fd->loops[i].m2));
- t = fold_convert (sizetype, unshare_expr (fd->loops[i].n2));
t = fold_build_pointer_plus (fd->loops[i - fd->loops[i].outer].v,
- t);
+ unshare_expr (fd->loops[i].n2));
}
else
{
@@ -3130,7 +3121,7 @@ extract_omp_for_update_vars (struct omp_for_data *fd, tree *nonrect_bounds,
{
if (POINTER_TYPE_P (TREE_TYPE (l->v)))
t = fold_build_pointer_plus (fd->loops[i + 1 - l->outer].v,
- fold_convert (sizetype, t));
+ t);
else
{
tree t2
@@ -3186,9 +3177,7 @@ extract_omp_for_update_vars (struct omp_for_data *fd, tree *nonrect_bounds,
if (l->m1)
{
if (POINTER_TYPE_P (TREE_TYPE (l->v)))
- t = fold_build_pointer_plus (fd->loops[i].v,
- fold_convert (sizetype,
- l->n1));
+ t = fold_build_pointer_plus (fd->loops[i].v, l->n1);
else
{
t = fold_build2 (MULT_EXPR, TREE_TYPE (l->m1), l->m1,
@@ -3210,9 +3199,7 @@ extract_omp_for_update_vars (struct omp_for_data *fd, tree *nonrect_bounds,
if (l->m2)
{
if (POINTER_TYPE_P (TREE_TYPE (l->v)))
- t = fold_build_pointer_plus (fd->loops[i].v,
- fold_convert (sizetype,
- l->n2));
+ t = fold_build_pointer_plus (fd->loops[i].v, l->n2);
else
{
t = fold_build2 (MULT_EXPR, TREE_TYPE (l->m2), l->m2,
@@ -3640,9 +3627,7 @@ expand_omp_for_ordered_loops (struct omp_for_data *fd, tree *counts,
{
gsi = gsi_last_bb (cont_bb);
if (POINTER_TYPE_P (type))
- t = fold_build_pointer_plus (fd->loops[i].v,
- fold_convert (sizetype,
- fd->loops[i].step));
+ t = fold_build_pointer_plus (fd->loops[i].v, fd->loops[i].step);
else
t = fold_build2 (PLUS_EXPR, type, fd->loops[i].v,
fold_convert (type, fd->loops[i].step));
@@ -6669,10 +6654,7 @@ expand_omp_simd (struct omp_region *region, struct omp_for_data *fd)
{
i = fd->collapse - 1;
if (POINTER_TYPE_P (TREE_TYPE (fd->loops[i].v)))
- {
- t = fold_convert (sizetype, fd->loops[i].step);
- t = fold_build_pointer_plus (fd->loops[i].v, t);
- }
+ t = fold_build_pointer_plus (fd->loops[i].v, fd->loops[i].step);
else
{
t = fold_convert (TREE_TYPE (fd->loops[i].v),
@@ -6714,7 +6696,7 @@ expand_omp_simd (struct omp_region *region, struct omp_for_data *fd)
if (fd->loops[i].m2)
t = n2v = create_tmp_var (itype);
else
- t = fold_convert (itype, fd->loops[i].n2);
+ t = fold_convert (itype, unshare_expr (fd->loops[i].n2));
t = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE,
false, GSI_CONTINUE_LINKING);
tree v = fd->loops[i].v;
@@ -6728,7 +6710,7 @@ expand_omp_simd (struct omp_region *region, struct omp_for_data *fd)
if (fd->collapse > 1 && !broken_loop)
t = n2var;
else
- t = fold_convert (type, n2);
+ t = fold_convert (type, unshare_expr (n2));
t = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE,
false, GSI_CONTINUE_LINKING);
tree v = fd->loop.v;
@@ -6820,10 +6802,7 @@ expand_omp_simd (struct omp_region *region, struct omp_for_data *fd)
e = EDGE_SUCC (last_bb, 1);
basic_block bb = split_edge (e);
if (POINTER_TYPE_P (TREE_TYPE (fd->loops[i].v)))
- {
- t = fold_convert (sizetype, fd->loops[i].step);
- t = fold_build_pointer_plus (fd->loops[i].v, t);
- }
+ t = fold_build_pointer_plus (fd->loops[i].v, fd->loops[i].step);
else
{
t = fold_convert (TREE_TYPE (fd->loops[i].v),
@@ -6840,7 +6819,7 @@ expand_omp_simd (struct omp_region *region, struct omp_for_data *fd)
if (fd->loops[i].m2)
t = nextn2v = create_tmp_var (itype);
else
- t = fold_convert (itype, fd->loops[i].n2);
+ t = fold_convert (itype, unshare_expr (fd->loops[i].n2));
t = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE,
false, GSI_CONTINUE_LINKING);
tree v = fd->loops[i].v;
@@ -6870,17 +6849,25 @@ expand_omp_simd (struct omp_region *region, struct omp_for_data *fd)
ne->probability = e->probability.invert ();
gsi = gsi_after_labels (init_bb);
- t = fold_convert (TREE_TYPE (fd->loops[i + 1].v),
- fd->loops[i + 1].n1);
if (fd->loops[i + 1].m1)
{
- tree t2 = fold_convert (TREE_TYPE (t),
+ tree t2 = fold_convert (TREE_TYPE (fd->loops[i + 1].v),
fd->loops[i + 1
- fd->loops[i + 1].outer].v);
- tree t3 = fold_convert (TREE_TYPE (t), fd->loops[i + 1].m1);
- t2 = fold_build2 (MULT_EXPR, TREE_TYPE (t), t2, t3);
- t = fold_build2 (PLUS_EXPR, TREE_TYPE (t), t, t2);
+ if (POINTER_TYPE_P (TREE_TYPE (t2)))
+ t = fold_build_pointer_plus (t2, fd->loops[i + 1].n1);
+ else
+ {
+ t = fold_convert (TREE_TYPE (fd->loops[i + 1].v),
+ fd->loops[i + 1].n1);
+ tree t3 = fold_convert (TREE_TYPE (t), fd->loops[i + 1].m1);
+ t2 = fold_build2 (MULT_EXPR, TREE_TYPE (t), t2, t3);
+ t = fold_build2 (PLUS_EXPR, TREE_TYPE (t), t, t2);
+ }
}
+ else
+ t = fold_convert (TREE_TYPE (fd->loops[i + 1].v),
+ fd->loops[i + 1].n1);
expand_omp_build_assign (&gsi, fd->loops[i + 1].v, t);
if (fd->loops[i + 1].m2)
{
@@ -6889,14 +6876,19 @@ expand_omp_simd (struct omp_region *region, struct omp_for_data *fd)
gcc_assert (n2v == NULL_TREE);
n2v = create_tmp_var (TREE_TYPE (fd->loops[i + 1].v));
}
- t = fold_convert (TREE_TYPE (fd->loops[i + 1].v),
- fd->loops[i + 1].n2);
- tree t2 = fold_convert (TREE_TYPE (t),
+ tree t2 = fold_convert (TREE_TYPE (fd->loops[i + 1].v),
fd->loops[i + 1
- fd->loops[i + 1].outer].v);
- tree t3 = fold_convert (TREE_TYPE (t), fd->loops[i + 1].m2);
- t2 = fold_build2 (MULT_EXPR, TREE_TYPE (t), t2, t3);
- t = fold_build2 (PLUS_EXPR, TREE_TYPE (t), t, t2);
+ if (POINTER_TYPE_P (TREE_TYPE (t2)))
+ t = fold_build_pointer_plus (t2, fd->loops[i + 1].n2);
+ else
+ {
+ t = fold_convert (TREE_TYPE (fd->loops[i + 1].v),
+ fd->loops[i + 1].n2);
+ tree t3 = fold_convert (TREE_TYPE (t), fd->loops[i + 1].m2);
+ t2 = fold_build2 (MULT_EXPR, TREE_TYPE (t), t2, t3);
+ t = fold_build2 (PLUS_EXPR, TREE_TYPE (t), t, t2);
+ }
expand_omp_build_assign (&gsi, n2v, t);
}
if (i + 2 == fd->collapse && n2var)
@@ -6912,17 +6904,25 @@ expand_omp_simd (struct omp_region *region, struct omp_for_data *fd)
tree t2 = fold_build2 (MINUS_EXPR, type, n2, fd->loop.v);
if (fd->loops[i + 1].m1 || fd->loops[i + 1].m2)
{
+ tree itype = TREE_TYPE (fd->loops[i].v);
+ if (POINTER_TYPE_P (itype))
+ itype = signed_type_for (itype);
t = build_int_cst (itype, (fd->loops[i + 1].cond_code
== LT_EXPR ? -1 : 1));
t = fold_build2 (PLUS_EXPR, itype,
fold_convert (itype,
fd->loops[i + 1].step), t);
- if (fd->loops[i + 1].m2)
- t = fold_build2 (PLUS_EXPR, itype, t, n2v);
- else
+ if (fd->loops[i + 1].m2 == NULL_TREE)
t = fold_build2 (PLUS_EXPR, itype, t,
fold_convert (itype,
fd->loops[i + 1].n2));
+ else if (POINTER_TYPE_P (TREE_TYPE (n2v)))
+ {
+ t = fold_build_pointer_plus (n2v, t);
+ t = fold_convert (itype, t);
+ }
+ else
+ t = fold_build2 (PLUS_EXPR, itype, t, n2v);
t = fold_build2 (MINUS_EXPR, itype, t,
fold_convert (itype, fd->loops[i + 1].v));
tree step = fold_convert (itype, fd->loops[i + 1].step);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 50686c7..781bba7 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,71 @@
+2022-07-31 Roger Sayle <roger@nextmovesoftware.com>
+ H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/106450
+ * gcc.target/i386/pr106450.c: New test case.
+
+2022-07-31 Harald Anlauf <anlauf@gmx.de>
+ Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/92805
+ * gfortran.dg/literal_constants.f: New test.
+ * gfortran.dg/literal_constants.f90: New test.
+
+2022-07-31 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/77652
+ * gfortran.dg/associated_target_9a.f90: New test.
+ * gfortran.dg/associated_target_9b.f90: New test.
+
+2022-07-31 Lewis Hyatt <lhyatt@gmail.com>
+
+ PR c++/66290
+ * c-c++-common/pragma-diag-15.c: Remove xfail for C++.
+
+2022-07-31 Jason Merrill <jason@redhat.com>
+
+ PR c++/106369
+ * g++.dg/cpp1z/constexpr-lambda27.C: New test.
+
+2022-07-29 Tobias Burnus <tobias@codesourcery.com>
+
+ * gfortran.dg/gomp/declare-simd-3.f90: New test.
+
+2022-07-29 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/106422
+ * gcc.dg/torture/pr106422.c: New testcase.
+
+2022-07-29 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/106448
+ * c-c++-common/gomp/atomic-32.c: New test.
+
+2022-07-28 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/105893
+ * gcc.dg/analyzer/putenv-1.c: New test.
+
+2022-07-28 Maciej W. Rozycki <macro@embecosm.com>
+
+ * gcc.target/riscv/fle-ieee.c: New test.
+ * gcc.target/riscv/fle-snan.c: New test.
+ * gcc.target/riscv/fle.c: New test.
+ * gcc.target/riscv/flef-ieee.c: New test.
+ * gcc.target/riscv/flef-snan.c: New test.
+ * gcc.target/riscv/flef.c: New test.
+ * gcc.target/riscv/flt-ieee.c: New test.
+ * gcc.target/riscv/flt-snan.c: New test.
+ * gcc.target/riscv/flt.c: New test.
+ * gcc.target/riscv/fltf-ieee.c: New test.
+ * gcc.target/riscv/fltf-snan.c: New test.
+ * gcc.target/riscv/fltf.c: New test.
+
+2022-07-28 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/106099
+ * gcc.dg/ubsan/pr106099.c: New test.
+
2022-07-27 Lewis Hyatt <lhyatt@gmail.com>
* c-c++-common/pragma-diag-14.c: New test.
diff --git a/gcc/testsuite/c-c++-common/gomp/atomic-32.c b/gcc/testsuite/c-c++-common/gomp/atomic-32.c
new file mode 100644
index 0000000..e39a967
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/atomic-32.c
@@ -0,0 +1,14 @@
+/* PR c++/106448 */
+
+int x, expr;
+
+void
+foo (void)
+{
+ #pragma omp atomic compare
+ x = (expr > x) ? expr : x; /* { dg-error "invalid (form|operator)" } */
+ #pragma omp atomic compare
+ x = (x < expr) ? expr : x; /* { dg-error "invalid (form|operator)" } */
+ #pragma omp atomic compare
+ x = (x == expr) ? expr : x; /* { dg-error "invalid (form|operator)" } */
+}
diff --git a/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda27.C b/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda27.C
new file mode 100644
index 0000000..24e2e9b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda27.C
@@ -0,0 +1,26 @@
+// PR c++/106369
+// { dg-do compile { target c++17 } }
+
+struct A {
+ int a[256];
+ constexpr int &operator[] (int n) noexcept { return a[n]; }
+ constexpr const int &operator[] (int n) const noexcept { return a[n]; }
+};
+struct B {};
+template <typename T>
+struct C {
+ constexpr T &foo (const char x) noexcept { c = T::d[x]; return static_cast<T &>(*this); }
+ int c;
+};
+struct D : public C<D>, public B
+{
+ D () noexcept = default;
+ static constexpr char e[9] { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I' };
+ static constexpr A d = [] () constexpr {
+ A f {};
+ for (int i = 0; i < 9; ++i)
+ f[e[i]] = 1;
+ return f;
+ } ();
+};
+constexpr auto g = D{}.foo ('E');
diff --git a/gcc/testsuite/gcc.dg/analyzer/putenv-1.c b/gcc/testsuite/gcc.dg/analyzer/putenv-1.c
new file mode 100644
index 0000000..4c3f0ae
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/putenv-1.c
@@ -0,0 +1,109 @@
+/* { dg-additional-options "-Wno-analyzer-null-argument" } */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+extern void populate (char *buf);
+
+void test_passthrough (char *s)
+{
+ putenv (s);
+}
+
+void test_str_lit (void)
+{
+ putenv ("NAME=value");
+}
+
+/* glibc allows strings without an equal sign. */
+
+void test_no_eq (void)
+{
+ putenv ("NAME");
+}
+
+void test_empty_string (void)
+{
+ putenv ("");
+}
+
+void test_NULL (void)
+{
+ putenv (NULL); /* possibly -Wanalyzer-null-argument */
+}
+
+void test_auto_buf_name_and_value (const char *name, const char *value)
+{
+ char buf[100]; /* { dg-message "'buf' declared on stack here" } */
+ snprintf (buf, sizeof (buf), "%s=%s", name, value);
+ putenv (buf); /* { dg-warning "'putenv' on a pointer to automatic variable 'buf' \\\[POS34-C\\\]" "warning" } */
+ /* { dg-message "perhaps use 'setenv' rather than 'putenv'" "setenv suggestion" { target *-*-* } .-1 } */
+}
+
+void test_auto_buf_value (const char *value)
+{
+ char buf[100]; /* { dg-message "'buf' declared on stack here" } */
+ snprintf (buf, sizeof (buf), "NAME=%s", value);
+ putenv (buf); /* { dg-warning "'putenv' on a pointer to automatic variable 'buf' \\\[POS34-C\\\]" } */
+}
+
+void test_static_buf (const char *value)
+{
+ static char buf[100];
+ snprintf (buf, sizeof (buf), "NAME=%s", value);
+ putenv (buf);
+}
+
+static char global_buf[1024];
+
+void test_global (const char *value)
+{
+ snprintf (global_buf, sizeof (global_buf), "NAME=%s", value);
+ putenv (global_buf);
+}
+
+void test_alloca (void)
+{
+ char *buf = __builtin_alloca (256); /* { dg-message "region created on stack here" } */
+ populate (buf);
+ putenv (buf); /* { dg-warning "'putenv' on a pointer to an on-stack buffer \\\[POS34-C\\\]" } */
+}
+
+void test_malloc_1 (void)
+{
+ char *buf = malloc (1024);
+ if (!buf)
+ return;
+ populate (buf);
+ putenv (buf);
+}
+
+void test_malloc_2 (void)
+{
+ const char *kvstr = "NAME=value";
+ size_t len = __builtin_strlen (kvstr);
+ char *buf = __builtin_malloc (len + 1);
+ if (!buf)
+ return;
+ __builtin_memcpy (buf, kvstr, len);
+ buf[len] = '\0';
+ putenv (buf); /* { dg-bogus "leak" } */
+}
+
+void test_arr (void)
+{
+ char arr[] = "NAME=VALUE"; /* { dg-message "'arr' declared on stack here" } */
+ putenv (arr); /* { dg-warning "'putenv' on a pointer to automatic variable 'arr' \\\[POS34-C\\\]" } */
+}
+
+static void __attribute__((noinline))
+__analyzer_test_inner (char *kvstr)
+{
+ putenv (kvstr); /* { dg-warning "'putenv' on a pointer to automatic variable 'arr_outer' \\\[POS34-C\\\]" } */
+}
+
+void test_outer (void)
+{
+ char arr_outer[] = "NAME=VALUE"; /* { dg-message "'arr_outer' declared on stack here" } */
+ __analyzer_test_inner (arr_outer);
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr106422.c b/gcc/testsuite/gcc.dg/torture/pr106422.c
new file mode 100644
index 0000000..a2cef1a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr106422.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+
+void vfork() __attribute__((__leaf__));
+void semanage_reload_policy(char *arg, void cb(void))
+{
+ if (!arg)
+ {
+ cb();
+ return;
+ }
+ vfork();
+ if (arg)
+ __builtin_free(arg);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr106450.c b/gcc/testsuite/gcc.target/i386/pr106450.c
new file mode 100644
index 0000000..d16231f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr106450.c
@@ -0,0 +1,14 @@
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-O2 -fsplit-paths" } */
+
+__int128 n;
+
+__attribute__ ((simd)) void
+foo (void)
+{
+ __int128 uninitialized;
+ unsigned __int128 *p = &n;
+
+ n >>= *p ? : 2;
+ n |= uninitialized;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/fle-ieee.c b/gcc/testsuite/gcc.target/riscv/fle-ieee.c
new file mode 100644
index 0000000..af9d503
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/fle-ieee.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target hard_float } */
+/* { dg-options "-fno-finite-math-only -ftrapping-math -fno-signaling-nans" } */
+
+long
+fle (double x, double y)
+{
+ return __builtin_islessequal (x, y);
+}
+
+/* { dg-final { scan-assembler "\tfrflags\t(\[^\n\]*)\n\tfle\\.d\t\[^\n\]*\n\tfsflags\t\\1\n" } } */
+/* { dg-final { scan-assembler-not "snez" } } */
diff --git a/gcc/testsuite/gcc.target/riscv/fle-snan.c b/gcc/testsuite/gcc.target/riscv/fle-snan.c
new file mode 100644
index 0000000..0579d93
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/fle-snan.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target hard_float } */
+/* { dg-options "-fno-finite-math-only -ftrapping-math -fsignaling-nans" } */
+
+long
+fle (double x, double y)
+{
+ return __builtin_islessequal (x, y);
+}
+
+/* { dg-final { scan-assembler "\tfrflags\t(\[^\n\]*)\n\tfle\\.d\t\[^,\]*,(\[^,\]*),(\[^,\]*)\n\tfsflags\t\\1\n\tfeq\\.d\tzero,\\2,\\3\n" } } */
+/* { dg-final { scan-assembler-not "snez" } } */
diff --git a/gcc/testsuite/gcc.target/riscv/fle.c b/gcc/testsuite/gcc.target/riscv/fle.c
new file mode 100644
index 0000000..97c8ab9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/fle.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target hard_float } */
+/* { dg-options "-fno-finite-math-only -fno-trapping-math -fno-signaling-nans" } */
+
+long
+fle (double x, double y)
+{
+ return __builtin_islessequal (x, y);
+}
+
+/* { dg-final { scan-assembler "\tf(?:gt|le)\\.d\t\[^\n\]*\n" } } */
+/* { dg-final { scan-assembler-not "f\[rs\]flags" } } */
diff --git a/gcc/testsuite/gcc.target/riscv/flef-ieee.c b/gcc/testsuite/gcc.target/riscv/flef-ieee.c
new file mode 100644
index 0000000..e2d6b0d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/flef-ieee.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target hard_float } */
+/* { dg-options "-fno-finite-math-only -ftrapping-math -fno-signaling-nans" } */
+
+long
+flef (float x, float y)
+{
+ return __builtin_islessequal (x, y);
+}
+
+/* { dg-final { scan-assembler "\tfrflags\t(\[^\n\]*)\n\tfle\\.s\t\[^\n\]*\n\tfsflags\t\\1\n" } } */
+/* { dg-final { scan-assembler-not "snez" } } */
diff --git a/gcc/testsuite/gcc.target/riscv/flef-snan.c b/gcc/testsuite/gcc.target/riscv/flef-snan.c
new file mode 100644
index 0000000..2d2c5b9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/flef-snan.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target hard_float } */
+/* { dg-options "-fno-finite-math-only -ftrapping-math -fsignaling-nans" } */
+
+long
+flef (float x, float y)
+{
+ return __builtin_islessequal (x, y);
+}
+
+/* { dg-final { scan-assembler "\tfrflags\t(\[^\n\]*)\n\tfle\\.s\t\[^,\]*,(\[^,\]*),(\[^,\]*)\n\tfsflags\t\\1\n\tfeq\\.s\tzero,\\2,\\3\n" } } */
+/* { dg-final { scan-assembler-not "snez" } } */
diff --git a/gcc/testsuite/gcc.target/riscv/flef.c b/gcc/testsuite/gcc.target/riscv/flef.c
new file mode 100644
index 0000000..379f511
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/flef.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target hard_float } */
+/* { dg-options "-fno-finite-math-only -fno-trapping-math -fno-signaling-nans" } */
+
+long
+flef (float x, float y)
+{
+ return __builtin_islessequal (x, y);
+}
+
+/* { dg-final { scan-assembler "\tf(?:gt|le)\\.s\t\[^\n\]*\n" } } */
+/* { dg-final { scan-assembler-not "f\[rs\]flags" } } */
diff --git a/gcc/testsuite/gcc.target/riscv/flt-ieee.c b/gcc/testsuite/gcc.target/riscv/flt-ieee.c
new file mode 100644
index 0000000..7d7aae3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/flt-ieee.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target hard_float } */
+/* { dg-options "-fno-finite-math-only -ftrapping-math -fno-signaling-nans" } */
+
+long
+flt (double x, double y)
+{
+ return __builtin_isless (x, y);
+}
+
+/* { dg-final { scan-assembler "\tfrflags\t(\[^\n\]*)\n\tflt\\.d\t\[^\n\]*\n\tfsflags\t\\1\n" } } */
+/* { dg-final { scan-assembler-not "snez" } } */
diff --git a/gcc/testsuite/gcc.target/riscv/flt-snan.c b/gcc/testsuite/gcc.target/riscv/flt-snan.c
new file mode 100644
index 0000000..ff4c4e9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/flt-snan.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target hard_float } */
+/* { dg-options "-fno-finite-math-only -ftrapping-math -fsignaling-nans" } */
+
+long
+flt (double x, double y)
+{
+ return __builtin_isless (x, y);
+}
+
+/* { dg-final { scan-assembler "\tfrflags\t(\[^\n\]*)\n\tflt\\.d\t\[^,\]*,(\[^,\]*),(\[^,\]*)\n\tfsflags\t\\1\n\tfeq\\.d\tzero,\\2,\\3\n" } } */
+/* { dg-final { scan-assembler-not "snez" } } */
diff --git a/gcc/testsuite/gcc.target/riscv/flt.c b/gcc/testsuite/gcc.target/riscv/flt.c
new file mode 100644
index 0000000..4f5ef1d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/flt.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target hard_float } */
+/* { dg-options "-fno-finite-math-only -fno-trapping-math -fno-signaling-nans" } */
+
+long
+flt (double x, double y)
+{
+ return __builtin_isless (x, y);
+}
+
+/* { dg-final { scan-assembler "\tf(?:ge|lt)\\.d\t\[^\n\]*\n" } } */
+/* { dg-final { scan-assembler-not "f\[rs\]flags" } } */
diff --git a/gcc/testsuite/gcc.target/riscv/fltf-ieee.c b/gcc/testsuite/gcc.target/riscv/fltf-ieee.c
new file mode 100644
index 0000000..ede076e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/fltf-ieee.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target hard_float } */
+/* { dg-options "-fno-finite-math-only -ftrapping-math -fno-signaling-nans" } */
+
+long
+fltf (float x, float y)
+{
+ return __builtin_isless (x, y);
+}
+
+/* { dg-final { scan-assembler "\tfrflags\t(\[^\n\]*)\n\tflt\\.s\t\[^\n\]*\n\tfsflags\t\\1\n" } } */
+/* { dg-final { scan-assembler-not "snez" } } */
diff --git a/gcc/testsuite/gcc.target/riscv/fltf-snan.c b/gcc/testsuite/gcc.target/riscv/fltf-snan.c
new file mode 100644
index 0000000..d29d786
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/fltf-snan.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target hard_float } */
+/* { dg-options "-fno-finite-math-only -ftrapping-math -fsignaling-nans" } */
+
+long
+fltf (float x, float y)
+{
+ return __builtin_isless (x, y);
+}
+
+/* { dg-final { scan-assembler "\tfrflags\t(\[^\n\]*)\n\tflt\\.s\t\[^,\]*,(\[^,\]*),(\[^,\]*)\n\tfsflags\t\\1\n\tfeq\\.s\tzero,\\2,\\3\n" } } */
+/* { dg-final { scan-assembler-not "snez" } } */
diff --git a/gcc/testsuite/gcc.target/riscv/fltf.c b/gcc/testsuite/gcc.target/riscv/fltf.c
new file mode 100644
index 0000000..c9e6a2b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/fltf.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target hard_float } */
+/* { dg-options "-fno-finite-math-only -fno-trapping-math -fno-signaling-nans" } */
+
+long
+fltf (float x, float y)
+{
+ return __builtin_isless (x, y);
+}
+
+/* { dg-final { scan-assembler "\tf(?:ge|lt)\\.s\t\[^\n\]*\n" } } */
+/* { dg-final { scan-assembler-not "f\[rs\]flags" } } */
diff --git a/gcc/testsuite/gfortran.dg/associated_target_9a.f90 b/gcc/testsuite/gfortran.dg/associated_target_9a.f90
new file mode 100644
index 0000000..708645d
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/associated_target_9a.f90
@@ -0,0 +1,27 @@
+! { dg-do run }
+! { dg-options "-std=f2018" }
+! PR fortran/77652 - Invalid rank error in ASSOCIATED when rank is remapped
+! Contributed by Paul Thomas
+
+program p
+ real, dimension(100), target :: array
+ real, dimension(:,:), pointer :: matrix
+ real, dimension(20,5), target :: array2
+ real, dimension(:), pointer :: matrix2
+ matrix(1:20,1:5) => array
+ matrix2(1:100) => array2
+ !
+ ! F2018:16.9.16, ASSOCIATED (POINTER [, TARGET])
+ ! Case(v): If TARGET is present and is an array target, the result is
+ ! true if and only if POINTER is associated with a target that has
+ ! the same shape as TARGET, ...
+ if (associated (matrix, array )) stop 1
+ if (associated (matrix2,array2)) stop 2
+ call check (matrix2, array2)
+contains
+ subroutine check (ptr, tgt)
+ real, pointer :: ptr(..)
+ real, target :: tgt(:,:)
+ if (associated (ptr, tgt)) stop 3
+ end subroutine check
+end
diff --git a/gcc/testsuite/gfortran.dg/associated_target_9b.f90 b/gcc/testsuite/gfortran.dg/associated_target_9b.f90
new file mode 100644
index 0000000..1daa0a7
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/associated_target_9b.f90
@@ -0,0 +1,23 @@
+! { dg-do compile }
+! { dg-options "-std=f2003" }
+! PR fortran/77652 - Invalid rank error in ASSOCIATED when rank is remapped
+! Contributed by Paul Thomas
+
+subroutine s
+ real, dimension(100), target :: array
+ real, dimension(:,:), pointer :: matrix
+ real, dimension(20,5), target :: array2
+ real, dimension(:), pointer :: matrix2
+ real, pointer :: scalar, scalar2
+ scalar => scalar2
+ print *, associated (scalar, scalar2)
+
+ matrix(1:20,1:5) => array ! F2003+
+! matrix2(1:100) => array2 ! F2008+
+ print *, associated (matrix, array ) ! Technically legal F2003
+ print *, associated (matrix2,array2) ! { dg-error "is not rank 1" }
+
+ ! There exists no related valid pointer assignment for these cases:
+ print *, associated (scalar,matrix2) ! { dg-error "must be of rank 0" }
+ print *, associated (matrix2,scalar) ! { dg-error "must be of rank 1" }
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/declare-simd-3.f90 b/gcc/testsuite/gfortran.dg/gomp/declare-simd-3.f90
new file mode 100644
index 0000000..b94587ef
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/declare-simd-3.f90
@@ -0,0 +1,30 @@
+! { dg-do compile }
+
+module m
+ implicit none (type, external)
+contains
+ real function add(x, y, j) result(res)
+ !$omp declare simd(add) uniform(x, y) linear(j : 1) simdlen(4)
+ integer, value :: j
+ real, intent(in) :: x(*), y(*)
+ res = x(j) + y(j)
+ end function
+end module m
+
+program main
+ use m
+ implicit none (type, external)
+ real, allocatable :: A(:), B(:), C(:)
+ integer :: i, N
+ N = 128
+ A = [(3*i, i = 1, N)]
+ B = [(7*i, i = 1, N)]
+ allocate (C(N))
+
+ !$omp simd
+ do i = 1, N
+ C(i) = add(A, B, i)
+ end do
+
+ if (any (C /= [(10*i, i = 1, N)])) error stop
+end program main
diff --git a/gcc/testsuite/gfortran.dg/literal_constants.f b/gcc/testsuite/gfortran.dg/literal_constants.f
new file mode 100644
index 0000000..4d1f1b7
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/literal_constants.f
@@ -0,0 +1,20 @@
+! { dg-do compile }
+! { dg-options "-ffixed-form" }
+! PR fortran/92805 - blanks within literal constants in fixed-form mode
+
+ implicit none
+ integer, parameter :: ck = kind ("a") ! default character kind
+ integer, parameter :: rk = kind (1.0) ! default real kind
+ print *, 1_"abc"
+ print *, 1 _"abc"
+ print *, 1_ "abc"
+ print *, ck_"a"
+ print *, ck _"ab"
+ print *, ck_ "ab"
+ print *, 3.1415_4
+ print *, 3.1415 _4
+ print *, 3.1415_ 4
+ print *, 3.1415_rk
+ print *, 3.1415 _rk
+ print *, 3.1415_ rk
+ end
diff --git a/gcc/testsuite/gfortran.dg/literal_constants.f90 b/gcc/testsuite/gfortran.dg/literal_constants.f90
new file mode 100644
index 0000000..f8908f9
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/literal_constants.f90
@@ -0,0 +1,24 @@
+! { dg-do compile }
+! { dg-options "-ffree-form" }
+! PR fortran/92805 - blanks within literal constants in free-form mode
+
+ implicit none
+ integer, parameter :: ck = kind ("a") ! default character kind
+ integer, parameter :: rk = kind (1.0) ! default real kind
+ print *, 1_"abc"
+ print *, 1 _"abc" ! { dg-error "Syntax error" }
+ print *, 1_ "abc" ! { dg-error "Missing kind-parameter" }
+ print *, 1 _ "abc" ! { dg-error "Syntax error" }
+ print *, ck_"a"
+ print *, ck _"ab" ! { dg-error "Syntax error" }
+ print *, ck_ "ab" ! { dg-error "Syntax error" }
+ print *, ck _ "ab" ! { dg-error "Syntax error" }
+ print *, 3.1415_4
+ print *, 3.1415 _4 ! { dg-error "Syntax error" }
+ print *, 3.1415_ 4 ! { dg-error "Missing kind-parameter" }
+ print *, 3.1415 _ 4 ! { dg-error "Syntax error" }
+ print *, 3.1415_rk
+ print *, 3.1415 _rk ! { dg-error "Syntax error" }
+ print *, 3.1415_ rk ! { dg-error "Missing kind-parameter" }
+ print *, 3.141 _ rk ! { dg-error "Syntax error" }
+ end
diff --git a/gcc/tree-ssa-threadbackward.cc b/gcc/tree-ssa-threadbackward.cc
index 3519aca..90f5331 100644
--- a/gcc/tree-ssa-threadbackward.cc
+++ b/gcc/tree-ssa-threadbackward.cc
@@ -777,6 +777,15 @@ back_threader_profitability::profitable_path_p (const vec<basic_block> &m_path,
"exceeds PARAM_MAX_FSM_THREAD_PATH_INSNS.\n");
return false;
}
+ edge entry = find_edge (m_path[m_path.length () - 1],
+ m_path[m_path.length () - 2]);
+ if (probably_never_executed_edge_p (cfun, entry))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, " FAIL: Jump-thread path not considered: "
+ "path entry is probably never executed.\n");
+ return false;
+ }
}
else if (!m_speed_p && n_insns > 1)
{
diff --git a/gcc/tree-ssa-threadupdate.cc b/gcc/tree-ssa-threadupdate.cc
index f901c77..0f2b319 100644
--- a/gcc/tree-ssa-threadupdate.cc
+++ b/gcc/tree-ssa-threadupdate.cc
@@ -2678,7 +2678,9 @@ fwd_jt_path_registry::update_cfg (bool may_peel_loop_headers)
for (j = 0; j < path->length (); j++)
{
edge e = (*path)[j]->e;
- if (m_removed_edges->find_slot (e, NO_INSERT))
+ if (m_removed_edges->find_slot (e, NO_INSERT)
+ || ((*path)[j]->type == EDGE_COPY_SRC_BLOCK
+ && !can_duplicate_block_p (e->src)))
break;
}
diff --git a/gcc/tree-vect-patterns.cc b/gcc/tree-vect-patterns.cc
index dfbfb71..09574bb 100644
--- a/gcc/tree-vect-patterns.cc
+++ b/gcc/tree-vect-patterns.cc
@@ -4509,10 +4509,8 @@ vect_recog_bool_pattern (vec_info *vinfo,
&& STMT_VINFO_DATA_REF (stmt_vinfo))
{
stmt_vec_info pattern_stmt_info;
- tree nunits_vectype;
- if (!vect_get_vector_types_for_stmt (vinfo, stmt_vinfo, &vectype,
- &nunits_vectype)
- || !VECTOR_MODE_P (TYPE_MODE (vectype)))
+ vectype = get_vectype_for_scalar_type (vinfo, TREE_TYPE (lhs));
+ if (!vectype || !VECTOR_MODE_P (TYPE_MODE (vectype)))
return NULL;
if (check_bool_pattern (var, vinfo, bool_stmts))
diff --git a/gcc/tree.cc b/gcc/tree.cc
index 84000dd..fed1434 100644
--- a/gcc/tree.cc
+++ b/gcc/tree.cc
@@ -12778,6 +12778,10 @@ array_at_struct_end_p (tree ref)
&& DECL_SIZE_UNIT (ref)
&& TREE_CODE (DECL_SIZE_UNIT (ref)) == INTEGER_CST)
{
+ /* If the object itself is the array it is not at struct end. */
+ if (DECL_P (ref_to_array))
+ return false;
+
/* Check whether the array domain covers all of the available
padding. */
poly_int64 offset;