[gcc r15-7474] sarif-replay: fix off-by-one in handling of "endColumn" (§3.30.8) [PR118792]

2025-02-11 Thread David Malcolm via Gcc-cvs
https://gcc.gnu.org/g:e8c5013b6b7820d77edc45d04e634d49b20c05ce

commit r15-7474-ge8c5013b6b7820d77edc45d04e634d49b20c05ce
Author: David Malcolm 
Date:   Tue Feb 11 08:54:15 2025 -0500

sarif-replay: fix off-by-one in handling of "endColumn" (§3.30.8) [PR118792]

gcc/ChangeLog:
PR sarif-replay/118792
* libsarifreplay.cc (sarif_replayer::handle_region_object): Fix
off-by-one in handling of endColumn property so that the code
matches the comment and the SARIF spec (§3.30.8).

gcc/testsuite/ChangeLog:
PR sarif-replay/118792
* sarif-replay.dg/2.1.0-valid/error-with-note.sarif: Update
expected output to reflect fix to off-by-one error in handling of
"endColumn" property.
* sarif-replay.dg/2.1.0-valid/malloc-vs-local-4.c.sarif: Likewise.
* sarif-replay.dg/2.1.0-valid/signal-1.c.moved.sarif: Likewise.
* sarif-replay.dg/2.1.0-valid/signal-1.c.sarif: Likewise.

Signed-off-by: David Malcolm 

Diff:
---
 gcc/libsarifreplay.cc  |  2 +-
 .../2.1.0-valid/error-with-note.sarif  |  4 ++--
 .../2.1.0-valid/malloc-vs-local-4.c.sarif  | 24 +++---
 .../2.1.0-valid/signal-1.c.moved.sarif | 14 ++---
 .../sarif-replay.dg/2.1.0-valid/signal-1.c.sarif   | 14 ++---
 5 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/gcc/libsarifreplay.cc b/gcc/libsarifreplay.cc
index 61d9565588ed..71f807979261 100644
--- a/gcc/libsarifreplay.cc
+++ b/gcc/libsarifreplay.cc
@@ -1739,7 +1739,7 @@ handle_region_object (const json::object ®ion_obj,
  /* SARIF's endColumn is 1 beyond the final column in the region,
 whereas GCC's end columns are inclusive.  */
  end = m_output_mgr.new_location_from_file_line_column
-   (file, end_line, end_column_jnum->get ());
+   (file, end_line, end_column_jnum->get () - 1);
}
   else
{
diff --git a/gcc/testsuite/sarif-replay.dg/2.1.0-valid/error-with-note.sarif 
b/gcc/testsuite/sarif-replay.dg/2.1.0-valid/error-with-note.sarif
index 0d75a693cdf8..77d5a4ee1814 100644
--- a/gcc/testsuite/sarif-replay.dg/2.1.0-valid/error-with-note.sarif
+++ b/gcc/testsuite/sarif-replay.dg/2.1.0-valid/error-with-note.sarif
@@ -26,12 +26,12 @@
 /* { dg-begin-multiline-output "" }
 /this/does/not/exist/test.bas:2:8: error: 'GOTO' is considered harmful
 2 |GOTO label
-  |^~  
+  |^~ 
{ dg-end-multiline-output "" } */
 /* { dg-begin-multiline-output "" }
 /this/does/not/exist/test.bas:1:1: note: this is the target of the 'GOTO'
 1 | label: PRINT "hello world!"
-  | ^~
+  | ^
{ dg-end-multiline-output "" } */
 
 // TODO: trailing [error]
diff --git 
a/gcc/testsuite/sarif-replay.dg/2.1.0-valid/malloc-vs-local-4.c.sarif 
b/gcc/testsuite/sarif-replay.dg/2.1.0-valid/malloc-vs-local-4.c.sarif
index 55c646bb5ad2..947d65c6a7e4 100644
--- a/gcc/testsuite/sarif-replay.dg/2.1.0-valid/malloc-vs-local-4.c.sarif
+++ b/gcc/testsuite/sarif-replay.dg/2.1.0-valid/malloc-vs-local-4.c.sarif
@@ -339,37 +339,37 @@
 In function 'callee_1':
 /not/a/real/path/malloc-vs-local-4.c:5:3: warning: dereference of 
possibly-NULL ‘ptr’ [-Wanalyzer-possible-null-dereference]
 5 |   *ptr = 42;
-  |   ^~
+  |   ^
   'test_1': events 1-5
 |
 |8 | int test_1 (int i, int flag)
-|  | ^~~
+|  | ^~
 |  | |
 |  | (1) entry to ‘test_1’
 |..
 |   12 |   if (flag)
-|  |  ~~
+|  |  ~
 |  |  |
 |  |  (2) following ‘true’ branch (when ‘flag != 0’)...
 |   13 | ptr = (int *)malloc (sizeof (int));
-|  |  ~~
+|  |  ~
 |  |  |
 |  |  (3) ...to here
 |  |  (4) this call could return NULL
 |   14 |   callee_1 (ptr);
-|  |   ~~~
+|  |   ~~
 |  |   |
 |  |   (5) calling ‘callee_1’ from ‘test_1’
 |
 +--> 'callee_1': events 6-7
|
|3 | void __attribute__((noinline)) callee_1 (int *ptr)
-   |  |^
+   |  |^~~~
|  ||
|  |(6) entry to ‘callee_1’
|4 | {
|5 |   *ptr = 42;
-   |  |   ~~
+   |  |   ~ 
|  |   |
|  |   (7) ‘ptr’ could be NULL: unchecked value from (4)
|
@@ -378,24 +378,24 @@ In function 'callee_1':
 In function 'test_2':
 /not/a/real/

[gcc r15-7470] c++: Fix use-after-free of replaced friend instantiation [PR118807]

2025-02-11 Thread Nathaniel Shead via Gcc-cvs
https://gcc.gnu.org/g:ef83fae50d8f085fe8440bfa595875a2e2329871

commit r15-7470-gef83fae50d8f085fe8440bfa595875a2e2329871
Author: Nathaniel Shead 
Date:   Mon Feb 10 22:15:30 2025 +1100

c++: Fix use-after-free of replaced friend instantiation [PR118807]

When instantiating a friend function, we call register_specialization
which adds it to the DECL_TEMPLATE_INSTANTIATIONS of the template.
However, in some circumstances we might immediately call pushdecl and
find an existing specialisation.  In this case, when reregistering the
specialisation we also need to update the DECL_TEMPLATE_INSTANTIATIONS
list so that we don't try to access the freed spec again later.

PR c++/118807

gcc/cp/ChangeLog:

* pt.cc (reregister_specialization): Remove spec from
DECL_TEMPLATE_INSTANTIATIONS.

gcc/testsuite/ChangeLog:

* g++.dg/modules/pr118807.C: New test.

Signed-off-by: Nathaniel Shead 
Reviewed-by: Jason Merrill 

Diff:
---
 gcc/cp/pt.cc| 11 +++
 gcc/testsuite/g++.dg/modules/pr118807.C | 11 +++
 2 files changed, 22 insertions(+)

diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index 8108bf5de655..f857b3f11804 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -1985,6 +1985,17 @@ reregister_specialization (tree spec, tree tinfo, tree 
new_spec)
   gcc_assert (entry->spec == spec || entry->spec == new_spec);
   gcc_assert (new_spec != NULL_TREE);
   entry->spec = new_spec;
+
+  /* We need to also remove SPEC from DECL_TEMPLATE_INSTANTIATIONS
+if it was placed there.  */
+  for (tree *inst = &DECL_TEMPLATE_INSTANTIATIONS (elt.tmpl);
+  *inst; inst = &TREE_CHAIN (*inst))
+   if (TREE_VALUE (*inst) == spec)
+ {
+   *inst = TREE_CHAIN (*inst);
+   break;
+ }
+
   return 1;
 }
 
diff --git a/gcc/testsuite/g++.dg/modules/pr118807.C 
b/gcc/testsuite/g++.dg/modules/pr118807.C
new file mode 100644
index ..a97afb926997
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr118807.C
@@ -0,0 +1,11 @@
+// PR c++/118807
+// { dg-additional-options "-fmodules --param=ggc-min-expand=0 
--param=ggc-min-heapsize=0 -Wno-global-module" }
+
+module;
+template  class basic_streambuf;
+template  struct basic_streambuf {
+  friend void __istream_extract();
+};
+template class basic_streambuf;
+template class basic_streambuf;
+export module M;


[gcc r15-7471] testsuite: Fix g++.dg/modules/adl-5

2025-02-11 Thread Nathaniel Shead via Gcc-cvs
https://gcc.gnu.org/g:1bfab1dc79bef1f1120bda37556f2e372a2378f5

commit r15-7471-g1bfab1dc79bef1f1120bda37556f2e372a2378f5
Author: Nathaniel Shead 
Date:   Tue Feb 11 22:24:55 2025 +1100

testsuite: Fix g++.dg/modules/adl-5

This testcase wasn't running, because adl-5_a had the wrong extension.
adl-5_d should have been reporting an error because 'frob' is only
visible from within the 'hidden' module but this was missed.

gcc/testsuite/ChangeLog:

* g++.dg/modules/adl-5_a.c: Move to...
* g++.dg/modules/adl-5_a.C: ...here.
* g++.dg/modules/adl-5_d.C: Add errors.

Signed-off-by: Nathaniel Shead 

Diff:
---
 gcc/testsuite/g++.dg/modules/{adl-5_a.c => adl-5_a.C} | 0
 gcc/testsuite/g++.dg/modules/adl-5_d.C| 5 +++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/gcc/testsuite/g++.dg/modules/adl-5_a.c 
b/gcc/testsuite/g++.dg/modules/adl-5_a.C
similarity index 100%
rename from gcc/testsuite/g++.dg/modules/adl-5_a.c
rename to gcc/testsuite/g++.dg/modules/adl-5_a.C
diff --git a/gcc/testsuite/g++.dg/modules/adl-5_d.C 
b/gcc/testsuite/g++.dg/modules/adl-5_d.C
index 9c75b6d14a7b..cf93b0423558 100644
--- a/gcc/testsuite/g++.dg/modules/adl-5_d.C
+++ b/gcc/testsuite/g++.dg/modules/adl-5_d.C
@@ -7,10 +7,11 @@ int main ()
 {
   X x (2);
 
-  if (frob (x) != 2)
+  if (frob (x) != 2)  // { dg-error "not declared in" }
 return 1;
 
-  if (TPL (x) != 2)
+  // { dg-regexp "\n\[^\n]*adl-5_a.C:8:15: error: 'frob' was not declared in 
this scope$" }
+  if (TPL (x) != 2)  // { dg-message "required from here" }
 return 2;
 
   return 0;


[gcc r15-7473] Synchronize include/dwarf2.def with binutils

2025-02-11 Thread Roger Sayle via Gcc-cvs
https://gcc.gnu.org/g:0f8fd6b336161ed0582edb08dbe6ea1932290a75

commit r15-7473-g0f8fd6b336161ed0582edb08dbe6ea1932290a75
Author: Roger Sayle 
Date:   Tue Feb 11 12:21:43 2025 +

Synchronize include/dwarf2.def with binutils

The contents of include/dwarf2.def have diverged between the gcc and
the binutils repositories.  Currently, it's impossible to build a combined
tree, as GCC won't build with the binutils version of dwarf2.def and 
binutils
won't build with the gcc version.  This patch realigns this file by copying
the defintion of DW_CFA_AARCH64_negate_ra_state_with_pc from binutils,
restoring the ability to build a combined source tree.

2025-02-11  Roger Sayle  

include/ChangeLog
* dwarf2.def (DW_CFA_AARCH64_negate_ra_state_with_pc): Define.

Diff:
---
 include/dwarf2.def | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/dwarf2.def b/include/dwarf2.def
index e9acb79df9ce..989f078041d4 100644
--- a/include/dwarf2.def
+++ b/include/dwarf2.def
@@ -788,6 +788,8 @@ DW_CFA (DW_CFA_hi_user, 0x3f)
 
 /* SGI/MIPS specific.  */
 DW_CFA (DW_CFA_MIPS_advance_loc8, 0x1d)
+/* AArch64 extensions.  */
+DW_CFA (DW_CFA_AARCH64_negate_ra_state_with_pc, 0x2c)
 /* GNU extensions.
NOTE: DW_CFA_GNU_window_save is multiplexed on Sparc and AArch64.  */
 DW_CFA (DW_CFA_GNU_window_save, 0x2d)


[gcc(refs/users/mikael/heads/refactor_descriptor_v01)] Mise à jour dump coarray_lib_token_4.f90

2025-02-11 Thread Mikael Morin via Gcc-cvs
https://gcc.gnu.org/g:4c58f111374fc10a40f5e8d35ca539a75d0209ee

commit 4c58f111374fc10a40f5e8d35ca539a75d0209ee
Author: Mikael Morin 
Date:   Tue Feb 11 19:56:08 2025 +0100

Mise à jour dump coarray_lib_token_4.f90

Diff:
---
 gcc/testsuite/gfortran.dg/coarray_lib_token_4.f90 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc/testsuite/gfortran.dg/coarray_lib_token_4.f90 
b/gcc/testsuite/gfortran.dg/coarray_lib_token_4.f90
index b69aa5fce89a..fe500684fb5d 100644
--- a/gcc/testsuite/gfortran.dg/coarray_lib_token_4.f90
+++ b/gcc/testsuite/gfortran.dg/coarray_lib_token_4.f90
@@ -43,9 +43,9 @@ end program test_caf
 !
 ! { dg-final { scan-tree-dump-times "expl \\(\\(integer\\(kind=4\\).0:. .\\) 
parm.\[0-9\]+.data, caf_token.\[0-9\]+, \\(\\(integer\\(kind=.\\)\\) 
parm.\[0-9\]+.data - \\(\\(integer\\(kind=.\\)\\) y.\[0-9\]+\\) \\+ 
caf_offset.\[0-9\]+\\);" 0 "original" } }
 !
-! { dg-final { scan-tree-dump-times "foo \\(&a, &a, &C.\[0-9\]+, a.token, 0, 
a.token, 0\\);" 1 "original" } }
+! { dg-final { scan-tree-dump-times {foo \(&a, &a, &C.[0-9]+, 
(?:NON_LVALUE_EXPR <)?a\.token>?, 0, (?:NON_LVALUE_EXPR <)?a.token>?, 0\);} 1 
"original" } }
 !
-! { dg-final { scan-tree-dump-times "foo \\(&parm.\[0-9\]+, &parm.\[0-9\]+, 
&C.\[0-9\]+, a.token, \\(integer\\(kind=.\\)\\) parm.\[0-9\]+.data - 
\\(integer\\(kind=.\\)\\) a.data, caf_token.\[0-9\]+, \\(integer\\(kind=.\\)\\) 
parm.\[0-9\]+.data - \\(integer\\(kind=.\\)\\) b\\);" 1 "original" } }
+! { dg-final { scan-tree-dump-times {foo \(&parm.[0-9]+, &parm.[0-9]+, 
&C.[0-9]+, (?:NON_LVALUE_EXPR <)?a\.token>?, \(integer\(kind=.\)\) 
parm.[0-9]+\.data - \(integer\(kind=.\)\) a\.data, caf_token.[0-9]+, 
\(integer\(kind=.\)\) parm.[0-9]+\.data - \(integer\(kind=.\)\) b\);} 1 
"original" } }
 !
-! { dg-final { scan-tree-dump-times "foo \\(&parm.\[0-9\]+, &a, &C.\[0-9\]+, 
caf_token.\[0-9\]+, \\(integer\\(kind=.\\)\\) parm.\[0-9\]+.data - 
\\(integer\\(kind=.\\)\\) b, a.token, 0\\);" 1 "original" } }
+! { dg-final { scan-tree-dump-times {foo \(&parm.[0-9]+, &a, &C.[0-9]+, 
caf_token.[0-9]+, \(integer\(kind=.\)\) parm.[0-9]+\.data - 
\(integer\(kind=.\)\) b, (?:NON_LVALUE_EXPR <)?a\.token>?, 0\);} 1 "original" } 
}
 !


[gcc(refs/users/mikael/heads/refactor_descriptor_v01)] Mise à jour dump coarray_lib_token_2.f90

2025-02-11 Thread Mikael Morin via Gcc-cvs
https://gcc.gnu.org/g:d130e5d8ba9f09fab366c705ef6f6a73c096ed97

commit d130e5d8ba9f09fab366c705ef6f6a73c096ed97
Author: Mikael Morin 
Date:   Tue Feb 11 20:14:28 2025 +0100

Mise à jour dump coarray_lib_token_2.f90

Diff:
---
 gcc/testsuite/gfortran.dg/coarray_lib_token_2.f90 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/testsuite/gfortran.dg/coarray_lib_token_2.f90 
b/gcc/testsuite/gfortran.dg/coarray_lib_token_2.f90
index 6aecc34b6656..891fabaae5c8 100644
--- a/gcc/testsuite/gfortran.dg/coarray_lib_token_2.f90
+++ b/gcc/testsuite/gfortran.dg/coarray_lib_token_2.f90
@@ -96,7 +96,7 @@ end program main
 !  sub ((integer(kind=4) *) caf.data, &((struct t * restrict) caf_dt.data)->b,
 !   caf.token, 0, caf_dt.token, 4);
 !
-! { dg-final { scan-tree-dump-times "sub \\(\[^,\]*caf.data, 
&\[^,\]*caf_dt.data.->b, caf.token, 0, caf_dt.token, 4\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times {sub \(\([^,]+ \*\) caf\.data, 
&\(\([^)]+\) caf_dt\.data\)->b, (?:NON_LVALUE_EXPR <)?caf\.token>?, 0, 
(?:NON_LVALUE_EXPR <)?caf_dt\.token>?, 4\)} 1 "original" } }
 !
 !  sub2 ((integer(kind=4) *) x1, (integer(kind=4) *) x2,
 !caf_token.4, NON_LVALUE_EXPR ,
@@ -110,5 +110,5 @@ end program main
 !
 ! CALL 4
 !
-! { dg-final { scan-tree-dump-times "sub_opt \\(.integer.kind=4. .. caf.data, 
caf.token, 0\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times {sub_opt \(\(integer\(kind=4\) \*\) 
caf\.data, (?:NON_LVALUE_EXPR <)?caf\.token>?, 0\)} 1 "original" } }
 !


[gcc(refs/users/mikael/heads/refactor_descriptor_v01)] Mise à jour dump coarray_lib_alloc_1.f90

2025-02-11 Thread Mikael Morin via Gcc-cvs
https://gcc.gnu.org/g:79013ea91f1faf3be96dc8db6260b948b07b128e

commit 79013ea91f1faf3be96dc8db6260b948b07b128e
Author: Mikael Morin 
Date:   Tue Feb 11 19:48:04 2025 +0100

Mise à jour dump coarray_lib_alloc_1.f90

Diff:
---
 gcc/testsuite/gfortran.dg/coarray_lib_alloc_1.f90 | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/gcc/testsuite/gfortran.dg/coarray_lib_alloc_1.f90 
b/gcc/testsuite/gfortran.dg/coarray_lib_alloc_1.f90
index 4f90bdfbdaa5..e3846599fc8f 100644
--- a/gcc/testsuite/gfortran.dg/coarray_lib_alloc_1.f90
+++ b/gcc/testsuite/gfortran.dg/coarray_lib_alloc_1.f90
@@ -13,9 +13,9 @@
  deallocate(xx,yy,stat=stat, errmsg=errmsg)
  end
 
-! { dg-final { scan-tree-dump-times "_gfortran_caf_register \\(4, 1, 
&xx.token, \\(void \\*\\) &xx, &stat.., &errmsg, 200\\);" 1 "original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_register \\(8, 1, 
&yy.token, \\(void \\*\\) &yy, &stat.., &errmsg, 200\\);" 1 "original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister .&xx.token, 0, 
&stat.., &errmsg, 200.;" 1 "original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister .&yy.token, 0, 
&stat.., &errmsg, 200.;" 1 "original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister .&yy.token, 0, 
0B, 0B, 0.;" 1 "original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister .&xx.token, 0, 
0B, 0B, 0.;" 1 "original" } }
+! { dg-final { scan-tree-dump-times {_gfortran_caf_register \(4, 1, 
&(?:NON_LVALUE_EXPR <)?xx\.token>?, \(void \*\) &xx, &stat.., &errmsg, 200\);} 
1 "original" } }
+! { dg-final { scan-tree-dump-times {_gfortran_caf_register \(8, 1, 
&(?:NON_LVALUE_EXPR <)?yy\.token>?, \(void \*\) &yy, &stat.., &errmsg, 200\);} 
1 "original" } }
+! { dg-final { scan-tree-dump-times {_gfortran_caf_deregister 
\(&(?:NON_LVALUE_EXPR <)?xx\.token>?, 0, &stat.., &errmsg, 200\);} 1 "original" 
} }
+! { dg-final { scan-tree-dump-times {_gfortran_caf_deregister 
\(&(?:NON_LVALUE_EXPR <)?yy\.token>?, 0, &stat.., &errmsg, 200\);} 1 "original" 
} }
+! { dg-final { scan-tree-dump-times {_gfortran_caf_deregister 
\(&(?:NON_LVALUE_EXPR <)?yy\.token>?, 0, 0B, 0B, 0\);} 1 "original" } }
+! { dg-final { scan-tree-dump-times {_gfortran_caf_deregister 
\(&(?:NON_LVALUE_EXPR <)?xx\.token>?, 0, 0B, 0B, 0\);} 1 "original" } }


[gcc(refs/users/mikael/heads/refactor_descriptor_v01)] Mise à jour dump coarray_lib_alloc_4.f90

2025-02-11 Thread Mikael Morin via Gcc-cvs
https://gcc.gnu.org/g:37a7e6605342f8ce0b4c91db5e9c4f1a70790b32

commit 37a7e6605342f8ce0b4c91db5e9c4f1a70790b32
Author: Mikael Morin 
Date:   Tue Feb 11 18:51:30 2025 +0100

Mise à jour dump coarray_lib_alloc_4.f90

Diff:
---
 gcc/testsuite/gfortran.dg/coarray_lib_alloc_4.f90 | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/gcc/testsuite/gfortran.dg/coarray_lib_alloc_4.f90 
b/gcc/testsuite/gfortran.dg/coarray_lib_alloc_4.f90
index d695faa9eafc..01da867c4479 100644
--- a/gcc/testsuite/gfortran.dg/coarray_lib_alloc_4.f90
+++ b/gcc/testsuite/gfortran.dg/coarray_lib_alloc_4.f90
@@ -38,10 +38,10 @@ program test_caf_alloc
   deallocate(xx)
 end
 
-! { dg-final { scan-tree-dump-times "_gfortran_caf_is_present \\(xx\\.token, 
\\(integer\\(kind=4\\)\\) \\(2 - xx\\.dim\\\[0\\\]\\.lbound\\), 
&caf_ref\\.\[0-9\]+\\)|_gfortran_caf_is_present \\(xx\\.token, 2 - 
xx\\.dim\\\[0\\\]\\.lbound, &caf_ref\\.\[0-9\]+\\)" 10 "original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_register \\(\[0-9\]+, 1, 
&xx\\.token, \\(void \\*\\) &xx, 0B, 0B, 0\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times {_gfortran_caf_is_present 
\((?:NON_LVALUE_EXPR <)?xx\.token>?, \(integer\(kind=4\)\) \(2 - 
xx\.dim\[0\]\.lbound\), &caf_ref\.[0-9]+\)|_gfortran_caf_is_present 
\((?:NON_LVALUE_EXPR <)?xx\.token>?, 2 - xx\.dim\[0\]\.lbound, 
&caf_ref\.[0-9]+\)} 10 "original" } }
+! { dg-final { scan-tree-dump-times {_gfortran_caf_register \([0-9]+, 1, 
&(?:NON_LVALUE_EXPR <)?xx\.token>?, \(void \*\) &xx, 0B, 0B, 0\)} 1 "original" 
} }
 ! { dg-final { scan-tree-dump-times "_gfortran_caf_register \\(\[0-9\]+, 7" 2 
"original" } }
 ! { dg-final { scan-tree-dump-times "_gfortran_caf_register \\(\[0-9\]+, 8" 2 
"original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister \\(&xx\\.token, 
0, 0B, 0B, 0\\)" 1 "original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister \\(&\\(\\(struct 
t \\* restrict\\) xx\\.data\\)->r\\.token, 1, 0B, 0B, 0\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times {_gfortran_caf_deregister 
\(&(?:NON_LVALUE_EXPR <)?xx\.token>?, 0, 0B, 0B, 0\)} 1 "original" } }
+! { dg-final { scan-tree-dump-times {_gfortran_caf_deregister 
\(&(?:NON_LVALUE_EXPR <)?\(\(struct t \* restrict\) xx\.data\)->r\.token>?, 1, 
0B, 0B, 0\)} 1 "original" } }
 ! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister \\(&\\(\\(struct 
t \\* restrict\\) xx\\.data\\)->_caf_i, 1, 0B, 0B, 0\\)" 1 "original" } }


[gcc(refs/users/mikael/heads/refactor_descriptor_v01)] Mise à jour dump coarray_lib_alloc_2.f90

2025-02-11 Thread Mikael Morin via Gcc-cvs
https://gcc.gnu.org/g:6ec34339cb904c6b0c1da470d280866fb469

commit 6ec34339cb904c6b0c1da470d280866fb469
Author: Mikael Morin 
Date:   Tue Feb 11 19:01:22 2025 +0100

Mise à jour dump coarray_lib_alloc_2.f90

Diff:
---
 gcc/testsuite/gfortran.dg/coarray_lib_alloc_2.f90 | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/gcc/testsuite/gfortran.dg/coarray_lib_alloc_2.f90 
b/gcc/testsuite/gfortran.dg/coarray_lib_alloc_2.f90
index 90998ee39aa0..995a0b6d05d7 100644
--- a/gcc/testsuite/gfortran.dg/coarray_lib_alloc_2.f90
+++ b/gcc/testsuite/gfortran.dg/coarray_lib_alloc_2.f90
@@ -15,9 +15,9 @@
  deallocate(xx,yy,stat=stat, errmsg=errmsg)
  end
 
-! { dg-final { scan-tree-dump-times "_gfortran_caf_register \\(1, 1, 
&xx._data.token, \\(void \\*\\) &xx._data, &stat.., &errmsg, 200\\);" 1 
"original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_register \\(1, 1, 
&yy._data.token, \\(void \\*\\) &yy._data, &stat.., &errmsg, 200\\);" 1 
"original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister 
.&xx._data.token, 0, &stat.., &errmsg, 200.;" 1 "original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister 
.&yy._data.token, 0, &stat.., &errmsg, 200.;" 1 "original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister 
.&yy._data.token, 0, 0B, 0B, 0.;" 1 "original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister 
.&xx._data.token, 0, 0B, 0B, 0.;" 1 "original" } }
+! { dg-final { scan-tree-dump-times {_gfortran_caf_register \(1, 1, 
&(?:NON_LVALUE_EXPR <)?xx\._data\.token>?, \(void \*\) &xx._data, &stat.., 
&errmsg, 200\);} 1 "original" } }
+! { dg-final { scan-tree-dump-times {_gfortran_caf_register \(1, 1, 
&(?:NON_LVALUE_EXPR <)?yy\._data\.token>?, \(void \*\) &yy._data, &stat.., 
&errmsg, 200\);} 1 "original" } }
+! { dg-final { scan-tree-dump-times {_gfortran_caf_deregister 
\(&(?:NON_LVALUE_EXPR <)?xx\._data\.token>?, 0, &stat.., &errmsg, 200\);} 1 
"original" } }
+! { dg-final { scan-tree-dump-times {_gfortran_caf_deregister 
\(&(?:NON_LVALUE_EXPR <)?yy\._data\.token>?, 0, &stat.., &errmsg, 200\);} 1 
"original" } }
+! { dg-final { scan-tree-dump-times {_gfortran_caf_deregister 
\(&(?:NON_LVALUE_EXPR <)?yy\._data\.token>?, 0, 0B, 0B, 0\);} 1 "original" } }
+! { dg-final { scan-tree-dump-times {_gfortran_caf_deregister 
\(&(?:NON_LVALUE_EXPR <)?xx\._data\.token>?, 0, 0B, 0B, 0\);} 1 "original" } }


[gcc(refs/users/mikael/heads/refactor_descriptor_v01)] Correction dump coarray_allocate_7.f08

2025-02-11 Thread Mikael Morin via Gcc-cvs
https://gcc.gnu.org/g:c490d4b66a3cf56ec27c1b2383a5d5958d26cc21

commit c490d4b66a3cf56ec27c1b2383a5d5958d26cc21
Author: Mikael Morin 
Date:   Tue Feb 11 18:44:26 2025 +0100

Correction dump coarray_allocate_7.f08

Diff:
---
 gcc/testsuite/gfortran.dg/coarray_allocate_7.f08 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/testsuite/gfortran.dg/coarray_allocate_7.f08 
b/gcc/testsuite/gfortran.dg/coarray_allocate_7.f08
index 56160e29d9f4..ab363588b7bc 100644
--- a/gcc/testsuite/gfortran.dg/coarray_allocate_7.f08
+++ b/gcc/testsuite/gfortran.dg/coarray_allocate_7.f08
@@ -23,5 +23,5 @@ program main
   if ( object%indices(1) /= 1 ) STOP 2
 end program
 
-! { dg-final { scan-tree-dump-times "_gfortran_caf_register \\(0, 7, \\(void 
\\*\\) &mytype\\.\[0-9\]+\\.indices\\.token, &mytype\\.\[0-9\]+\\.indices, 0B, 
0B, 0\\);" 1 "original" } }
+! { dg-final { scan-tree-dump-times {_gfortran_caf_register \(0, 7, \(void 
\*\) &(?:NON_LVALUE_EXPR <)?mytype\.[0-9]+\.indices\.token>?, 
&mytype\.[0-9]+\.indices, 0B, 0B, 0\);} 1 "original" } }


[gcc r13-9371] x86: Correct ASM_OUTPUT_SYMBOL_REF

2025-02-11 Thread H.J. Lu via Gcc-cvs
https://gcc.gnu.org/g:0a1c9d03309ff1e507f7ea347fe8cc12bf669296

commit r13-9371-g0a1c9d03309ff1e507f7ea347fe8cc12bf669296
Author: H.J. Lu 
Date:   Tue Feb 11 13:47:54 2025 +0800

x86: Correct ASM_OUTPUT_SYMBOL_REF

x is not a macro argument.  It just happens to work as final.cc passes
x for 2nd argument:

final.cc:  ASM_OUTPUT_SYMBOL_REF (file, x);

PR target/118825
* config/i386/i386.h (ASM_OUTPUT_SYMBOL_REF): Replace x with
SYM.

Signed-off-by: H.J. Lu 
(cherry picked from commit 7317fc0b03380a83ad03a5fc4fabef5f38c44c9d)

Diff:
---
 gcc/config/i386/i386.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index 25c6540fb2c9..c147ff8732c9 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -2181,7 +2181,7 @@ extern int const 
svr4_debugger_register_map[FIRST_PSEUDO_REGISTER];
 #define ASM_OUTPUT_SYMBOL_REF(FILE, SYM) \
   do { \
 const char *name   \
-  = assemble_name_resolve (XSTR (x, 0));   \
+  = assemble_name_resolve (XSTR (SYM, 0)); \
 /* In -masm=att wrap identifiers that start with $ \
into parens.  */\
 if (ASSEMBLER_DIALECT == ASM_ATT   \


[gcc r14-11301] x86: Correct ASM_OUTPUT_SYMBOL_REF

2025-02-11 Thread H.J. Lu via Gcc-cvs
https://gcc.gnu.org/g:5f47dc6e9aa82e1c00ed030cb9469cd84df8691d

commit r14-11301-g5f47dc6e9aa82e1c00ed030cb9469cd84df8691d
Author: H.J. Lu 
Date:   Tue Feb 11 13:47:54 2025 +0800

x86: Correct ASM_OUTPUT_SYMBOL_REF

x is not a macro argument.  It just happens to work as final.cc passes
x for 2nd argument:

final.cc:  ASM_OUTPUT_SYMBOL_REF (file, x);

PR target/118825
* config/i386/i386.h (ASM_OUTPUT_SYMBOL_REF): Replace x with
SYM.

Signed-off-by: H.J. Lu 
(cherry picked from commit 7317fc0b03380a83ad03a5fc4fabef5f38c44c9d)

Diff:
---
 gcc/config/i386/i386.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index 1c456c3422fc..2fc82b175e6d 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -2229,7 +2229,7 @@ extern int const 
svr4_debugger_register_map[FIRST_PSEUDO_REGISTER];
 #define ASM_OUTPUT_SYMBOL_REF(FILE, SYM) \
   do { \
 const char *name   \
-  = assemble_name_resolve (XSTR (x, 0));   \
+  = assemble_name_resolve (XSTR (SYM, 0)); \
 /* In -masm=att wrap identifiers that start with $ \
into parens.  */\
 if (ASSEMBLER_DIALECT == ASM_ATT   \


[gcc r12-10950] x86: Correct ASM_OUTPUT_SYMBOL_REF

2025-02-11 Thread H.J. Lu via Gcc-cvs
https://gcc.gnu.org/g:bd52571d713749f1a4cf0f58ca4922dbc42b5752

commit r12-10950-gbd52571d713749f1a4cf0f58ca4922dbc42b5752
Author: H.J. Lu 
Date:   Tue Feb 11 13:47:54 2025 +0800

x86: Correct ASM_OUTPUT_SYMBOL_REF

x is not a macro argument.  It just happens to work as final.cc passes
x for 2nd argument:

final.cc:  ASM_OUTPUT_SYMBOL_REF (file, x);

PR target/118825
* config/i386/i386.h (ASM_OUTPUT_SYMBOL_REF): Replace x with
SYM.

Signed-off-by: H.J. Lu 
(cherry picked from commit 7317fc0b03380a83ad03a5fc4fabef5f38c44c9d)

Diff:
---
 gcc/config/i386/i386.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index ed988ca280ea..8416e5b02b64 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -2174,7 +2174,7 @@ extern int const 
svr4_dbx_register_map[FIRST_PSEUDO_REGISTER];
 #define ASM_OUTPUT_SYMBOL_REF(FILE, SYM) \
   do { \
 const char *name   \
-  = assemble_name_resolve (XSTR (x, 0));   \
+  = assemble_name_resolve (XSTR (SYM, 0)); \
 /* In -masm=att wrap identifiers that start with $ \
into parens.  */\
 if (ASSEMBLER_DIALECT == ASM_ATT   \


[gcc(refs/users/mikael/heads/refactor_descriptor_v01)] Correction ICE coarray_42.f90

2025-02-11 Thread Mikael Morin via Gcc-cvs
https://gcc.gnu.org/g:4a8163325ac5b79fb869baee36ffefd656c445ee

commit 4a8163325ac5b79fb869baee36ffefd656c445ee
Author: Mikael Morin 
Date:   Tue Feb 11 10:36:20 2025 +0100

Correction ICE coarray_42.f90

Diff:
---
 gcc/fortran/trans-array.cc | 33 +++--
 gcc/fortran/trans-array.h  |  1 +
 gcc/fortran/trans-intrinsic.cc |  4 +---
 3 files changed, 29 insertions(+), 9 deletions(-)

diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc
index f0dadfbe58fc..7072927a30be 100644
--- a/gcc/fortran/trans-array.cc
+++ b/gcc/fortran/trans-array.cc
@@ -258,6 +258,14 @@ get_field (tree desc, unsigned field_idx)
   tree field = gfc_advance_chain (TYPE_FIELDS (type), field_idx);
   gcc_assert (field != NULL_TREE);
 
+  return field;
+}
+
+tree
+get_component (tree desc, unsigned field_idx)
+{
+  tree field = get_field (desc, field_idx);
+
   return fold_build3_loc (input_location, COMPONENT_REF, TREE_TYPE (field),
  desc, field, NULL_TREE);
 }
@@ -265,7 +273,7 @@ get_field (tree desc, unsigned field_idx)
 tree
 get_data (tree desc)
 {
-  return get_field (desc, DATA_FIELD);
+  return get_component (desc, DATA_FIELD);
 }
 
 tree
@@ -296,7 +304,7 @@ conv_data_addr (tree desc)
 tree
 get_offset (tree desc)
 {
-  tree field = get_field (desc, OFFSET_FIELD);
+  tree field = get_component (desc, OFFSET_FIELD);
   gcc_assert (TREE_TYPE (field) == gfc_array_index_type);
   return field;
 }
@@ -317,7 +325,7 @@ conv_offset_set (stmtblock_t *block, tree desc, tree value)
 tree
 get_dtype (tree desc)
 {
-  tree field = get_field (desc, DTYPE_FIELD);
+  tree field = get_component (desc, DTYPE_FIELD);
   gcc_assert (TREE_TYPE (field) == get_dtype_type_node ());
   return field;
 }
@@ -338,7 +346,7 @@ conv_dtype_set (stmtblock_t *block, tree desc, tree val)
 tree
 get_span (tree desc)
 {
-  tree field = get_field (desc, SPAN_FIELD);
+  tree field = get_component (desc, SPAN_FIELD);
   gcc_assert (TREE_TYPE (field) == gfc_array_index_type);
   return field;
 }
@@ -513,7 +521,7 @@ conv_type_set (stmtblock_t *block, tree desc, tree value)
 tree
 get_dimensions (tree desc)
 {
-  tree field = get_field (desc, DIMENSION_FIELD);
+  tree field = get_component (desc, DIMENSION_FIELD);
   gcc_assert (TREE_CODE (TREE_TYPE (field)) == ARRAY_TYPE
  && TREE_CODE (TREE_TYPE (TREE_TYPE (field))) == RECORD_TYPE);
   return field;
@@ -573,11 +581,18 @@ conv_dimension_set (stmtblock_t *block, tree desc, tree 
dim, tree value)
 }
 
 
+tree
+get_token_field (tree desc)
+{
+  gcc_assert (flag_coarray == GFC_FCOARRAY_LIB);
+  return get_field (desc, CAF_TOKEN_FIELD);
+}
+
 tree
 get_token (tree desc)
 {
   gcc_assert (flag_coarray == GFC_FCOARRAY_LIB);
-  tree field = get_field (desc, CAF_TOKEN_FIELD);
+  tree field = get_component (desc, CAF_TOKEN_FIELD);
   /* Should be a restricted pointer - except in the finalization wrapper.  */
   gcc_assert (TREE_TYPE (field) == prvoid_type_node
  || TREE_TYPE (field) == pvoid_type_node);
@@ -861,6 +876,12 @@ gfc_conv_descriptor_token_get (tree desc)
   return gfc_descriptor::conv_token_get (desc);
 }
 
+tree
+gfc_conv_descriptor_token_field (tree desc)
+{
+  return gfc_descriptor::get_token_field (desc);
+}
+
 void
 gfc_conv_descriptor_token_set (stmtblock_t *block, tree desc, tree value)
 {
diff --git a/gcc/fortran/trans-array.h b/gcc/fortran/trans-array.h
index a704d9384cd1..836a177da014 100644
--- a/gcc/fortran/trans-array.h
+++ b/gcc/fortran/trans-array.h
@@ -205,6 +205,7 @@ tree gfc_conv_descriptor_ubound_get (tree, tree);
 tree gfc_conv_descriptor_extent_get (tree, tree);
 tree gfc_conv_descriptor_sm_get (tree, tree);
 tree gfc_conv_descriptor_token_get (tree);
+tree gfc_conv_descriptor_token_field (tree);
 
 void gfc_conv_descriptor_data_set (stmtblock_t *, tree, tree);
 void gfc_conv_descriptor_offset_set (stmtblock_t *, tree, tree);
diff --git a/gcc/fortran/trans-intrinsic.cc b/gcc/fortran/trans-intrinsic.cc
index 019191a54b67..4e280b9b7208 100644
--- a/gcc/fortran/trans-intrinsic.cc
+++ b/gcc/fortran/trans-intrinsic.cc
@@ -1318,9 +1318,7 @@ conv_expr_ref_to_caf_ref (stmtblock_t *block, gfc_expr 
*expr)
  tree arr_desc_token_offset;
  /* Get the token field from the descriptor.  */
  tree descriptor = ref->u.c.component->backend_decl;
- tree desc_token = gfc_conv_descriptor_token_get (descriptor);
- gcc_assert (TREE_CODE (desc_token) == COMPONENT_REF);
- arr_desc_token_offset = TREE_OPERAND (desc_token, 1);
+ arr_desc_token_offset = gfc_conv_descriptor_token_field 
(descriptor);
  arr_desc_token_offset
  = compute_component_offset (arr_desc_token_offset,
  TREE_TYPE (tmp));


[gcc r15-7468] config.gcc: Support mips*64*-linux-muslabi64 as ABI64 by default

2025-02-11 Thread YunQiang Su via Gcc-cvs
https://gcc.gnu.org/g:0399e3e54a2c891116d6b43683c7fdce689304c5

commit r15-7468-g0399e3e54a2c891116d6b43683c7fdce689304c5
Author: YunQiang Su 
Date:   Mon Sep 23 00:55:29 2024 +0800

config.gcc: Support mips*64*-linux-muslabi64 as ABI64 by default

LLVM introduced this triple support.  Let's sync with it.

gcc
* config.gcc: Add mips*64*-linux-muslabi64 triple support.

Diff:
---
 gcc/config.gcc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 9e167f7f00d5..a518e976b82e 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -2683,7 +2683,7 @@ mips*-*-linux*)   # Linux MIPS, 
either endian.
default_mips_arch=mips64r2
enable_mips_multilibs="yes"
;;
-   mips64*-*-linux-gnuabi64 | mipsisa64*-*-linux-gnuabi64)
+   mips64*-*-linux-gnuabi64 | mipsisa64*-*-linux-gnuabi64 | 
mips*64*-linux-muslabi64)
default_mips_abi=64
enable_mips_multilibs="yes"
;;


[gcc(refs/users/mikael/heads/refactor_descriptor_v01)] match: Unwrap non-lvalue as unary or binary operand

2025-02-11 Thread Mikael Morin via Gcc-cvs
https://gcc.gnu.org/g:278b414fa52a35a4ef0dc02717aff694ac01802a

commit 278b414fa52a35a4ef0dc02717aff694ac01802a
Author: Mikael Morin 
Date:   Thu Jul 4 15:24:36 2024 +0200

match: Unwrap non-lvalue as unary or binary operand

This avoids most of the testsuite dump pattern updates with a patch
generating more NON_LVALUE_EXPR trees that I plan to post later.

Regression tested on x86_64-linux.  OK for master?

-- 8< --

gcc/ChangeLog:

* match.pd (`op (non_lvalue X) Y`, `op X (non_lvalue Y)`,
`op (non_lvalue X)`): New simplifications, unwrap NON_LVALUE_EXPR
trees when they are used as operand of a unary or binary operator.

gcc/testsuite/ChangeLog:

* gfortran.dg/non_lvalue_2.f90: New test.

Diff:
---
 gcc/match.pd   | 12 
 gcc/testsuite/gfortran.dg/non_lvalue_2.f90 | 44 ++
 2 files changed, 56 insertions(+)

diff --git a/gcc/match.pd b/gcc/match.pd
index 5e6bb8945e8b..85b4e8013783 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -281,6 +281,18 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
(outer_op @0 @2)
@3))
 
+/* Remove superfluous NON_LVALUE_EXPR in unary operators.  */
+(for op (UNCOND_UNARY)
+ (simplify (op (non_lvalue @0))
+  (op @0)))
+
+/* Remove superfluous NON_LVALUE_EXPR in binary operators.  */
+(for op (UNCOND_BINARY tcc_comparison)
+ (simplify (op (non_lvalue @0) @1)
+  (op @0 @1))
+ (simplify (op @0 (non_lvalue @1))
+  (op @0 @1)))
+
 /* Simplify x - x.
This is unsafe for certain floats even in non-IEEE formats.
In IEEE, it is unsafe because it does wrong for NaNs.
diff --git a/gcc/testsuite/gfortran.dg/non_lvalue_2.f90 
b/gcc/testsuite/gfortran.dg/non_lvalue_2.f90
new file mode 100644
index ..8c3197eab1f0
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/non_lvalue_2.f90
@@ -0,0 +1,44 @@
+! { dg-do compile }
+! { dg-additional-options "-fdump-tree-original" }
+!
+! Check the removal of NON_LVALUE_EXPR if they are used in a non-lvalue context
+
+! The NON_LVALUE_EXPR is dropped if it's part (left operand) of a bigger 
expression
+function f1 (f1_arg1, f1_arg2)
+  integer, value :: f1_arg1, f1_arg2
+  integer :: f1
+  f1 = (f1_arg1 + 0) + f1_arg2
+end function
+! { dg-final { scan-tree-dump "__result_f1 = f1_arg1 \\+ f1_arg2;" "original" 
} }
+
+! The NON_LVALUE_EXPR is dropped if it's part (right operand) of a bigger 
expression
+function f2 (f2_arg1, f2_arg2)
+  integer, value :: f2_arg1, f2_arg2
+  integer :: f2
+  f2 = f2_arg1 + (f2_arg2 + 0)
+end function
+! { dg-final { scan-tree-dump "__result_f2 = f2_arg1 \\+ f2_arg2;" "original" 
} }
+
+! The NON_LVALUE_EXPR is dropped if it's part (left operand) of a binary 
logical operator
+function f3 (f3_arg1)
+  integer, value :: f3_arg1
+  logical :: f3
+  f3 = (f3_arg1 + 0) > 0
+end function
+! { dg-final { scan-tree-dump "__result_f3 = f3_arg1 > 0;" "original" } }
+
+! The NON_LVALUE_EXPR is dropped if it's part (right operand) of a binary 
logical operator
+function f4 (f4_arg1, f4_arg2)
+  integer, value :: f4_arg1, f4_arg2
+  logical :: f4
+  f4 = f4_arg1 > (f4_arg2 + 0)
+end function
+! { dg-final { scan-tree-dump "__result_f4 = f4_arg1 > f4_arg2;" "original" } }
+
+! The NON_LVALUE_EXPR is dropped if it's part of a unary operator
+function f5 (f5_arg1)
+  integer, value :: f5_arg1
+  integer :: f5
+  f5 = -(not(not(f5_arg1)))
+end function
+! { dg-final { scan-tree-dump "__result_f5 = -f5_arg1;" "original" } }


[gcc(refs/users/mikael/heads/refactor_descriptor_v01)] match: Simplify double not and double negate to a non_lvalue

2025-02-11 Thread Mikael Morin via Gcc-cvs
https://gcc.gnu.org/g:f22fec6822adc49f25471ef31d1672ea7c4f0cb2

commit f22fec6822adc49f25471ef31d1672ea7c4f0cb2
Author: Mikael Morin 
Date:   Thu Jul 4 12:59:34 2024 +0200

match: Simplify double not and double negate to a non_lvalue

I noticed while testing the second patch that none of the NON_LVALUE_EXPR
trees I expected were generated when simplifying unary operators, whereas
they were generated with binary operators.

Regression tested on x86_64-linux.  OK for master?

-- 8< --

gcc/ChangeLog:

* match.pd (`-(-X)`, `~(~X)`): Add a NON_LVALUE_EXPR wrapper to the
simplification of doubled unary operators NEGATE_EXPR and
BIT_NOT_EXPR.

gcc/testsuite/ChangeLog:

* gfortran.dg/non_lvalue_1.f90: New test.

Diff:
---
 gcc/match.pd   |  4 ++--
 gcc/testsuite/gfortran.dg/non_lvalue_1.f90 | 21 +
 2 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/gcc/match.pd b/gcc/match.pd
index 171930874988..5e6bb8945e8b 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -2318,7 +2318,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
 /* ~~x -> x */
 (simplify
   (bit_not (bit_not @0))
-  @0)
+  (non_lvalue @0))
 
 /* zero_one_valued_p will match when a value is known to be either
0 or 1 including constants 0 or 1.
@@ -3930,7 +3930,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
   (negate (nop_convert? (negate @1)))
   (if (!TYPE_OVERFLOW_SANITIZED (type)
&& !TYPE_OVERFLOW_SANITIZED (TREE_TYPE (@1)))
-   (view_convert @1)))
+   (non_lvalue (view_convert @1
 
  /* We can't reassociate floating-point unless -fassociative-math
 or fixed-point plus or minus because of saturation to +-Inf.  */
diff --git a/gcc/testsuite/gfortran.dg/non_lvalue_1.f90 
b/gcc/testsuite/gfortran.dg/non_lvalue_1.f90
new file mode 100644
index ..ac52b2720945
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/non_lvalue_1.f90
@@ -0,0 +1,21 @@
+! { dg-do compile }
+! { dg-additional-options "-fdump-tree-original" }
+!
+! Check the generation of NON_LVALUE_EXPR trees in cases where a unary 
operator expression
+! simplifies to a data reference.
+
+! A NON_LVALUE_EXPR is generated for a double negation that simplifies to a 
data reference.  */
+function f1 (f1_arg1)
+  integer, value :: f1_arg1
+  integer :: f1
+  f1 = -(-f1_arg1)
+end function
+! { dg-final { scan-tree-dump "__result_f1 = NON_LVALUE_EXPR ;" 
"original" } }
+
+! A NON_LVALUE_EXPR is generated for a double complement that simplifies to a 
data reference.  */
+function f2 (f2_arg1)
+  integer, value :: f2_arg1
+  integer :: f2
+  f2 = not(not(f2_arg1))
+end function
+! { dg-final { scan-tree-dump "__result_f2 = NON_LVALUE_EXPR ;" 
"original" } }


[gcc r15-7466] libphobos: Disable libphobos.phobos/std/concurrency.d on macOS 13+ [PR111628]

2025-02-11 Thread Rainer Orth via Gcc-cvs
https://gcc.gnu.org/g:b7008552b493edaca6af041a18ff436c37f259bc

commit r15-7466-gb7008552b493edaca6af041a18ff436c37f259bc
Author: Rainer Orth 
Date:   Tue Feb 11 09:41:18 2025 +0100

libphobos: Disable libphobos.phobos/std/concurrency.d on macOS 13+ 
[PR111628]

The libphobos.phobos_shared/std/concurrency.d test just hangs on macOS
13 and beyond and isn't even termintated after the testsuite timeout is
exceeded.  Thus, more and more concurrency.exe processes keep
accumulating, consuming CPU time for nothing.

To avoid this, this patch skips the test on macOS 13+.  The static test
SEGVs immediately instead, but I'm skipping it too for symmetry.

Tested on macOS 15 (where it becomes UNSUPPORTED) and 12 (where it still
PASSes).

I have no idea what happens on Darwin/arm64, so currently the skipping
is restricted to Darwin/x86_64.

2025-02-10  Rainer Orth  

PR d/111628
* testsuite/libphobos.phobos/phobos.exp (libphobos_skip_tests):
Add libphobos.phobos/std/concurrency.d on macOS 13+.
* testsuite/libphobos.phobos_shared/phobos_shared.exp
(libphobos_skip_tests): Likewise for
libphobos.phobos_shared/std/concurrency.d

Diff:
---
 libphobos/testsuite/libphobos.phobos/phobos.exp   | 2 ++
 libphobos/testsuite/libphobos.phobos_shared/phobos_shared.exp | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/libphobos/testsuite/libphobos.phobos/phobos.exp 
b/libphobos/testsuite/libphobos.phobos/phobos.exp
index 55622698f135..3e74078f1366 100644
--- a/libphobos/testsuite/libphobos.phobos/phobos.exp
+++ b/libphobos/testsuite/libphobos.phobos/phobos.exp
@@ -37,6 +37,8 @@ set libphobos_skip_tests {
 # Skip curl tests if library is not available
 { libphobos.phobos/etc/c/curl.d { ! libcurl_available } }
 { libphobos.phobos/std/net/curl.d { ! libcurl_available } }
+# Skip concurrency.d test: SEGVs or hangs on macOS 13+ (PR d/111628).
+{ libphobos.phobos/std/concurrency.d { x86_64-apple-darwin2[2-9]* } }
 }
 
 # Initialize dg.
diff --git a/libphobos/testsuite/libphobos.phobos_shared/phobos_shared.exp 
b/libphobos/testsuite/libphobos.phobos_shared/phobos_shared.exp
index 2940a663a803..54acea78a686 100644
--- a/libphobos/testsuite/libphobos.phobos_shared/phobos_shared.exp
+++ b/libphobos/testsuite/libphobos.phobos_shared/phobos_shared.exp
@@ -37,6 +37,8 @@ set libphobos_skip_tests {
 # Skip curl tests if library is not available
 { libphobos.phobos_shared/etc/c/curl.d { ! libcurl_available } }
 { libphobos.phobos_shared/std/net/curl.d { ! libcurl_available } }
+# Skip concurrency.d test: SEGVs or hangs on macOS 13+ (PR d/111628).
+{ libphobos.phobos_shared/std/concurrency.d { x86_64-apple-darwin2[2-9]* } 
}
 }
 
 # Initialize dg.


[gcc r15-7467] MIPS: Add some floating point instructions support for MIPSr6

2025-02-11 Thread YunQiang Su via Gcc-cvs
https://gcc.gnu.org/g:86b9abc829316f94d455a2309f212031af36ba68

commit r15-7467-g86b9abc829316f94d455a2309f212031af36ba68
Author: Jie Mei 
Date:   Fri Sep 20 10:42:48 2024 +0800

MIPS: Add some floating point instructions support for MIPSr6

This patch adds some of the float point instructions from
MIPS32 Release 6(mips32r6) with their respective built-in
functions and tests:

min_a_s, min_a_d
max_a_s, max_a_d
rint_s, rint_d
class_s, class_d

gcc/ChangeLog:

* config/mips/i6400.md (i6400_fpu_minmax): Include
fclass type.
(i6400_fpu_fadd): Include frint type.
* config/mips/mips.cc (AVAIL_NON_MIPS16): Add an entry
for __builtin_mipsr6_xxx.
(MIPSR6_BUILTIN_PURE): Same as above.
(CODE_FOR_mipsr6_min_a_s, CODE_FOR_mipsr6_min_a_d)
(CODE_FOR_mipsr6_max_a_s, CODE_FOR_mipsr6_max_a_d)
(CODE_FOR_mipsr6_class_s, CODE_FOR_mipsr6_class_d):
New code_aliasing macros.
(mips_builtins): Add mips32r6 min_a_s, min_a_d, max_a_s,
max_a_d, class_s, class_d builtins.
* config/mips/mips.h (ISA_HAS_FRINT): Define a new macro.
(ISA_HAS_FCLASS): Same as above.
* config/mips/mips.md (UNSPEC_FRINT): New unspec.
(UNSPEC_FCLASS): Same as above.
(type): Add frint and fclass.
(fmin_a_): Generates MINA.fmt instructions.
(fmax_a_): Generates MAXA.fmt instructions.
(rint2): Generates RINT.fmt instructions.
(fclass_): Generates CLASS.fmt instructions.
* config/mips/p6600.md (p6600_fpu_fadd): Include
frint type.
(p6600_fpu_fabs): Include fclass type.

gcc/testsuite/ChangeLog:

* gcc.target/mips/mips-class.c: New tests for MIPSr6
* gcc.target/mips/mips-minamaxa.c: Same as above.
* gcc.target/mips/mips-rint.c: Same as above.

Signed-off-by: Jie Mei 
Co-authored-by: Xi Ruoyao 

Diff:
---
 gcc/config/mips/i6400.md  |  8 ++---
 gcc/config/mips/mips.cc   | 24 +
 gcc/config/mips/mips.h|  4 +++
 gcc/config/mips/mips.md   | 52 +--
 gcc/config/mips/p6600.md  |  8 ++---
 gcc/testsuite/gcc.target/mips/mips-class.c| 17 +
 gcc/testsuite/gcc.target/mips/mips-minamaxa.c | 31 
 gcc/testsuite/gcc.target/mips/mips-rint.c | 17 +
 8 files changed, 151 insertions(+), 10 deletions(-)

diff --git a/gcc/config/mips/i6400.md b/gcc/config/mips/i6400.md
index 53d5a8950370..467afad1c70b 100644
--- a/gcc/config/mips/i6400.md
+++ b/gcc/config/mips/i6400.md
@@ -219,16 +219,16 @@
(eq_attr "type" "fabs,fneg,fmove"))
   "i6400_fpu_short, i6400_fpu_apu")
 
-;; min, max
+;; min, max, fclass
 (define_insn_reservation "i6400_fpu_minmax" 2
   (and (eq_attr "cpu" "i6400")
-   (eq_attr "type" "fminmax"))
+   (eq_attr "type" "fminmax,fclass"))
   "i6400_fpu_short+i6400_fpu_logic")
 
-;; fadd, fsub, fcvt
+;; fadd, fsub, fcvt, frint
 (define_insn_reservation "i6400_fpu_fadd" 4
   (and (eq_attr "cpu" "i6400")
-   (eq_attr "type" "fadd,fcvt"))
+   (eq_attr "type" "fadd,fcvt,frint"))
   "i6400_fpu_long, i6400_fpu_apu")
 
 ;; fmul
diff --git a/gcc/config/mips/mips.cc b/gcc/config/mips/mips.cc
index b159eab75124..24a28dcf817f 100644
--- a/gcc/config/mips/mips.cc
+++ b/gcc/config/mips/mips.cc
@@ -15775,6 +15775,7 @@ AVAIL_NON_MIPS16 (dspr2_32, !TARGET_64BIT && 
TARGET_DSPR2)
 AVAIL_NON_MIPS16 (loongson, TARGET_LOONGSON_MMI)
 AVAIL_MIPS16E2_OR_NON_MIPS16 (cache, TARGET_CACHE_BUILTIN)
 AVAIL_NON_MIPS16 (msa, TARGET_MSA)
+AVAIL_NON_MIPS16 (r6, mips_isa_rev >= 6)
 
 /* Construct a mips_builtin_description from the given arguments.
 
@@ -15940,6 +15941,14 @@ AVAIL_NON_MIPS16 (msa, TARGET_MSA)
 "__builtin_msa_" #INSN,  MIPS_BUILTIN_DIRECT_NO_TARGET,\
 FUNCTION_TYPE, mips_builtin_avail_msa, false }
 
+/* Define a MIPSr6 MIPS_BUILTIN_DIRECT pure function __builtin_mipsr6_
+   for instruction CODE_FOR_mipsr6_.  FUNCTION_TYPE is a 
builtin_description
+   field.  */
+#define MIPSR6_BUILTIN_PURE(INSN, FUNCTION_TYPE)   \
+{ CODE_FOR_mipsr6_ ## INSN, MIPS_FP_COND_f,
\
+"__builtin_mipsr6_" #INSN,  MIPS_BUILTIN_DIRECT,   \
+FUNCTION_TYPE, mips_builtin_avail_r6, true }
+
 #define CODE_FOR_mips_sqrt_ps CODE_FOR_sqrtv2sf2
 #define CODE_FOR_mips_addq_ph CODE_FOR_addv2hi3
 #define CODE_FOR_mips_addu_qb CODE_FOR_addv4qi3
@@ -16177,6 +16186,13 @@ AVAIL_NON_MIPS16 (msa, TARGET_MSA)
 #define CODE_FOR_msa_ldi_w CODE_FOR_msa_ldiv4si
 #define CODE_FOR_msa_ldi_d CODE_FOR_msa_ldiv2di
 
+#define CODE_FOR_mipsr6_min_a_s CODE_FOR_fmin_a_sf
+#define CODE_FOR_mipsr6_min_a_d CODE_FOR_fmin_a_df
+#define CODE_FOR_mipsr6_max_a

[gcc r15-7469] x86: Correct ASM_OUTPUT_SYMBOL_REF

2025-02-11 Thread H.J. Lu via Gcc-cvs
https://gcc.gnu.org/g:7317fc0b03380a83ad03a5fc4fabef5f38c44c9d

commit r15-7469-g7317fc0b03380a83ad03a5fc4fabef5f38c44c9d
Author: H.J. Lu 
Date:   Tue Feb 11 13:47:54 2025 +0800

x86: Correct ASM_OUTPUT_SYMBOL_REF

x is not a macro argument.  It just happens to work as final.cc passes
x for 2nd argument:

final.cc:  ASM_OUTPUT_SYMBOL_REF (file, x);

PR target/118825
* config/i386/i386.h (ASM_OUTPUT_SYMBOL_REF): Replace x with
SYM.

Signed-off-by: H.J. Lu 

Diff:
---
 gcc/config/i386/i386.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index e8e528c7811b..40b1aa4e6dfe 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -2235,7 +2235,7 @@ extern unsigned int const 
svr4_debugger_register_map[FIRST_PSEUDO_REGISTER];
 #define ASM_OUTPUT_SYMBOL_REF(FILE, SYM) \
   do { \
 const char *name   \
-  = assemble_name_resolve (XSTR (x, 0));   \
+  = assemble_name_resolve (XSTR (SYM, 0)); \
 /* In -masm=att wrap identifiers that start with $ \
into parens.  */\
 if (ASSEMBLER_DIALECT == ASM_ATT   \


[gcc r15-7477] OpenMP: Bug fixes for comparing context selectors

2025-02-11 Thread Sandra Loosemore via Gcc-cvs
https://gcc.gnu.org/g:84854ce5b84c86aed23016de5ca05372bc7fa7cf

commit r15-7477-g84854ce5b84c86aed23016de5ca05372bc7fa7cf
Author: Sandra Loosemore 
Date:   Sun Feb 9 21:34:34 2025 +

OpenMP: Bug fixes for comparing context selectors

gcc/ChangeLog
* omp-general.cc (omp_context_selector_props_compare): Handle
arbitrary expressions in the "user" and "device_num" selectors.
(omp_context_selector_set_compare): Detect mismatch when one
selector specifies a score and the other doesn't.

Diff:
---
 gcc/omp-general.cc | 26 +++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/gcc/omp-general.cc b/gcc/omp-general.cc
index 2ce79bfc9d83..0d6f02ece31e 100644
--- a/gcc/omp-general.cc
+++ b/gcc/omp-general.cc
@@ -2350,8 +2350,26 @@ omp_context_selector_props_compare (enum omp_tss_code 
set,
  if (set == OMP_TRAIT_SET_USER
  && sel == OMP_TRAIT_USER_CONDITION)
{
- if (integer_zerop (OMP_TP_VALUE (p1))
- != integer_zerop (OMP_TP_VALUE (p2)))
+ /* Recognize constants that have equal truth values,
+otherwise assume all expressions are unique.  */
+ tree v1 = OMP_TP_VALUE (p1);
+ tree v2 = OMP_TP_VALUE (p2);
+ if (TREE_CODE (v1) != INTEGER_CST
+ || TREE_CODE (v2) != INTEGER_CST
+ || integer_zerop (v1) != integer_zerop (v2))
+   return 2;
+ break;
+   }
+ if (set == OMP_TRAIT_SET_TARGET_DEVICE
+ && sel == OMP_TRAIT_DEVICE_NUM)
+   {
+ /* Recognize constants that have equal values,
+otherwise assume all expressions are unique.  */
+ tree v1 = OMP_TP_VALUE (p1);
+ tree v2 = OMP_TP_VALUE (p2);
+ if (TREE_CODE (v1) != INTEGER_CST
+ || TREE_CODE (v2) != INTEGER_CST
+ || tree_int_cst_compare (v1, v2) != 0)
return 2;
  break;
}
@@ -2469,7 +2487,9 @@ omp_context_selector_set_compare (enum omp_tss_code set, 
tree ctx1, tree ctx2)
  {
tree score1 = OMP_TS_SCORE (ts1);
tree score2 = OMP_TS_SCORE (ts2);
-   if (score1 && score2 && !simple_cst_equal (score1, score2))
+   if ((score1 && score2 && !simple_cst_equal (score1, score2))
+   || (score1 && !score2)
+   || (!score1 && score2))
  return 2;
 
int r = omp_context_selector_props_compare (set, OMP_TS_CODE (ts1),


[gcc r15-7478] OpenMP: Pass a 3-way flag to omp_check_context_selector instead of a bool.

2025-02-11 Thread Sandra Loosemore via Gcc-cvs
https://gcc.gnu.org/g:9a2116f91150cf872e7d4a66036a81ecd2526b48

commit r15-7478-g9a2116f91150cf872e7d4a66036a81ecd2526b48
Author: Sandra Loosemore 
Date:   Sun Feb 9 21:34:35 2025 +

OpenMP: Pass a 3-way flag to omp_check_context_selector instead of a bool.

The OpenMP "begin declare variant" directive has slightly different
requirements for context selectors than regular "declare variant", so
something more than a bool is required to tell the error-checking routine
what to check.

gcc/ChangeLog
* omp-general.cc (omp_check_context_selector): Change
metadirective_p argument to a 3-way flag.  Add extra check for
OMP_CTX_BEGIN_DECLARE_VARIANT.
* omp-general.h (enum omp_ctx_directive): New.
(omp_check_context_selector): Adjust declaration.

gcc/c/ChangeLog
* c-parser.cc (c_finish_omp_declare_variant): Update call to
omp_check_context_selector.
(c_parser_omp_metadirective): Likewise.

gcc/cp/ChangeLog
* parser.cc (cp_finish_omp_declare_variant): Update call to
omp_check_context_selector.
(cp_parser_omp_metadirective): Likewise.

gcc/fortran/ChangeLog
* trans-openmp.cc (gfc_trans_omp_declare_variant): Update call to
omp_check_context_selector.
(gfc_trans_omp_metadirective): Likewise.

Diff:
---
 gcc/c/c-parser.cc   |  6 --
 gcc/cp/parser.cc|  6 --
 gcc/fortran/trans-openmp.cc |  5 +++--
 gcc/omp-general.cc  | 18 +++---
 gcc/omp-general.h   |  6 +-
 5 files changed, 31 insertions(+), 10 deletions(-)

diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc
index 106a5b48093d..62c6bc031d69 100644
--- a/gcc/c/c-parser.cc
+++ b/gcc/c/c-parser.cc
@@ -26982,7 +26982,8 @@ c_finish_omp_declare_variant (c_parser *parser, tree 
fndecl, tree parms)
  ctx  = c_parser_omp_context_selector_specification (parser, parms);
  if (ctx == error_mark_node)
goto fail;
- ctx = omp_check_context_selector (match_loc, ctx, false);
+ ctx = omp_check_context_selector (match_loc, ctx,
+   OMP_CTX_DECLARE_VARIANT);
  if (ctx != error_mark_node && variant != error_mark_node)
{
  if (TREE_CODE (variant) != FUNCTION_DECL)
@@ -29099,7 +29100,8 @@ c_parser_omp_metadirective (c_parser *parser, bool 
*if_p)
 NULL_TREE);
  if (ctx == error_mark_node)
goto error;
- ctx = omp_check_context_selector (match_loc, ctx, true);
+ ctx = omp_check_context_selector (match_loc, ctx,
+   OMP_CTX_METADIRECTIVE);
  if (ctx == error_mark_node)
goto error;
 
diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc
index bd43f885ebe3..9d0970b4d834 100644
--- a/gcc/cp/parser.cc
+++ b/gcc/cp/parser.cc
@@ -50437,7 +50437,8 @@ cp_finish_omp_declare_variant (cp_parser *parser, 
cp_token *pragma_tok,
  ctx = cp_parser_omp_context_selector_specification (parser, true);
  if (ctx == error_mark_node)
goto fail;
- ctx = omp_check_context_selector (match_loc, ctx, false);
+ ctx = omp_check_context_selector (match_loc, ctx,
+   OMP_CTX_DECLARE_VARIANT);
  if (ctx != error_mark_node && variant != error_mark_node)
{
  tree match_loc_node
@@ -51424,7 +51425,8 @@ cp_parser_omp_metadirective (cp_parser *parser, 
cp_token *pragma_tok,
  ctx = cp_parser_omp_context_selector_specification (parser, false);
  if (ctx == error_mark_node)
goto fail;
- ctx = omp_check_context_selector (match_loc, ctx, true);
+ ctx = omp_check_context_selector (match_loc, ctx,
+   OMP_CTX_METADIRECTIVE);
  if (ctx == error_mark_node)
goto fail;
 
diff --git a/gcc/fortran/trans-openmp.cc b/gcc/fortran/trans-openmp.cc
index e9103cd3bac3..580d5837bd5f 100644
--- a/gcc/fortran/trans-openmp.cc
+++ b/gcc/fortran/trans-openmp.cc
@@ -8776,7 +8776,8 @@ gfc_trans_omp_declare_variant (gfc_namespace *ns)
  continue;
}
   set_selectors = omp_check_context_selector
-   (gfc_get_location (&odv->where), set_selectors, false);
+   (gfc_get_location (&odv->where), set_selectors,
+OMP_CTX_DECLARE_VARIANT);
   if (set_selectors != error_mark_node)
{
  if (!variant_proc_sym->attr.implicit_type
@@ -9082,7 +9083,7 @@ gfc_trans_omp_metadirective (gfc_code *code)
   tree ctx = gfc_trans_omp_set_selector (variant->selectors,
 variant->where);
   ctx = omp_check_context_selector (gfc_get_location (&variant->where),
-   ctx, true);
+   

[gcc(refs/users/mikael/heads/refactor_descriptor_v01)] Mise à jour dump bind-c-contiguous-2.f90

2025-02-11 Thread Mikael Morin via Gcc-cvs
https://gcc.gnu.org/g:5565aa25ce55ba39c942c7cc501decf206cd7019

commit 5565aa25ce55ba39c942c7cc501decf206cd7019
Author: Mikael Morin 
Date:   Tue Feb 11 18:07:23 2025 +0100

Mise à jour dump bind-c-contiguous-2.f90

Diff:
---
 gcc/testsuite/gfortran.dg/bind-c-contiguous-2.f90 | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/gcc/testsuite/gfortran.dg/bind-c-contiguous-2.f90 
b/gcc/testsuite/gfortran.dg/bind-c-contiguous-2.f90
index 5b546800e7ff..243c4a57cba4 100644
--- a/gcc/testsuite/gfortran.dg/bind-c-contiguous-2.f90
+++ b/gcc/testsuite/gfortran.dg/bind-c-contiguous-2.f90
@@ -60,12 +60,12 @@ end
 
 ! Copy in + out
 
-! { dg-final { scan-tree-dump-times "__builtin_memcpy \\(\\(void \\*\\) 
xx->data \\+ xx->dtype.elem_len \\* arrayidx.\[0-9\]+, _xx->base_addr \\+ 
shift.\[0-9\]+, xx->dtype.elem_len\\);" 1 "original" } }
+! { dg-final { scan-tree-dump-times {__builtin_memcpy \(\(void \*\) xx->data 
\+ xx->dtype.elem_len \* arrayidx.[0-9]+, _xx->base_addr \+ shift.[0-9]+, 
(?:NON_LVALUE_EXPR <)?xx->dtype.elem_len>?\);} 1 "original" } }
 ! { dg-final { scan-tree-dump-times "xx->data = \\(void \\* restrict\\) 
_xx->base_addr;" 1 "original" } }
-! { dg-final { scan-tree-dump-times "__builtin_memcpy \\(\\(void \\*\\) 
xx->data \\+ xx->dtype.elem_len \\* arrayidx.\[0-9\]+, _xx->base_addr \\+ 
shift.\[0-9\]+, xx->dtype.elem_len\\);" 1 "original" } }
-! { dg-final { scan-tree-dump-times "__builtin_memcpy \\(\\(void \\*\\) 
yy->data \\+ yy->dtype.elem_len \\* arrayidx.\[0-9\]+, _yy->base_addr \\+ 
shift.\[0-9\]+, yy->dtype.elem_len\\);" 1 "original" } }
+! { dg-final { scan-tree-dump-times {__builtin_memcpy \(\(void \*\) xx->data 
\+ xx->dtype.elem_len \* arrayidx.[0-9]+, _xx->base_addr \+ shift.[0-9]+, 
(?:NON_LVALUE_EXPR <)?xx->dtype.elem_len>?\);} 1 "original" } }
+! { dg-final { scan-tree-dump-times {__builtin_memcpy \(\(void \*\) yy->data 
\+ yy->dtype.elem_len \* arrayidx.[0-9]+, _yy->base_addr \+ shift.[0-9]+, 
(?:NON_LVALUE_EXPR <)?yy->dtype.elem_len>?\);} 1 "original" } }
 ! { dg-final { scan-tree-dump-times "yy->data = \\(void \\* restrict\\) 
_yy->base_addr;" 1 "original" } }
-! { dg-final { scan-tree-dump-times "__builtin_memcpy \\(_yy->base_addr \\+ 
shift.\[0-9\]+, \\(void \\*\\) yy->data \\+ yy->dtype.elem_len \\* 
arrayidx.\[0-9\]+, yy->dtype.elem_len\\);" 1 "original" } }
+! { dg-final { scan-tree-dump-times {__builtin_memcpy \(_yy->base_addr \+ 
shift.[0-9]+, \(void \*\) yy->data \+ yy->dtype.elem_len \* arrayidx.[0-9]+, 
(?:NON_LVALUE_EXPR <)?yy->dtype.elem_len>?\);} 1 "original" } }
 
 ! { dg-final { scan-tree-dump-times "zz = 
\\(character\\(kind=1\\)\\\[0:\\\]\\\[1:zz.\[0-9\]+\\\] \\* restrict\\) 
_zz->base_addr;" 1 "original" } }
 ! { dg-final { scan-tree-dump-times "__builtin_memcpy \\(\\(void \\*\\) zz \\+ 
_zz->elem_len \\* arrayidx.\[0-9\]+, _zz->base_addr \\+ shift.\[0-9\]+, 
_zz->elem_len\\);" 1 "original" } }
@@ -73,10 +73,10 @@ end
 
 ! Copy in only
 
-! { dg-final { scan-tree-dump-times "__builtin_memcpy \\(\\(void \\*\\) 
aa->data \\+ aa->dtype.elem_len \\* arrayidx.\[0-9\]+, _aa->base_addr \\+ 
shift.\[0-9\]+, aa->dtype.elem_len\\);" 1 "original" } }
+! { dg-final { scan-tree-dump-times {__builtin_memcpy \(\(void \*\) aa->data 
\+ aa->dtype.elem_len \* arrayidx.[0-9]+, _aa->base_addr \+ shift.[0-9]+, 
(?:NON_LVALUE_EXPR <)?aa->dtype.elem_len>?\);} 1 "original" } }
 
 ! { dg-final { scan-tree-dump-times "aa->data = \\(void \\* restrict\\) 
_aa->base_addr;" 1 "original" } }
-! { dg-final { scan-tree-dump-times "__builtin_memcpy \\(\\(void \\*\\) 
bb->data \\+ bb->dtype.elem_len \\* arrayidx.\[0-9\]+, _bb->base_addr \\+ 
shift.\[0-9\]+, bb->dtype.elem_len\\);" 1 "original" } }
+! { dg-final { scan-tree-dump-times {__builtin_memcpy \(\(void \*\) bb->data 
\+ bb->dtype.elem_len \* arrayidx.[0-9]+, _bb->base_addr \+ shift.[0-9]+, 
(?:NON_LVALUE_EXPR <)?bb->dtype.elem_len>?\);} 1 "original" } }
 ! { dg-final { scan-tree-dump-times "bb->data = \\(void \\* restrict\\) 
_bb->base_addr;" 1 "original" } }
 ! { dg-final { scan-tree-dump-times "cc = 
\\(character\\(kind=1\\)\\\[0:\\\]\\\[1:cc.\[0-9\]+\\\] \\* restrict\\) 
_cc->base_addr;" 1 "original" } }
 ! { dg-final { scan-tree-dump-times "__builtin_memcpy \\(\\(void \\*\\) cc \\+ 
_cc->elem_len \\* arrayidx.\[0-9\]+, _cc->base_addr \\+ shift.\[0-9\]+, 
_cc->elem_len\\);" 1 "original" } }


[gcc(refs/users/mikael/heads/refactor_descriptor_v01)] Mise à jour dumps coarray_poly_*.f90

2025-02-11 Thread Mikael Morin via Gcc-cvs
https://gcc.gnu.org/g:93cb38cd1c37f1454582200643b39bcae3ca4208

commit 93cb38cd1c37f1454582200643b39bcae3ca4208
Author: Mikael Morin 
Date:   Tue Feb 11 18:17:19 2025 +0100

Mise à jour dumps coarray_poly_*.f90

Diff:
---
 gcc/testsuite/gfortran.dg/coarray_poly_4.f90 | 2 +-
 gcc/testsuite/gfortran.dg/coarray_poly_5.f90 | 2 +-
 gcc/testsuite/gfortran.dg/coarray_poly_6.f90 | 2 +-
 gcc/testsuite/gfortran.dg/coarray_poly_7.f90 | 2 +-
 gcc/testsuite/gfortran.dg/coarray_poly_8.f90 | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/gcc/testsuite/gfortran.dg/coarray_poly_4.f90 
b/gcc/testsuite/gfortran.dg/coarray_poly_4.f90
index ff574c1ef650..22bd1c578a38 100644
--- a/gcc/testsuite/gfortran.dg/coarray_poly_4.f90
+++ b/gcc/testsuite/gfortran.dg/coarray_poly_4.f90
@@ -19,4 +19,4 @@ allocate(var%x[*])
 call sub(var%x)
 end subroutine test
 
-! { dg-final { scan-tree-dump-times "sub \\(\\(real\\(kind=4\\) \\*\\) 
var.x.data, var.x.token, 0\\);" 1 "original" } }
+! { dg-final { scan-tree-dump-times {sub \(\(real\(kind=4\) \*\) var.x.data, 
(?:NON_LVALUE_EXPR <)?var.x.token>?, 0\);} 1 "original" } }
diff --git a/gcc/testsuite/gfortran.dg/coarray_poly_5.f90 
b/gcc/testsuite/gfortran.dg/coarray_poly_5.f90
index 8e6142f935df..8c303f0beed6 100644
--- a/gcc/testsuite/gfortran.dg/coarray_poly_5.f90
+++ b/gcc/testsuite/gfortran.dg/coarray_poly_5.f90
@@ -10,4 +10,4 @@ class(t) :: x
 allocate(x%x[*])
 end subroutine test
 
-! { dg-final { scan-tree-dump-times "_gfortran_caf_register \\(4, 1, 
&x->_data->x.token, \\(void \\*\\) &x->_data->x, 0B, 0B, 0\\);" 1 "original" } }
+! { dg-final { scan-tree-dump-times {_gfortran_caf_register \(4, 1, 
&(?:NON_LVALUE_EXPR <)?x->_data->x.token>?, \(void \*\) &x->_data->x, 0B, 0B, 
0\);} 1 "original" } }
diff --git a/gcc/testsuite/gfortran.dg/coarray_poly_6.f90 
b/gcc/testsuite/gfortran.dg/coarray_poly_6.f90
index 344e12b4eff7..f2f084b9038c 100644
--- a/gcc/testsuite/gfortran.dg/coarray_poly_6.f90
+++ b/gcc/testsuite/gfortran.dg/coarray_poly_6.f90
@@ -18,4 +18,4 @@ end
 ! { dg-final { scan-tree-dump-times "foo \\(struct __class_MAIN___T_0_1t & 
restrict x, void \\* restrict caf_token.., integer\\(kind=\[48\]\\) 
caf_offset..\\)" 1 "original" } }
 ! { dg-final { scan-tree-dump-times "bar \\(struct __class_MAIN___T_0_1t \\* 
restrict x, void \\* restrict caf_token.., integer\\(kind=\[48\]\\) 
caf_offset..\\)" 1 "original" } }
 ! { dg-final { scan-tree-dump-times "bar \\(0B, 0B, 0\\);" 1 "original" } }
-! { dg-final { scan-tree-dump-times "foo \\(&class.., y._data.token, 
\\(integer\\(kind=\[48\]\\)\\) class..._data.data - 
\\(integer\\(kind=\[48\]\\)\\) y._data.data\\);" 1 "original" } }
+! { dg-final { scan-tree-dump-times {foo \(&class.., (?:NON_LVALUE_EXPR 
<)?y._data.token>?, \(integer\(kind=[48]\)\) class..._data.data - 
\(integer\(kind=[48]\)\) y._data.data\);} 1 "original" } }
diff --git a/gcc/testsuite/gfortran.dg/coarray_poly_7.f90 
b/gcc/testsuite/gfortran.dg/coarray_poly_7.f90
index d8d83aea39b5..e3bcb5c2476f 100644
--- a/gcc/testsuite/gfortran.dg/coarray_poly_7.f90
+++ b/gcc/testsuite/gfortran.dg/coarray_poly_7.f90
@@ -18,4 +18,4 @@ end
 ! { dg-final { scan-tree-dump-times "foo \\(struct __class_MAIN___T_1_1t & 
restrict x, void \\* restrict caf_token.., integer\\(kind=\[48\]\\) 
caf_offset..\\)" 1 "original" } }
 ! { dg-final { scan-tree-dump-times "bar \\(struct __class_MAIN___T_1_1t \\* 
restrict x, void \\* restrict caf_token.., integer\\(kind=\[48\]\\) 
caf_offset..\\)" 1 "original" } }
 ! { dg-final { scan-tree-dump-times "bar \\(0B, 0B, 0\\);" 1 "original" } }
-! { dg-final { scan-tree-dump-times "foo \\(&class.., y._data.token, 
\\(integer\\(kind=\[48\]\\)\\) class..._data.data - 
\\(integer\\(kind=\[48\]\\)\\) y._data.data\\);" 1 "original" } }
+! { dg-final { scan-tree-dump-times {foo \(&class.., (?:NON_LVALUE_EXPR 
<)?y._data.token>?, \(integer\(kind=[48]\)\) class..._data.data - 
\(integer\(kind=[48]\)\) y._data.data\);} 1 "original" } }
diff --git a/gcc/testsuite/gfortran.dg/coarray_poly_8.f90 
b/gcc/testsuite/gfortran.dg/coarray_poly_8.f90
index abdfc0ca5f82..45ad4655cb62 100644
--- a/gcc/testsuite/gfortran.dg/coarray_poly_8.f90
+++ b/gcc/testsuite/gfortran.dg/coarray_poly_8.f90
@@ -18,4 +18,4 @@ end
 ! { dg-final { scan-tree-dump-times "foo \\(struct __class_MAIN___T_1_1t & 
restrict x, void \\* restrict caf_token.., integer\\(kind=\[48\]\\) 
caf_offset..\\)" 1 "original" } }
 ! { dg-final { scan-tree-dump-times "bar \\(struct __class_MAIN___T_1_1t \\* 
restrict x, void \\* restrict caf_token.., integer\\(kind=\[48\]\\) 
caf_offset..\\)" 1 "original" } }
 ! { dg-final { scan-tree-dump-times "bar \\(0B, 0B, 0\\);" 1 "original" } }
-! { dg-final { scan-tree-dump-times "foo \\(&class.., y._data.token, 
\\(integer\\(kind=\[48\]\\)\\) class..._data.data - 
\\(integer\\(kind=\[48\]\\)\\) y._data.data\\);" 1 "original" } }
+! { dg-final { scan-tree-dump-times {foo \(&class.., (?:NON_LVALUE_EXPR 
<)y._data.token>?, \(integer\(kind=[48]\)\) class..._da

[gcc(refs/users/mikael/heads/refactor_descriptor_v01)] Mise à jour dump coarray_lock_7.f90

2025-02-11 Thread Mikael Morin via Gcc-cvs
https://gcc.gnu.org/g:35716cd0ed273e5fb963a049acaab0ff26a0974d

commit 35716cd0ed273e5fb963a049acaab0ff26a0974d
Author: Mikael Morin 
Date:   Tue Feb 11 18:40:23 2025 +0100

Mise à jour dump coarray_lock_7.f90

Diff:
---
 gcc/testsuite/gfortran.dg/coarray_lock_7.f90 | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/gcc/testsuite/gfortran.dg/coarray_lock_7.f90 
b/gcc/testsuite/gfortran.dg/coarray_lock_7.f90
index 4f4bdde856d9..7e78c5c02bc5 100644
--- a/gcc/testsuite/gfortran.dg/coarray_lock_7.f90
+++ b/gcc/testsuite/gfortran.dg/coarray_lock_7.f90
@@ -29,8 +29,8 @@ end
 
 ! { dg-final { scan-tree-dump-times "_gfortran_caf_register \\(1, 2, \\(void 
\\* \\*\\) &caf_token.., \\(void \\*\\) &desc.., 0B, 0B, 0\\);" 1 "original" } }
 ! { dg-final { scan-tree-dump-times "_gfortran_caf_register \\(25, 2, \\(void 
\\* \\*\\) &caf_token.., \\(void \\*\\) &desc.., 0B, 0B, 0\\);" 1 "original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_register \\(1, 3, 
&three.token, \\(void \\*\\) &three, &stat.., 0B, 0\\);" 1 "original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_register \\(7, 3, 
&four.token, \\(void \\*\\) &four, &stat.., 0B, 0\\);" 1 "original" } }
+! { dg-final { scan-tree-dump-times {_gfortran_caf_register \(1, 3, 
&(?:NON_LVALUE_EXPR <)?three.token>?, \(void \*\) &three, &stat.., 0B, 0\);} 1 
"original" } }
+! { dg-final { scan-tree-dump-times {_gfortran_caf_register \(7, 3, 
&(?:NON_LVALUE_EXPR <)?four.token>?, \(void \*\) &four, &stat.., 0B, 0\);} 1 
"original" } }
 
 ! { dg-final { scan-tree-dump-times "_gfortran_caf_lock \\(caf_token.., 0, 0, 
0B, 0B, 0B, 0\\);" 1 "original" } }
 ! { dg-final { scan-tree-dump-times "_gfortran_caf_unlock \\(caf_token.., 0, 
0, 0B, 0B, 0\\);" 1 "original" } }
@@ -38,9 +38,9 @@ end
 ! { dg-final { scan-tree-dump-times "_gfortran_caf_lock \\(caf_token.., 
.*\\(\\(3 - parm.\\d+.dim\\\[0\\\].lbound\\) \\+ \\(MAX_EXPR 
 \\+ 1\\) 
\\* \\(3 - parm.\\d+.dim\\\[1\\\].lbound\\)\\), 0, 0B, &ii, 0B, 
0\\);|_gfortran_caf_lock \\(caf_token.1, \\(3 - 
parm.\\d+.dim\\\[0\\\].lbound\\) \\+ \\(MAX_EXPR  \\+ 1\\) \\* \\(3 - 
parm.\\d+.dim\\\[1\\\].lbound\\), 0, 0B, &ii, 0B, 0\\);" 1 "original" } }
 ! { dg-final { scan-tree-dump-times "_gfortran_caf_unlock \\(caf_token.., 
.*\\(\\(2 - parm.\\d+.dim\\\[0\\\].lbound\\) \\+ \\(MAX_EXPR 
 \\+ 1\\) 
\\* \\(3 - parm.\\d+.dim\\\[1\\\].lbound\\)\\), 0, &ii, 0B, 
0\\);|_gfortran_caf_unlock \\(caf_token.., \\(2 - 
parm.\\d+.dim\\\[0\\\].lbound\\) \\+ \\(MAX_EXPR  \\+ 1\\) \\* \\(3 - 
parm.\\d+.dim\\\[1\\\].lbound\\), 0, &ii, 0B, 0\\);" 1 "original" } }
 
-! { dg-final { scan-tree-dump-times "_gfortran_caf_lock \\(three.token, 0, 
\\(integer\\(kind=4\\)\\) \\(5 - three.dim\\\[0\\\].lbound\\), 
&acquired.\[0-9\]+, 0B, 0B, 0\\);|_gfortran_caf_lock \\(three.token, 0, 5 - 
three.dim\\\[0\\\].lbound, &acquired.\[0-9\]+, 0B, 0B, 0\\);" 1 "original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_unlock \\(three.token, 0, 
\\(integer\\(kind=4\\)\\) \\(8 - three.dim\\\[0\\\].lbound\\), &ii, 0B, 
0\\);|_gfortran_caf_unlock \\(three.token, 0, 8 - three.dim\\\[0\\\].lbound, 
&ii, 0B, 0\\);" 1 "original" } }
+! { dg-final { scan-tree-dump-times {_gfortran_caf_lock \((?:NON_LVALUE_EXPR 
<)?three.token>?, 0, \(integer\(kind=4\)\) \(5 - three.dim\[0\].lbound\), 
&acquired.[0-9]+, 0B, 0B, 0\);|_gfortran_caf_lock \((?:NON_LVALUE_EXPR 
<)?three.token>?, 0, 5 - three.dim\[0\].lbound, &acquired.[0-9]+, 0B, 0B, 0\);} 
1 "original" } }
+! { dg-final { scan-tree-dump-times {_gfortran_caf_unlock \((?:NON_LVALUE_EXPR 
<)?three.token>?, 0, \(integer\(kind=4\)\) \(8 - three.dim\[0\].lbound\), &ii, 
0B, 0\);|_gfortran_caf_unlock \((?:NON_LVALUE_EXPR <)?three.token>?, 0, 8 - 
three.dim\[0\].lbound, &ii, 0B, 0\);} 1 "original" } }
 
-! { dg-final { scan-tree-dump-times "_gfortran_caf_lock \\(four.token, .*\\(1 
- four.dim\\\[0\\\].lbound\\), \\(integer\\(kind=4\\)\\) \\(7 - 
four.dim\\\[1\\\].lbound\\), &acquired.\[0-9\]+, &ii, 0B, 
0\\);|_gfortran_caf_lock \\(four.token, \[^\n\r]*1 - 
four.dim\\\[0\\\].lbound\\)?, 7 - four.dim\\\[1\\\].lbound, &acquired.\[0-9\]+, 
&ii, 0B, 0\\);" 1 "original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_unlock \\(four.token, 
.*\\(2 - four.dim\\\[0\\\].lbound\\), \\(integer\\(kind=4\\)\\) \\(8 - 
four.dim\\\[1\\\].lbound\\), 0B, 0B, 0\\);|_gfortran_caf_unlock \\(four.token, 
\[^\n\r]*2 - four.dim\\\[0\\\].lbound\\)?, 8 - four.dim\\\[1\\\].lbound, 0B, 
0B, 0\\);" 1 "original" } }
+! { dg-final { scan-tree-dump-times {_gfortran_caf_lock \((?:NON_LVALUE_EXPR 
<)?four.token>?, .*\(1 - four.dim\[0\].lbound\), \(integer\(kind=4\)\) \(7 - 
four.dim\[1\].lbound\), &acquired.[0-9]+, &ii, 0B, 0\);|_gfortran_caf_lock 
\((?:NON_LVALUE_EXPR <)?four.token>?, [^\n\r]*1 - four.dim\[0\].lbound\)?, 7 - 
four.dim\[1\].lbound, &acquired.[0-9]+, &ii, 0B, 0\);} 1 "original" } }
+! { dg-final { scan-tree-dump-times {_gfortran_caf_unlock \((?:NON_LVALUE_EXPR 
<)?four.token>?, .*\(2 - four.dim\[0\

[gcc r15-7480] aarch64: Update fp8 dependencies

2025-02-11 Thread Andrew Carlotti via Gcc-cvs
https://gcc.gnu.org/g:299a8e2dc667e795991bc439d2cad5ea5bd379e2

commit r15-7480-g299a8e2dc667e795991bc439d2cad5ea5bd379e2
Author: Andrew Carlotti 
Date:   Wed Feb 5 17:27:56 2025 +

aarch64: Update fp8 dependencies

We agreed with LLVM developers to not enforce the architectural
dependencies between fp8 multiplication features, and they have already
been removed from LLVM and Binutils.  Remove them from GCC as well.

gcc/ChangeLog:

* config/aarch64/aarch64-option-extensions.def
(SSVE_FP8FMA): Adjust formatting.
(FP8DOT4): Replace FP8FMA dependency with FP8.
(SSVE_FP8DOT4): Replace SSVE_FP8FMA dependency with SME2+FP8.
(FP8DOT2): Replace FP8DOT4 dependency with FP8.
(SSVE_FP8DOT2): Replace SSVE_FP8DOT4 dependency with SME2+FP8.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/pragma_cpp_predefs_4.c: Adjust expected
defines.
* gcc.target/aarch64/simd/vmla_lane_indices_1.c: Modify target
pragmas.
* gcc.target/aarch64/sve/acle/general-c/ternary_mfloat8_1.c:
Ditto.
* 
gcc.target/aarch64/sve/acle/general-c/ternary_mfloat8_lane_group_selection_1.c:
Ditto.
* gcc.target/aarch64/sve2/acle/asm/dot_lane_mf8.c: Ditto.
* gcc.target/aarch64/sve2/acle/asm/dot_mf8.c: Ditto.

Diff:
---
 gcc/config/aarch64/aarch64-option-extensions.def   | 10 +-
 gcc/testsuite/gcc.target/aarch64/pragma_cpp_predefs_4.c|  6 +++---
 gcc/testsuite/gcc.target/aarch64/simd/vmla_lane_indices_1.c|  2 +-
 .../gcc.target/aarch64/sve/acle/general-c/ternary_mfloat8_1.c  |  2 +-
 .../acle/general-c/ternary_mfloat8_lane_group_selection_1.c|  2 +-
 gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/dot_lane_mf8.c  |  4 ++--
 gcc/testsuite/gcc.target/aarch64/sve2/acle/asm/dot_mf8.c   |  4 ++--
 7 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/gcc/config/aarch64/aarch64-option-extensions.def 
b/gcc/config/aarch64/aarch64-option-extensions.def
index cc42bd518dca..aa8d315c240f 100644
--- a/gcc/config/aarch64/aarch64-option-extensions.def
+++ b/gcc/config/aarch64/aarch64-option-extensions.def
@@ -261,17 +261,17 @@ AARCH64_OPT_EXTENSION("fp8", FP8, (SIMD), (), (), "f8cvt")
 
 AARCH64_OPT_EXTENSION("fp8fma", FP8FMA, (FP8), (), (), "f8fma")
 
-AARCH64_OPT_EXTENSION("ssve-fp8fma", SSVE_FP8FMA, (SME2,FP8), (), (), 
"smesf8fma")
+AARCH64_OPT_EXTENSION("ssve-fp8fma", SSVE_FP8FMA, (SME2, FP8), (), (), 
"smesf8fma")
 
 AARCH64_OPT_EXTENSION("faminmax", FAMINMAX, (SIMD), (), (), "faminmax")
 
-AARCH64_OPT_EXTENSION("fp8dot4", FP8DOT4, (FP8FMA), (), (), "f8dp4")
+AARCH64_OPT_EXTENSION("fp8dot4", FP8DOT4, (FP8), (), (), "f8dp4")
 
-AARCH64_OPT_EXTENSION("ssve-fp8dot4", SSVE_FP8DOT4, (SSVE_FP8FMA), (), (), 
"smesf8dp4")
+AARCH64_OPT_EXTENSION("ssve-fp8dot4", SSVE_FP8DOT4, (SME2, FP8), (), (), 
"smesf8dp4")
 
-AARCH64_OPT_EXTENSION("fp8dot2", FP8DOT2, (FP8DOT4), (), (), "f8dp2")
+AARCH64_OPT_EXTENSION("fp8dot2", FP8DOT2, (FP8), (), (), "f8dp2")
 
-AARCH64_OPT_EXTENSION("ssve-fp8dot2", SSVE_FP8DOT2, (SSVE_FP8DOT4), (), (), 
"smesf8dp2")
+AARCH64_OPT_EXTENSION("ssve-fp8dot2", SSVE_FP8DOT2, (SME2, FP8), (), (), 
"smesf8dp2")
 
 AARCH64_OPT_EXTENSION("lut", LUT, (SIMD), (), (), "lut")
 
diff --git a/gcc/testsuite/gcc.target/aarch64/pragma_cpp_predefs_4.c 
b/gcc/testsuite/gcc.target/aarch64/pragma_cpp_predefs_4.c
index 0dcfbec05bad..97d68b94512e 100644
--- a/gcc/testsuite/gcc.target/aarch64/pragma_cpp_predefs_4.c
+++ b/gcc/testsuite/gcc.target/aarch64/pragma_cpp_predefs_4.c
@@ -292,7 +292,7 @@
 #ifndef __ARM_FEATURE_FP8
 #error Foo
 #endif
-#ifndef __ARM_FEATURE_FP8FMA
+#ifdef __ARM_FEATURE_FP8FMA
 #error Foo
 #endif
 #ifndef __ARM_FEATURE_FP8DOT4
@@ -306,10 +306,10 @@
 #ifndef __ARM_FEATURE_FP8
 #error Foo
 #endif
-#ifndef __ARM_FEATURE_FP8FMA
+#ifdef __ARM_FEATURE_FP8FMA
 #error Foo
 #endif
-#ifndef __ARM_FEATURE_FP8DOT4
+#ifdef __ARM_FEATURE_FP8DOT4
 #error Foo
 #endif
 #ifndef __ARM_FEATURE_FP8DOT2
diff --git a/gcc/testsuite/gcc.target/aarch64/simd/vmla_lane_indices_1.c 
b/gcc/testsuite/gcc.target/aarch64/simd/vmla_lane_indices_1.c
index d1a69f4ba541..739ff4c6a75a 100644
--- a/gcc/testsuite/gcc.target/aarch64/simd/vmla_lane_indices_1.c
+++ b/gcc/testsuite/gcc.target/aarch64/simd/vmla_lane_indices_1.c
@@ -2,7 +2,7 @@
 
 #include "arm_neon.h"
 
-#pragma GCC target "+fp8dot4+fp8dot2"
+#pragma GCC target "+fp8fma"
 
 void
 test(float16x4_t f16, float16x8_t f16q, float32x2_t f32,
diff --git 
a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/ternary_mfloat8_1.c 
b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/ternary_mfloat8_1.c
index 9ad789a8ad2c..fa0df46db226 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/ternary_mfloat8_1.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/ternary_mfloat8_1.c
@@ -2,7 +2,7 @@
 
 #include 
 
-#pragma GCC target ("arch=armv8.2

[gcc r15-7479] testsuite: Enable reduced parallel batch sizes

2025-02-11 Thread Andrew Carlotti via Gcc-cvs
https://gcc.gnu.org/g:00d943bf840386bd6e3e8a04554df5b528722e46

commit r15-7479-g00d943bf840386bd6e3e8a04554df5b528722e46
Author: Andrew Carlotti 
Date:   Tue Feb 4 19:45:31 2025 +

testsuite: Enable reduced parallel batch sizes

Various aarch64 tests attempt to reduce the batch size for parallel test
execution to a single test per batch, but it looks like the necessary
changes to gcc_parallel_test_run_p were accidentally omitted when the
aarch64-*-acle-asm.exp files were merged.  This patch corrects that
omission.

This does have a measurable performance impact when running a limited
number of tests.  For example, in aarch64-sve-acle-asm.exp the use of
torture options results in 16 compiler executions for each test; when
running two such tests I observed a total test duration of 3m39 without
this patch, and 1m55 with the patch.  A full batch of 10 tests would
have taken over 15 minutes to run on this machine.

gcc/testsuite/ChangeLog:

* lib/gcc-defs.exp
(gcc_runtest_parallelize_limit_minor): New global variable.
(gcc_parallel_test_run_p): Use new variable for batch size.

Diff:
---
 gcc/testsuite/lib/gcc-defs.exp | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/gcc/testsuite/lib/gcc-defs.exp b/gcc/testsuite/lib/gcc-defs.exp
index 29403d7317c7..2f8b7d488691 100644
--- a/gcc/testsuite/lib/gcc-defs.exp
+++ b/gcc/testsuite/lib/gcc-defs.exp
@@ -172,6 +172,7 @@ if { [info exists env(GCC_RUNTEST_PARALLELIZE_DIR)] \
  && [info procs gcc_parallelize_saved_runtest_file_p] == [list] } then {
 global gcc_runtest_parallelize_counter
 global gcc_runtest_parallelize_counter_minor
+global gcc_runtest_parallelize_limit_minor
 global gcc_runtest_parallelize_enable
 global gcc_runtest_parallelize_dir
 global gcc_runtest_parallelize_last
@@ -212,6 +213,7 @@ if { [info exists env(GCC_RUNTEST_PARALLELIZE_DIR)] \
 #and investigate if they don't.
 set gcc_runtest_parallelize_counter 0
 set gcc_runtest_parallelize_counter_minor 0
+set gcc_runtest_parallelize_limit_minor 10
 set gcc_runtest_parallelize_enable 1
 set gcc_runtest_parallelize_dir [getenv GCC_RUNTEST_PARALLELIZE_DIR]
 set gcc_runtest_parallelize_last 0
@@ -219,6 +221,7 @@ if { [info exists env(GCC_RUNTEST_PARALLELIZE_DIR)] \
 proc gcc_parallel_test_run_p { testcase } {
global gcc_runtest_parallelize_counter
global gcc_runtest_parallelize_counter_minor
+   global gcc_runtest_parallelize_limit_minor
global gcc_runtest_parallelize_enable
global gcc_runtest_parallelize_dir
global gcc_runtest_parallelize_last
@@ -228,10 +231,10 @@ if { [info exists env(GCC_RUNTEST_PARALLELIZE_DIR)] \
}
 
# Only test the filesystem every 10th iteration
-   incr gcc_runtest_parallelize_counter_minor
-   if { $gcc_runtest_parallelize_counter_minor == 10 } {
+   if { $gcc_runtest_parallelize_counter_minor >= 
$gcc_runtest_parallelize_limit_minor } {
set gcc_runtest_parallelize_counter_minor 0
}
+   incr gcc_runtest_parallelize_counter_minor
if { $gcc_runtest_parallelize_counter_minor != 1 } {
#verbose -log "gcc_parallel_test_run_p $testcase 
$gcc_runtest_parallelize_counter $gcc_runtest_parallelize_last"
return $gcc_runtest_parallelize_last


[gcc r15-7472] tree-optimization/118817 - missed folding of PRE inserted code

2025-02-11 Thread Richard Biener via Gcc-cvs
https://gcc.gnu.org/g:0a1d2ea57722c248777e1130de076e28c443ff8b

commit r15-7472-g0a1d2ea57722c248777e1130de076e28c443ff8b
Author: Richard Biener 
Date:   Tue Feb 11 10:29:18 2025 +0100

tree-optimization/118817 - missed folding of PRE inserted code

When PRE inserts code it is not fully folded with following SSA
edges which can cause missed optimizations since the next fully
folding pass is way ahead, after strlen which in the PRs case leads
to diagnostics emitted on dead code.

The following mitigates the missed expression canonicalization that
happens during PHI translation where to be inserted expressions are
calculated.  It is largely refactoring and eliminating the single
use of fully_constant_expression and otherwise leverages the
work already done by vn_nary_simplify by updating the NARY with
the simplified expression.

PR tree-optimization/118817
* tree-ssa-pre.cc (fully_constant_expression): Fold into
the single caller.
(phi_translate_1): Refactor folded in fully_constant_expression.
* tree-ssa-sccvn.cc (vn_nary_simplify): Update the NARY with
the simplified expression.

* g++.dg/lto/pr118817_0.C: New testcase.

Diff:
---
 gcc/testsuite/g++.dg/lto/pr118817_0.C |  17 ++
 gcc/tree-ssa-pre.cc   | 111 --
 gcc/tree-ssa-sccvn.cc |  13 +++-
 3 files changed, 65 insertions(+), 76 deletions(-)

diff --git a/gcc/testsuite/g++.dg/lto/pr118817_0.C 
b/gcc/testsuite/g++.dg/lto/pr118817_0.C
new file mode 100644
index ..ae65f34504e8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/pr118817_0.C
@@ -0,0 +1,17 @@
+// { dg-lto-do link }
+// { dg-lto-options { { -O3 -fPIC -flto -shared -std=c++20 -Wall } } }
+// { dg-require-effective-target fpic }
+// { dg-require-effective-target shared }
+
+#include 
+#include 
+#include 
+
+int func()
+{
+  auto strVec = std::make_unique>();
+  strVec->emplace_back("One");
+  strVec->emplace_back("Two");
+  strVec->emplace_back("Three");
+  return 0;
+}
diff --git a/gcc/tree-ssa-pre.cc b/gcc/tree-ssa-pre.cc
index 735893bb191e..ecf45d29e769 100644
--- a/gcc/tree-ssa-pre.cc
+++ b/gcc/tree-ssa-pre.cc
@@ -1185,41 +1185,6 @@ get_or_alloc_expr_for_constant (tree constant)
   return newexpr;
 }
 
-/* Return the folded version of T if T, when folded, is a gimple
-   min_invariant or an SSA name.  Otherwise, return T.  */
-
-static pre_expr
-fully_constant_expression (pre_expr e)
-{
-  switch (e->kind)
-{
-case CONSTANT:
-  return e;
-case NARY:
-  {
-   vn_nary_op_t nary = PRE_EXPR_NARY (e);
-   tree res = vn_nary_simplify (nary);
-   if (!res)
- return e;
-   if (is_gimple_min_invariant (res))
- return get_or_alloc_expr_for_constant (res);
-   if (TREE_CODE (res) == SSA_NAME)
- return get_or_alloc_expr_for_name (res);
-   return e;
-  }
-case REFERENCE:
-  {
-   vn_reference_t ref = PRE_EXPR_REFERENCE (e);
-   tree folded;
-   if ((folded = fully_constant_vn_reference_p (ref)))
- return get_or_alloc_expr_for_constant (folded);
-   return e;
-  }
-default:
-  return e;
-}
-}
-
 /* Translate the VUSE backwards through phi nodes in E->dest, so that
it has the value it would have in E->src.  Set *SAME_VALID to true
in case the new vuse doesn't change the value id of the OPERANDS.  */
@@ -1443,57 +1408,55 @@ phi_translate_1 (bitmap_set_t dest,
  }
if (changed)
  {
-   pre_expr constant;
unsigned int new_val_id;
 
-   PRE_EXPR_NARY (expr) = newnary;
-   constant = fully_constant_expression (expr);
-   PRE_EXPR_NARY (expr) = nary;
-   if (constant != expr)
+   /* Try to simplify the new NARY.  */
+   tree res = vn_nary_simplify (newnary);
+   if (res)
  {
+   if (is_gimple_min_invariant (res))
+ return get_or_alloc_expr_for_constant (res);
+
/* For non-CONSTANTs we have to make sure we can eventually
   insert the expression.  Which means we need to have a
   leader for it.  */
-   if (constant->kind != CONSTANT)
+   gcc_assert (TREE_CODE (res) == SSA_NAME);
+
+   /* Do not allow simplifications to non-constants over
+  backedges as this will likely result in a loop PHI node
+  to be inserted and increased register pressure.
+  See PR77498 - this avoids doing predcoms work in
+  a less efficient way.  */
+   if (e->flags & EDGE_DFS_BACK)
+ ;
+   else
  {
-   /* Do not allow simplifications to non-constants over
-  backedges as this will likely result in a loop PHI node
-  

[gcc r15-7476] lto: Add an entry for cold attribute to lto_gnu_attributes

2025-02-11 Thread Martin Jambor via Gcc-cvs
https://gcc.gnu.org/g:4abac2ffdb071ca9337e4f31fa79cd38df1ac7c3

commit r15-7476-g4abac2ffdb071ca9337e4f31fa79cd38df1ac7c3
Author: Martin Jambor 
Date:   Tue Feb 11 16:39:56 2025 +0100

lto: Add an entry for cold attribute to lto_gnu_attributes

PR 118125 is a performance regression stemming from the fact that we
lose the cold attribute of our __builtin_unreachable.  The attribute
is simply and silently dropped on the floor by decl_attributes (in
attribs.cc) in the process of building decls for builtins because it
cannot look it up in the gnu attribute name space by
lookup_scoped_attribute_spec.  For that not to happen it must be in
lto_gnu_attributes and this patch adds it there.

In comment 13 of the bug Andrew identified other attributes which are
in builtin-attrs.def but missing in lto_gnu_attributes but apart from
cold it seems that they are either not used in builtins.def or are
used in DEF_LIB_BUILTIN which I guess might be less critical?
Eventually I decided to go for the most simple of patches and only add
things if they are requested.  For the same reason I also did not add
any checking to the attribute "handle" callback or any exclusion check.
They seem to be mostly relevant before LTO FE kicks in to me, but
again, I'm happy to add any if they seem to be useful.

Since Ian fixed PR 118746, the same issue has also been fixed in the
Go front-end and so I have added a simple checking assert to the
redirect_to_unreachable function to make sure it has the intended
effect.

gcc/ChangeLog:

2025-02-03  Martin Jambor  

PR lto/118125
* ipa-fnsummary.cc (redirect_to_unreachable): Add checking assert
that the builtin_unreachable decl has attribute cold.

gcc/lto/ChangeLog:

2025-02-03  Martin Jambor  

PR lto/118125
* lto-lang.cc (lto_gnu_attributes): Add an entry for cold attribute.
(handle_cold_attribute): New function.

Diff:
---
 gcc/ipa-fnsummary.cc |  3 +++
 gcc/lto/lto-lang.cc  | 13 +
 2 files changed, 16 insertions(+)

diff --git a/gcc/ipa-fnsummary.cc b/gcc/ipa-fnsummary.cc
index 33f19365ec36..4c062fe8a0e2 100644
--- a/gcc/ipa-fnsummary.cc
+++ b/gcc/ipa-fnsummary.cc
@@ -255,6 +255,9 @@ redirect_to_unreachable (struct cgraph_edge *e)
   struct cgraph_node *target
 = cgraph_node::get_create (builtin_decl_unreachable ());
 
+  gcc_checking_assert (lookup_attribute ("cold",
+DECL_ATTRIBUTES (target->decl)));
+
   if (e->speculative)
 e = cgraph_edge::resolve_speculation (e, target->decl);
   else if (!e->callee)
diff --git a/gcc/lto/lto-lang.cc b/gcc/lto/lto-lang.cc
index 652d7fc5e30d..e41b548b3983 100644
--- a/gcc/lto/lto-lang.cc
+++ b/gcc/lto/lto-lang.cc
@@ -60,6 +60,7 @@ static tree ignore_attribute (tree *, tree, tree, int, bool 
*);
 static tree handle_format_attribute (tree *, tree, tree, int, bool *);
 static tree handle_fnspec_attribute (tree *, tree, tree, int, bool *);
 static tree handle_format_arg_attribute (tree *, tree, tree, int, bool *);
+static tree handle_cold_attribute (tree *, tree, tree, int, bool *);
 
 /* Helper to define attribute exclusions.  */
 #define ATTR_EXCL(name, function, type, variable)  \
@@ -128,6 +129,8 @@ static const attribute_spec lto_gnu_attributes[] =
  handle_sentinel_attribute, NULL },
   { "type generic",   0, 0, false, true, true, false,
  handle_type_generic_attribute, NULL },
+  { "cold",  0, 0, false,  false, false, false,
+ handle_cold_attribute, NULL },
   { "fn spec",   1, 1, false, true, true, false,
  handle_fnspec_attribute, NULL },
   { "transaction_pure",  0, 0, false, true, true, false,
@@ -598,6 +601,16 @@ handle_fnspec_attribute (tree *node ATTRIBUTE_UNUSED, tree 
ARG_UNUSED (name),
   return NULL_TREE;
 }
 
+/* Handle a "cold" attribute; arguments as in
+   struct attribute_spec.handler.  */
+
+static tree
+handle_cold_attribute (tree *, tree, tree, int, bool *)
+{
+  /* Nothing to be done here.  */
+  return NULL_TREE;
+}
+
 /* Cribbed from c-common.cc.  */
 
 static void


[gcc r15-7475] c++: Reject cdtors and conversion operators with a single * as return type [PR118304, PR118306]

2025-02-11 Thread Simon Martin via Gcc-cvs
https://gcc.gnu.org/g:c74e7f651a014d59631361bcc9be05d797928c5c

commit r15-7475-gc74e7f651a014d59631361bcc9be05d797928c5c
Author: Simon Martin 
Date:   Tue Feb 11 15:59:02 2025 +0100

c++: Reject cdtors and conversion operators with a single * as return type 
[PR118304, PR118306]

We currently accept the following constructor declaration (clang, EDG
and MSVC do as well), and ICE on the destructor declaration

=== cut here ===
struct A {
  *A ();
  ~A () = default;
};
=== cut here ===

The problem is that we end up in grokdeclarator with a cp_declarator of
kind cdk_pointer but no type, and we happily go through (if we have a
reference instead we eventually error out trying to form a reference to
void).

This patch makes sure that grokdeclarator errors out and strips the
invalid declarator when processing a cdtor (or a conversion operator
with no return type specified) with a declarator representing a pointer
or a reference type.

PR c++/118306
PR c++/118304

gcc/cp/ChangeLog:

* decl.cc (maybe_strip_indirect_ref): New.
(check_special_function_return_type): Take declarator as input.
Call maybe_strip_indirect_ref and error out if it returns true.
(grokdeclarator): Update call to
check_special_function_return_type.

gcc/testsuite/ChangeLog:

* g++.old-deja/g++.jason/operator.C: Adjust bogus test
expectation (char** vs char*).
* g++.dg/parse/constructor4.C: New test.
* g++.dg/parse/constructor5.C: New test.
* g++.dg/parse/conv_op2.C: New test.
* g++.dg/parse/default_to_int.C: New test.

Diff:
---
 gcc/cp/decl.cc  | 50 +--
 gcc/testsuite/g++.dg/parse/constructor4.C   | 54 +
 gcc/testsuite/g++.dg/parse/constructor5.C   | 48 ++
 gcc/testsuite/g++.dg/parse/conv_op2.C   | 10 +
 gcc/testsuite/g++.dg/parse/default_to_int.C | 37 +
 gcc/testsuite/g++.old-deja/g++.jason/operator.C |  2 +-
 6 files changed, 187 insertions(+), 14 deletions(-)

diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc
index 84abc17ade0f..552a7a2ec546 100644
--- a/gcc/cp/decl.cc
+++ b/gcc/cp/decl.cc
@@ -101,7 +101,8 @@ static void end_cleanup_fn (void);
 static tree cp_make_fname_decl (location_t, tree, int);
 static void initialize_predefined_identifiers (void);
 static tree check_special_function_return_type
-   (special_function_kind, tree, tree, int, const location_t*);
+   (special_function_kind, tree, tree, int, const cp_declarator**,
+   const location_t*);
 static tree push_cp_library_fn (enum tree_code, tree, int);
 static tree build_cp_library_fn (tree, enum tree_code, tree, int);
 static void store_parm_decls (tree);
@@ -12441,10 +12442,27 @@ smallest_type_location (const cp_decl_specifier_seq 
*declspecs)
   return smallest_type_location (type_quals, declspecs->locations);
 }
 
-/* Check that it's OK to declare a function with the indicated TYPE
-   and TYPE_QUALS.  SFK indicates the kind of special function (if any)
-   that this function is.  OPTYPE is the type given in a conversion
-   operator declaration, or the class type for a constructor/destructor.
+/* Returns whether DECLARATOR represented a pointer or a reference and if so,
+   strip out the pointer/reference declarator(s).  */
+
+static bool
+maybe_strip_indirect_ref (const cp_declarator** declarator)
+{
+  bool indirect_ref_p = false;
+  while (declarator && *declarator
+&& ((*declarator)->kind == cdk_pointer
+|| (*declarator)->kind == cdk_reference))
+{
+  indirect_ref_p = true;
+  *declarator = (*declarator)->declarator;
+}
+  return indirect_ref_p;
+}
+
+/* Check that it's OK to declare a function with the indicated TYPE, TYPE_QUALS
+   and DECLARATOR.  SFK indicates the kind of special function (if any) that
+   this function is.  OPTYPE is the type given in a conversion operator
+   declaration, or the class type for a constructor/destructor.
Returns the actual return type of the function; that may be different
than TYPE if an error occurs, or for certain special functions.  */
 
@@ -12453,13 +12471,18 @@ check_special_function_return_type 
(special_function_kind sfk,
tree type,
tree optype,
int type_quals,
+   const cp_declarator** declarator,
const location_t* locations)
 {
+  gcc_assert (declarator);
+  location_t rettype_loc = (type
+   ? smallest_type_location (type_quals, locations)
+   : (*declarator)->id_loc);
   switch (sfk)
 {
 case sfk_constructor:
-  if (type)
-   error_at (sm

[gcc/devel/omp/gcc-14] Fortran/OpenMP: Add location data to 'sorry' [PR118740]

2025-02-11 Thread Tobias Burnus via Gcc-cvs
https://gcc.gnu.org/g:5e61f141689100654d0132be2fce0b6ef875e004

commit 5e61f141689100654d0132be2fce0b6ef875e004
Author: Tobias Burnus 
Date:   Wed Feb 5 14:03:47 2025 +0100

Fortran/OpenMP: Add location data to 'sorry' [PR118740]

PR fortran/118740

gcc/fortran/ChangeLog:

* openmp.cc (gfc_match_omp_context_selector, 
match_omp_metadirective):
Change sorry to sorry_at and use gfc_current_locus as location.
* trans-openmp.cc (gfc_trans_omp_clauses): Likewise, but use 
n->where.

gcc/testsuite/ChangeLog:

* gfortran.dg/gomp/append_args-2.f90: Update for line change.

(cherry picked from commit 6f95af4f22b641fbb3509f1436bce811d4e4acad)

Diff:
---
 gcc/fortran/ChangeLog.omp| 10 ++
 gcc/fortran/openmp.cc|  6 --
 gcc/fortran/trans-openmp.cc  |  8 +---
 gcc/testsuite/ChangeLog.omp  |  8 
 gcc/testsuite/gfortran.dg/gomp/append_args-2.f90 |  2 +-
 5 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/gcc/fortran/ChangeLog.omp b/gcc/fortran/ChangeLog.omp
index cab0b2b2193c..56c8ee2b2fc0 100644
--- a/gcc/fortran/ChangeLog.omp
+++ b/gcc/fortran/ChangeLog.omp
@@ -1,3 +1,13 @@
+2025-02-12  Tobias Burnus  
+
+   Backported from master:
+   2025-02-05  Tobias Burnus  
+
+   PR fortran/118740
+   * openmp.cc (gfc_match_omp_context_selector, match_omp_metadirective):
+   Change sorry to sorry_at and use gfc_current_locus as location.
+   * trans-openmp.cc (gfc_trans_omp_clauses): Likewise, but use n->where.
+
 2025-02-12  Tobias Burnus  
 
Backported from master:
diff --git a/gcc/fortran/openmp.cc b/gcc/fortran/openmp.cc
index 6894f638100c..71f148e45c2f 100644
--- a/gcc/fortran/openmp.cc
+++ b/gcc/fortran/openmp.cc
@@ -6806,7 +6806,8 @@ gfc_match_omp_context_selector (gfc_omp_set_selector *oss,
/* FIXME: The "requires" selector was added in OpenMP 5.1.
   Currently only the now-deprecated syntax
   from OpenMP 5.0 is supported.  */
-   sorry ("% selector is not supported yet");
+   sorry_at (gfc_get_location (&gfc_current_locus),
+ "% selector is not supported yet");
return MATCH_ERROR;
  }
else
@@ -7200,7 +7201,8 @@ match_omp_metadirective (bool begin_p)
   gfc_matching_omp_context_selector = false;
 
   if (is_omp_declarative_stmt (directive))
-   sorry ("declarative directive variants are not supported");
+   sorry_at (gfc_get_location (&gfc_current_locus),
+ "declarative directive variants are not supported");
 
   if (gfc_error_flag_test ())
{
diff --git a/gcc/fortran/trans-openmp.cc b/gcc/fortran/trans-openmp.cc
index e15b49929b04..09d237617b44 100644
--- a/gcc/fortran/trans-openmp.cc
+++ b/gcc/fortran/trans-openmp.cc
@@ -5298,7 +5298,8 @@ gfc_trans_omp_clauses (stmtblock_t *block, 
gfc_omp_clauses *clauses,
  if (openacc && n->sym->ts.type == BT_CLASS)
{
  if (n->sym->attr.optional)
-   sorry ("optional class parameter");
+   sorry_at (gfc_get_location (&n->where),
+ "optional class parameter");
  tree ptr = gfc_class_data_get (decl);
  ptr = build_fold_indirect_ref (ptr);
  OMP_CLAUSE_DECL (node) = ptr;
@@ -5784,7 +5785,8 @@ gfc_trans_omp_clauses (stmtblock_t *block, 
gfc_omp_clauses *clauses,
}
}
  else
-   sorry ("unhandled expression type");
+   sorry_at (gfc_get_location (&n->where),
+ "unhandled expression type");
}
 
  tree inner = se.expr;
@@ -6133,7 +6135,7 @@ gfc_trans_omp_clauses (stmtblock_t *block, 
gfc_omp_clauses *clauses,
gcc_unreachable ();
}
  else
-   sorry ("unhandled expression");
+   sorry_at (gfc_get_location (&n->where), "unhandled expression");
 
  finalize_map_clause:
 
diff --git a/gcc/testsuite/ChangeLog.omp b/gcc/testsuite/ChangeLog.omp
index c6d70fadbb1c..6a13a2810636 100644
--- a/gcc/testsuite/ChangeLog.omp
+++ b/gcc/testsuite/ChangeLog.omp
@@ -1,3 +1,11 @@
+2025-02-12  Tobias Burnus  
+
+   Backported from master:
+   2025-02-05  Tobias Burnus  
+
+   PR fortran/118740
+   * gfortran.dg/gomp/append_args-2.f90: Update for line change.
+
 2025-01-30  Tobias Burnus  
 
Backported from master:
diff --git a/gcc/testsuite/gfortran.dg/gomp/append_args-2.f90 
b/gcc/testsuite/gfortran.dg/gomp/append_args-2.f90
index a20f610a03dc..7a68977ed4d0 100644
--- a/gcc/tes

[gcc/devel/omp/gcc-14] fortran/trans-openmp.cc: Use the correct member in gfc_omp_namelist [PR118745]

2025-02-11 Thread Tobias Burnus via Gcc-cvs
https://gcc.gnu.org/g:4f0432cf258159b9055e6ef0cf5b63d6773a85fd

commit 4f0432cf258159b9055e6ef0cf5b63d6773a85fd
Author: Tobias Burnus 
Date:   Wed Feb 5 08:44:41 2025 +0100

fortran/trans-openmp.cc: Use the correct member in gfc_omp_namelist 
[PR118745]

gcc/fortran/ChangeLog:

PR fortran/118745
* trans-openmp.cc (gfc_trans_omp_declare_variant): Use
append_args_list in the condition for the append_arg location.

(cherry picked from commit 3a5882707df50ed29905b3c47cbaa0868ea248c9)

Diff:
---
 gcc/fortran/ChangeLog.omp   | 9 +
 gcc/fortran/trans-openmp.cc | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/gcc/fortran/ChangeLog.omp b/gcc/fortran/ChangeLog.omp
index a5d7bbfed544..cab0b2b2193c 100644
--- a/gcc/fortran/ChangeLog.omp
+++ b/gcc/fortran/ChangeLog.omp
@@ -1,3 +1,12 @@
+2025-02-12  Tobias Burnus  
+
+   Backported from master:
+   2025-02-05  Tobias Burnus  
+
+   PR fortran/118745
+   * trans-openmp.cc (gfc_trans_omp_declare_variant): Use
+   append_args_list in the condition for the append_arg location.
+
 2025-01-30  Tobias Burnus  
 
Backported from master:
diff --git a/gcc/fortran/trans-openmp.cc b/gcc/fortran/trans-openmp.cc
index e79794d1859e..e15b49929b04 100644
--- a/gcc/fortran/trans-openmp.cc
+++ b/gcc/fortran/trans-openmp.cc
@@ -11386,7 +11386,7 @@ gfc_trans_omp_declare_variant (gfc_namespace *ns)
last_arg->next = extra_arg;
  else if (extra_arg)
variant_proc_sym->formal = extra_arg;
- locus *loc = (odv->adjust_args_list
+ locus *loc = (odv->append_args_list
? &odv->append_args_list->where :  &odv->where);
  int nextra_arg = 0;
  for (; extra_arg; extra_arg = extra_arg->next)


[gcc/devel/omp/gcc-14] (65 commits) Merge remote-tracking branch 'origin/releases/gcc-14' into

2025-02-11 Thread Tobias Burnus via Gcc-cvs
The branch 'devel/omp/gcc-14' was updated to point to:

 29d03adf0a75... Merge remote-tracking branch 'origin/releases/gcc-14' into 

It previously pointed to:

 5e61f1416891... Fortran/OpenMP: Add location data to 'sorry' [PR118740]

Diff:

Summary of changes (added commits):
---

  29d03ad... Merge remote-tracking branch 'origin/releases/gcc-14' into 
  0075e4a... Daily bump. (*)
  5f47dc6... x86: Correct ASM_OUTPUT_SYMBOL_REF (*)
  cec0326... i386: Fix AVX512BW intrin header with __OPTIMIZE__ [PR 1188 (*)
  818b5ca... Daily bump. (*)
  7cb0224... i386: Fix ICE with conditional QI/HI vector maxmin [PR11877 (*)
  08bfa32... c++: Fix up name independent decl in structured binding han (*)
  6cd1daf... c++: Don't use CLEANUP_EH_ONLY for new expression cleanup [ (*)
  6f5ada5... c++: Allow constexpr reads from volatile std::nullptr_t obj (*)
  ab9518d... loop-iv, riscv: Fix get_biv_step_1 for RISC-V [PR117506] (*)
  916daed... icf: Compare call argument types in certain cases and asm o (*)
  3f475f4... niter: Make build_cltz_expr more robust [PR118689] (*)
  acd0e21... d: give dependency files better filenames [PR118477] (*)
  b7553f7... c++: Return false from __is_bounded_array for zero-sized ar (*)
  1dac899... combine: Fix up make_extraction [PR118638] (*)
  15e66f7... c++: Only destruct elts of array for new expression if exce (*)
  7a369b6... tree-assume: Fix UB in assume_query [PR118605] (*)
  2c9ebb8... builtins: Store unspecified value to *exp for inf/nan [PR11 (*)
  2349c6a... match.pd: Fix (FTYPE) N CMP (FTYPE) M optimization for GENE (*)
  0faffd5... vec.h: Properly destruct elements in auto_vec auto storage  (*)
  282dedf... Daily bump. (*)
  7968492... libgcc: On FreeBSD use GCC's crt objects for static linking (*)
  f93541f... Daily bump. (*)
  4098d67... Daily bump. (*)
  1cd744a... Fortran:  FIx ICE in associate with elemental function [PR1 (*)
  4d4c5ec... Fortran: Fix error recovery for bad component arrayspecs [P (*)
  373e2db... Daily bump. (*)
  ca652ae... Fortran: host association issue with symbol in COMMON block (*)
  9a09fc9... LoongArch: Fix ICE caused by illegal calls to builtin funct (*)
  8bca14a... Daily bump. (*)
  6a4df91... RTEMS: Add Cortex-M33 multilib (*)
  6f08060... Daily bump. (*)
  65ecfba... Fortran: F2008 passing of internal procs to a proc pointer  (*)
  b0bb0d9... Daily bump. (*)
  1e77549... options: Adjust cl_optimization_compare to avoid checking I (*)
  c2b2e9c... Daily bump. (*)
  f89f3e5... Daily bump. (*)
  8c79b66... Ada: Fix segfault on uninitialized variable as operand of p (*)
  7bc54a8... Daily bump. (*)
  63ea47f... Fortran: fix bogus diagnostics on renamed interface import  (*)
  58ad709... Daily bump. (*)
  a0550ff... Daily bump. (*)
  b53d19a... Fortran: fix passing of component ref to assumed-rank dummy (*)
  50c111e... testsuite/118127: Pass fortran tests on ppc64le for IEEE128 (*)
  f0420cc... libstdc++: Fix views::transform(move_only_fn{}) forwarding  (*)
  8774d50... c++: re-enable NSDMI CONSTRUCTOR folding [PR118355] (*)
  a481616... Daily bump. (*)
  c061ad5... c++: friend vs inherited guide confusion [PR117855] (*)
  f8daec2... AArch64: don't override march to assembler with mcpu if mar (*)
  7c6fde4... AArch64: have -mcpu=native detect architecture extensions f (*)
  946c17e... asan: Fix missing FakeStack flag cleanup (*)
  fb0e3f9... Daily bump. (*)
  d121d1e... libstdc++: perfectly forward std::ranges::clamp arguments (*)
  0af8fc2... c++: explicit spec of constrained member tmpl [PR107522] (*)
  18f447a... Daily bump. (*)
  1eafda3... Daily bump. (*)
  18a0994... Daily bump. (*)
  b69eb2c... Fortran: Fix UTF-8 output with A edit descriptor. (*)
  d4df61d... Fortran: do not copy back for parameter actual arguments [P (*)
  504fbaf... c++: ICE with nested anonymous union [PR117153] (*)
  1836a65... testsuite: arm: Use -Os -fno-math-errno in vfp-1.c [PR11644 (*)
  a1acb1c... rs6000: Fix ICE for invalid constants in built-in functions (*)
  68df376... rs6000: Fix loop limit for built-in constant checking (*)
  1a80a04... Daily bump. (*)
  11abd61... hppa: Fix typo in ADDITIONAL_REGISTER_NAMES in pa32-regs.h (*)

(*) This commit already exists in another branch.
Because the reference `refs/heads/devel/omp/gcc-14' matches
your hooks.email-new-commits-only configuration,
no separate email is sent for this commit.


[gcc/devel/omp/gcc-14] Merge remote-tracking branch 'origin/releases/gcc-14' into devel/omp/gcc-14

2025-02-11 Thread Tobias Burnus via Gcc-cvs
https://gcc.gnu.org/g:29d03adf0a752c43a48494ddab4ff9ec2bab8123

commit 29d03adf0a752c43a48494ddab4ff9ec2bab8123
Merge: 5e61f1416891 0075e4a8428d
Author: Tobias Burnus 
Date:   Wed Feb 12 08:01:44 2025 +0100

Merge remote-tracking branch 'origin/releases/gcc-14' into devel/omp/gcc-14

Merge up to r14-11302-g0075e4a8428d05 (12th Feb 2025).

Diff:

 gcc/ChangeLog  | 181 ++
 gcc/DATESTAMP  |   2 +-
 gcc/ada/ChangeLog  |   6 +
 gcc/ada/sem_warn.adb   |   4 +
 gcc/asan.cc|  37 ++-
 gcc/builtins.cc|  10 +-
 gcc/combine.cc |   2 +-
 gcc/config/aarch64/aarch64.h   |   2 +-
 gcc/config/aarch64/driver-aarch64.cc   |  52 +++--
 gcc/config/arm/t-rtems |   5 +-
 gcc/config/i386/avx512bwintrin.h   |   2 +-
 gcc/config/i386/i386.h |   2 +-
 gcc/config/i386/sse.md |  18 +-
 gcc/config/loongarch/loongarch-builtins.cc |   7 +-
 gcc/config/pa/pa32-regs.h  |   2 +-
 gcc/config/rs6000/rs6000-builtin.cc|  10 +-
 gcc/config/rs6000/rs6000-builtins.def  |   4 +-
 gcc/cp/ChangeLog   |  90 ++-
 gcc/cp/ChangeLog.omp   |  13 ++
 gcc/cp/constexpr.cc|   3 +-
 gcc/cp/constraint.cc   |  18 +-
 gcc/cp/cp-tree.h   |   3 +-
 gcc/cp/decl2.cc|   5 +-
 gcc/cp/init.cc |  18 +-
 gcc/cp/parser.cc   |  10 +
 gcc/cp/semantics.cc|   9 +-
 gcc/cp/typeck2.cc  |   8 +-
 gcc/d/ChangeLog|  10 +
 gcc/d/Make-lang.in |   4 +-
 gcc/fortran/ChangeLog  |  76 ++
 gcc/fortran/class.cc   |   2 +-
 gcc/fortran/decl.cc|  19 +-
 gcc/fortran/frontend-passes.cc |   7 +
 gcc/fortran/interface.cc   |   9 +-
 gcc/fortran/resolve.cc |  11 +-
 gcc/fortran/trans-array.cc |  10 +-
 gcc/fortran/trans-expr.cc  |  14 +-
 gcc/ipa-icf-gimple.cc  |  53 +++--
 gcc/loop-iv.cc |   1 +
 gcc/match.pd   |   2 +-
 gcc/optc-save-gen.awk  |   5 +
 gcc/testsuite/ChangeLog| 259 +
 gcc/testsuite/c-c++-common/cpp/pr115913.c  |   7 +
 gcc/testsuite/g++.dg/asan/pr118763.C   |  15 ++
 gcc/testsuite/g++.dg/cpp0x/constexpr-union9.C  |  16 ++
 gcc/testsuite/g++.dg/cpp0x/constexpr-volatile4.C   |  20 ++
 gcc/testsuite/g++.dg/cpp0x/nsdmi-list10.C  |  35 +++
 gcc/testsuite/g++.dg/cpp0x/nsdmi-list9.C   |  34 +++
 .../g++.dg/cpp23/class-deduction-inherited7.C  |  12 +
 .../g++.dg/cpp26/name-independent-decl10.C |  63 +
 .../g++.dg/cpp26/name-independent-decl9.C  |  49 
 .../g++.dg/cpp2a/concepts-explicit-spec7.C |  30 +++
 gcc/testsuite/g++.dg/ext/is_bounded_array.C|  14 ++
 gcc/testsuite/g++.dg/init/array66.C|  33 +++
 gcc/testsuite/g++.dg/other/anon-union6.C   |  13 ++
 gcc/testsuite/g++.dg/other/anon-union7.C   |  16 ++
 gcc/testsuite/gcc.c-torture/execute/pr117432.c |  72 ++
 gcc/testsuite/gcc.c-torture/execute/pr118638.c |  20 ++
 gcc/testsuite/gcc.dg/bitint-120.c  |  11 +
 gcc/testsuite/gcc.dg/pr117506.c|  18 ++
 gcc/testsuite/gcc.dg/torture/builtin-frexp-1.c |  33 ++-
 gcc/testsuite/gcc.target/aarch64/cpunative/info_34 |  18 ++
 gcc/testsuite/gcc.target/aarch64/cpunative/info_35 |  18 ++
 .../gcc.target/aarch64/cpunative/native_cpu_34.c   |  12 +
 .../gcc.target/aarch64/cpunative/native_cpu_35.c   |  13 ++
 gcc/testsuite/gcc.target/aarch64/options_set_29.c  |  11 +
 gcc/testsuite/gcc.target/arm/vfp-1.c   |   2 +-
 gcc/testsuite/gcc.target/i386/pr117432.c   |  17 ++
 gcc/testsuite/gcc.target/i386/pr118776.c   |  23 ++
 gcc/testsuite/gcc.target/loongarch/pr118561.c  |   9 +
 .../gcc.target/powerpc/mma-builtin-error.c |  11 +
 gcc/testsuite/gcc.target/riscv/pr117506.c  |   5 +
 gcc/testsuite/gfortran.dg/associate_72.f90 |  26 +++
 gcc/testsuite/gfortran.dg/common_29.f90|  34 +++
 gcc/testsuite/gfortran.dg/default_format_2.f90 |   2 +-
 .../gfortran.dg

[gcc r15-7483] [PR target/115478] Accept ADD, IOR or XOR when combining objects with no bits in common

2025-02-11 Thread Jeff Law via Gcc-cvs
https://gcc.gnu.org/g:71f6540fc54036cc8f71db497cc22816f794549a

commit r15-7483-g71f6540fc54036cc8f71db497cc22816f794549a
Author: Jeff Law 
Date:   Tue Feb 11 16:55:03 2025 -0700

[PR target/115478] Accept ADD, IOR or XOR when combining objects with no 
bits in common

So the change to prefer ADD over IOR for combining two objects with no bits 
in
common is (IMHO) generally good.  It has some minor fallout.

In particular the aarch64 port (and I suspect others) have patterns that
recognize IOR, but not PLUS or XOR for these cases and thus tests which
expected to optimize with IOR are no longer optimizing.

Roger suggested using a code iterator for this purpose.  Richard S. 
suggested a
new match operator to cover those cases.

I really like the match operator idea, but as Richard S. notes in the PR it
would require either not validating the "no bits in common", which 
dramatically
reduces the utility IMHO or we'd need some work to allow consistent results
without polluting the nonzero bits cache.

So this patch goes back to Roger's idea of just using a match iterator in 
the
aarch64 backend (and presumably anywhere else we see this popping up).

Bootstrapped and regression tested on aarch64-linux-gnu where it fixes
bitint-args.c (as expected).

PR target/115478
gcc/
* config/aarch64/iterators.md (any_or_plus): New code iterator.
* config/aarch64/aarch64.md (extr5_insn): Use any_or_plus.
(extr5_insn_alt, extrsi5_insn_uxtw): Likewise.
(extrsi5_insn_uxtw_alt, extrsi5_insn_di): Likewise.

gcc/testsuite/
* gcc.target/aarch64/bitint-args.c: Update expected output.

Diff:
---
 gcc/config/aarch64/aarch64.md  | 50 ++
 gcc/config/aarch64/iterators.md|  4 +++
 gcc/testsuite/gcc.target/aarch64/bitint-args.c |  4 +--
 3 files changed, 33 insertions(+), 25 deletions(-)

diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
index 071058dbeb33..cfe730f3732c 100644
--- a/gcc/config/aarch64/aarch64.md
+++ b/gcc/config/aarch64/aarch64.md
@@ -6194,10 +6194,11 @@
 
 (define_insn "*extr5_insn"
   [(set (match_operand:GPI 0 "register_operand" "=r")
-   (ior:GPI (ashift:GPI (match_operand:GPI 1 "register_operand" "r")
-(match_operand 3 "const_int_operand" "n"))
-(lshiftrt:GPI (match_operand:GPI 2 "register_operand" "r")
-  (match_operand 4 "const_int_operand" "n"]
+   (any_or_plus:GPI
+ (ashift:GPI (match_operand:GPI 1 "register_operand" "r")
+ (match_operand 3 "const_int_operand" "n"))
+ (lshiftrt:GPI (match_operand:GPI 2 "register_operand" "r")
+ (match_operand 4 "const_int_operand" "n"]
   "UINTVAL (operands[3]) < GET_MODE_BITSIZE (mode) &&
(UINTVAL (operands[3]) + UINTVAL (operands[4]) == GET_MODE_BITSIZE 
(mode))"
   "extr\\t%0, %1, %2, %4"
@@ -6208,10 +6209,11 @@
 ;; so we have to match both orderings.
 (define_insn "*extr5_insn_alt"
   [(set (match_operand:GPI 0 "register_operand" "=r")
-   (ior:GPI  (lshiftrt:GPI (match_operand:GPI 2 "register_operand" "r")
-   (match_operand 4 "const_int_operand" "n"))
- (ashift:GPI (match_operand:GPI 1 "register_operand" "r")
- (match_operand 3 "const_int_operand" "n"]
+   (any_or_plus:GPI
+ (lshiftrt:GPI (match_operand:GPI 2 "register_operand" "r")
+   (match_operand 4 "const_int_operand" "n"))
+ (ashift:GPI (match_operand:GPI 1 "register_operand" "r")
+ (match_operand 3 "const_int_operand" "n"]
   "UINTVAL (operands[3]) < GET_MODE_BITSIZE (mode)
&& (UINTVAL (operands[3]) + UINTVAL (operands[4])
== GET_MODE_BITSIZE (mode))"
@@ -6223,10 +6225,11 @@
 (define_insn "*extrsi5_insn_uxtw"
   [(set (match_operand:DI 0 "register_operand" "=r")
(zero_extend:DI
-(ior:SI (ashift:SI (match_operand:SI 1 "register_operand" "r")
-   (match_operand 3 "const_int_operand" "n"))
-(lshiftrt:SI (match_operand:SI 2 "register_operand" "r")
- (match_operand 4 "const_int_operand" "n")]
+(any_or_plus:SI
+  (ashift:SI (match_operand:SI 1 "register_operand" "r")
+ (match_operand 3 "const_int_operand" "n"))
+  (lshiftrt:SI (match_operand:SI 2 "register_operand" "r")
+ (match_operand 4 "const_int_operand" "n")]
   "UINTVAL (operands[3]) < 32 &&
(UINTVAL (operands[3]) + UINTVAL (operands[4]) == 32)"
   "extr\\t%w0, %w1, %w2, %4"
@@ -6236,10 +6239,11 @@
 (define_insn "*extrsi5_insn_uxtw_alt"
   [(set (match_operand:DI 0 "register_operand" "=r")
(zero_extend:DI
-(ior:SI (lshiftrt:SI (match_operand:SI

[gcc r15-7489] RISC-V: unrecognizable insn ICE in xtheadvector/pr114194.c on 32bit targets

2025-02-11 Thread Ma Jin via Gcc-cvs
https://gcc.gnu.org/g:580f571be6ce80aa71fb80e7b16e01824f088229

commit r15-7489-g580f571be6ce80aa71fb80e7b16e01824f088229
Author: Jin Ma 
Date:   Tue Feb 11 21:28:05 2025 +0800

RISC-V: unrecognizable insn ICE in xtheadvector/pr114194.c on 32bit targets

This is a follow-up to the patch below to avoid generating unrecognized
vsetivl instructions for XTheadVector.

https://gcc.gnu.org/pipermail/gcc-patches/2025-January/674185.html

PR target/118601

gcc/ChangeLog:

* config/riscv/riscv-string.cc (expand_block_move): Check with new
constraint 'vl' instead of 'K'.
(expand_vec_setmem): Likewise.
(expand_vec_cmpmem): Likewise.
* config/riscv/riscv-v.cc (force_vector_length_operand): Likewise.
(expand_load_store): Likewise.
(expand_strided_load): Likewise.
(expand_strided_store): Likewise.
(expand_lanes_load_store): Likewise.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/xtheadvector/pr114194.c: Move to...
* gcc.target/riscv/rvv/xtheadvector/pr114194-rv64.c: ...here.
* gcc.target/riscv/rvv/xtheadvector/pr114194-rv32.c: New test.
* gcc.target/riscv/rvv/xtheadvector/pr118601.c: New test.

Reported-by: Edwin Lu 

Diff:
---
 gcc/config/riscv/riscv-string.cc   |  6 +--
 gcc/config/riscv/riscv-v.cc| 10 ++---
 .../riscv/rvv/xtheadvector/pr114194-rv32.c | 51 ++
 .../xtheadvector/{pr114194.c => pr114194-rv64.c}   |  5 +--
 .../gcc.target/riscv/rvv/xtheadvector/pr118601.c   | 18 
 5 files changed, 79 insertions(+), 11 deletions(-)

diff --git a/gcc/config/riscv/riscv-string.cc b/gcc/config/riscv/riscv-string.cc
index 97e20bdb0026..408eb07e87f3 100644
--- a/gcc/config/riscv/riscv-string.cc
+++ b/gcc/config/riscv/riscv-string.cc
@@ -1275,7 +1275,7 @@ expand_block_move (rtx dst_in, rtx src_in, rtx length_in, 
bool movmem_p)
   machine_mode mask_mode = riscv_vector::get_vector_mode
(BImode, GET_MODE_NUNITS (info.vmode)).require ();
   rtx mask =  CONSTM1_RTX (mask_mode);
-  if (!satisfies_constraint_K (cnt))
+  if (!satisfies_constraint_vl (cnt))
cnt= force_reg (Pmode, cnt);
   rtx m_ops[] = {vec, mask, src};
   emit_nonvlmax_insn (code_for_pred_mov (info.vmode),
@@ -1626,7 +1626,7 @@ expand_vec_setmem (rtx dst_in, rtx length_in, rtx 
fill_value_in)
 }
   else
 {
-  if (!satisfies_constraint_K (info.avl))
+  if (!satisfies_constraint_vl (info.avl))
info.avl = force_reg (Pmode, info.avl);
   emit_nonvlmax_insn (code_for_pred_broadcast (info.vmode),
  riscv_vector::UNARY_OP, broadcast_ops, info.avl);
@@ -1694,7 +1694,7 @@ expand_vec_cmpmem (rtx result_out, rtx blk_a_in, rtx 
blk_b_in, rtx length_in)
 }
   else
 {
-  if (!satisfies_constraint_K (length_in))
+  if (!satisfies_constraint_vl (length_in))
  length_in = force_reg (Pmode, length_in);
 
   rtx memmask = CONSTM1_RTX (mask_mode);
diff --git a/gcc/config/riscv/riscv-v.cc b/gcc/config/riscv/riscv-v.cc
index 9847439ca779..62456c7ef79d 100644
--- a/gcc/config/riscv/riscv-v.cc
+++ b/gcc/config/riscv/riscv-v.cc
@@ -2103,7 +2103,7 @@ get_unknown_min_value (machine_mode mode)
 static rtx
 force_vector_length_operand (rtx vl)
 {
-  if (CONST_INT_P (vl) && !satisfies_constraint_K (vl))
+  if (CONST_INT_P (vl) && !satisfies_constraint_vl (vl))
 return force_reg (Pmode, vl);
   return vl;
 }
@@ -4130,7 +4130,7 @@ expand_load_store (rtx *ops, bool is_load)
 }
   else
 {
-  if (!satisfies_constraint_K (len))
+  if (!satisfies_constraint_vl (len))
len = force_reg (Pmode, len);
   if (is_load)
{
@@ -4165,7 +4165,7 @@ expand_strided_load (machine_mode mode, rtx *ops)
 emit_vlmax_insn (icode, BINARY_OP_TAMA, emit_ops);
   else
 {
-  len = satisfies_constraint_K (len) ? len : force_reg (Pmode, len);
+  len = satisfies_constraint_vl (len) ? len : force_reg (Pmode, len);
   emit_nonvlmax_insn (icode, BINARY_OP_TAMA, emit_ops, len);
 }
 }
@@ -4191,7 +4191,7 @@ expand_strided_store (machine_mode mode, rtx *ops)
 }
   else
 {
-  len = satisfies_constraint_K (len) ? len : force_reg (Pmode, len);
+  len = satisfies_constraint_vl (len) ? len : force_reg (Pmode, len);
   vl_type = get_avl_type_rtx (NONVLMAX);
 }
 
@@ -4642,7 +4642,7 @@ expand_lanes_load_store (rtx *ops, bool is_load)
 }
   else
 {
-  if (!satisfies_constraint_K (len))
+  if (!satisfies_constraint_vl (len))
len = force_reg (Pmode, len);
   if (is_load)
{
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/pr114194-rv32.c 
b/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/pr114194-rv32.c
new file mode 100644
index ..f95e713ea246
--- /dev/null
+++ b/gcc/testsuite/gcc.t

[gcc r15-7490] RISC-V: Vector pesudoinsns with x0 operand to use imm 0

2025-02-11 Thread Vineet Gupta via Gcc-cvs
https://gcc.gnu.org/g:3880271e94b7598b4f5d98c615b7fcee6d4c

commit r15-7490-g3880271e94b7598b4f5d98c615b7fcee6d4c
Author: Vineet Gupta 
Date:   Wed Feb 5 16:46:48 2025 +0530

RISC-V: Vector pesudoinsns with x0 operand to use imm 0

A couple of Vector pseudoinstructions use x0 scalar which could be
inefficient on wider uarches due to regfile crossing.

Instead use the imm 0 form, which should be functionally equivalent.

 pseudoinsnorig insn with x0 this patch
     ---
 vneg.v vd,vs  vrsub.vx vd,vs,x0 vrsub.vi vd,vs,0
 vncvt.x.x.w vd,vs,vm  vnsrl.wx vd,vs,x0,vm  vnsrl.wi vd,vs,0,vm
 vwcvt.x.x.v vd,vs,vm  vwadd.vx vd,vs,x0,vm  (imm not supported)

gcc/ChangeLog:
* config/riscv/vector.md: vncvt substitute vnsrl.
vnsrl with x0 replace with immediate 0.
vneg substitute vrsub.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/cond/cond_convert_int2int-rv32-1.c: 
Change
expected pattern.
* gcc.target/riscv/rvv/autovec/cond/cond_convert_int2int-rv32-2.c: 
Ditto.
* gcc.target/riscv/rvv/autovec/cond/cond_convert_int2int-rv64-1.c: 
Ditto.
* gcc.target/riscv/rvv/autovec/cond/cond_convert_int2int-rv64-2.c: 
Ditto.
* gcc.target/riscv/rvv/autovec/cond/cond_unary-1.c: Ditto.
* gcc.target/riscv/rvv/autovec/cond/cond_unary-2.c: Ditto.
* gcc.target/riscv/rvv/autovec/cond/cond_unary-3.c: Ditto.
* gcc.target/riscv/rvv/autovec/cond/cond_unary-4.c: Ditto.
* gcc.target/riscv/rvv/autovec/cond/cond_unary-5.c: Ditto.
* gcc.target/riscv/rvv/autovec/cond/cond_unary-6.c: Ditto.
* gcc.target/riscv/rvv/autovec/cond/cond_unary-7.c: Ditto.
* gcc.target/riscv/rvv/autovec/cond/cond_unary-8.c: Ditto.
* gcc.target/riscv/rvv/autovec/conversions/vncvt-rv32gcv.c: Ditto.
* gcc.target/riscv/rvv/autovec/conversions/vncvt-rv64gcv.c: Ditto.
* gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub_trunc-1-u16.c: 
Ditto
* gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub_trunc-1-u32.c: 
Ditto.
* gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub_trunc-1-u8.c: 
Ditto.
* gcc.target/riscv/rvv/autovec/unop/abs-rv32gcv.c: Ditto.
* gcc.target/riscv/rvv/autovec/unop/abs-rv64gcv.c: Ditto.
* gcc.target/riscv/rvv/autovec/unop/vneg-rv32gcv.c: Ditto.
* gcc.target/riscv/rvv/autovec/unop/vneg-rv64gcv.c: Ditto.
* gcc.target/riscv/rvv/autovec/vls/abs-2.c: Ditto.
* gcc.target/riscv/rvv/autovec/vls/cond_convert-11.c: Ditto.
* gcc.target/riscv/rvv/autovec/vls/cond_convert-12.c: Ditto.
* gcc.target/riscv/rvv/autovec/vls/cond_neg-1.c: Ditto.
* gcc.target/riscv/rvv/autovec/vls/cond_trunc-1.c: Ditto.
* gcc.target/riscv/rvv/autovec/vls/cond_trunc-2.c: Ditto.
* gcc.target/riscv/rvv/autovec/vls/cond_trunc-3.c: Ditto.
* gcc.target/riscv/rvv/autovec/vls/convert-11.c: Ditto.
* gcc.target/riscv/rvv/autovec/vls/convert-12.c: Ditto.
* gcc.target/riscv/rvv/autovec/vls/neg-1.c: Ditto.
* gcc.target/riscv/rvv/autovec/vls/trunc-1.c: Ditto.
* gcc.target/riscv/rvv/autovec/vls/trunc-2.c: Ditto.
* gcc.target/riscv/rvv/autovec/vls/trunc-3.c: Ditto.
* gcc.target/riscv/rvv/base/simplify-vdiv.c: Ditto.
* gcc.target/riscv/rvv/base/unop_v_constraint-1.c: Ditto.

Signed-off-by: Vineet Gupta 

Diff:
---
 gcc/config/riscv/vector.md | 16 ---
 .../rvv/autovec/cond/cond_convert_int2int-rv32-1.c |  4 ++--
 .../rvv/autovec/cond/cond_convert_int2int-rv32-2.c |  4 ++--
 .../rvv/autovec/cond/cond_convert_int2int-rv64-1.c |  4 ++--
 .../rvv/autovec/cond/cond_convert_int2int-rv64-2.c |  4 ++--
 .../riscv/rvv/autovec/cond/cond_unary-1.c  |  6 +++---
 .../riscv/rvv/autovec/cond/cond_unary-2.c  |  6 +++---
 .../riscv/rvv/autovec/cond/cond_unary-3.c  |  6 +++---
 .../riscv/rvv/autovec/cond/cond_unary-4.c  |  6 +++---
 .../riscv/rvv/autovec/cond/cond_unary-5.c  |  6 +++---
 .../riscv/rvv/autovec/cond/cond_unary-6.c  |  6 +++---
 .../riscv/rvv/autovec/cond/cond_unary-7.c  |  6 +++---
 .../riscv/rvv/autovec/cond/cond_unary-8.c  |  6 +++---
 .../riscv/rvv/autovec/conversions/vncvt-rv32gcv.c  |  2 +-
 .../riscv/rvv/autovec/conversions/vncvt-rv64gcv.c  |  2 +-
 .../rvv/autovec/sat/vec_sat_u_sub_trunc-1-u16.c|  2 +-
 .../rvv/autovec/sat/vec_sat_u_sub_trunc-1-u32.c|  2 +-
 .../rvv/autovec/sat/vec_sat_u_sub_trunc-1-u8.c |  2 +-
 .../riscv/rvv/autovec/unop/abs-rv32gcv.c   |  2 +-
 .../riscv/rvv/autovec/unop/abs-rv64gcv.c   |  2 +-
 .../riscv/rvv/autovec/unop/vneg-rv32gcv.

[gcc(refs/users/meissner/heads/work193-bugs)] Fix PR 118541, do not generate unordered fp cmoves for IEEE compares.

2025-02-11 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:f733e7ff512d420603bb21e2d2d49f2fae55ff00

commit f733e7ff512d420603bb21e2d2d49f2fae55ff00
Author: Michael Meissner 
Date:   Tue Feb 11 14:01:52 2025 -0500

Fix PR 118541, do not generate unordered fp cmoves for IEEE compares.

This is version 3 of the patch.

In bug PR target/118541 on power9, power10, and power11 systems, for the
function:

extern double __ieee754_acos (double);

double
__acospi (double x)
{
  double ret = __ieee754_acos (x) / 3.14;
  return __builtin_isgreater (ret, 1.0) ? 1.0 : ret;
}

GCC currently generates the following code:

Power9  Power10 and Power11
==  ===
bl __ieee754_acos   bl __ieee754_acos@notoc
nop plfd 0,.LC0@pcrel
addis 9,2,.LC2@toc@ha   xxspltidp 12,1065353216
addi 1,1,32 addi 1,1,32
lfd 0,.LC2@toc@l(9) ld 0,16(1)
addis 9,2,.LC0@toc@ha   fdiv 0,1,0
ld 0,16(1)  mtlr 0
lfd 12,.LC0@toc@l(9)xscmpgtdp 1,0,12
fdiv 0,1,0  xxsel 1,0,12,1
mtlr 0  blr
xscmpgtdp 1,0,12
xxsel 1,0,12,1
blr

This is because ifcvt.c optimizes the conditional floating point move to 
use the
XSCMPGTDP instruction.

However, the XSCMPGTDP instruction will generate an interrupt if one of the
arguments is a signalling NaN and signalling NaNs can generate an interrupt.
The IEEE comparison functions (isgreater, etc.) require that the comparison 
not
raise an interrupt.

The following patch changes the PowerPC back end so that ifcvt.c will not 
change
the if/then test and move into a conditional move if the comparison is one 
of
the comparisons that do not raise an error with signalling NaNs and -Ofast 
is
not used.  If a normal comparison is used or -Ofast is used, GCC will 
continue
to generate XSCMPGTDP and XXSEL.

For the following code:

double
ordered_compare (double a, double b, double c, double d)
{
  return __builtin_isgreater (a, b) ? c : d;
}

/* Verify normal > does generate xscmpgtdp.  */

double
normal_compare (double a, double b, double c, double d)
{
  return a > b ? c : d;
}

with the following patch, GCC generates the following for power9, power10, 
and
power11:

ordered_compare:
fcmpu 0,1,2
fmr 1,4
bnglr 0
fmr 1,3
blr

normal_compare:
xscmpgtdp 1,1,2
xxsel 1,4,3,1
blr

I have built bootstrap compilers on big endian power9 systems and little 
endian
power9/power10 systems and there were no regressions.  Can I check this 
patch
into the GCC trunk, and after a waiting period, can I check this into the 
active
older branches?

2025-02-11  Michael Meissner  

gcc/

PR target/118541
* config/rs6000/predicates.md (invert_fpmask_comparison_operator): 
Do
not allow UNLT and UNLE unless -ffast-math.
* config/rs6000/rs6000-protos.h (enum reverse_cond_t): New 
enumeration.
(rs6000_reverse_condition): Add argument.
* config/rs6000/rs6000.cc (rs6000_reverse_condition): Do not allow
ordered comparisons to be reversed for floating point conditional 
moves,
but allow ordered comparisons to be reversed on jumps.
(rs6000_emit_sCOND): Adjust rs6000_reverse_condition call.
* config/rs6000/rs6000.h (REVERSE_CONDITION): Likewise.
* config/rs6000/rs6000.md (reverse_branch_comparison): Name insn.
Adjust rs6000_reverse_condition calls.

gcc/testsuite/

PR target/118541
* gcc.target/powerpc/pr118541-1.c: New test.
* gcc.target/powerpc/pr118541-2.c: Likewise.
* gcc.target/powerpc/pr118541-3.c: Likewise.
* gcc.target/powerpc/pr118541-4.c: Likewise.

Diff:
---
 gcc/config/rs6000/predicates.md   | 10 +-
 gcc/config/rs6000/rs6000-protos.h | 17 +++-
 gcc/config/rs6000/rs6000.cc   | 23 +-
 gcc/config/rs6000/rs6000.h| 10 --
 gcc/config/rs6000/rs6000.md   | 24 ++-
 gcc/testsuite/gcc.target/powerpc/pr118541-1.c | 28 +++
 gcc/testsuite/gcc.target/powerpc/pr

[gcc(refs/users/mikael/heads/refactor_descriptor_v01)] Mise à jour dump coarray_lib_token_3.f90

2025-02-11 Thread Mikael Morin via Gcc-cvs
https://gcc.gnu.org/g:19c7720b17b178fe0dca80f88a1929295b70d54f

commit 19c7720b17b178fe0dca80f88a1929295b70d54f
Author: Mikael Morin 
Date:   Tue Feb 11 20:00:39 2025 +0100

Mise à jour dump coarray_lib_token_3.f90

Diff:
---
 gcc/testsuite/gfortran.dg/coarray_lib_token_3.f90 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/testsuite/gfortran.dg/coarray_lib_token_3.f90 
b/gcc/testsuite/gfortran.dg/coarray_lib_token_3.f90
index bedb0919d006..c1f00731def4 100644
--- a/gcc/testsuite/gfortran.dg/coarray_lib_token_3.f90
+++ b/gcc/testsuite/gfortran.dg/coarray_lib_token_3.f90
@@ -8,5 +8,5 @@ allocate(CAF(1)[*])
 allocate(CAF_SCALAR[*])
 end
 
-! { dg-final { scan-tree-dump-times "_gfortran_caf_register \\(4, 1, 
&caf.token, \\(void \\*\\) &caf, 0B, 0B, 0\\);" 1 "original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_register \\(4, 1, 
&caf_scalar.token, \\(void \\*\\) &caf_scalar, 0B, 0B, 0\\);" 1 "original" } }
+! { dg-final { scan-tree-dump-times {_gfortran_caf_register \(4, 1, 
&(?:NON_LVALUE_EXPR <)?caf\.token>?, \(void \*\) &caf, 0B, 0B, 0\);} 1 
"original" } }
+! { dg-final { scan-tree-dump-times {_gfortran_caf_register \(4, 1, 
&(?:NON_LVALUE_EXPR <)?caf_scalar\.token>?, \(void \*\) &caf_scalar, 0B, 0B, 
0\);} 1 "original" } }


[gcc(refs/users/mikael/heads/refactor_descriptor_v01)] Mise à jour dump coarray_lib_alloc_3.f90

2025-02-11 Thread Mikael Morin via Gcc-cvs
https://gcc.gnu.org/g:3e36fe8200505a88011054c2d2c9637bb0fbf711

commit 3e36fe8200505a88011054c2d2c9637bb0fbf711
Author: Mikael Morin 
Date:   Tue Feb 11 19:42:47 2025 +0100

Mise à jour dump coarray_lib_alloc_3.f90

Diff:
---
 gcc/testsuite/gfortran.dg/coarray_lib_alloc_3.f90 | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/gcc/testsuite/gfortran.dg/coarray_lib_alloc_3.f90 
b/gcc/testsuite/gfortran.dg/coarray_lib_alloc_3.f90
index 17f800ffe700..ad4ce887c944 100644
--- a/gcc/testsuite/gfortran.dg/coarray_lib_alloc_3.f90
+++ b/gcc/testsuite/gfortran.dg/coarray_lib_alloc_3.f90
@@ -16,9 +16,9 @@ subroutine test
  deallocate(xx,yy,stat=stat, errmsg=errmsg)
  end
 
-! { dg-final { scan-tree-dump-times "_gfortran_caf_register \\(1, 1, 
&xx._data.token, \\(void \\*\\) &xx._data, &stat.., &errmsg, 200\\);" 1 
"original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_register \\(1, 1, 
&yy._data.token, \\(void \\*\\) &yy._data, &stat.., &errmsg, 200\\);" 1 
"original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister 
.&xx._data.token, 0, &stat.., &errmsg, 200.;" 1 "original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister 
.&yy._data.token, 0, &stat.., &errmsg, 200.;" 1 "original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister 
.&yy._data.token, 0, 0B, 0B, 0.;" 1 "original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister 
.&xx._data.token, 0, 0B, 0B, 0.;" 1 "original" } }
+! { dg-final { scan-tree-dump-times {_gfortran_caf_register \(1, 1, 
&(?:NON_LVALUE_EXPR <)?xx\._data\.token>?, \(void \*\) &xx\._data, &stat.., 
&errmsg, 200\);} 1 "original" } }
+! { dg-final { scan-tree-dump-times {_gfortran_caf_register \(1, 1, 
&(?:NON_LVALUE_EXPR <)?yy\._data\.token>?, \(void \*\) &yy\._data, &stat.., 
&errmsg, 200\);} 1 "original" } }
+! { dg-final { scan-tree-dump-times {_gfortran_caf_deregister 
\(&(?:NON_LVALUE_EXPR <)?xx\._data\.token>?, 0, &stat.., &errmsg, 200\);} 1 
"original" } }
+! { dg-final { scan-tree-dump-times {_gfortran_caf_deregister 
\(&(?:NON_LVALUE_EXPR <)?yy\._data\.token>?, 0, &stat.., &errmsg, 200\);} 1 
"original" } }
+! { dg-final { scan-tree-dump-times {_gfortran_caf_deregister 
\(&(?:NON_LVALUE_EXPR <)?yy\._data\.token>?, 0, 0B, 0B, 0\);} 1 "original" } }
+! { dg-final { scan-tree-dump-times {_gfortran_caf_deregister 
\(&(?:NON_LVALUE_EXPR <)?xx\._data\.token>?, 0, 0B, 0B, 0\);} 1 "original" } }


[gcc(refs/users/meissner/heads/work193-bugs)] Update ChangeLog.*

2025-02-11 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:e506c0b3bc07460bef67000afe4874ca9e062923

commit e506c0b3bc07460bef67000afe4874ca9e062923
Author: Michael Meissner 
Date:   Tue Feb 11 14:03:43 2025 -0500

Update ChangeLog.*

Diff:
---
 gcc/ChangeLog.bugs | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/gcc/ChangeLog.bugs b/gcc/ChangeLog.bugs
index 288addbed9b0..329d928c50d6 100644
--- a/gcc/ChangeLog.bugs
+++ b/gcc/ChangeLog.bugs
@@ -1,4 +1,4 @@
- Branch work193-bugs, patch #210 
+ Branch work193-bugs, patch #211 
 
 Fix PR 118541, do not generate unordered fp cmoves for IEEE compares.
 
@@ -84,15 +84,14 @@ power9/power10 systems and there were no regressions.  Can 
I check this patch
 into the GCC trunk, and after a waiting period, can I check this into the 
active
 older branches?
 
-2025-02-10  Michael Meissner  
+2025-02-11  Michael Meissner  
 
 gcc/
 
PR target/118541
* config/rs6000/predicates.md (invert_fpmask_comparison_operator): Do
-   not allow UNLT and UNLE unless -ffast-math or not power9.
-   * config/rs6000/rs6000-protos.h (enum reverse_condition_t): New
-   enumeration.
+   not allow UNLT and UNLE unless -ffast-math.
+   * config/rs6000/rs6000-protos.h (enum reverse_cond_t): New enumeration.
(rs6000_reverse_condition): Add argument.
* config/rs6000/rs6000.cc (rs6000_reverse_condition): Do not allow
ordered comparisons to be reversed for floating point conditional moves,
@@ -110,6 +109,8 @@ gcc/testsuite/
* gcc.target/powerpc/pr118541-3.c: Likewise.
* gcc.target/powerpc/pr118541-4.c: Likewise.
 
+ Branch work193-bugs, patch #210 was reverted 

+
  Branch work193-bugs, patch #202 
 
 PR target/108958 -- use mtvsrdd to zero extend GPR DImode to VSX TImode


[gcc(refs/users/mikael/heads/refactor_descriptor_v01)] Interdiction non-lvalue as lhs

2025-02-11 Thread Mikael Morin via Gcc-cvs
https://gcc.gnu.org/g:6a9e70ecbc4507e92308e13acb6db207e94c74d1

commit 6a9e70ecbc4507e92308e13acb6db207e94c74d1
Author: Mikael Morin 
Date:   Tue Feb 11 21:34:11 2025 +0100

Interdiction non-lvalue as lhs

Diff:
---
 gcc/gimplify.cc | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc
index 58a9d2a748d6..e81a1dc5522e 100644
--- a/gcc/gimplify.cc
+++ b/gcc/gimplify.cc
@@ -6838,6 +6838,12 @@ gimplify_modify_expr (tree *expr_p, gimple_seq *pre_p, 
gimple_seq *post_p,
   gcc_assert (TREE_CODE (*expr_p) == MODIFY_EXPR
  || TREE_CODE (*expr_p) == INIT_EXPR);
 
+  if (TREE_CODE (*to_p) == NON_LVALUE_EXPR)
+{
+  error ("non-lvalue %qE used as lhs", *to_p);
+  return GS_ERROR;
+}
+
   /* Trying to simplify a clobber using normal logic doesn't work,
  so handle it here.  */
   if (TREE_CLOBBER_P (*from_p))


[gcc(refs/users/mikael/heads/refactor_descriptor_v01)] Mise à jour dump contiguous_3.f90

2025-02-11 Thread Mikael Morin via Gcc-cvs
https://gcc.gnu.org/g:ca555487c224cc48d2ba9faddf7eec974c43cc91

commit ca555487c224cc48d2ba9faddf7eec974c43cc91
Author: Mikael Morin 
Date:   Tue Feb 11 20:21:54 2025 +0100

Mise à jour dump contiguous_3.f90

Diff:
---
 gcc/testsuite/gfortran.dg/contiguous_3.f90 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/testsuite/gfortran.dg/contiguous_3.f90 
b/gcc/testsuite/gfortran.dg/contiguous_3.f90
index ba0ccce8f9ee..05bd785be464 100644
--- a/gcc/testsuite/gfortran.dg/contiguous_3.f90
+++ b/gcc/testsuite/gfortran.dg/contiguous_3.f90
@@ -35,8 +35,8 @@ end subroutine t2
 
 ! { dg-final { scan-tree-dump-times "= a1->dim.0..stride;" 0 "original" } }
 ! { dg-final { scan-tree-dump-times "= b1->dim.0..stride;" 0 "original" } }
-! { dg-final { scan-tree-dump-times "= c2->dim.0..stride;" 1 "original" } }
-! { dg-final { scan-tree-dump-times "= d2->dim.0..stride;" 1 "original" } }
+! { dg-final { scan-tree-dump-times {= (?:NON_LVALUE_EXPR 
<)?c2->dim\[0\]\.stride>?;} 1 "original" } }
+! { dg-final { scan-tree-dump-times {= (?:NON_LVALUE_EXPR 
<)?d2->dim\[0\]\.stride>?;} 1 "original" } }
 
 
 subroutine test3()


[gcc r15-7485] RISC-V: Drop __riscv_vendor_feature_bits

2025-02-11 Thread Jeff Law via Gcc-cvs
https://gcc.gnu.org/g:2605daa6b896aed15dead194462725874f332c0a

commit r15-7485-g2605daa6b896aed15dead194462725874f332c0a
Author: Yangyu Chen 
Date:   Tue Feb 11 18:40:41 2025 -0700

RISC-V: Drop __riscv_vendor_feature_bits

As discussed from RISC-V C-API PR #101 [1], As discussed in #96, current
interface is insufficient to support some cases, like a vendor buying a
CPU IP from the upstream vendor but using their own mvendorid and custom
features from the upstream vendor. In this case, we might need to add
these extensions for each downstream vendor many times. Thus, making
__riscv_vendor_feature_bits guarded by mvendorid is not a good idea. So,
drop __riscv_vendor_feature_bits for now, and we should have time to
discuss a better solution.

[1] https://github.com/riscv-non-isa/riscv-c-api-doc/pull/101

Signed-off-by: Yangyu Chen 

gcc/ChangeLog:

* config/riscv/riscv-feature-bits.h 
(RISCV_VENDOR_FEATURE_BITS_LENGTH): Drop.
(struct riscv_vendor_feature_bits): Drop.

libgcc/ChangeLog:

* config/riscv/feature_bits.c (RISCV_VENDOR_FEATURE_BITS_LENGTH): 
Drop.
(__init_riscv_features_bits_linux): Drop.

Diff:
---
 gcc/config/riscv/riscv-feature-bits.h |  7 ---
 libgcc/config/riscv/feature_bits.c| 10 --
 2 files changed, 17 deletions(-)

diff --git a/gcc/config/riscv/riscv-feature-bits.h 
b/gcc/config/riscv/riscv-feature-bits.h
index b571c44285fe..7ef7a2aecb71 100644
--- a/gcc/config/riscv/riscv-feature-bits.h
+++ b/gcc/config/riscv/riscv-feature-bits.h
@@ -28,13 +28,6 @@ struct riscv_feature_bits {
   unsigned long long features[RISCV_FEATURE_BITS_LENGTH];
 };
 
-#define RISCV_VENDOR_FEATURE_BITS_LENGTH 1
-
-struct riscv_vendor_feature_bits {
-  unsigned length;
-  unsigned long long features[RISCV_VENDOR_FEATURE_BITS_LENGTH];
-};
-
 struct riscv_cpu_model {
   unsigned mvendorid;
   unsigned long long marchid;
diff --git a/libgcc/config/riscv/feature_bits.c 
b/libgcc/config/riscv/feature_bits.c
index b34d4eea1d15..157bcdcad69a 100644
--- a/libgcc/config/riscv/feature_bits.c
+++ b/libgcc/config/riscv/feature_bits.c
@@ -30,13 +30,6 @@ struct {
   unsigned long long features[RISCV_FEATURE_BITS_LENGTH];
 } __riscv_feature_bits __attribute__ ((visibility ("hidden"), nocommon));
 
-#define RISCV_VENDOR_FEATURE_BITS_LENGTH 1
-
-struct {
-  unsigned length;
-  unsigned long long features[RISCV_VENDOR_FEATURE_BITS_LENGTH];
-} __riscv_vendor_feature_bits __attribute__ ((visibility ("hidden"), 
nocommon));
-
 struct {
   unsigned mvendorid;
   unsigned long long marchid;
@@ -382,8 +375,6 @@ static void __init_riscv_features_bits_linux ()
 __riscv_feature_bits.features[i] = features[i];
 
   __riscv_feature_bits.length = RISCV_FEATURE_BITS_LENGTH;
-
-  __riscv_vendor_feature_bits.length = 0;
 }
 #endif
 
@@ -402,7 +393,6 @@ __init_riscv_feature_bits ()
 #else
   /* Unsupported, just initialize that into all zeros.  */
   __riscv_feature_bits.length = 0;
-  __riscv_vendor_feature_bits.length = 0;
   __riscv_cpu_model.mvendorid = 0;
   __riscv_cpu_model.marchid = 0;
   __riscv_cpu_model.mimpid = 0;


[gcc r15-7487] Doc: Fix some typos and other nearby sloppy-writing issues

2025-02-11 Thread Sandra Loosemore via Gcc-cvs
https://gcc.gnu.org/g:b9857b78a4afb7ccdb8ff3858b48d25b1df5ceb3

commit r15-7487-gb9857b78a4afb7ccdb8ff3858b48d25b1df5ceb3
Author: Sandra Loosemore 
Date:   Tue Feb 11 21:52:36 2025 +

Doc: Fix some typos and other nearby sloppy-writing issues

I spotted some typos in the GCC manual.  Since often these are a sign
that the text was inserted without being proofread, I looked at the
context and fixed some grammar/punctuation/wording issues as well.

gcc/ChangeLog
* doc/extend.texi: Fix a bunch of typos and other writing bugs.
* doc/invoke.texi: Likewise.

Diff:
---
 gcc/doc/extend.texi | 87 ++---
 gcc/doc/invoke.texi | 62 +++---
 2 files changed, 74 insertions(+), 75 deletions(-)

diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index d79e97d9a030..065bd8b84e14 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -1004,17 +1004,16 @@ The ISO C++14 library also defines the @samp{i} suffix, 
so C++14 code
 that includes the @samp{} header cannot use @samp{i} for the
 GNU extension.  The @samp{j} suffix still has the GNU meaning.
 
-GCC can handle both implicit and explicit casts between the @code{_Complex}
-types and other @code{_Complex} types as casting both the real and imaginary
-parts to the scalar type.
-GCC can handle implicit and explicit casts from a scalar type to a 
@code{_Complex}
-type and where the imaginary part will be considered zero.
-The C front-end can handle implicit and explicit casts from a @code{_Complex} 
type
-to a scalar type where the imaginary part will be ignored. In C++ code, this 
cast
-is considered illformed and G++ will error out.
-
-GCC provides a built-in function @code{__builtin_complex} will can be used to
-construct a complex value.
+GCC handles both implicit and explicit casts between the
+@code{_Complex} types with different scalar base types by casting both
+the real and imaginary parts to the base type of the result.
+GCC also handles implicit and explicit casts from a scalar type to a
+@code{_Complex} type, by giving the imaginary part a zero value.
+
+The C front end can handle implicit and explicit casts from a
+@code{_Complex} type to a scalar type, which uses the value of the
+real part and ignores the imaginary part.  In C++ code, this cast is
+considered ill-formed and G++ diagnoses it as an error.
 
 @cindex @code{__real__} keyword
 @cindex @code{__imag__} keyword
@@ -1023,7 +1022,7 @@ GCC has a few extensions which can be used to extract the 
real
 and the imaginary part of the complex-valued expression. Note
 these expressions are lvalues if the @var{exp} is an lvalue.
 These expressions operands have the type of a complex type
-which might get prompoted to a complex type from a scalar type.
+which might get promoted to a complex type from a scalar type.
 E.g. @code{__real__ (int)@var{x}} is the same as casting to
 @code{_Complex int} before @code{__real__} is done.
 
@@ -1035,7 +1034,7 @@ E.g. @code{__real__ (int)@var{x}} is the same as casting 
to
 @tab Extract the imaginary part of @var{exp}.
 @end multitable
 
-For values of floating point, you should use the ISO C99
+For values of floating-point type, you should use the ISO C99
 functions, declared in @code{} and also provided as
 built-in functions by GCC@.
 
@@ -1053,7 +1052,7 @@ with a complex type.  This is a GNU extension; for values 
of
 floating type, you should use the ISO C99 functions @code{conjf},
 @code{conj} and @code{conjl}, declared in @code{} and also
 provided as built-in functions by GCC@. Note unlike the @code{__real__}
-and @code{__imag__} operators, this operator will not do an implicit cast
+and @code{__imag__} operators, this operator does not do an implicit cast
 to the complex type because the @samp{~} is already a normal operator.
 
 GCC can allocate complex automatic variables in a noncontiguous
@@ -3526,7 +3525,7 @@ mismatched allocation and deallocation functions and 
diagnose them under
 the control of options such as @option{-Wmismatched-dealloc}.  It also
 makes it possible to diagnose attempts to deallocate objects that were not
 allocated dynamically, by @option{-Wfree-nonheap-object}.  To indicate
-that an allocation function both satisifies the nonaliasing property and
+that an allocation function both satisfies the nonaliasing property and
 has a deallocator associated with it, both the plain form of the attribute
 and the one with the @var{deallocator} argument must be used.  The same
 function can be both an allocator and a deallocator.  Since inlining one
@@ -3949,7 +3948,7 @@ caveats.
 If the pointer argument is also referred to by an @code{access} attribute on 
the
 function with @var{access-mode} either @code{read_only} or @code{read_write}
 and the latter attribute has the optional @var{size-index} argument
-referring to a size argument, this expressses the maximum size of the access.
+referring to a size argumen

[gcc r15-7486] Doc: Delete obsolete interface.texi chapter from GCC internals manual

2025-02-11 Thread Sandra Loosemore via Gcc-cvs
https://gcc.gnu.org/g:29a5b1bdd9ff1bbfd2c367aea2f38fc23e6dbfb4

commit r15-7486-g29a5b1bdd9ff1bbfd2c367aea2f38fc23e6dbfb4
Author: Sandra Loosemore 
Date:   Wed Feb 12 00:17:30 2025 +

Doc: Delete obsolete interface.texi chapter from GCC internals manual

The "Interfacing to GCC Output" chapter used to be part of the
user-facing GCC documentation but ended up in the GCC internals manual
when the two documents were separated in 2001.  It hasn't been updated
in any substantive way since then, and is now very bit-rotten.  (PCC is
no longer the "standard compiler" on any target, and the target-specific
issues mentioned are for very old architectures.)

Meanwhile, the GCC user documentation now has a chapter called "Binary
Compatibility" that covers ABI issues in a generic way and also covers
C++ compatibility.  Let's keep that one and throw out the obsolete
text that seems to predate the whole notion of an ABI.

gcc/ChangeLog
* Makefile.in (TEXI_GCCINT_FILES): Remove interface.texi.
* doc/gccint.texi (Top): Remove menu entry for the "interface" node,
and include of interface.texi.
* doc/interface.texi: Delete.

Diff:
---
 gcc/Makefile.in|  2 +-
 gcc/doc/gccint.texi|  5 +---
 gcc/doc/interface.texi | 70 --
 3 files changed, 2 insertions(+), 75 deletions(-)

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index a8e32e25cf54..c159825e62c8 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -3697,7 +3697,7 @@ TEXI_GCC_FILES = gcc.texi gcc-common.texi gcc-vers.texi 
frontends.texi\
 # the *.texi files have changed.
 TEXI_GCCINT_FILES = gccint.texi gcc-common.texi gcc-vers.texi  \
 contribute.texi makefile.texi configterms.texi options.texi\
-portability.texi interface.texi passes.texi rtl.texi md.texi   \
+portability.texi passes.texi rtl.texi md.texi  \
 $(srcdir)/doc/tm.texi hostconfig.texi fragments.texi   \
 configfiles.texi collect2.texi headerdirs.texi funding.texi\
 gnu.texi gpl_v3.texi fdl.texi contrib.texi languages.texi  \
diff --git a/gcc/doc/gccint.texi b/gcc/doc/gccint.texi
index eea2d48f87ab..d88fc1a1c683 100644
--- a/gcc/doc/gccint.texi
+++ b/gcc/doc/gccint.texi
@@ -87,8 +87,7 @@ Compiler Collection (GCC)}.
 This manual is mainly a reference manual rather than a tutorial.  It
 discusses how to contribute to GCC (@pxref{Contributing}), the
 characteristics of the machines supported by GCC as hosts and targets
-(@pxref{Portability}), how GCC relates to the ABIs on such systems
-(@pxref{Interface}), and the characteristics of the languages for
+(@pxref{Portability}), and the characteristics of the languages for
 which GCC front ends are written (@pxref{Languages}).  It then
 describes the GCC source tree structure and build system, some of the
 interfaces to GCC front ends, and how support for a target system is
@@ -100,7 +99,6 @@ Additional tutorial information is linked to from
 @menu
 * Contributing::How to contribute to testing and developing GCC.
 * Portability:: Goals of GCC's portability features.
-* Interface::   Function-call interface of GCC output.
 * Libgcc::  Low-level runtime library used by GCC.
 * Languages::   Languages for which GCC front ends are written.
 * Source Tree:: GCC source tree structure and build system.
@@ -141,7 +139,6 @@ Additional tutorial information is linked to from
 
 @include contribute.texi
 @include portability.texi
-@include interface.texi
 @include libgcc.texi
 @include languages.texi
 @include sourcebuild.texi
diff --git a/gcc/doc/interface.texi b/gcc/doc/interface.texi
deleted file mode 100644
index 1688d6f66ecf..
--- a/gcc/doc/interface.texi
+++ /dev/null
@@ -1,70 +0,0 @@
-@c Copyright (C) 1988-2025 Free Software Foundation, Inc.
-@c This is part of the GCC manual.
-@c For copying conditions, see the file gcc.texi.
-
-@node Interface
-@chapter Interfacing to GCC Output
-@cindex interfacing to GCC output
-@cindex run-time conventions
-@cindex function call conventions
-@cindex conventions, run-time
-
-GCC is normally configured to use the same function calling convention
-normally in use on the target system.  This is done with the
-machine-description macros described (@pxref{Target Macros}).
-
-@cindex unions, returning
-@cindex structures, returning
-@cindex returning structures and unions
-However, returning of structure and union values is done differently on
-some target machines.  As a result, functions compiled with PCC
-returning such types cannot be called from code compiled with GCC,
-and vice versa.  This does not cause trouble often because few Unix
-library routines return structures or unions.
-
-GCC code returns structures and unions that are 1, 2, 4 or 8 bytes
-long in the same registers used for @code{int} or @code{double} return
-values.  (GCC typically allocate

[gcc r15-7488] Doc: Fix Texinfo warning in install.texi

2025-02-11 Thread Sandra Loosemore via Gcc-cvs
https://gcc.gnu.org/g:805329e09cede41209f6c3502fa2c17aefffe91b

commit r15-7488-g805329e09cede41209f6c3502fa2c17aefffe91b
Author: Sandra Loosemore 
Date:   Tue Feb 11 22:13:49 2025 +

Doc: Fix Texinfo warning in install.texi

For some time I've been seeing this Texinfo warning in my builds:

.../gcc/doc/install.texi:2295: warning: `.' or `,' must follow @xref, not f

Fixed thusly.

gcc/ChangeLog
* doc/install.texi: Add missing comma after @xref to fix warning.

Diff:
---
 gcc/doc/install.texi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index d6cf318b3afe..bd7a38048eb3 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -2292,7 +2292,7 @@ canadian cross build.  The @option{--disable-nls} option 
disables NLS@.
 Note that this functionality requires either libintl (provided by GNU
 gettext) or C standard library that contains support for gettext (such
 as the GNU C Library).
-@xref{with-included-gettext,,--with-included-gettext} for more
+@xref{with-included-gettext,,--with-included-gettext}, for more
 information on the conditions required to get gettext support.
 
 @item --with-libintl-prefix=@var{dir}


[gcc r15-7482] c++: don't default -frange-for-ext-temps in -std=gnu++20 [PR188574]

2025-02-11 Thread Jason Merrill via Gcc-cvs
https://gcc.gnu.org/g:556248d7d2cf557423993eb68f6a55ae6bda0cee

commit r15-7482-g556248d7d2cf557423993eb68f6a55ae6bda0cee
Author: Jason Merrill 
Date:   Tue Feb 11 13:51:32 2025 +0100

c++: don't default -frange-for-ext-temps in -std=gnu++20 [PR188574]

Since -frange-for-ext-temps has been causing trouble, let's not enable it
by default in pre-C++23 GNU modes for GCC 15, and also allow disabling it in
C++23 and up.

PR c++/188574

gcc/c-family/ChangeLog:

* c-opts.cc (c_common_post_options): Only enable
-frange-for-ext-temps by default in C++23.

gcc/ChangeLog:

* doc/invoke.texi: Adjust -frange-for-ext-temps documentation.

gcc/testsuite/ChangeLog:

* g++.dg/cpp23/range-for3.C: Use -frange-for-ext-temps.
* g++.dg/cpp23/range-for4.C: Adjust expected result.

libgomp/ChangeLog:

* testsuite/libgomp.c++/range-for-4.C: Adjust expected result.

Diff:
---
 gcc/doc/invoke.texi |  5 ++---
 gcc/c-family/c-opts.cc  | 17 +++--
 gcc/testsuite/g++.dg/cpp23/range-for3.C |  4 ++--
 gcc/testsuite/g++.dg/cpp23/range-for4.C |  4 ++--
 libgomp/testsuite/libgomp.c++/range-for-4.C |  2 +-
 5 files changed, 10 insertions(+), 22 deletions(-)

diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 0aef2abf05b9..56d43cb67796 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -3548,9 +3548,8 @@ easier, you can use @option{-fno-pretty-templates} to 
disable them.
 Enable lifetime extension of C++ range based for temporaries.
 With @option{-std=c++23} and above this is part of the language standard,
 so lifetime of the temporaries is extended until the end of the loop
-regardless of this option.  This option allows enabling that behavior also
-in earlier versions of the standard and is enabled by default in the
-GNU dialects, from @option{-std=gnu++11} until @option{-std=gnu++20}.
+by default.  This option allows enabling that behavior also
+in earlier versions of the standard.
 
 @opindex fno-rtti
 @opindex frtti
diff --git a/gcc/c-family/c-opts.cc b/gcc/c-family/c-opts.cc
index 87b231861a64..d43b3aef1024 100644
--- a/gcc/c-family/c-opts.cc
+++ b/gcc/c-family/c-opts.cc
@@ -1213,20 +1213,9 @@ c_common_post_options (const char **pfilename)
   if (cxx_dialect >= cxx20)
 flag_concepts = 1;
 
-  /* Enable lifetime extension of range based for temporaries for C++23.
- Diagnose -std=c++23 -fno-range-for-ext-temps.  */
-  if (cxx_dialect >= cxx23)
-{
-  if (OPTION_SET_P (flag_range_for_ext_temps)
- && !flag_range_for_ext_temps)
-   error ("%<-fno-range-for-ext-temps%> is incompatible with C++23");
-  flag_range_for_ext_temps = 1;
-}
-  /* Otherwise default to enabled in GNU modes but allow user to override.  */
-  else if (cxx_dialect >= cxx11
-  && !flag_iso
-  && !OPTION_SET_P (flag_range_for_ext_temps))
-flag_range_for_ext_temps = 1;
+  /* Enable lifetime extension of range based for temporaries for C++23.  */
+  SET_OPTION_IF_UNSET (&global_options, &global_options_set,
+  flag_range_for_ext_temps, cxx_dialect >= cxx23);
 
   /* -fimmediate-escalation has no effect when immediate functions are not
  supported.  */
diff --git a/gcc/testsuite/g++.dg/cpp23/range-for3.C 
b/gcc/testsuite/g++.dg/cpp23/range-for3.C
index 301e25886ec6..f95b21b3ceee 100644
--- a/gcc/testsuite/g++.dg/cpp23/range-for3.C
+++ b/gcc/testsuite/g++.dg/cpp23/range-for3.C
@@ -1,7 +1,7 @@
 // P2718R0 - Wording for P2644R1 Fix for Range-based for Loop
 // { dg-do run { target c++11 } }
-// Verify -frange-for-ext-temps is set by default in -std=gnu++* modes.
-// { dg-options "" }
+// Verify -frange-for-ext-temps works in earlier standards.
+// { dg-additional-options "-frange-for-ext-temps" }
 
 #define RANGE_FOR_EXT_TEMPS 1
 #include "range-for1.C"
diff --git a/gcc/testsuite/g++.dg/cpp23/range-for4.C 
b/gcc/testsuite/g++.dg/cpp23/range-for4.C
index f8c380d32c72..16204974bac9 100644
--- a/gcc/testsuite/g++.dg/cpp23/range-for4.C
+++ b/gcc/testsuite/g++.dg/cpp23/range-for4.C
@@ -1,7 +1,7 @@
 // P2718R0 - Wording for P2644R1 Fix for Range-based for Loop
 // { dg-do run { target c++11 } }
-// Verify -frange-for-ext-temps is set by default in -std=gnu++* modes.
+// Verify -frange-for-ext-temps is not set by default in -std=gnu++* modes.
 // { dg-options "" }
 
-#define RANGE_FOR_EXT_TEMPS 1
+#define RANGE_FOR_EXT_TEMPS 0
 #include "range-for2.C"
diff --git a/libgomp/testsuite/libgomp.c++/range-for-4.C 
b/libgomp/testsuite/libgomp.c++/range-for-4.C
index 3c10e7349af7..aa6e4da523c1 100644
--- a/libgomp/testsuite/libgomp.c++/range-for-4.C
+++ b/libgomp/testsuite/libgomp.c++/range-for-4.C
@@ -3,5 +3,5 @@
 // { dg-additional-options "-std=gnu++17" }
 // { dg-require-effective-target tls_runtime }
 
-#define RANGE_FOR_EXT_TEMPS 1
+#define RANGE_FOR_EXT_TEMPS 0
 #include "r

[gcc r15-7481] c++: change implementation of -frange-for-ext-temps [PR118574]

2025-02-11 Thread Jason Merrill via Gcc-cvs
https://gcc.gnu.org/g:0d2a5f3cb715fd95f1fa4a13b5d67c7eea28f178

commit r15-7481-g0d2a5f3cb715fd95f1fa4a13b5d67c7eea28f178
Author: Jason Merrill 
Date:   Mon Feb 10 15:44:13 2025 +0100

c++: change implementation of -frange-for-ext-temps [PR118574]

The implementation in r15-3840 used a novel technique of wrapping the entire
range-for loop in a CLEANUP_POINT_EXPR, which confused the coroutines
transformation.  Instead let's use the existing extend_ref_init_temps
mechanism.

This does not revert all of r15-3840, only the parts that change how
CLEANUP_POINT_EXPRs are applied to range-for declarations.

PR c++/118574
PR c++/107637

gcc/cp/ChangeLog:

* call.cc (struct extend_temps_data): New.
(extend_temps_r, extend_all_temps): New.
(set_up_extended_ref_temp): Handle tree walk case.
(extend_ref_init_temps): Cal extend_all_temps.
* decl.cc (initialize_local_var): Revert ext-temps change.
* parser.cc (cp_convert_range_for): Likewise.
(cp_parser_omp_loop_nest): Likewise.
* pt.cc (tsubst_stmt): Likewise.
* semantics.cc (finish_for_stmt): Likewise.

gcc/testsuite/ChangeLog:

* g++.dg/coroutines/range-for1.C: New test.

Diff:
---
 gcc/cp/call.cc   | 117 ---
 gcc/cp/decl.cc   |   5 --
 gcc/cp/parser.cc |  23 +-
 gcc/cp/pt.cc |  22 -
 gcc/cp/semantics.cc  |  13 ---
 gcc/testsuite/g++.dg/coroutines/range-for1.C |  69 
 6 files changed, 180 insertions(+), 69 deletions(-)

diff --git a/gcc/cp/call.cc b/gcc/cp/call.cc
index e440d58141ba..2c77b4a4b689 100644
--- a/gcc/cp/call.cc
+++ b/gcc/cp/call.cc
@@ -14154,6 +14154,20 @@ make_temporary_var_for_ref_to_temp (tree decl, tree 
type)
   return pushdecl (var);
 }
 
+/* Data for extend_temps_r, mostly matching the parameters of
+   extend_ref_init_temps.  */
+
+struct extend_temps_data
+{
+  tree decl;
+  tree init;
+  vec **cleanups;
+  tree* cond_guard;
+  hash_set *pset;
+};
+
+static tree extend_temps_r (tree *, int *, void *);
+
 /* EXPR is the initializer for a variable DECL of reference or
std::initializer_list type.  Create, push and return a new VAR_DECL
for the initializer so that it will live as long as DECL.  Any
@@ -14162,7 +14176,8 @@ make_temporary_var_for_ref_to_temp (tree decl, tree 
type)
 
 static tree
 set_up_extended_ref_temp (tree decl, tree expr, vec **cleanups,
- tree *initp, tree *cond_guard)
+ tree *initp, tree *cond_guard,
+ extend_temps_data *walk_data)
 {
   tree init;
   tree type;
@@ -14198,10 +14213,16 @@ set_up_extended_ref_temp (tree decl, tree expr, 
vec **cleanups,
   suppress_warning (decl);
 }
 
-  /* Recursively extend temps in this initializer.  */
-  TARGET_EXPR_INITIAL (expr)
-= extend_ref_init_temps (decl, TARGET_EXPR_INITIAL (expr), cleanups,
-cond_guard);
+  /* Recursively extend temps in this initializer.  The recursion needs to come
+ after creating the variable to conform to the mangling ABI, and before
+ maybe_constant_init because the extension might change its result.  */
+  if (walk_data)
+cp_walk_tree (&TARGET_EXPR_INITIAL (expr), extend_temps_r,
+ walk_data, walk_data->pset);
+  else
+TARGET_EXPR_INITIAL (expr)
+  = extend_ref_init_temps (decl, TARGET_EXPR_INITIAL (expr), cleanups,
+  cond_guard);
 
   /* Any reference temp has a non-trivial initializer.  */
   DECL_NONTRIVIALLY_INITIALIZED_P (var) = true;
@@ -14801,7 +14822,8 @@ extend_ref_init_temps_1 (tree decl, tree init, 
vec **cleanups,
   if (TREE_CODE (*p) == TARGET_EXPR)
 {
   tree subinit = NULL_TREE;
-  *p = set_up_extended_ref_temp (decl, *p, cleanups, &subinit, cond_guard);
+  *p = set_up_extended_ref_temp (decl, *p, cleanups, &subinit,
+cond_guard, nullptr);
   recompute_tree_invariant_for_addr_expr (sub);
   if (init != sub)
init = fold_convert (TREE_TYPE (init), sub);
@@ -14811,6 +14833,81 @@ extend_ref_init_temps_1 (tree decl, tree init, 
vec **cleanups,
   return init;
 }
 
+/* Tree walk function for extend_all_temps.  Generally parallel to
+   extend_ref_init_temps_1, but adapted for walk_tree.  */
+
+tree
+extend_temps_r (tree *tp, int *walk_subtrees, void *data)
+{
+  extend_temps_data *d = (extend_temps_data *)data;
+
+  if (TYPE_P (*tp) || TREE_CODE (*tp) == CLEANUP_POINT_EXPR)
+{
+  *walk_subtrees = 0;
+  return NULL_TREE;
+}
+
+  if (TREE_CODE (*tp) == COND_EXPR)
+{
+  cp_walk_tree (&TREE_OPERAND (*tp, 0), extend_temps_r, d, d->pset);
+
+  auto walk_arm = [d](tree &op)
+  {
+