[gcc r15-644] RISC-V: Fix "Nan-box the result of movbf on soft-bf16"

2024-05-17 Thread xiao via Gcc-cvs
https://gcc.gnu.org/g:7422e050f33dd9ee7dcd5a72c80b4e11d61995ce

commit r15-644-g7422e050f33dd9ee7dcd5a72c80b4e11d61995ce
Author: Xiao Zeng 
Date:   Wed May 15 16:23:16 2024 +0800

RISC-V: Fix "Nan-box the result of movbf on soft-bf16"

1 According to unpriv-isa spec:


  1.1 "FMV.H.X moves the half-precision value encoded in IEEE 754-2008
  standard encoding from the lower 16 bits of integer register rs1
  to the floating-point register rd, NaN-boxing the result."
  1.2 "FMV.W.X moves the single-precision value encoded in IEEE 754-2008
  standard encoding from the lower 32 bits of integer register rs1
  to the floating-point register rd. The bits are not modified in the
  transfer, and in particular, the payloads of non-canonical NaNs are 
preserved."

2 When (!TARGET_ZFHMIN == true && TARGET_HARD_FLOAT == true), instruction 
needs
to be added to complete the Nan-box, as done in
"RISC-V: Nan-box the result of movhf on soft-fp16":



3 Consider the "RISC-V: Nan-box the result of movbf on soft-bf16" in:


It ignores that both hf16 and bf16 are 16bits floating-point.

4 zfbfmin -> zfhmin in:



gcc/ChangeLog:

* config/riscv/riscv.cc (riscv_legitimize_move): Optimize movbf
with Nan-boxing value.
* config/riscv/riscv.md (*movhf_softfloat_boxing): Expand movbf
with Nan-boxing value.
(*mov_softfloat_boxing): Ditto.
with Nan-boxing value.
(*movbf_softfloat_boxing): Delete abandon pattern.

Diff:
---
 gcc/config/riscv/riscv.cc | 15 ++-
 gcc/config/riscv/riscv.md | 19 +--
 2 files changed, 11 insertions(+), 23 deletions(-)

diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
index 2be04ec6bc5e..7a34b4be873f 100644
--- a/gcc/config/riscv/riscv.cc
+++ b/gcc/config/riscv/riscv.cc
@@ -3192,13 +3192,12 @@ riscv_legitimize_move (machine_mode mode, rtx dest, rtx 
src)
  (set (reg:SI/DI mask) (const_int -65536)
  (set (reg:SI/DI temp) (zero_extend:SI/DI (subreg:HI (reg:HF/BF src) 0)))
  (set (reg:SI/DI temp) (ior:SI/DI (reg:SI/DI mask) (reg:SI/DI temp)))
- (set (reg:HF/BF dest) (unspec:HF/BF[ (reg:SI/DI temp) ]
-   UNSPEC_FMV_SFP16_X/UNSPEC_FMV_SBF16_X))
- */
+ (set (reg:HF/BF dest) (unspec:HF/BF[ (reg:SI/DI temp) ] 
UNSPEC_FMV_FP16_X))
+  */
 
   if (TARGET_HARD_FLOAT
-  && ((!TARGET_ZFHMIN && mode == HFmode)
- || (!TARGET_ZFBFMIN && mode == BFmode))
+  && !TARGET_ZFHMIN
+  && (mode == HFmode || mode == BFmode)
   && REG_P (dest) && FP_REG_P (REGNO (dest))
   && REG_P (src) && !FP_REG_P (REGNO (src))
   && can_create_pseudo_p ())
@@ -3213,10 +3212,8 @@ riscv_legitimize_move (machine_mode mode, rtx dest, rtx 
src)
   else
emit_insn (gen_iordi3 (temp, mask, temp));
 
-  riscv_emit_move (dest,
-  gen_rtx_UNSPEC (mode, gen_rtvec (1, temp),
-  mode == HFmode ? UNSPEC_FMV_SFP16_X
- : UNSPEC_FMV_SBF16_X));
+  riscv_emit_move (dest, gen_rtx_UNSPEC (mode, gen_rtvec (1, temp),
+UNSPEC_FMV_FP16_X));
 
   return true;
 }
diff --git a/gcc/config/riscv/riscv.md b/gcc/config/riscv/riscv.md
index 04f54cedad94..ff4557c1325f 100644
--- a/gcc/config/riscv/riscv.md
+++ b/gcc/config/riscv/riscv.md
@@ -87,8 +87,7 @@
   UNSPEC_STRLEN
 
   ;; Workaround for HFmode and BFmode without hardware extension
-  UNSPEC_FMV_SFP16_X
-  UNSPEC_FMV_SBF16_X
+  UNSPEC_FMV_FP16_X
 
   ;; XTheadFmv moves
   UNSPEC_XTHEADFMV
@@ -1959,23 +1958,15 @@
(set_attr "type" "fmove,move,load,store,mtc,mfc")
(set_attr "mode" "")])
 
-(define_insn "*movhf_softfloat_boxing"
-  [(set (match_operand:HF 0 "register_operand""=f")
-(unspec:HF [(match_operand:X 1 "register_operand" " r")] 
UNSPEC_FMV_SFP16_X))]
+(define_insn "*mov_softfloat_boxing"
+  [(set (match_operand:HFBF 0 "register_operand"   "=f")
+   (unspec:HFBF [(match_operand:X 1 "register_operand" " r")]
+UNSPEC_FMV_FP16_X))]
   "!TARGET_ZFHMIN"
   "fmv.w.x\t%0,%1"
   [(set_attr "type" "fmove")
(set_attr "mode" "SF")])
 
-(define_insn "*movbf_softfloat_boxing"
-  [(set (match_operand:BF 0 "register_operand"   "=f")
-   (unspec:BF [(match_operand:X 1 "register_operand" " r")]
-UNSPEC_FMV_SBF16_X))]
-  "!TARGET_ZFBFMIN"
-  "fmv.w.x\t%0,%1"
-  [(set_attr "type" "fmove")
-   (set_attr 

[gcc r15-643] RISC-V: Modify _Bfloat16 to __bf16

2024-05-17 Thread xiao via Gcc-cvs
https://gcc.gnu.org/g:6da1d6efde2282e6582c00d1631e7457975ad998

commit r15-643-g6da1d6efde2282e6582c00d1631e7457975ad998
Author: Xiao Zeng 
Date:   Fri May 17 13:48:21 2024 +0800

RISC-V: Modify _Bfloat16 to __bf16

According to the description in:
,
the type representation symbol of BF16 has been corrected.

Kito Cheng pointed out relevant information in the email:


gcc/ChangeLog:

* config/riscv/riscv-builtins.cc (riscv_init_builtin_types):
Modify _Bfloat16 to __bf16.
* config/riscv/riscv.cc (riscv_mangle_type): Ditto.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/_Bfloat16-nanboxing.c: Move to...
* gcc.target/riscv/__bf16-nanboxing.c: ...here.
* gcc.target/riscv/bf16_arithmetic.c: Modify _Bfloat16 to __bf16.
* gcc.target/riscv/bf16_call.c: Ditto.
* gcc.target/riscv/bf16_comparison.c: Ditto.
* gcc.target/riscv/bf16_float_libcall_convert.c: Ditto.
* gcc.target/riscv/bf16_integer_libcall_convert.c: Ditto.

Diff:
---
 gcc/config/riscv/riscv-builtins.cc   |  6 +++---
 gcc/config/riscv/riscv.cc|  2 +-
 .../riscv/{_Bfloat16-nanboxing.c => __bf16-nanboxing.c}  | 12 ++--
 gcc/testsuite/gcc.target/riscv/bf16_arithmetic.c |  6 +++---
 gcc/testsuite/gcc.target/riscv/bf16_call.c   |  4 ++--
 gcc/testsuite/gcc.target/riscv/bf16_comparison.c |  6 +++---
 gcc/testsuite/gcc.target/riscv/bf16_float_libcall_convert.c  |  2 +-
 .../gcc.target/riscv/bf16_integer_libcall_convert.c  |  2 +-
 8 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/gcc/config/riscv/riscv-builtins.cc 
b/gcc/config/riscv/riscv-builtins.cc
index 4c08834288ac..dc54e1a59b52 100644
--- a/gcc/config/riscv/riscv-builtins.cc
+++ b/gcc/config/riscv/riscv-builtins.cc
@@ -275,7 +275,7 @@ riscv_init_builtin_types (void)
 lang_hooks.types.register_builtin_type (riscv_float16_type_node,
"_Float16");
 
-  /* Provide the _Bfloat16 type and bfloat16_type_node if needed.  */
+  /* Provide the __bf16 type and bfloat16_type_node if needed.  */
   if (!bfloat16_type_node)
 {
   riscv_bfloat16_type_node = make_node (REAL_TYPE);
@@ -286,9 +286,9 @@ riscv_init_builtin_types (void)
   else
 riscv_bfloat16_type_node = bfloat16_type_node;
 
-  if (!maybe_get_identifier ("_Bfloat16"))
+  if (!maybe_get_identifier ("__bf16"))
 lang_hooks.types.register_builtin_type (riscv_bfloat16_type_node,
-   "_Bfloat16");
+   "__bf16");
 }
 
 /* Implement TARGET_INIT_BUILTINS.  */
diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
index 9ac2be87acd2..2be04ec6bc5e 100644
--- a/gcc/config/riscv/riscv.cc
+++ b/gcc/config/riscv/riscv.cc
@@ -10276,7 +10276,7 @@ riscv_asan_shadow_offset (void)
 static const char *
 riscv_mangle_type (const_tree type)
 {
-  /* Half-precision float, _Float16 is "DF16_" and _Bfloat16 is "DF16b".  */
+  /* Half-precision float, _Float16 is "DF16_" and __bf16 is "DF16b".  */
   if (SCALAR_FLOAT_TYPE_P (type) && TYPE_PRECISION (type) == 16)
 {
   if (TYPE_MODE (type) == HFmode)
diff --git a/gcc/testsuite/gcc.target/riscv/_Bfloat16-nanboxing.c 
b/gcc/testsuite/gcc.target/riscv/__bf16-nanboxing.c
similarity index 83%
rename from gcc/testsuite/gcc.target/riscv/_Bfloat16-nanboxing.c
rename to gcc/testsuite/gcc.target/riscv/__bf16-nanboxing.c
index 11a73d222345..a9a586c98b9c 100644
--- a/gcc/testsuite/gcc.target/riscv/_Bfloat16-nanboxing.c
+++ b/gcc/testsuite/gcc.target/riscv/__bf16-nanboxing.c
@@ -1,14 +1,14 @@
 /* { dg-do compile } */
 /* { dg-options "-march=rv64ifd -mabi=lp64d -mcmodel=medlow -O" } */
 
-_Bfloat16 gvar = 9.87654;
+__bf16 gvar = 9.87654;
 union U
 {
   unsigned short i16;
-  _Bfloat16 f16;
+  __bf16 f16;
 };
 
-_Bfloat16
+__bf16
 test1 (unsigned short input)
 {
   union U tmp;
@@ -16,19 +16,19 @@ test1 (unsigned short input)
   return tmp.f16;
 }
 
-_Bfloat16
+__bf16
 test2 ()
 {
   return 1.234f;
 }
 
-_Bfloat16
+__bf16
 test3 ()
 {
   return gvar;
 }
 
-_Bfloat16
+__bf16
 test ()
 {
   return 0.0f;
diff --git a/gcc/testsuite/gcc.target/riscv/bf16_arithmetic.c 
b/gcc/testsuite/gcc.target/riscv/bf16_arithmetic.c
index 9e4850512600..190cc1d574a6 100644
--- a/gcc/testsuite/gcc.target/riscv/bf16_arithmetic.c
+++ b/gcc/testsuite/gcc.target/riscv/bf16_arithmetic.c
@@ -5,9 +5,9 @@
 /* 1) bf -> sf  (call  __extendbfsf2)  */
 /* 2) sf1 [+|-|*|/] sf2 (call  __[add|sub|mul|div]sf3)  */
 /* 3) sf -> bf  (call  __truncsfbf2)  */
-extern _Bfloat16 bf;
-extern _Bfloat16 bf1;
-extern _Bfloat16 bf2;
+extern __bf16 bf;
+extern __bf16 bf1;
+extern 

[gcc r15-642] RISC-V: Implement IFN SAT_ADD for both the scalar and vector

2024-05-17 Thread Pan Li via Gcc-cvs
https://gcc.gnu.org/g:34ed2b4593fa98b613632d0dde30b6ba3e7ecad9

commit r15-642-g34ed2b4593fa98b613632d0dde30b6ba3e7ecad9
Author: Pan Li 
Date:   Fri May 17 18:49:46 2024 +0800

RISC-V: Implement IFN SAT_ADD for both the scalar and vector

The patch implement the SAT_ADD in the riscv backend as the
sample for both the scalar and vector.  Given below vector
as example:

void vec_sat_add_u64 (uint64_t *out, uint64_t *x, uint64_t *y, unsigned n)
{
  unsigned i;

  for (i = 0; i < n; i++)
out[i] = (x[i] + y[i]) | (- (uint64_t)((uint64_t)(x[i] + y[i]) < x[i]));
}

Before this patch:
vec_sat_add_u64:
  ...
  vsetvli a5,a3,e64,m1,ta,ma
  vle64.v v0,0(a1)
  vle64.v v1,0(a2)
  sllia4,a5,3
  sub a3,a3,a5
  add a1,a1,a4
  add a2,a2,a4
  vadd.vv v1,v0,v1
  vmsgtu.vv   v0,v0,v1
  vmerge.vim  v1,v1,-1,v0
  vse64.v v1,0(a0)
  ...

After this patch:
vec_sat_add_u64:
  ...
  vsetvli a5,a3,e64,m1,ta,ma
  vle64.v v1,0(a1)
  vle64.v v2,0(a2)
  sllia4,a5,3
  sub a3,a3,a5
  add a1,a1,a4
  add a2,a2,a4
  vsaddu.vv   v1,v1,v2  <=  Vector Single-Width Saturating Add
  vse64.v v1,0(a0)
  ...

The below test suites are passed for this patch.
* The riscv fully regression tests.
* The aarch64 fully regression tests.
* The x86 bootstrap tests.
* The x86 fully regression tests.

PR target/51492
PR target/112600

gcc/ChangeLog:

* config/riscv/autovec.md (usadd3): New pattern expand for
the unsigned SAT_ADD in vector mode.
* config/riscv/riscv-protos.h (riscv_expand_usadd): New func decl
to expand usadd3 pattern.
(expand_vec_usadd): Ditto but for vector.
* config/riscv/riscv-v.cc (emit_vec_saddu): New func impl to emit
the vsadd insn.
(expand_vec_usadd): New func impl to expand usadd3 for vector.
* config/riscv/riscv.cc (riscv_expand_usadd): New func impl to
expand usadd3 for scalar.
* config/riscv/riscv.md (usadd3): New pattern expand for
the unsigned SAT_ADD in scalar mode.
* config/riscv/vector.md: Allow VLS mode for vsaddu.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/binop/vec_sat_binary.h: New test.
* gcc.target/riscv/rvv/autovec/binop/vec_sat_u_add-1.c: New test.
* gcc.target/riscv/rvv/autovec/binop/vec_sat_u_add-2.c: New test.
* gcc.target/riscv/rvv/autovec/binop/vec_sat_u_add-3.c: New test.
* gcc.target/riscv/rvv/autovec/binop/vec_sat_u_add-4.c: New test.
* gcc.target/riscv/rvv/autovec/binop/vec_sat_u_add-run-1.c: New 
test.
* gcc.target/riscv/rvv/autovec/binop/vec_sat_u_add-run-2.c: New 
test.
* gcc.target/riscv/rvv/autovec/binop/vec_sat_u_add-run-3.c: New 
test.
* gcc.target/riscv/rvv/autovec/binop/vec_sat_u_add-run-4.c: New 
test.
* gcc.target/riscv/sat_arith.h: New test.
* gcc.target/riscv/sat_u_add-1.c: New test.
* gcc.target/riscv/sat_u_add-2.c: New test.
* gcc.target/riscv/sat_u_add-3.c: New test.
* gcc.target/riscv/sat_u_add-4.c: New test.
* gcc.target/riscv/sat_u_add-run-1.c: New test.
* gcc.target/riscv/sat_u_add-run-2.c: New test.
* gcc.target/riscv/sat_u_add-run-3.c: New test.
* gcc.target/riscv/sat_u_add-run-4.c: New test.
* gcc.target/riscv/scalar_sat_binary.h: New test.

Signed-off-by: Pan Li 

Diff:
---
 gcc/config/riscv/autovec.md| 17 +
 gcc/config/riscv/riscv-protos.h|  2 +
 gcc/config/riscv/riscv-v.cc| 19 ++
 gcc/config/riscv/riscv.cc  | 55 
 gcc/config/riscv/riscv.md  | 11 
 gcc/config/riscv/vector.md | 12 ++--
 .../riscv/rvv/autovec/binop/vec_sat_binary.h   | 33 ++
 .../riscv/rvv/autovec/binop/vec_sat_u_add-1.c  | 19 ++
 .../riscv/rvv/autovec/binop/vec_sat_u_add-2.c  | 20 ++
 .../riscv/rvv/autovec/binop/vec_sat_u_add-3.c  | 20 ++
 .../riscv/rvv/autovec/binop/vec_sat_u_add-4.c  | 20 ++
 .../riscv/rvv/autovec/binop/vec_sat_u_add-run-1.c  | 75 ++
 .../riscv/rvv/autovec/binop/vec_sat_u_add-run-2.c  | 75 ++
 .../riscv/rvv/autovec/binop/vec_sat_u_add-run-3.c  | 75 ++
 .../riscv/rvv/autovec/binop/vec_sat_u_add-run-4.c  | 75 ++
 gcc/testsuite/gcc.target/riscv/sat_arith.h | 31 +
 gcc/testsuite/gcc.target/riscv/sat_u_add-1.c   | 19 ++
 gcc/testsuite/gcc.target/riscv/sat_u_add-2.c   | 21 ++
 

[gcc(refs/users/meissner/heads/work166-vpair)] Merge commit 'refs/users/meissner/heads/work166-vpair' of git+ssh://gcc.gnu.org/git/gcc into me/work

2024-05-17 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:e60cea0eb7b7a7887270717e3acb24a280af9f95

commit e60cea0eb7b7a7887270717e3acb24a280af9f95
Merge: d8ce7db4c231 371220eb0c01
Author: Michael Meissner 
Date:   Fri May 17 21:07:48 2024 -0400

Merge commit 'refs/users/meissner/heads/work166-vpair' of 
git+ssh://gcc.gnu.org/git/gcc into me/work166-vpair

Diff:


[gcc(refs/users/meissner/heads/work166-vpair)] Add ChangeLog.vpair and update REVISION.

2024-05-17 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:d8ce7db4c231d73ebba1285e237f8b34e8e502fb

commit d8ce7db4c231d73ebba1285e237f8b34e8e502fb
Author: Michael Meissner 
Date:   Fri May 17 20:41:52 2024 -0400

Add ChangeLog.vpair and update REVISION.

2024-05-17  Michael Meissner  

gcc/

* ChangeLog.vpair: New file for branch.
* REVISION: Update.

Diff:
---
 gcc/ChangeLog.vpair | 6 ++
 gcc/REVISION| 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog.vpair b/gcc/ChangeLog.vpair
new file mode 100644
index ..172fd3d00bc4
--- /dev/null
+++ b/gcc/ChangeLog.vpair
@@ -0,0 +1,6 @@
+ Branch work166-vpair, baseline 
+
+2024-05-17   Michael Meissner  
+
+   Clone branch
+
diff --git a/gcc/REVISION b/gcc/REVISION
index 42eef54d0aeb..155b9d8d70eb 100644
--- a/gcc/REVISION
+++ b/gcc/REVISION
@@ -1 +1 @@
-work166 branch
+work166-vpair branch


[gcc/meissner/heads/work166-vpair] (8 commits) Merge commit 'refs/users/meissner/heads/work166-vpair' of g

2024-05-17 Thread Michael Meissner via Gcc-cvs
The branch 'meissner/heads/work166-vpair' was updated to point to:

 e60cea0eb7b7... Merge commit 'refs/users/meissner/heads/work166-vpair' of g

It previously pointed to:

 371220eb0c01... Add ChangeLog.vpair and update REVISION.

Diff:

Summary of changes (added commits):
---

  e60cea0... Merge commit 'refs/users/meissner/heads/work166-vpair' of g
  d8ce7db... Add ChangeLog.vpair and update REVISION.
  373ebc4... Update ChangeLog.* (*)
  a0ccb78... Add -mcpu=future tuning support. (*)
  78dc639... Add -mcpu=future support. (*)
  d69f7b4... Add -mcpu=power11 tests. (*)
  c47c66e... Add -mcpu=power11 tuning support. (*)
  00c9f9b... Add -mcpu=power11 support. (*)

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


[gcc(refs/users/meissner/heads/work166-test)] Merge commit 'refs/users/meissner/heads/work166-test' of git+ssh://gcc.gnu.org/git/gcc into me/work1

2024-05-17 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:92c1554aaa046ea67e52cebf8616390f8d772878

commit 92c1554aaa046ea67e52cebf8616390f8d772878
Merge: d955b23a2461 ebd3fabfb5ba
Author: Michael Meissner 
Date:   Fri May 17 21:06:41 2024 -0400

Merge commit 'refs/users/meissner/heads/work166-test' of 
git+ssh://gcc.gnu.org/git/gcc into me/work166-test

Diff:


[gcc(refs/users/meissner/heads/work166-test)] Add ChangeLog.test and update REVISION.

2024-05-17 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:d955b23a2461097fbd714d30945505762cdd0a21

commit d955b23a2461097fbd714d30945505762cdd0a21
Author: Michael Meissner 
Date:   Fri May 17 20:48:57 2024 -0400

Add ChangeLog.test and update REVISION.

2024-05-17  Michael Meissner  

gcc/

* ChangeLog.test: New file for branch.
* REVISION: Update.

Diff:
---
 gcc/ChangeLog.test | 6 ++
 gcc/REVISION   | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog.test b/gcc/ChangeLog.test
new file mode 100644
index ..e2a281f8f9ec
--- /dev/null
+++ b/gcc/ChangeLog.test
@@ -0,0 +1,6 @@
+ Branch work166-test, baseline 
+
+2024-05-17   Michael Meissner  
+
+   Clone branch
+
diff --git a/gcc/REVISION b/gcc/REVISION
index 42eef54d0aeb..a8ef9d6b8080 100644
--- a/gcc/REVISION
+++ b/gcc/REVISION
@@ -1 +1 @@
-work166 branch
+work166-test branch


[gcc/meissner/heads/work166-test] (8 commits) Merge commit 'refs/users/meissner/heads/work166-test' of gi

2024-05-17 Thread Michael Meissner via Gcc-cvs
The branch 'meissner/heads/work166-test' was updated to point to:

 92c1554aaa04... Merge commit 'refs/users/meissner/heads/work166-test' of gi

It previously pointed to:

 ebd3fabfb5ba... Add ChangeLog.test and update REVISION.

Diff:

Summary of changes (added commits):
---

  92c1554... Merge commit 'refs/users/meissner/heads/work166-test' of gi
  d955b23... Add ChangeLog.test and update REVISION.
  373ebc4... Update ChangeLog.* (*)
  a0ccb78... Add -mcpu=future tuning support. (*)
  78dc639... Add -mcpu=future support. (*)
  d69f7b4... Add -mcpu=power11 tests. (*)
  c47c66e... Add -mcpu=power11 tuning support. (*)
  00c9f9b... Add -mcpu=power11 support. (*)

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


[gcc(refs/users/meissner/heads/work166-tar)] Merge commit 'refs/users/meissner/heads/work166-tar' of git+ssh://gcc.gnu.org/git/gcc into me/work16

2024-05-17 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:7f03db8d29149b9b3c0a04f849d38649e5917c08

commit 7f03db8d29149b9b3c0a04f849d38649e5917c08
Merge: b0dd90490ee6 1a2e3e0e4240
Author: Michael Meissner 
Date:   Fri May 17 21:05:34 2024 -0400

Merge commit 'refs/users/meissner/heads/work166-tar' of 
git+ssh://gcc.gnu.org/git/gcc into me/work166-tar

Diff:


[gcc/meissner/heads/work166-tar] (8 commits) Merge commit 'refs/users/meissner/heads/work166-tar' of git

2024-05-17 Thread Michael Meissner via Gcc-cvs
The branch 'meissner/heads/work166-tar' was updated to point to:

 7f03db8d2914... Merge commit 'refs/users/meissner/heads/work166-tar' of git

It previously pointed to:

 1a2e3e0e4240... Add ChangeLog.tar and update REVISION.

Diff:

Summary of changes (added commits):
---

  7f03db8... Merge commit 'refs/users/meissner/heads/work166-tar' of git
  b0dd904... Add ChangeLog.tar and update REVISION.
  373ebc4... Update ChangeLog.* (*)
  a0ccb78... Add -mcpu=future tuning support. (*)
  78dc639... Add -mcpu=future support. (*)
  d69f7b4... Add -mcpu=power11 tests. (*)
  c47c66e... Add -mcpu=power11 tuning support. (*)
  00c9f9b... Add -mcpu=power11 support. (*)

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


[gcc(refs/users/meissner/heads/work166-tar)] Add ChangeLog.tar and update REVISION.

2024-05-17 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:b0dd90490ee602491f114faf07969e6baf4b9f49

commit b0dd90490ee602491f114faf07969e6baf4b9f49
Author: Michael Meissner 
Date:   Fri May 17 20:47:03 2024 -0400

Add ChangeLog.tar and update REVISION.

2024-05-17  Michael Meissner  

gcc/

* ChangeLog.tar: New file for branch.
* REVISION: Update.

Diff:
---
 gcc/ChangeLog.tar | 6 ++
 gcc/REVISION  | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog.tar b/gcc/ChangeLog.tar
new file mode 100644
index ..3e168fa367eb
--- /dev/null
+++ b/gcc/ChangeLog.tar
@@ -0,0 +1,6 @@
+ Branch work166-tar, baseline 
+
+2024-05-17   Michael Meissner  
+
+   Clone branch
+
diff --git a/gcc/REVISION b/gcc/REVISION
index 42eef54d0aeb..3b5b120ee37e 100644
--- a/gcc/REVISION
+++ b/gcc/REVISION
@@ -1 +1 @@
-work166 branch
+work166-tar branch


[gcc(refs/users/meissner/heads/work166-dmf)] Merge commit 'refs/users/meissner/heads/work166-dmf' of git+ssh://gcc.gnu.org/git/gcc into me/work16

2024-05-17 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:93ac8e1984dd4f23f79508ab73112adb197dfba2

commit 93ac8e1984dd4f23f79508ab73112adb197dfba2
Merge: 4c7f5203b45e 40164d125941
Author: Michael Meissner 
Date:   Fri May 17 21:03:34 2024 -0400

Merge commit 'refs/users/meissner/heads/work166-dmf' of 
git+ssh://gcc.gnu.org/git/gcc into me/work166-dmf

Diff:


[gcc(refs/users/meissner/heads/work166-dmf)] Add ChangeLog.dmf and update REVISION.

2024-05-17 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:4c7f5203b45e07a82673f95f5dfa8fb6c9dde105

commit 4c7f5203b45e07a82673f95f5dfa8fb6c9dde105
Author: Michael Meissner 
Date:   Fri May 17 20:40:56 2024 -0400

Add ChangeLog.dmf and update REVISION.

2024-05-17  Michael Meissner  

gcc/

* ChangeLog.dmf: New file for branch.
* REVISION: Update.

Diff:
---
 gcc/ChangeLog.dmf | 6 ++
 gcc/REVISION  | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog.dmf b/gcc/ChangeLog.dmf
new file mode 100644
index ..ab0fdd1054fb
--- /dev/null
+++ b/gcc/ChangeLog.dmf
@@ -0,0 +1,6 @@
+ Branch work166-dmf, baseline 
+
+2024-05-17   Michael Meissner  
+
+   Clone branch
+
diff --git a/gcc/REVISION b/gcc/REVISION
index 42eef54d0aeb..ee73a03644d7 100644
--- a/gcc/REVISION
+++ b/gcc/REVISION
@@ -1 +1 @@
-work166 branch
+work166-dmf branch


[gcc/meissner/heads/work166-dmf] (8 commits) Merge commit 'refs/users/meissner/heads/work166-dmf' of git

2024-05-17 Thread Michael Meissner via Gcc-cvs
The branch 'meissner/heads/work166-dmf' was updated to point to:

 93ac8e1984dd... Merge commit 'refs/users/meissner/heads/work166-dmf' of git

It previously pointed to:

 40164d125941... Add ChangeLog.dmf and update REVISION.

Diff:

Summary of changes (added commits):
---

  93ac8e1... Merge commit 'refs/users/meissner/heads/work166-dmf' of git
  4c7f520... Add ChangeLog.dmf and update REVISION.
  373ebc4... Update ChangeLog.* (*)
  a0ccb78... Add -mcpu=future tuning support. (*)
  78dc639... Add -mcpu=future support. (*)
  d69f7b4... Add -mcpu=power11 tests. (*)
  c47c66e... Add -mcpu=power11 tuning support. (*)
  00c9f9b... Add -mcpu=power11 support. (*)

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


[gcc(refs/users/meissner/heads/work166-bugs)] Merge commit 'refs/users/meissner/heads/work166-bugs' of git+ssh://gcc.gnu.org/git/gcc into me/work1

2024-05-17 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:0c733b94c2d60debfec04af40b87382bb2a8b1e8

commit 0c733b94c2d60debfec04af40b87382bb2a8b1e8
Merge: fac728fd72e4 4adff7dc8cd2
Author: Michael Meissner 
Date:   Fri May 17 21:02:22 2024 -0400

Merge commit 'refs/users/meissner/heads/work166-bugs' of 
git+ssh://gcc.gnu.org/git/gcc into me/work166-bugs

Diff:


[gcc(refs/users/meissner/heads/work166-bugs)] Add ChangeLog.bugs and update REVISION.

2024-05-17 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:fac728fd72e41d2ee9292dd39570b66bf5e62b23

commit fac728fd72e41d2ee9292dd39570b66bf5e62b23
Author: Michael Meissner 
Date:   Fri May 17 20:47:59 2024 -0400

Add ChangeLog.bugs and update REVISION.

2024-05-17  Michael Meissner  

gcc/

* ChangeLog.bugs: New file for branch.
* REVISION: Update.

Diff:
---
 gcc/ChangeLog.bugs | 6 ++
 gcc/REVISION   | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog.bugs b/gcc/ChangeLog.bugs
new file mode 100644
index ..48a479c763ff
--- /dev/null
+++ b/gcc/ChangeLog.bugs
@@ -0,0 +1,6 @@
+ Branch work166-bugs, baseline 
+
+2024-05-17   Michael Meissner  
+
+   Clone branch
+
diff --git a/gcc/REVISION b/gcc/REVISION
index 42eef54d0aeb..5e353b50cf66 100644
--- a/gcc/REVISION
+++ b/gcc/REVISION
@@ -1 +1 @@
-work166 branch
+work166-bugs branch


[gcc/meissner/heads/work166-bugs] (8 commits) Merge commit 'refs/users/meissner/heads/work166-bugs' of gi

2024-05-17 Thread Michael Meissner via Gcc-cvs
The branch 'meissner/heads/work166-bugs' was updated to point to:

 0c733b94c2d6... Merge commit 'refs/users/meissner/heads/work166-bugs' of gi

It previously pointed to:

 4adff7dc8cd2... Add ChangeLog.bugs and update REVISION.

Diff:

Summary of changes (added commits):
---

  0c733b9... Merge commit 'refs/users/meissner/heads/work166-bugs' of gi
  fac728f... Add ChangeLog.bugs and update REVISION.
  373ebc4... Update ChangeLog.* (*)
  a0ccb78... Add -mcpu=future tuning support. (*)
  78dc639... Add -mcpu=future support. (*)
  d69f7b4... Add -mcpu=power11 tests. (*)
  c47c66e... Add -mcpu=power11 tuning support. (*)
  00c9f9b... Add -mcpu=power11 support. (*)

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


[gcc(refs/users/meissner/heads/work166)] Update ChangeLog.*

2024-05-17 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:373ebc4c081d8e60a58a832f7b4244b8b5794d68

commit 373ebc4c081d8e60a58a832f7b4244b8b5794d68
Author: Michael Meissner 
Date:   Fri May 17 21:01:02 2024 -0400

Update ChangeLog.*

Diff:
---
 gcc/ChangeLog.meissner | 185 -
 1 file changed, 184 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog.meissner b/gcc/ChangeLog.meissner
index 50c34720bc0d..c192220892b8 100644
--- a/gcc/ChangeLog.meissner
+++ b/gcc/ChangeLog.meissner
@@ -1,6 +1,189 @@
+ Branch work166, patch #11 
+
+Add -mcpu=future tuning support.
+
+This patch makes -mtune=future use the same tuning decision as -mtune=power11.
+
+2024-05-17  Michael Meissner  
+
+gcc/
+
+   * config/rs6000/power10.md (all reservations): Add future as an
+   alterntive to power10 and power11.
+
+ Branch work166, patch #10 
+
+Add -mcpu=future support.
+
+This patch adds the future option to the -mcpu= and -mtune= switches.
+
+This patch treats the future like a power11 in terms of costs and reassociation
+width.
+
+This patch issues a ".machine future" to the assembly file if you use
+-mcpu=power11.
+
+This patch defines _ARCH_PWR_FUTURE if the user uses -mcpu=future.
+
+This patch allows GCC to be configured with the --with-cpu=future and
+--with-tune=future options.
+
+This patch passes -mfuture to the assembler if the user uses -mcpu=future.
+
+2024-05-17  Michael Meissner  
+
+gcc/
+
+   * config.gcc (rs6000*-*-*, powerpc*-*-*): Add support for power11.
+   * config/rs6000/aix71.h (ASM_CPU_SPEC): Add support for -mcpu=power11.
+   * config/rs6000/aix72.h (ASM_CPU_SPEC): Likewise.
+   * config/rs6000/aix73.h (ASM_CPU_SPEC): Likewise.
+   * config/rs6000/driver-rs6000.cc (asm_names): Likewise.
+   * config/rs6000/rs6000-c.cc (rs6000_target_modify_macros): Define
+   _ARCH_PWR_FUTURE if -mcpu=future.
+   * config/rs6000/rs6000-cpus.def (ISA_FUTURE_MASKS_SERVER): New define.
+   (POWERPC_MASKS): Add future isa bit.
+   (power11 cpu): Add future definition.
+   * config/rs6000/rs6000-opts.h (PROCESSOR_FUTURE): Add future processor.
+   * config/rs6000/rs6000-string.cc (expand_compare_loop): Likewise.
+   * config/rs6000/rs6000-tables.opt: Regenerate.
+   * config/rs6000/rs6000.cc (rs6000_option_override_internal): Add future
+   support.
+   (rs6000_machine_from_flags): Likewise.
+   (rs6000_reassociation_width): Likewise.
+   (rs6000_adjust_cost): Likewise.
+   (rs6000_issue_rate): Likewise.
+   (rs6000_sched_reorder): Likewise.
+   (rs6000_sched_reorder2): Likewise.
+   (rs6000_register_move_cost): Likewise.
+   (rs6000_opt_masks): Likewise.
+   * config/rs6000/rs6000.h (ASM_CPU_SPEC): Likewise.
+   * config/rs6000/rs6000.md (cpu attribute): Add future.
+   * config/rs6000/rs6000.opt (-mpower11): Add internal future ISA flag.
+   * doc/invoke.texi (RS/6000 and PowerPC Options): Document -mcpu=future.
+
+ Branch work166, patch #3 
+
+Add -mcpu=power11 tests.
+
+This patch adds some simple tests for -mcpu=power11 support.  In order to run
+these tests, you need an assembler that supports the appropriate option for
+supporting the Power11 processor (-mpower11 under Linux or -mpwr11 under AIX).
+
+2024-05-17  Michael Meissner  
+
+gcc/testsuite/
+
+   * gcc.target/powerpc/power11-1.c: New test.
+   * gcc.target/powerpc/power11-2.c: Likewise.
+   * gcc.target/powerpc/power11-3.c: Likewise.
+   * lib/target-supports.exp (check_effective_target_power11_ok): Add new
+   effective target.
+
+ Branch work166, patch #2 
+
+Add -mcpu=power11 tuning support.
+
+This patch makes -mtune=power11 use the same tuning decisions as 
-mtune=power10.
+
+2024-05-17  Michael Meissner  
+
+gcc/
+
+   * config/rs6000/power10.md (all reservations): Add power11 as an
+   alternative to power10.
+
+ Branch work166, patch #1 
+
+Add -mcpu=power11 support.
+
+This patch adds the power11 option to the -mcpu= and -mtune= switches.
+
+This patch treats the power11 like a power10 in terms of costs and 
reassociation
+width.
+
+This patch issues a ".machine power11" to the assembly file if you use
+-mcpu=power11.
+
+This patch defines _ARCH_PWR11 if the user uses -mcpu=power11.
+
+This patch allows GCC to be configured with the --with-cpu=power11 and
+--with-tune=power11 options.
+
+This patch passes -mpwr11 to the assembler if the user uses -mcpu=power11.
+
+This patch adds support for using "power11" in the __builtin_cpu_is built-in
+function.
+
+2024-05-17  Michael Meissner  
+
+gcc/
+
+   * config.gcc (rs6000*-*-*, powerpc*-*-*): Add support for power11.
+   * config/rs6000/aix71.h (ASM_CPU_SPEC): Add support for -mcpu=power11.
+   * config/rs6000/aix72.h (ASM_CPU_SPEC): 

[gcc(refs/users/meissner/heads/work166)] Add -mcpu=future tuning support.

2024-05-17 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:a0ccb78078a306d10ba79d60c5258c0cbdd6a4cf

commit a0ccb78078a306d10ba79d60c5258c0cbdd6a4cf
Author: Michael Meissner 
Date:   Fri May 17 20:57:50 2024 -0400

Add -mcpu=future tuning support.

This patch makes -mtune=future use the same tuning decision as 
-mtune=power11.

2024-05-17  Michael Meissner  

gcc/

* config/rs6000/power10.md (all reservations): Add future as an
alterntive to power10 and power11.

Diff:
---
 gcc/config/rs6000/power10.md | 145 ++-
 1 file changed, 73 insertions(+), 72 deletions(-)

diff --git a/gcc/config/rs6000/power10.md b/gcc/config/rs6000/power10.md
index 90312643858e..1ec1bef07260 100644
--- a/gcc/config/rs6000/power10.md
+++ b/gcc/config/rs6000/power10.md
@@ -1,4 +1,5 @@
-;; Scheduling description for the IBM POWER10 and POWER11 processors.
+;; Scheduling description for the IBM POWER10 and POWER11 processors as well as
+;; potential future processors.
 ;; Copyright (C) 2020-2024 Free Software Foundation, Inc.
 ;;
 ;; Contributed by Pat Haugen (pthau...@us.ibm.com).
@@ -97,12 +98,12 @@
(eq_attr "update" "no")
(eq_attr "size" "!128")
(eq_attr "prefixed" "no")
-   (eq_attr "cpu" "power10,power11"))
+   (eq_attr "cpu" "power10,power11,future"))
   "DU_any_power10,LU_power10")
 
 (define_insn_reservation "power10-fused-load" 4
   (and (eq_attr "type" "fused_load_cmpi,fused_addis_load,fused_load_load")
-   (eq_attr "cpu" "power10,power11"))
+   (eq_attr "cpu" "power10,power11,future"))
   "DU_even_power10,LU_power10")
 
 (define_insn_reservation "power10-prefixed-load" 4
@@ -110,13 +111,13 @@
(eq_attr "update" "no")
(eq_attr "size" "!128")
(eq_attr "prefixed" "yes")
-   (eq_attr "cpu" "power10,power11"))
+   (eq_attr "cpu" "power10,power11,future"))
   "DU_even_power10,LU_power10")
 
 (define_insn_reservation "power10-load-update" 4
   (and (eq_attr "type" "load")
(eq_attr "update" "yes")
-   (eq_attr "cpu" "power10,power11"))
+   (eq_attr "cpu" "power10,power11,future"))
   "DU_even_power10,LU_power10+SXU_power10")
 
 (define_insn_reservation "power10-fpload-double" 4
@@ -124,7 +125,7 @@
(eq_attr "update" "no")
(eq_attr "size" "64")
(eq_attr "prefixed" "no")
-   (eq_attr "cpu" "power10,power11"))
+   (eq_attr "cpu" "power10,power11,future"))
   "DU_any_power10,LU_power10")
 
 (define_insn_reservation "power10-prefixed-fpload-double" 4
@@ -132,14 +133,14 @@
(eq_attr "update" "no")
(eq_attr "size" "64")
(eq_attr "prefixed" "yes")
-   (eq_attr "cpu" "power10,power11"))
+   (eq_attr "cpu" "power10,power11,future"))
   "DU_even_power10,LU_power10")
 
 (define_insn_reservation "power10-fpload-update-double" 4
   (and (eq_attr "type" "fpload")
(eq_attr "update" "yes")
(eq_attr "size" "64")
-   (eq_attr "cpu" "power10,power11"))
+   (eq_attr "cpu" "power10,power11,future"))
   "DU_even_power10,LU_power10+SXU_power10")
 
 ; SFmode loads are cracked and have additional 3 cycles over DFmode
@@ -148,27 +149,27 @@
   (and (eq_attr "type" "fpload")
(eq_attr "update" "no")
(eq_attr "size" "32")
-   (eq_attr "cpu" "power10,power11"))
+   (eq_attr "cpu" "power10,power11,future"))
   "DU_even_power10,LU_power10")
 
 (define_insn_reservation "power10-fpload-update-single" 7
   (and (eq_attr "type" "fpload")
(eq_attr "update" "yes")
(eq_attr "size" "32")
-   (eq_attr "cpu" "power10,power11"))
+   (eq_attr "cpu" "power10,power11,future"))
   "DU_even_power10,LU_power10+SXU_power10")
 
 (define_insn_reservation "power10-vecload" 4
   (and (eq_attr "type" "vecload")
(eq_attr "size" "!256")
-   (eq_attr "cpu" "power10,power11"))
+   (eq_attr "cpu" "power10,power11,future"))
   "DU_any_power10,LU_power10")
 
 ; lxvp
 (define_insn_reservation "power10-vecload-pair" 4
   (and (eq_attr "type" "vecload")
(eq_attr "size" "256")
-   (eq_attr "cpu" "power10,power11"))
+   (eq_attr "cpu" "power10,power11,future"))
   "DU_even_power10,LU_power10+SXU_power10")
 
 ; Store Unit
@@ -178,12 +179,12 @@
(eq_attr "prefixed" "no")
(eq_attr "size" "!128")
(eq_attr "size" "!256")
-   (eq_attr "cpu" "power10,power11"))
+   (eq_attr "cpu" "power10,power11,future"))
   "DU_any_power10,STU_power10")
 
 (define_insn_reservation "power10-fused-store" 0
   (and (eq_attr "type" "fused_store_store")
-   (eq_attr "cpu" "power10,power11"))
+   (eq_attr "cpu" "power10,power11,future"))
   "DU_even_power10,STU_power10")
 
 (define_insn_reservation "power10-prefixed-store" 0
@@ -191,52 +192,52 @@
(eq_attr "prefixed" "yes")
(eq_attr "size" "!128")
(eq_attr "size" "!256")
-   (eq_attr "cpu" "power10,power11"))
+   (eq_attr "cpu" "power10,power11,future"))
   "DU_even_power10,STU_power10")
 
 ; Update 

[gcc(refs/users/meissner/heads/work166)] Add -mcpu=future support.

2024-05-17 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:78dc63916474eec9e2f6c1cb76d948742fdffb94

commit 78dc63916474eec9e2f6c1cb76d948742fdffb94
Author: Michael Meissner 
Date:   Fri May 17 20:56:47 2024 -0400

Add -mcpu=future support.

This patch adds the future option to the -mcpu= and -mtune= switches.

This patch treats the future like a power11 in terms of costs and 
reassociation
width.

This patch issues a ".machine future" to the assembly file if you use
-mcpu=power11.

This patch defines _ARCH_PWR_FUTURE if the user uses -mcpu=future.

This patch allows GCC to be configured with the --with-cpu=future and
--with-tune=future options.

This patch passes -mfuture to the assembler if the user uses -mcpu=future.

2024-05-17  Michael Meissner  

gcc/

* config.gcc (rs6000*-*-*, powerpc*-*-*): Add support for power11.
* config/rs6000/aix71.h (ASM_CPU_SPEC): Add support for 
-mcpu=power11.
* config/rs6000/aix72.h (ASM_CPU_SPEC): Likewise.
* config/rs6000/aix73.h (ASM_CPU_SPEC): Likewise.
* config/rs6000/driver-rs6000.cc (asm_names): Likewise.
* config/rs6000/rs6000-c.cc (rs6000_target_modify_macros): Define
_ARCH_PWR_FUTURE if -mcpu=future.
* config/rs6000/rs6000-cpus.def (ISA_FUTURE_MASKS_SERVER): New 
define.
(POWERPC_MASKS): Add future isa bit.
(power11 cpu): Add future definition.
* config/rs6000/rs6000-opts.h (PROCESSOR_FUTURE): Add future 
processor.
* config/rs6000/rs6000-string.cc (expand_compare_loop): Likewise.
* config/rs6000/rs6000-tables.opt: Regenerate.
* config/rs6000/rs6000.cc (rs6000_option_override_internal): Add 
future
support.
(rs6000_machine_from_flags): Likewise.
(rs6000_reassociation_width): Likewise.
(rs6000_adjust_cost): Likewise.
(rs6000_issue_rate): Likewise.
(rs6000_sched_reorder): Likewise.
(rs6000_sched_reorder2): Likewise.
(rs6000_register_move_cost): Likewise.
(rs6000_opt_masks): Likewise.
* config/rs6000/rs6000.h (ASM_CPU_SPEC): Likewise.
* config/rs6000/rs6000.md (cpu attribute): Add future.
* config/rs6000/rs6000.opt (-mpower11): Add internal future ISA 
flag.
* doc/invoke.texi (RS/6000 and PowerPC Options): Document 
-mcpu=future.

Diff:
---
 gcc/config.gcc  |  4 ++--
 gcc/config/rs6000/aix71.h   |  1 +
 gcc/config/rs6000/aix72.h   |  1 +
 gcc/config/rs6000/aix73.h   |  1 +
 gcc/config/rs6000/driver-rs6000.cc  |  2 ++
 gcc/config/rs6000/rs6000-c.cc   |  2 ++
 gcc/config/rs6000/rs6000-cpus.def   |  5 +
 gcc/config/rs6000/rs6000-opts.h |  3 ++-
 gcc/config/rs6000/rs6000-string.cc  |  1 +
 gcc/config/rs6000/rs6000-tables.opt |  3 +++
 gcc/config/rs6000/rs6000.cc | 30 ++
 gcc/config/rs6000/rs6000.h  |  1 +
 gcc/config/rs6000/rs6000.md |  2 +-
 gcc/config/rs6000/rs6000.opt|  3 +++
 gcc/doc/invoke.texi |  2 +-
 15 files changed, 48 insertions(+), 13 deletions(-)

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 226d90396d96..dbc7ac975de4 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -535,7 +535,7 @@ powerpc*-*-*)
extra_headers="${extra_headers} amo.h"
case x$with_cpu in
xpowerpc64 | xdefault64 | x6[23]0 | x970 | xG5 | xpower[3456789] \
-   | xpower1[01] | xpower6x | xrs64a | xcell | xa2 | xe500mc64 \
+   | xpower1[01] | xfuture | xpower6x | xrs64a | xcell | xa2 | 
xe500mc64 \
| xe5500 | xe6500)
cpu_is_64bit=yes
;;
@@ -5624,7 +5624,7 @@ case "${target}" in
eval "with_$which=405"
;;
"" | common | native \
-   | power[3456789] | power1[01] | power5+ | power6x \
+   | power[3456789] | power1[01] | power5+ | power6x | 
future \
| powerpc | powerpc64 | powerpc64le \
| rs64 \
| 401 | 403 | 405 | 405fp | 440 | 440fp | 464 | 464fp \
diff --git a/gcc/config/rs6000/aix71.h b/gcc/config/rs6000/aix71.h
index 41037b3852d7..570ddcc451db 100644
--- a/gcc/config/rs6000/aix71.h
+++ b/gcc/config/rs6000/aix71.h
@@ -79,6 +79,7 @@ do {  
\
 #undef ASM_CPU_SPEC
 #define ASM_CPU_SPEC \
 "%{mcpu=native: %(asm_cpu_native); \
+  mcpu=future: -mfuture; \
   mcpu=power11: -mpwr11; \
   mcpu=power10: -mpwr10; \
   mcpu=power9: -mpwr9; \
diff --git a/gcc/config/rs6000/aix72.h b/gcc/config/rs6000/aix72.h
index fe59f8319b48..242ca94bd065 100644
--- a/gcc/config/rs6000/aix72.h
+++ b/gcc/config/rs6000/aix72.h
@@ -79,6 +79,7 @@ do {

[gcc(refs/users/meissner/heads/work166)] Add -mcpu=power11 tests.

2024-05-17 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:d69f7b44398a5c83c8cf37b28b27bb3eba1eed44

commit d69f7b44398a5c83c8cf37b28b27bb3eba1eed44
Author: Michael Meissner 
Date:   Fri May 17 20:54:49 2024 -0400

Add -mcpu=power11 tests.

This patch adds some simple tests for -mcpu=power11 support.  In order to 
run
these tests, you need an assembler that supports the appropriate option for
supporting the Power11 processor (-mpower11 under Linux or -mpwr11 under 
AIX).

2024-05-17  Michael Meissner  

gcc/testsuite/

* gcc.target/powerpc/power11-1.c: New test.
* gcc.target/powerpc/power11-2.c: Likewise.
* gcc.target/powerpc/power11-3.c: Likewise.
* lib/target-supports.exp (check_effective_target_power11_ok): Add 
new
effective target.

Diff:
---
 gcc/testsuite/gcc.target/powerpc/power11-1.c | 13 +
 gcc/testsuite/gcc.target/powerpc/power11-2.c | 20 
 gcc/testsuite/gcc.target/powerpc/power11-3.c | 10 ++
 gcc/testsuite/lib/target-supports.exp| 17 +
 4 files changed, 60 insertions(+)

diff --git a/gcc/testsuite/gcc.target/powerpc/power11-1.c 
b/gcc/testsuite/gcc.target/powerpc/power11-1.c
new file mode 100644
index ..6a2e802eedf3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/power11-1.c
@@ -0,0 +1,13 @@
+/* { dg-do compile { target powerpc*-*-* } } */
+/* { dg-require-effective-target power11_ok } */
+/* { dg-options "-mdejagnu-cpu=power11 -O2" } */
+
+/* Basic check to see if the compiler supports -mcpu=power11.  */
+
+#ifndef _ARCH_PWR11
+#error "-mcpu=power11 is not supported"
+#endif
+
+void foo (void)
+{
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/power11-2.c 
b/gcc/testsuite/gcc.target/powerpc/power11-2.c
new file mode 100644
index ..7b9904c1d294
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/power11-2.c
@@ -0,0 +1,20 @@
+/* { dg-do compile { target powerpc*-*-* } } */
+/* { dg-require-effective-target power11_ok } */
+/* { dg-options "-O2" } */
+
+/* Check if we can set the power11 target via a target attribute.  */
+
+__attribute__((__target__("cpu=power9")))
+void foo_p9 (void)
+{
+}
+
+__attribute__((__target__("cpu=power10")))
+void foo_p10 (void)
+{
+}
+
+__attribute__((__target__("cpu=power11")))
+void foo_p11 (void)
+{
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/power11-3.c 
b/gcc/testsuite/gcc.target/powerpc/power11-3.c
new file mode 100644
index ..9b2d643cc0fd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/power11-3.c
@@ -0,0 +1,10 @@
+/* { dg-do compile { target powerpc*-*-* } }  */
+/* { dg-require-effective-target power11_ok } */
+/* { dg-options "-mdejagnu-cpu=power8 -O2" }  */
+
+/* Check if we can set the power11 target via a target_clones attribute.  */
+
+__attribute__((__target_clones__("cpu=power11,cpu=power9,default")))
+void foo (void)
+{
+}
diff --git a/gcc/testsuite/lib/target-supports.exp 
b/gcc/testsuite/lib/target-supports.exp
index ec9baa4f32a3..cfff747f3c8c 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -7105,6 +7105,23 @@ proc check_effective_target_power10_ok { } {
 }
 }
 
+# Return 1 if this is a PowerPC target supporting -mcpu=power11.
+
+proc check_effective_target_power11_ok { } {
+if { ([istarget powerpc*-*-*]) } {
+   return [check_no_compiler_messages power11_ok object {
+   int main (void) {
+   #ifndef _ARCH_PWR11
+   #error "-mcpu=power11 is not supported"
+   #endif
+   return 0;
+   }
+   } "-mcpu=power11"]
+} else {
+   return 0
+}
+}
+
 # Return 1 if this is a PowerPC target supporting -mfloat128 via either
 # software emulation on power7/power8 systems or hardware support on power9.


[gcc(refs/users/meissner/heads/work166)] Add -mcpu=power11 tuning support.

2024-05-17 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:c47c66e78975dfbc517707ba72f92c5746c41036

commit c47c66e78975dfbc517707ba72f92c5746c41036
Author: Michael Meissner 
Date:   Fri May 17 20:53:58 2024 -0400

Add -mcpu=power11 tuning support.

This patch makes -mtune=power11 use the same tuning decisions as 
-mtune=power10.

2024-05-17  Michael Meissner  

gcc/

* config/rs6000/power10.md (all reservations): Add power11 as an
alternative to power10.

Diff:
---
 gcc/config/rs6000/power10.md | 144 +--
 1 file changed, 72 insertions(+), 72 deletions(-)

diff --git a/gcc/config/rs6000/power10.md b/gcc/config/rs6000/power10.md
index fcc2199ab291..90312643858e 100644
--- a/gcc/config/rs6000/power10.md
+++ b/gcc/config/rs6000/power10.md
@@ -1,4 +1,4 @@
-;; Scheduling description for the IBM POWER10 processor.
+;; Scheduling description for the IBM POWER10 and POWER11 processors.
 ;; Copyright (C) 2020-2024 Free Software Foundation, Inc.
 ;;
 ;; Contributed by Pat Haugen (pthau...@us.ibm.com).
@@ -97,12 +97,12 @@
(eq_attr "update" "no")
(eq_attr "size" "!128")
(eq_attr "prefixed" "no")
-   (eq_attr "cpu" "power10"))
+   (eq_attr "cpu" "power10,power11"))
   "DU_any_power10,LU_power10")
 
 (define_insn_reservation "power10-fused-load" 4
   (and (eq_attr "type" "fused_load_cmpi,fused_addis_load,fused_load_load")
-   (eq_attr "cpu" "power10"))
+   (eq_attr "cpu" "power10,power11"))
   "DU_even_power10,LU_power10")
 
 (define_insn_reservation "power10-prefixed-load" 4
@@ -110,13 +110,13 @@
(eq_attr "update" "no")
(eq_attr "size" "!128")
(eq_attr "prefixed" "yes")
-   (eq_attr "cpu" "power10"))
+   (eq_attr "cpu" "power10,power11"))
   "DU_even_power10,LU_power10")
 
 (define_insn_reservation "power10-load-update" 4
   (and (eq_attr "type" "load")
(eq_attr "update" "yes")
-   (eq_attr "cpu" "power10"))
+   (eq_attr "cpu" "power10,power11"))
   "DU_even_power10,LU_power10+SXU_power10")
 
 (define_insn_reservation "power10-fpload-double" 4
@@ -124,7 +124,7 @@
(eq_attr "update" "no")
(eq_attr "size" "64")
(eq_attr "prefixed" "no")
-   (eq_attr "cpu" "power10"))
+   (eq_attr "cpu" "power10,power11"))
   "DU_any_power10,LU_power10")
 
 (define_insn_reservation "power10-prefixed-fpload-double" 4
@@ -132,14 +132,14 @@
(eq_attr "update" "no")
(eq_attr "size" "64")
(eq_attr "prefixed" "yes")
-   (eq_attr "cpu" "power10"))
+   (eq_attr "cpu" "power10,power11"))
   "DU_even_power10,LU_power10")
 
 (define_insn_reservation "power10-fpload-update-double" 4
   (and (eq_attr "type" "fpload")
(eq_attr "update" "yes")
(eq_attr "size" "64")
-   (eq_attr "cpu" "power10"))
+   (eq_attr "cpu" "power10,power11"))
   "DU_even_power10,LU_power10+SXU_power10")
 
 ; SFmode loads are cracked and have additional 3 cycles over DFmode
@@ -148,27 +148,27 @@
   (and (eq_attr "type" "fpload")
(eq_attr "update" "no")
(eq_attr "size" "32")
-   (eq_attr "cpu" "power10"))
+   (eq_attr "cpu" "power10,power11"))
   "DU_even_power10,LU_power10")
 
 (define_insn_reservation "power10-fpload-update-single" 7
   (and (eq_attr "type" "fpload")
(eq_attr "update" "yes")
(eq_attr "size" "32")
-   (eq_attr "cpu" "power10"))
+   (eq_attr "cpu" "power10,power11"))
   "DU_even_power10,LU_power10+SXU_power10")
 
 (define_insn_reservation "power10-vecload" 4
   (and (eq_attr "type" "vecload")
(eq_attr "size" "!256")
-   (eq_attr "cpu" "power10"))
+   (eq_attr "cpu" "power10,power11"))
   "DU_any_power10,LU_power10")
 
 ; lxvp
 (define_insn_reservation "power10-vecload-pair" 4
   (and (eq_attr "type" "vecload")
(eq_attr "size" "256")
-   (eq_attr "cpu" "power10"))
+   (eq_attr "cpu" "power10,power11"))
   "DU_even_power10,LU_power10+SXU_power10")
 
 ; Store Unit
@@ -178,12 +178,12 @@
(eq_attr "prefixed" "no")
(eq_attr "size" "!128")
(eq_attr "size" "!256")
-   (eq_attr "cpu" "power10"))
+   (eq_attr "cpu" "power10,power11"))
   "DU_any_power10,STU_power10")
 
 (define_insn_reservation "power10-fused-store" 0
   (and (eq_attr "type" "fused_store_store")
-   (eq_attr "cpu" "power10"))
+   (eq_attr "cpu" "power10,power11"))
   "DU_even_power10,STU_power10")
 
 (define_insn_reservation "power10-prefixed-store" 0
@@ -191,52 +191,52 @@
(eq_attr "prefixed" "yes")
(eq_attr "size" "!128")
(eq_attr "size" "!256")
-   (eq_attr "cpu" "power10"))
+   (eq_attr "cpu" "power10,power11"))
   "DU_even_power10,STU_power10")
 
 ; Update forms have 2 cycle latency for updated addr reg
 (define_insn_reservation "power10-store-update" 2
   (and (eq_attr "type" "store,fpstore")
(eq_attr "update" "yes")
-   (eq_attr "cpu" "power10"))
+   (eq_attr "cpu" "power10,power11"))
   

[gcc(refs/users/meissner/heads/work166)] Add -mcpu=power11 support.

2024-05-17 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:00c9f9b1f8e3e7a01298c6df58a3c8baeff0e196

commit 00c9f9b1f8e3e7a01298c6df58a3c8baeff0e196
Author: Michael Meissner 
Date:   Fri May 17 20:52:51 2024 -0400

Add -mcpu=power11 support.

This patch adds the power11 option to the -mcpu= and -mtune= switches.

This patch treats the power11 like a power10 in terms of costs and 
reassociation
width.

This patch issues a ".machine power11" to the assembly file if you use
-mcpu=power11.

This patch defines _ARCH_PWR11 if the user uses -mcpu=power11.

This patch allows GCC to be configured with the --with-cpu=power11 and
--with-tune=power11 options.

This patch passes -mpwr11 to the assembler if the user uses -mcpu=power11.

This patch adds support for using "power11" in the __builtin_cpu_is built-in
function.

2024-05-17  Michael Meissner  

gcc/

* config.gcc (rs6000*-*-*, powerpc*-*-*): Add support for power11.
* config/rs6000/aix71.h (ASM_CPU_SPEC): Add support for 
-mcpu=power11.
* config/rs6000/aix72.h (ASM_CPU_SPEC): Likewise.
* config/rs6000/aix73.h (ASM_CPU_SPEC): Likewise.
* config/rs6000/driver-rs6000.cc (asm_names): Likewise.
* config/rs6000/ppc-auxv.h (PPC_PLATFORM_POWER11): New define.
* config/rs6000/rs6000-builtin.cc (cpu_is_info): Add power11.
* config/rs6000/rs6000-c.cc (rs6000_target_modify_macros): Define
_ARCH_PWR11 if -mcpu=power11.
* config/rs6000/rs6000-cpus.def (ISA_POWER11_MASKS_SERVER): New 
define.
(POWERPC_MASKS): Add power11 isa bit.
(power11 cpu): Add power11 definition.
* config/rs6000/rs6000-opts.h (PROCESSOR_POWER11): Add power11 
processor.
* config/rs6000/rs6000-string.cc (expand_compare_loop): Likewise.
* config/rs6000/rs6000-tables.opt: Regenerate.
* config/rs6000/rs6000.cc (rs6000_option_override_internal): Add 
power11
support.
(rs6000_machine_from_flags): Likewise.
(rs6000_reassociation_width): Likewise.
(rs6000_adjust_cost): Likewise.
(rs6000_issue_rate): Likewise.
(rs6000_sched_reorder): Likewise.
(rs6000_sched_reorder2): Likewise.
(rs6000_register_move_cost): Likewise.
(rs6000_opt_masks): Likewise.
* config/rs6000/rs6000.h (ASM_CPU_SPEC): Likewise.
* config/rs6000/rs6000.md (cpu attribute): Add power11.
* config/rs6000/rs6000.opt (-mpower11): Add internal power11 ISA 
flag.
* doc/invoke.texi (RS/6000 and PowerPC Options): Document 
-mcpu=power11.

Diff:
---
 gcc/config.gcc  |  6 --
 gcc/config/rs6000/aix71.h   |  1 +
 gcc/config/rs6000/aix72.h   |  1 +
 gcc/config/rs6000/aix73.h   |  1 +
 gcc/config/rs6000/driver-rs6000.cc  |  2 ++
 gcc/config/rs6000/ppc-auxv.h|  3 +--
 gcc/config/rs6000/rs6000-builtin.cc |  1 +
 gcc/config/rs6000/rs6000-c.cc   |  2 ++
 gcc/config/rs6000/rs6000-cpus.def   |  5 +
 gcc/config/rs6000/rs6000-opts.h |  3 ++-
 gcc/config/rs6000/rs6000-string.cc  |  1 +
 gcc/config/rs6000/rs6000-tables.opt |  3 +++
 gcc/config/rs6000/rs6000.cc | 32 
 gcc/config/rs6000/rs6000.h  |  1 +
 gcc/config/rs6000/rs6000.md |  2 +-
 gcc/config/rs6000/rs6000.opt|  3 +++
 gcc/doc/invoke.texi |  5 +++--
 17 files changed, 56 insertions(+), 16 deletions(-)

diff --git a/gcc/config.gcc b/gcc/config.gcc
index cfc2db545d01..226d90396d96 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -534,7 +534,9 @@ powerpc*-*-*)
extra_headers="${extra_headers} ppu_intrinsics.h spu2vmx.h vec_types.h 
si2vmx.h"
extra_headers="${extra_headers} amo.h"
case x$with_cpu in
-   
xpowerpc64|xdefault64|x6[23]0|x970|xG5|xpower[3456789]|xpower10|xpower6x|xrs64a|xcell|xa2|xe500mc64|xe5500|xe6500)
+   xpowerpc64 | xdefault64 | x6[23]0 | x970 | xG5 | xpower[3456789] \
+   | xpower1[01] | xpower6x | xrs64a | xcell | xa2 | xe500mc64 \
+   | xe5500 | xe6500)
cpu_is_64bit=yes
;;
esac
@@ -5622,7 +5624,7 @@ case "${target}" in
eval "with_$which=405"
;;
"" | common | native \
-   | power[3456789] | power10 | power5+ | power6x \
+   | power[3456789] | power1[01] | power5+ | power6x \
| powerpc | powerpc64 | powerpc64le \
| rs64 \
| 401 | 403 | 405 | 405fp | 440 | 440fp | 464 | 464fp \
diff --git a/gcc/config/rs6000/aix71.h b/gcc/config/rs6000/aix71.h
index 24bc301e37d6..41037b3852d7 100644
--- a/gcc/config/rs6000/aix71.h
+++ b/gcc/config/rs6000/aix71.h
@@ -79,6 +79,7 @@ 

[gcc(refs/users/meissner/heads/work166-orig)] Add REVISION.

2024-05-17 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:fc9431681be76b76abbe4cf546757fdad4a72601

commit fc9431681be76b76abbe4cf546757fdad4a72601
Author: Michael Meissner 
Date:   Fri May 17 20:49:52 2024 -0400

Add REVISION.

2024-05-17  Michael Meissner  

gcc/

* REVISION: New file for branch.

Diff:
---
 gcc/REVISION | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/REVISION b/gcc/REVISION
new file mode 100644
index ..21f194ed8dcc
--- /dev/null
+++ b/gcc/REVISION
@@ -0,0 +1 @@
+work166-orig branch


[gcc] Created branch 'meissner/heads/work166-orig' in namespace 'refs/users'

2024-05-17 Thread Michael Meissner via Gcc-cvs
The branch 'meissner/heads/work166-orig' was created in namespace 'refs/users' 
pointing to:

 5812e1bbb1c8... Fix Ada runtime library breakage on Solaris


[gcc(refs/users/meissner/heads/work166-test)] Add ChangeLog.test and update REVISION.

2024-05-17 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:ebd3fabfb5ba02a2829e031aa12bb7c8bd6e7675

commit ebd3fabfb5ba02a2829e031aa12bb7c8bd6e7675
Author: Michael Meissner 
Date:   Fri May 17 20:48:57 2024 -0400

Add ChangeLog.test and update REVISION.

2024-05-17  Michael Meissner  

gcc/

* ChangeLog.test: New file for branch.
* REVISION: Update.

Diff:
---
 gcc/ChangeLog.test | 6 ++
 gcc/REVISION   | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog.test b/gcc/ChangeLog.test
new file mode 100644
index ..e2a281f8f9ec
--- /dev/null
+++ b/gcc/ChangeLog.test
@@ -0,0 +1,6 @@
+ Branch work166-test, baseline 
+
+2024-05-17   Michael Meissner  
+
+   Clone branch
+
diff --git a/gcc/REVISION b/gcc/REVISION
index 42eef54d0aeb..a8ef9d6b8080 100644
--- a/gcc/REVISION
+++ b/gcc/REVISION
@@ -1 +1 @@
-work166 branch
+work166-test branch


[gcc] Created branch 'meissner/heads/work166-test' in namespace 'refs/users'

2024-05-17 Thread Michael Meissner via Gcc-cvs
The branch 'meissner/heads/work166-test' was created in namespace 'refs/users' 
pointing to:

 34b6b91f1029... Add ChangeLog.meissner and REVISION.


[gcc(refs/users/meissner/heads/work166-bugs)] Add ChangeLog.bugs and update REVISION.

2024-05-17 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:4adff7dc8cd232071777468c6469d1ac6928c038

commit 4adff7dc8cd232071777468c6469d1ac6928c038
Author: Michael Meissner 
Date:   Fri May 17 20:47:59 2024 -0400

Add ChangeLog.bugs and update REVISION.

2024-05-17  Michael Meissner  

gcc/

* ChangeLog.bugs: New file for branch.
* REVISION: Update.

Diff:
---
 gcc/ChangeLog.bugs | 6 ++
 gcc/REVISION   | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog.bugs b/gcc/ChangeLog.bugs
new file mode 100644
index ..48a479c763ff
--- /dev/null
+++ b/gcc/ChangeLog.bugs
@@ -0,0 +1,6 @@
+ Branch work166-bugs, baseline 
+
+2024-05-17   Michael Meissner  
+
+   Clone branch
+
diff --git a/gcc/REVISION b/gcc/REVISION
index 42eef54d0aeb..5e353b50cf66 100644
--- a/gcc/REVISION
+++ b/gcc/REVISION
@@ -1 +1 @@
-work166 branch
+work166-bugs branch


[gcc] Created branch 'meissner/heads/work166-bugs' in namespace 'refs/users'

2024-05-17 Thread Michael Meissner via Gcc-cvs
The branch 'meissner/heads/work166-bugs' was created in namespace 'refs/users' 
pointing to:

 34b6b91f1029... Add ChangeLog.meissner and REVISION.


[gcc(refs/users/meissner/heads/work166-tar)] Add ChangeLog.tar and update REVISION.

2024-05-17 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:1a2e3e0e4240ccc23aa93d1bccb4126713ab651b

commit 1a2e3e0e4240ccc23aa93d1bccb4126713ab651b
Author: Michael Meissner 
Date:   Fri May 17 20:47:03 2024 -0400

Add ChangeLog.tar and update REVISION.

2024-05-17  Michael Meissner  

gcc/

* ChangeLog.tar: New file for branch.
* REVISION: Update.

Diff:
---
 gcc/ChangeLog.tar | 6 ++
 gcc/REVISION  | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog.tar b/gcc/ChangeLog.tar
new file mode 100644
index ..3e168fa367eb
--- /dev/null
+++ b/gcc/ChangeLog.tar
@@ -0,0 +1,6 @@
+ Branch work166-tar, baseline 
+
+2024-05-17   Michael Meissner  
+
+   Clone branch
+
diff --git a/gcc/REVISION b/gcc/REVISION
index 42eef54d0aeb..3b5b120ee37e 100644
--- a/gcc/REVISION
+++ b/gcc/REVISION
@@ -1 +1 @@
-work166 branch
+work166-tar branch


[gcc] Created branch 'meissner/heads/work166-tar' in namespace 'refs/users'

2024-05-17 Thread Michael Meissner via Gcc-cvs
The branch 'meissner/heads/work166-tar' was created in namespace 'refs/users' 
pointing to:

 34b6b91f1029... Add ChangeLog.meissner and REVISION.


[gcc(refs/users/meissner/heads/work166-vpair)] Add ChangeLog.vpair and update REVISION.

2024-05-17 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:371220eb0c0136af5c4f080e0b2312ea081f23e0

commit 371220eb0c0136af5c4f080e0b2312ea081f23e0
Author: Michael Meissner 
Date:   Fri May 17 20:41:52 2024 -0400

Add ChangeLog.vpair and update REVISION.

2024-05-17  Michael Meissner  

gcc/

* ChangeLog.vpair: New file for branch.
* REVISION: Update.

Diff:
---
 gcc/ChangeLog.vpair | 6 ++
 gcc/REVISION| 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog.vpair b/gcc/ChangeLog.vpair
new file mode 100644
index ..172fd3d00bc4
--- /dev/null
+++ b/gcc/ChangeLog.vpair
@@ -0,0 +1,6 @@
+ Branch work166-vpair, baseline 
+
+2024-05-17   Michael Meissner  
+
+   Clone branch
+
diff --git a/gcc/REVISION b/gcc/REVISION
index 42eef54d0aeb..155b9d8d70eb 100644
--- a/gcc/REVISION
+++ b/gcc/REVISION
@@ -1 +1 @@
-work166 branch
+work166-vpair branch


[gcc] Created branch 'meissner/heads/work166-vpair' in namespace 'refs/users'

2024-05-17 Thread Michael Meissner via Gcc-cvs
The branch 'meissner/heads/work166-vpair' was created in namespace 'refs/users' 
pointing to:

 34b6b91f1029... Add ChangeLog.meissner and REVISION.


[gcc(refs/users/meissner/heads/work166-dmf)] Add ChangeLog.dmf and update REVISION.

2024-05-17 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:40164d1259418c6a92375d1950a19bf22d14beb4

commit 40164d1259418c6a92375d1950a19bf22d14beb4
Author: Michael Meissner 
Date:   Fri May 17 20:40:56 2024 -0400

Add ChangeLog.dmf and update REVISION.

2024-05-17  Michael Meissner  

gcc/

* ChangeLog.dmf: New file for branch.
* REVISION: Update.

Diff:
---
 gcc/ChangeLog.dmf | 6 ++
 gcc/REVISION  | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog.dmf b/gcc/ChangeLog.dmf
new file mode 100644
index ..ab0fdd1054fb
--- /dev/null
+++ b/gcc/ChangeLog.dmf
@@ -0,0 +1,6 @@
+ Branch work166-dmf, baseline 
+
+2024-05-17   Michael Meissner  
+
+   Clone branch
+
diff --git a/gcc/REVISION b/gcc/REVISION
index 42eef54d0aeb..ee73a03644d7 100644
--- a/gcc/REVISION
+++ b/gcc/REVISION
@@ -1 +1 @@
-work166 branch
+work166-dmf branch


[gcc] Created branch 'meissner/heads/work166-dmf' in namespace 'refs/users'

2024-05-17 Thread Michael Meissner via Gcc-cvs
The branch 'meissner/heads/work166-dmf' was created in namespace 'refs/users' 
pointing to:

 34b6b91f1029... Add ChangeLog.meissner and REVISION.


[gcc(refs/users/meissner/heads/work166)] Add ChangeLog.meissner and REVISION.

2024-05-17 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:34b6b91f102919d2980c99c796e9fc5fab5a80e4

commit 34b6b91f102919d2980c99c796e9fc5fab5a80e4
Author: Michael Meissner 
Date:   Fri May 17 20:40:01 2024 -0400

Add ChangeLog.meissner and REVISION.

2024-05-17  Michael Meissner  

gcc/

* REVISION: New file for branch.
* ChangeLog.meissner: New file.

gcc/c-family/

* ChangeLog.meissner: New file.

gcc/c/

* ChangeLog.meissner: New file.

gcc/cp/

* ChangeLog.meissner: New file.

gcc/fortran/

* ChangeLog.meissner: New file.

gcc/testsuite/

* ChangeLog.meissner: New file.

libgcc/

* ChangeLog.meissner: New file.

Diff:
---
 gcc/ChangeLog.meissner   | 6 ++
 gcc/REVISION | 1 +
 gcc/c-family/ChangeLog.meissner  | 6 ++
 gcc/c/ChangeLog.meissner | 6 ++
 gcc/cp/ChangeLog.meissner| 6 ++
 gcc/fortran/ChangeLog.meissner   | 6 ++
 gcc/testsuite/ChangeLog.meissner | 6 ++
 libgcc/ChangeLog.meissner| 6 ++
 libstdc++-v3/ChangeLog.meissner  | 6 ++
 9 files changed, 49 insertions(+)

diff --git a/gcc/ChangeLog.meissner b/gcc/ChangeLog.meissner
new file mode 100644
index ..50c34720bc0d
--- /dev/null
+++ b/gcc/ChangeLog.meissner
@@ -0,0 +1,6 @@
+ Branch work166, baseline 
+
+2024-05-17   Michael Meissner  
+
+   Clone branch
+
diff --git a/gcc/REVISION b/gcc/REVISION
new file mode 100644
index ..42eef54d0aeb
--- /dev/null
+++ b/gcc/REVISION
@@ -0,0 +1 @@
+work166 branch
diff --git a/gcc/c-family/ChangeLog.meissner b/gcc/c-family/ChangeLog.meissner
new file mode 100644
index ..50c34720bc0d
--- /dev/null
+++ b/gcc/c-family/ChangeLog.meissner
@@ -0,0 +1,6 @@
+ Branch work166, baseline 
+
+2024-05-17   Michael Meissner  
+
+   Clone branch
+
diff --git a/gcc/c/ChangeLog.meissner b/gcc/c/ChangeLog.meissner
new file mode 100644
index ..50c34720bc0d
--- /dev/null
+++ b/gcc/c/ChangeLog.meissner
@@ -0,0 +1,6 @@
+ Branch work166, baseline 
+
+2024-05-17   Michael Meissner  
+
+   Clone branch
+
diff --git a/gcc/cp/ChangeLog.meissner b/gcc/cp/ChangeLog.meissner
new file mode 100644
index ..50c34720bc0d
--- /dev/null
+++ b/gcc/cp/ChangeLog.meissner
@@ -0,0 +1,6 @@
+ Branch work166, baseline 
+
+2024-05-17   Michael Meissner  
+
+   Clone branch
+
diff --git a/gcc/fortran/ChangeLog.meissner b/gcc/fortran/ChangeLog.meissner
new file mode 100644
index ..50c34720bc0d
--- /dev/null
+++ b/gcc/fortran/ChangeLog.meissner
@@ -0,0 +1,6 @@
+ Branch work166, baseline 
+
+2024-05-17   Michael Meissner  
+
+   Clone branch
+
diff --git a/gcc/testsuite/ChangeLog.meissner b/gcc/testsuite/ChangeLog.meissner
new file mode 100644
index ..50c34720bc0d
--- /dev/null
+++ b/gcc/testsuite/ChangeLog.meissner
@@ -0,0 +1,6 @@
+ Branch work166, baseline 
+
+2024-05-17   Michael Meissner  
+
+   Clone branch
+
diff --git a/libgcc/ChangeLog.meissner b/libgcc/ChangeLog.meissner
new file mode 100644
index ..50c34720bc0d
--- /dev/null
+++ b/libgcc/ChangeLog.meissner
@@ -0,0 +1,6 @@
+ Branch work166, baseline 
+
+2024-05-17   Michael Meissner  
+
+   Clone branch
+
diff --git a/libstdc++-v3/ChangeLog.meissner b/libstdc++-v3/ChangeLog.meissner
new file mode 100644
index ..50c34720bc0d
--- /dev/null
+++ b/libstdc++-v3/ChangeLog.meissner
@@ -0,0 +1,6 @@
+ Branch work166, baseline 
+
+2024-05-17   Michael Meissner  
+
+   Clone branch
+


[gcc] Created branch 'meissner/heads/work166' in namespace 'refs/users'

2024-05-17 Thread Michael Meissner via Gcc-cvs
The branch 'meissner/heads/work166' was created in namespace 'refs/users' 
pointing to:

 5812e1bbb1c8... Fix Ada runtime library breakage on Solaris


[gcc r15-641] Fix Ada runtime library breakage on Solaris

2024-05-17 Thread Eric Botcazou via Gcc-cvs
https://gcc.gnu.org/g:5812e1bbb1c8a7a90d995a0165cddae4d450d6cf

commit r15-641-g5812e1bbb1c8a7a90d995a0165cddae4d450d6cf
Author: Eric Botcazou 
Date:   Sat May 18 00:21:56 2024 +0200

Fix Ada runtime library breakage on Solaris

The recent changes made to the runtime library broke its build on Solaris
because it uses Solaris threads instead of POSIX threads on this platform.

gcc/ada/
PR ada/115133
* libgnarl/s-osinte__solaris.ads (mutex_t): Fix typo.
* libgnarl/s-taprop__solaris.adb (Record_Lock): Add conversion.
(Check_Sleep): Likewise.
(Record_Wakeup): Likewise.
(Check_Unlock): Likewise.
* libgnarl/s-tasini.adb (Initialize_RTS_Lock): Add pragma Import
on the overlaid variable.
(Finalize_RTS_Lock): Likewise.
(Acquire_RTS_Lock): Likewise.
(Release_RTS_Lock): Likewise.
* libgnarl/s-taspri__solaris.ads (To_RTS_Lock_Ptr): New instance
of Ada.Unchecked_Conversion.
* libgnat/s-oslock__solaris.ads: Add with clause for
Ada.Unchecked_Conversion.
(array_type_9): Add missing name qualification.
(record_type_3): Likewise.
(mutex_t): Fix formatting.

Diff:
---
 gcc/ada/libgnarl/s-osinte__solaris.ads | 2 +-
 gcc/ada/libgnarl/s-taprop__solaris.adb | 8 
 gcc/ada/libgnarl/s-tasini.adb  | 4 
 gcc/ada/libgnarl/s-taspri__solaris.ads | 2 ++
 gcc/ada/libgnat/s-oslock__solaris.ads  | 7 ---
 5 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/gcc/ada/libgnarl/s-osinte__solaris.ads 
b/gcc/ada/libgnarl/s-osinte__solaris.ads
index 12ad52bb48ed..3703697ef44f 100644
--- a/gcc/ada/libgnarl/s-osinte__solaris.ads
+++ b/gcc/ada/libgnarl/s-osinte__solaris.ads
@@ -298,7 +298,7 @@ package System.OS_Interface is
 
function To_thread_t is new Ada.Unchecked_Conversion (Integer, thread_t);
 
-   subtype mutex_t is System.OS_Lock.mutex_t;
+   subtype mutex_t is System.OS_Locks.mutex_t;
 
type cond_t is limited private;
 
diff --git a/gcc/ada/libgnarl/s-taprop__solaris.adb 
b/gcc/ada/libgnarl/s-taprop__solaris.adb
index 88b77b09820d..82e51b8d25c5 100644
--- a/gcc/ada/libgnarl/s-taprop__solaris.adb
+++ b/gcc/ada/libgnarl/s-taprop__solaris.adb
@@ -1399,7 +1399,7 @@ package body System.Task_Primitives.Operations is
   P := Self_ID.Common.LL.Locks;
 
   if P /= null then
- L.Next := P;
+ L.Next := To_RTS_Lock_Ptr (P);
   end if;
 
   Self_ID.Common.LL.Locking := null;
@@ -1440,7 +1440,7 @@ package body System.Task_Primitives.Operations is
 
   Self_ID.Common.LL.L.Owner := null;
   P := Self_ID.Common.LL.Locks;
-  Self_ID.Common.LL.Locks := Self_ID.Common.LL.Locks.Next;
+  Self_ID.Common.LL.Locks := To_Lock_Ptr (Self_ID.Common.LL.Locks.Next);
   P.Next := null;
   return True;
end Check_Sleep;
@@ -1468,7 +1468,7 @@ package body System.Task_Primitives.Operations is
   P := Self_ID.Common.LL.Locks;
 
   if P /= null then
- L.Next := P;
+ L.Next := To_RTS_Lock_Ptr (P);
   end if;
 
   Self_ID.Common.LL.Locking := null;
@@ -1549,7 +1549,7 @@ package body System.Task_Primitives.Operations is
 
   L.Owner := null;
   P := Self_ID.Common.LL.Locks;
-  Self_ID.Common.LL.Locks := Self_ID.Common.LL.Locks.Next;
+  Self_ID.Common.LL.Locks := To_Lock_Ptr (Self_ID.Common.LL.Locks.Next);
   P.Next := null;
   return True;
end Check_Unlock;
diff --git a/gcc/ada/libgnarl/s-tasini.adb b/gcc/ada/libgnarl/s-tasini.adb
index 794183f5356a..d42d2881df45 100644
--- a/gcc/ada/libgnarl/s-tasini.adb
+++ b/gcc/ada/libgnarl/s-tasini.adb
@@ -246,6 +246,7 @@ package body System.Tasking.Initialization is
procedure Initialize_RTS_Lock (Addr : Address) is
   Lock : aliased SOL.RTS_Lock;
   for Lock'Address use Addr;
+  pragma Import (Ada, Lock);
 
begin
   Initialize_Lock (Lock'Unchecked_Access, PO_Level);
@@ -258,6 +259,7 @@ package body System.Tasking.Initialization is
procedure Finalize_RTS_Lock (Addr : Address) is
   Lock : aliased SOL.RTS_Lock;
   for Lock'Address use Addr;
+  pragma Import (Ada, Lock);
 
begin
   Finalize_Lock (Lock'Unchecked_Access);
@@ -270,6 +272,7 @@ package body System.Tasking.Initialization is
procedure Acquire_RTS_Lock (Addr : Address) is
   Lock : aliased SOL.RTS_Lock;
   for Lock'Address use Addr;
+  pragma Import (Ada, Lock);
 
begin
   Write_Lock (Lock'Unchecked_Access);
@@ -282,6 +285,7 @@ package body System.Tasking.Initialization is
procedure Release_RTS_Lock (Addr : Address) is
   Lock : aliased SOL.RTS_Lock;
   for Lock'Address use Addr;
+  pragma Import (Ada, Lock);
 
begin
   Unlock (Lock'Unchecked_Access);
diff --git a/gcc/ada/libgnarl/s-taspri__solaris.ads 
b/gcc/ada/libgnarl/s-taspri__solaris.ads
index ca40229993bd..16fc4196b005 100644
--- 

[gcc r15-640] Regenerate common.opt.urls

2024-05-17 Thread David Malcolm via Gcc-cvs
https://gcc.gnu.org/g:4e3bb431bbf2802bcf8e5d983dd1450f719d6ac7

commit r15-640-g4e3bb431bbf2802bcf8e5d983dd1450f719d6ac7
Author: David Malcolm 
Date:   Fri May 17 17:56:56 2024 -0400

Regenerate common.opt.urls

I forgot to do this for r15-636-g770657d02c986c.

gcc/ChangeLog:
* common.opt.urls: Regenerate to add
fdiagnostics-show-event-links.

Signed-off-by: David Malcolm 

Diff:
---
 gcc/common.opt.urls | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gcc/common.opt.urls b/gcc/common.opt.urls
index f71ed80a34b4..10462e408744 100644
--- a/gcc/common.opt.urls
+++ b/gcc/common.opt.urls
@@ -534,6 +534,9 @@ 
UrlSuffix(gcc/Diagnostic-Message-Formatting-Options.html#index-fdiagnostics-show
 fdiagnostics-show-caret
 
UrlSuffix(gcc/Diagnostic-Message-Formatting-Options.html#index-fdiagnostics-show-caret)
 
+fdiagnostics-show-event-links
+UrlSuffix(gcc/Diagnostic-Message-Formatting-Options.html#index-fdiagnostics-show-event-links)
+
 fdiagnostics-show-labels
 
UrlSuffix(gcc/Diagnostic-Message-Formatting-Options.html#index-fdiagnostics-show-labels)


gcc-wwwdocs branch master updated. a67b6efe485d07bb94d3b1261e73b5fd0014eefb

2024-05-17 Thread Gerald Pfeifer via Gcc-cvs-wwwdocs
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gcc-wwwdocs".

The branch, master has been updated
   via  a67b6efe485d07bb94d3b1261e73b5fd0014eefb (commit)
  from  8d8905c36f17aac7a6af5926009fa7688bf03b6d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -
commit a67b6efe485d07bb94d3b1261e73b5fd0014eefb
Author: Gerald Pfeifer 
Date:   Fri May 17 23:34:29 2024 +0200

gcc-4.6: Use 64-bit instead of 64 bit

diff --git a/htdocs/gcc-4.6/changes.html b/htdocs/gcc-4.6/changes.html
index c96d347f..d1e15af3 100644
--- a/htdocs/gcc-4.6/changes.html
+++ b/htdocs/gcc-4.6/changes.html
@@ -791,7 +791,7 @@
 Several enhancements were committed to improve SIMD code
   generation for NEON by adding support for widening instructions,
   misaligned loads and stores, vector conditionals and
-  support for 64 bit arithmetic.
+  support for 64-bit arithmetic.
 
 Support was added for the Faraday cores fa526, fa606te,
   fa626te, fmp626te, fmp626 and fa726te and can be used with the
@@ -927,7 +927,7 @@
   which always generates the VSX memory instructions.
 The GCC compiler on AIX now defaults to a process layout with a
   larger data space allowing larger programs to be compiled.
-The GCC long double type on AIX 6.1 and above has reverted to 64 bit
+The GCC long double type on AIX 6.1 and above has reverted to 64-bit
   double precision, matching the AIX XL compiler default, because of
   missing C99 symbols required by the GCC runtime.
 The default processor scheduling model and tuning for PowerPC64

---

Summary of changes:
 htdocs/gcc-4.6/changes.html | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
gcc-wwwdocs


gcc-wwwdocs branch master updated. 8d8905c36f17aac7a6af5926009fa7688bf03b6d

2024-05-17 Thread Gerald Pfeifer via Gcc-cvs-wwwdocs
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gcc-wwwdocs".

The branch, master has been updated
   via  8d8905c36f17aac7a6af5926009fa7688bf03b6d (commit)
  from  b55eb49edaf67eb671102a3ed8069cb9c9a3d108 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -
commit 8d8905c36f17aac7a6af5926009fa7688bf03b6d
Author: Gerald Pfeifer 
Date:   Fri May 17 23:26:59 2024 +0200

gcc-12: Fix typo

diff --git a/htdocs/gcc-12/changes.html b/htdocs/gcc-12/changes.html
index 8a0347e3..0cfa12eb 100644
--- a/htdocs/gcc-12/changes.html
+++ b/htdocs/gcc-12/changes.html
@@ -903,7 +903,7 @@ function Multiply (S1, S2 : Sign) return Sign is
 announcement
 New ISA extension support for zba, zbb, zbc, zbs was added.
 New ISA extension support for vector and scalar crypto was added, only
-   support architecture testing marco and -march= 
parsing.
+   support architecture testing macro and -march= 
parsing.
 The option -mtune=thead-c906 is added to tune for T-HEAD
c906 cores.
 libstdc++ no longer attempts to detect built-in atomics.

---

Summary of changes:
 htdocs/gcc-12/changes.html | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


hooks/post-receive
-- 
gcc-wwwdocs


[gcc r15-639] RISC-V: Add initial cost handling for segment loads/stores.

2024-05-17 Thread Robin Dapp via Gcc-cvs
https://gcc.gnu.org/g:e0b9c8ad7098fb08a25a61fe17d4274dd73e5145

commit r15-639-ge0b9c8ad7098fb08a25a61fe17d4274dd73e5145
Author: Robin Dapp 
Date:   Mon Feb 26 13:09:15 2024 +0100

RISC-V: Add initial cost handling for segment loads/stores.

This patch makes segment loads and stores more expensive.  It adds
segment_permute_2 as well as 3 to 8 cost fields to the common vector
costs and adds handling to adjust_stmt_cost.

gcc/ChangeLog:

* config/riscv/riscv-protos.h (struct common_vector_cost): Add
segment_permute cost.
* config/riscv/riscv-vector-costs.cc (costs::adjust_stmt_cost):
Handle segment loads/stores.
* config/riscv/riscv.cc: Initialize segment_permute_[2-8] to 1.

gcc/testsuite/ChangeLog:

* gcc.dg/vect/costmodel/riscv/rvv/pr113112-4.c: Adjust test.

Diff:
---
 gcc/config/riscv/riscv-protos.h|   9 ++
 gcc/config/riscv/riscv-vector-costs.cc | 163 +++--
 gcc/config/riscv/riscv.cc  |  14 ++
 .../gcc.dg/vect/costmodel/riscv/rvv/pr113112-4.c   |   4 +-
 4 files changed, 146 insertions(+), 44 deletions(-)

diff --git a/gcc/config/riscv/riscv-protos.h b/gcc/config/riscv/riscv-protos.h
index 565ead1382a7..004ceb1031b8 100644
--- a/gcc/config/riscv/riscv-protos.h
+++ b/gcc/config/riscv/riscv-protos.h
@@ -222,6 +222,15 @@ struct common_vector_cost
   const int gather_load_cost;
   const int scatter_store_cost;
 
+  /* Segment load/store permute cost.  */
+  const int segment_permute_2;
+  const int segment_permute_3;
+  const int segment_permute_4;
+  const int segment_permute_5;
+  const int segment_permute_6;
+  const int segment_permute_7;
+  const int segment_permute_8;
+
   /* Cost of a vector-to-scalar operation.  */
   const int vec_to_scalar_cost;
 
diff --git a/gcc/config/riscv/riscv-vector-costs.cc 
b/gcc/config/riscv/riscv-vector-costs.cc
index 4582b0db4250..0a88e142a934 100644
--- a/gcc/config/riscv/riscv-vector-costs.cc
+++ b/gcc/config/riscv/riscv-vector-costs.cc
@@ -1052,6 +1052,25 @@ costs::better_main_loop_than_p (const vector_costs 
*uncast_other) const
   return vector_costs::better_main_loop_than_p (other);
 }
 
+/* Returns the group size i.e. the number of vectors to be loaded by a
+   segmented load/store instruction.  Return 0 if it is no segmented
+   load/store.  */
+static int
+segment_loadstore_group_size (enum vect_cost_for_stmt kind,
+ stmt_vec_info stmt_info)
+{
+  if (stmt_info
+  && (kind == vector_load || kind == vector_store)
+  && STMT_VINFO_DATA_REF (stmt_info))
+{
+  stmt_info = DR_GROUP_FIRST_ELEMENT (stmt_info);
+  if (stmt_info
+ && STMT_VINFO_MEMORY_ACCESS_TYPE (stmt_info) == VMAT_LOAD_STORE_LANES)
+   return DR_GROUP_SIZE (stmt_info);
+}
+  return 0;
+}
+
 /* Adjust vectorization cost after calling riscv_builtin_vectorization_cost.
For some statement, we would like to further fine-grain tweak the cost on
top of riscv_builtin_vectorization_cost handling which doesn't have any
@@ -1076,55 +1095,115 @@ costs::adjust_stmt_cost (enum vect_cost_for_stmt kind, 
loop_vec_info loop,
 case vector_load:
 case vector_store:
{
- /* Unit-stride vector loads and stores do not have offset addressing
-as opposed to scalar loads and stores.
-If the address depends on a variable we need an additional
-add/sub for each load/store in the worst case.  */
- if (stmt_info && stmt_info->stmt)
+ if (stmt_info && stmt_info->stmt && STMT_VINFO_DATA_REF (stmt_info))
{
- data_reference *dr = STMT_VINFO_DATA_REF (stmt_info);
- class loop *father = stmt_info->stmt->bb->loop_father;
- if (!loop && father && !father->inner && father->superloops)
+ /* Segment loads and stores.  When the group size is > 1
+the vectorizer will add a vector load/store statement for
+each vector in the group.  Here we additionally add permute
+costs for each.  */
+ /* TODO: Indexed and ordered/unordered cost.  */
+ int group_size = segment_loadstore_group_size (kind, stmt_info);
+ if (group_size > 1)
+   {
+ switch (group_size)
+   {
+   case 2:
+ if (riscv_v_ext_vector_mode_p (loop->vector_mode))
+   stmt_cost += costs->vla->segment_permute_2;
+ else
+   stmt_cost += costs->vls->segment_permute_2;
+ break;
+   case 3:
+ if (riscv_v_ext_vector_mode_p (loop->vector_mode))
+   stmt_cost += costs->vla->segment_permute_3;
+ else
+   stmt_cost += costs->vls->segment_permute_3;
+ 

[gcc r15-638] internal-fn: Do not force vcond_mask operands to reg.

2024-05-17 Thread Robin Dapp via Gcc-cvs
https://gcc.gnu.org/g:7ca35f2e430081d6ec91e910002f92d9713350fa

commit r15-638-g7ca35f2e430081d6ec91e910002f92d9713350fa
Author: Robin Dapp 
Date:   Fri May 10 12:44:44 2024 +0200

internal-fn: Do not force vcond_mask operands to reg.

In order to directly use constants this patch removes force_regs
in the vcond_mask expander.

gcc/ChangeLog:

PR middle-end/113474

* internal-fn.cc (expand_vec_cond_mask_optab_fn):  Remove
force_regs.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/pr113474.c: New test.

Diff:
---
 gcc/internal-fn.cc|  3 ---
 gcc/testsuite/gcc.target/riscv/rvv/autovec/pr113474.c | 13 +
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/gcc/internal-fn.cc b/gcc/internal-fn.cc
index 73045ca8c8c1..9c09026793fa 100644
--- a/gcc/internal-fn.cc
+++ b/gcc/internal-fn.cc
@@ -3165,9 +3165,6 @@ expand_vec_cond_mask_optab_fn (internal_fn, gcall *stmt, 
convert_optab optab)
   rtx_op1 = expand_normal (op1);
   rtx_op2 = expand_normal (op2);
 
-  mask = force_reg (mask_mode, mask);
-  rtx_op1 = force_reg (mode, rtx_op1);
-
   rtx target = expand_expr (lhs, NULL_RTX, VOIDmode, EXPAND_WRITE);
   create_output_operand ([0], target, mode);
   create_input_operand ([1], rtx_op1, mode);
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr113474.c 
b/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr113474.c
new file mode 100644
index ..0364bf9f5e38
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr113474.c
@@ -0,0 +1,13 @@
+/* { dg-do compile { target riscv_v } }  */
+/* { dg-additional-options "-std=c99" }  */
+
+void
+foo (int n, int **a)
+{
+  int b;
+  for (b = 0; b < n; b++)
+for (long e = 8; e > 0; e--)
+  a[b][e] = a[b][e] == 15;
+}
+
+/* { dg-final { scan-assembler "vmerge.vim" } }  */


[gcc r15-637] Use DW_TAG_module for Ada

2024-05-17 Thread Tom Tromey via Gcc-cvs
https://gcc.gnu.org/g:9b6acf5357818ce7ff234c504ed79078a06d0e0f

commit r15-637-g9b6acf5357818ce7ff234c504ed79078a06d0e0f
Author: Tom Tromey 
Date:   Thu Apr 18 09:08:23 2024 -0600

Use DW_TAG_module for Ada

DWARF is not especially clear on the distinction between
DW_TAG_namespace and DW_TAG_module, but I think that DW_TAG_module is
more appropriate for Ada.  This patch changes the compiler to do this.
Note that the Ada compiler does not yet create NAMESPACE_DECLs.

gcc

* dwarf2out.cc (gen_namespace_die): Use DW_TAG_module for Ada.

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

diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc
index 70b7f5f42cd7..5b064ffd78ad 100644
--- a/gcc/dwarf2out.cc
+++ b/gcc/dwarf2out.cc
@@ -27003,7 +27003,7 @@ gen_namespace_die (tree decl, dw_die_ref context_die)
 {
   /* Output a real namespace or module.  */
   context_die = setup_namespace_context (decl, comp_unit_die ());
-  namespace_die = new_die (is_fortran () || is_dlang ()
+  namespace_die = new_die (is_fortran () || is_dlang () || is_ada ()
   ? DW_TAG_module : DW_TAG_namespace,
   context_die, decl);
   /* For Fortran modules defined in different CU don't add src coords.  */


[gcc r15-636] diagnostics, analyzer: add CFG edge visualization to path-printing

2024-05-17 Thread David Malcolm via Gcc-cvs
https://gcc.gnu.org/g:770657d02c986c8724214dba51f21bb3c299ebae

commit r15-636-g770657d02c986c8724214dba51f21bb3c299ebae
Author: David Malcolm 
Date:   Fri May 17 14:51:47 2024 -0400

diagnostics, analyzer: add CFG edge visualization to path-printing

This patch adds some ability for links between labelled ranges when
quoting the user's source code, and uses this to add links between
events when printing diagnostic_paths, chopping them up further into
event ranges that can be printed together.
It adds links to the various "from..." - "...to" events in the
analyzer.

For example, previously we emitted this for
c-c++-common/analyzer/infinite-loop-linked-list.c's
while_loop_missing_next':

infinite-loop-linked-list.c:30:10: warning: infinite loop [CWE-835] 
[-Wanalyzer-infinite-loop]
   30 |   while (n)
  |  ^
  'while_loop_missing_next': events 1-5
   30 |   while (n)
  |  ^
  |  |
  |  (1) infinite loop here
  |  (2) when 'n' is non-NULL: always following 'true' branch...
  |  (5) ...to here
   31 | {
   32 |   sum += n->val;
  |   ~
  |   |   |
  |   |   (3) ...to here
  |   (4) looping back...

whereas with the patch we now emit:

infinite-loop-linked-list.c:30:10: warning: infinite loop [CWE-835] 
[-Wanalyzer-infinite-loop]
   30 |   while (n)
  |  ^
  'while_loop_missing_next': events 1-3
   30 |   while (n)
  |  ^
  |  |
  |  (1) infinite loop here
  |  (2) when 'n' is non-NULL: always following 'true' 
branch... ->-+
  | 
|
  | 
|
  
|++
   31 ||{
   32 ||  sum += n->val;
  || ~~
  ||  |
  |+->(3) ...to here
  'while_loop_missing_next': event 4
   32 |   sum += n->val;
  |   ^
  |   |
  |   (4) looping back... ->-+
  |  |
  'while_loop_missing_next': event 5
  |  |
  |+-+
   30 ||  while (n)
  || ^
  || |
  |+>(5) ...to here

which I believe is easier to understand.

The patch also implements the use of unicode characters and colorization
for the lines (not shown in the above example).

There is a new option -fno-diagnostics-show-event-links for getting
back the old behavior (added to -fdiagnostics-plain-output).

gcc/analyzer/ChangeLog:
* checker-event.h (checker_event::connect_to_next_event_p):
Implement new diagnostic_event::connect_to_next_event_p vfunc.
(start_cfg_edge_event::connect_to_next_event_p): Likewise.
(start_consolidated_cfg_edges_event::connect_to_next_event_p):
Likewise.
* infinite-loop.cc (class looping_back_event): New subclass.
(infinite_loop_diagnostic::add_final_event): Use it.

gcc/ChangeLog:
* common.opt (fdiagnostics-show-event-links): New option.
* diagnostic-label-effects.h: New file.
* diagnostic-path.h (diagnostic_event::connect_to_next_event_p):
New pure virtual function.
(simple_diagnostic_event::connect_to_next_event_p): Implement it.
(simple_diagnostic_event::connect_to_next_event): New.
(simple_diagnostic_event::m_connected_to_next_event): New field.
(simple_diagnostic_path::connect_to_next_event): New decl.
* diagnostic-show-locus.cc: Include "text-art/theme.h" and
"diagnostic-label-effects.h".
(colorizer::set_cfg_edge): New.
(layout::m_fallback_theme): New field.
(layout::m_theme): New field.
(layout::m_effect_info): New field.
(layout::m_link_lhs_state): New enum and field.
(layout::m_link_rhs_column): New field.
(layout_range::has_in_edge): New.
(layout_range::has_out_edge): New.
(layout::layout): Add "effect_info" optional param.  Initialize
m_theme, m_link_lhs_state, and m_link_rhs_column.
(layout::maybe_add_location_range): Remove stray "FIXME" from
leading comment.
(layout::print_source_line): Replace space after margin with a
call to print_leftmost_column.
(layout::print_leftmost_column): New.

[gcc r15-635] MAINTAINERS: Add myself to write after approval

2024-05-17 Thread Levy Hsu via Gcc-cvs
https://gcc.gnu.org/g:6daed961542a9d5e83f9b94a3ee91f918f4268a5

commit r15-635-g6daed961542a9d5e83f9b94a3ee91f918f4268a5
Author: Levy Hsu 
Date:   Sat May 18 02:20:18 2024 +0800

MAINTAINERS: Add myself to write after approval

ChangeLog:

* MAINTAINERS: Add myself.

Diff:
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 8bb435dd54ea..8e0add6bef86 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -467,6 +467,7 @@ Matthew Hiller  

 Kazu Hirata
 Manfred Hollstein  
 Cong Hou   
+Levy Hsu   
 Lin Hu 
 Falk Hueffner  
 Andrew John Hughes 


[gcc r15-634] i386: Rename sat_plusminus expanders to standard names [PR112600]

2024-05-17 Thread Uros Bizjak via Gcc-cvs
https://gcc.gnu.org/g:b59de4113262f2bee14147eb17eb3592f03d9556

commit r15-634-gb59de4113262f2bee14147eb17eb3592f03d9556
Author: Uros Bizjak 
Date:   Fri May 17 09:55:49 2024 +0200

i386: Rename sat_plusminus expanders to standard names [PR112600]

Rename _3 expander to a standard ssadd,
usadd, sssub and ussub name to enable corresponding optab expansion.

Also add named expander for MMX modes.

PR middle-end/112600

gcc/ChangeLog:

* config/i386/mmx.md (3): New expander.
* config/i386/sse.md
(_3):
Rename expander to 3.
(3): Update for rename.
* config/i386/i386-builtin.def: Update for rename.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr112600-1a.c: New test.
* gcc.target/i386/pr112600-1b.c: New test.

Diff:
---
 gcc/config/i386/i386-builtin.def| 80 ++---
 gcc/config/i386/mmx.md  |  7 +++
 gcc/config/i386/sse.md  |  4 +-
 gcc/testsuite/gcc.target/i386/pr112600-1a.c | 15 ++
 gcc/testsuite/gcc.target/i386/pr112600-1b.c | 15 ++
 5 files changed, 79 insertions(+), 42 deletions(-)

diff --git a/gcc/config/i386/i386-builtin.def b/gcc/config/i386/i386-builtin.def
index ab73e20121aa..927a79bb825b 100644
--- a/gcc/config/i386/i386-builtin.def
+++ b/gcc/config/i386/i386-builtin.def
@@ -800,14 +800,14 @@ BDESC (OPTION_MASK_ISA_SSE2, 0, CODE_FOR_subv8hi3, 
"__builtin_ia32_psubw128", IX
 BDESC (OPTION_MASK_ISA_SSE2, 0, CODE_FOR_subv4si3, "__builtin_ia32_psubd128", 
IX86_BUILTIN_PSUBD128, UNKNOWN, (int) V4SI_FTYPE_V4SI_V4SI)
 BDESC (OPTION_MASK_ISA_SSE2, 0, CODE_FOR_subv2di3, "__builtin_ia32_psubq128", 
IX86_BUILTIN_PSUBQ128, UNKNOWN, (int) V2DI_FTYPE_V2DI_V2DI)
 
-BDESC (OPTION_MASK_ISA_SSE2, 0, CODE_FOR_sse2_ssaddv16qi3, 
"__builtin_ia32_paddsb128", IX86_BUILTIN_PADDSB128, UNKNOWN, (int) 
V16QI_FTYPE_V16QI_V16QI)
-BDESC (OPTION_MASK_ISA_SSE2, 0, CODE_FOR_sse2_ssaddv8hi3, 
"__builtin_ia32_paddsw128", IX86_BUILTIN_PADDSW128, UNKNOWN, (int) 
V8HI_FTYPE_V8HI_V8HI)
-BDESC (OPTION_MASK_ISA_SSE2, 0, CODE_FOR_sse2_sssubv16qi3, 
"__builtin_ia32_psubsb128", IX86_BUILTIN_PSUBSB128, UNKNOWN, (int) 
V16QI_FTYPE_V16QI_V16QI)
-BDESC (OPTION_MASK_ISA_SSE2, 0, CODE_FOR_sse2_sssubv8hi3, 
"__builtin_ia32_psubsw128", IX86_BUILTIN_PSUBSW128, UNKNOWN, (int) 
V8HI_FTYPE_V8HI_V8HI)
-BDESC (OPTION_MASK_ISA_SSE2, 0, CODE_FOR_sse2_usaddv16qi3, 
"__builtin_ia32_paddusb128", IX86_BUILTIN_PADDUSB128, UNKNOWN, (int) 
V16QI_FTYPE_V16QI_V16QI)
-BDESC (OPTION_MASK_ISA_SSE2, 0, CODE_FOR_sse2_usaddv8hi3, 
"__builtin_ia32_paddusw128", IX86_BUILTIN_PADDUSW128, UNKNOWN, (int) 
V8HI_FTYPE_V8HI_V8HI)
-BDESC (OPTION_MASK_ISA_SSE2, 0, CODE_FOR_sse2_ussubv16qi3, 
"__builtin_ia32_psubusb128", IX86_BUILTIN_PSUBUSB128, UNKNOWN, (int) 
V16QI_FTYPE_V16QI_V16QI)
-BDESC (OPTION_MASK_ISA_SSE2, 0, CODE_FOR_sse2_ussubv8hi3, 
"__builtin_ia32_psubusw128", IX86_BUILTIN_PSUBUSW128, UNKNOWN, (int) 
V8HI_FTYPE_V8HI_V8HI)
+BDESC (OPTION_MASK_ISA_SSE2, 0, CODE_FOR_ssaddv16qi3, 
"__builtin_ia32_paddsb128", IX86_BUILTIN_PADDSB128, UNKNOWN, (int) 
V16QI_FTYPE_V16QI_V16QI)
+BDESC (OPTION_MASK_ISA_SSE2, 0, CODE_FOR_ssaddv8hi3, 
"__builtin_ia32_paddsw128", IX86_BUILTIN_PADDSW128, UNKNOWN, (int) 
V8HI_FTYPE_V8HI_V8HI)
+BDESC (OPTION_MASK_ISA_SSE2, 0, CODE_FOR_sssubv16qi3, 
"__builtin_ia32_psubsb128", IX86_BUILTIN_PSUBSB128, UNKNOWN, (int) 
V16QI_FTYPE_V16QI_V16QI)
+BDESC (OPTION_MASK_ISA_SSE2, 0, CODE_FOR_sssubv8hi3, 
"__builtin_ia32_psubsw128", IX86_BUILTIN_PSUBSW128, UNKNOWN, (int) 
V8HI_FTYPE_V8HI_V8HI)
+BDESC (OPTION_MASK_ISA_SSE2, 0, CODE_FOR_usaddv16qi3, 
"__builtin_ia32_paddusb128", IX86_BUILTIN_PADDUSB128, UNKNOWN, (int) 
V16QI_FTYPE_V16QI_V16QI)
+BDESC (OPTION_MASK_ISA_SSE2, 0, CODE_FOR_usaddv8hi3, 
"__builtin_ia32_paddusw128", IX86_BUILTIN_PADDUSW128, UNKNOWN, (int) 
V8HI_FTYPE_V8HI_V8HI)
+BDESC (OPTION_MASK_ISA_SSE2, 0, CODE_FOR_ussubv16qi3, 
"__builtin_ia32_psubusb128", IX86_BUILTIN_PSUBUSB128, UNKNOWN, (int) 
V16QI_FTYPE_V16QI_V16QI)
+BDESC (OPTION_MASK_ISA_SSE2, 0, CODE_FOR_ussubv8hi3, 
"__builtin_ia32_psubusw128", IX86_BUILTIN_PSUBUSW128, UNKNOWN, (int) 
V8HI_FTYPE_V8HI_V8HI)
 
 BDESC (OPTION_MASK_ISA_SSE2, 0, CODE_FOR_mulv8hi3, "__builtin_ia32_pmullw128", 
IX86_BUILTIN_PMULLW128, UNKNOWN, (int) V8HI_FTYPE_V8HI_V8HI)
 BDESC (OPTION_MASK_ISA_SSE2, 0, CODE_FOR_smulv8hi3_highpart, 
"__builtin_ia32_pmulhw128", IX86_BUILTIN_PMULHW128, UNKNOWN,(int) 
V8HI_FTYPE_V8HI_V8HI)
@@ -1193,10 +1193,10 @@ BDESC (OPTION_MASK_ISA_AVX2, 0, CODE_FOR_addv32qi3, 
"__builtin_ia32_paddb256", I
 BDESC (OPTION_MASK_ISA_AVX2, 0, CODE_FOR_addv16hi3, "__builtin_ia32_paddw256", 
IX86_BUILTIN_PADDW256, UNKNOWN, (int) V16HI_FTYPE_V16HI_V16HI)
 BDESC (OPTION_MASK_ISA_AVX2, 0, CODE_FOR_addv8si3, "__builtin_ia32_paddd256", 
IX86_BUILTIN_PADDD256, UNKNOWN, (int) V8SI_FTYPE_V8SI_V8SI)
 BDESC (OPTION_MASK_ISA_AVX2, 0, CODE_FOR_addv4di3, "__builtin_ia32_paddq256", 

[gcc r14-10216] Fortran: Fix select type regression due to r14-9489 [PR114874]

2024-05-17 Thread Paul Thomas via Gcc-cvs
https://gcc.gnu.org/g:c887341432bb71cf5540d54955ad7265b0aaca77

commit r14-10216-gc887341432bb71cf5540d54955ad7265b0aaca77
Author: Paul Thomas 
Date:   Fri May 17 15:19:26 2024 +0100

Fortran: Fix select type regression due to r14-9489 [PR114874]

2024-05-17  Paul Thomas  

gcc/fortran
PR fortran/114874
* gfortran.h: Add 'assoc_name_inferred' to gfc_namespace.
* match.cc (gfc_match_select_type): Set 'assoc_name_inferred'
in select type namespace if the selector has inferred type.
* primary.cc (gfc_match_varspec): If a select type temporary
is apparently scalar and a left parenthesis has been detected,
check the current namespace has 'assoc_name_inferred' set. If
so, set inferred_type.
* resolve.cc (resolve_variable): If the namespace of a select
type temporary is marked with 'assoc_name_inferred' call
gfc_fixup_inferred_type_refs to ensure references are OK.
(gfc_fixup_inferred_type_refs): Catch invalid array refs..

gcc/testsuite/
PR fortran/114874
* gfortran.dg/pr114874_1.f90: New test for valid code.
* gfortran.dg/pr114874_2.f90: New test for invalid code.

(cherry picked from commit 5f5074fe7aaf9524defb265299a985eecba7f914)

Diff:
---
 gcc/fortran/gfortran.h   |  4 +++
 gcc/fortran/match.cc | 21 +
 gcc/fortran/primary.cc   | 10 +++---
 gcc/fortran/resolve.cc   | 17 +++---
 gcc/testsuite/gfortran.dg/pr114874_1.f90 | 32 +++
 gcc/testsuite/gfortran.dg/pr114874_2.f90 | 53 
 6 files changed, 128 insertions(+), 9 deletions(-)

diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index 58505446bac5..de3d9e25911b 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -2241,6 +2241,10 @@ typedef struct gfc_namespace
   /* Set when resolve_types has been called for this namespace.  */
   unsigned types_resolved:1;
 
+  /* Set if the associate_name in a select type statement is an
+ inferred type.  */
+  unsigned assoc_name_inferred:1;
+
   /* Set to 1 if code has been generated for this namespace.  */
   unsigned translated:1;
 
diff --git a/gcc/fortran/match.cc b/gcc/fortran/match.cc
index 4539c9bb1344..1851a8f94a54 100644
--- a/gcc/fortran/match.cc
+++ b/gcc/fortran/match.cc
@@ -6721,6 +6721,27 @@ gfc_match_select_type (void)
   goto cleanup;
 }
 
+  /* Select type namespaces are not filled until resolution. Therefore, the
+ namespace must be marked as having an inferred type associate name if
+ either expr1 is an inferred type variable or expr2 is. In the latter
+ case, as well as the symbol being marked as inferred type, it might be
+ that it has not been detected to be so. In this case the target has
+ unknown type. Once the namespace is marked, the fixups in resolution can
+ be triggered.  */
+  if (!expr2
+  && expr1->symtree->n.sym->assoc
+  && expr1->symtree->n.sym->assoc->inferred_type)
+gfc_current_ns->assoc_name_inferred = 1;
+  else if (expr2 && expr2->expr_type == EXPR_VARIABLE
+  && expr2->symtree->n.sym->assoc)
+{
+  if (expr2->symtree->n.sym->assoc->inferred_type)
+   gfc_current_ns->assoc_name_inferred = 1;
+  else if (expr2->symtree->n.sym->assoc->target
+  && expr2->symtree->n.sym->assoc->target->ts.type == BT_UNKNOWN)
+   gfc_current_ns->assoc_name_inferred = 1;
+}
+
   new_st.op = EXEC_SELECT_TYPE;
   new_st.expr1 = expr1;
   new_st.expr2 = expr2;
diff --git a/gcc/fortran/primary.cc b/gcc/fortran/primary.cc
index 606e84432be6..c4821030ebb5 100644
--- a/gcc/fortran/primary.cc
+++ b/gcc/fortran/primary.cc
@@ -2113,13 +2113,13 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag, 
bool sub_flag,
 
   inferred_type = IS_INFERRED_TYPE (primary);
 
-  /* SELECT TYPE and SELECT RANK temporaries within an ASSOCIATE block, whose
- selector has not been parsed, can generate errors with array and component
- refs.. Use 'inferred_type' as a flag to suppress these errors.  */
+  /* SELECT TYPE temporaries within an ASSOCIATE block, whose selector has not
+ been parsed, can generate errors with array refs.. The SELECT TYPE
+ namespace is marked with 'assoc_name_inferred'. During resolution, this is
+ detected and gfc_fixup_inferred_type_refs is called.  */
   if (!inferred_type
-  && (gfc_peek_ascii_char () == '(' && !sym->attr.dimension)
-  && !sym->attr.codimension
   && sym->attr.select_type_temporary
+  && sym->ns->assoc_name_inferred
   && !sym->attr.select_rank_temporary)
 inferred_type = true;
 
diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc
index 4368627041ed..d7a0856fcca1 100644
--- a/gcc/fortran/resolve.cc
+++ b/gcc/fortran/resolve.cc
@@ -5888,6 +5888,9 @@ resolve_variable 

gcc-wwwdocs branch master updated. b55eb49edaf67eb671102a3ed8069cb9c9a3d108

2024-05-17 Thread Arthur Cohen via Gcc-cvs-wwwdocs
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gcc-wwwdocs".

The branch, master has been updated
   via  b55eb49edaf67eb671102a3ed8069cb9c9a3d108 (commit)
  from  48be8366fcbf9246b2b5b1625febb5e9202842b8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -
commit b55eb49edaf67eb671102a3ed8069cb9c9a3d108
Author: Arthur Cohen 
Date:   Tue May 14 10:34:16 2024 +0200

gcc-14/changes: Add Rust section to New languages

diff --git a/htdocs/gcc-14/changes.html b/htdocs/gcc-14/changes.html
index 924e045a..dd3fea8d 100644
--- a/htdocs/gcc-14/changes.html
+++ b/htdocs/gcc-14/changes.html
@@ -626,6 +626,19 @@ You may also want to check out our
   
 
 
+
+Rust
+
+  
+Experimental support for the Rust programming language has been
+added. The compiler is incomplete, but already supports a subset of the
+Rust programming language. The frontend does not support compiling the
+Rust standard library, so it cannot be used for most real-world Rust code 
yet.
+However, you can experiment with the compiler to run Rust code on 
#[no_core]
+targets.
+  
+
+
 
 libgccjit
 

---

Summary of changes:
 htdocs/gcc-14/changes.html | 13 +
 1 file changed, 13 insertions(+)


hooks/post-receive
-- 
gcc-wwwdocs


[gcc r15-633] Fortran: Fix select type regression due to r14-9489 [PR114874]

2024-05-17 Thread Paul Thomas via Gcc-cvs
https://gcc.gnu.org/g:5f5074fe7aaf9524defb265299a985eecba7f914

commit r15-633-g5f5074fe7aaf9524defb265299a985eecba7f914
Author: Paul Thomas 
Date:   Fri May 17 15:19:26 2024 +0100

Fortran: Fix select type regression due to r14-9489 [PR114874]

2024-05-17  Paul Thomas  

gcc/fortran
PR fortran/114874
* gfortran.h: Add 'assoc_name_inferred' to gfc_namespace.
* match.cc (gfc_match_select_type): Set 'assoc_name_inferred'
in select type namespace if the selector has inferred type.
* primary.cc (gfc_match_varspec): If a select type temporary
is apparently scalar and a left parenthesis has been detected,
check the current namespace has 'assoc_name_inferred' set. If
so, set inferred_type.
* resolve.cc (resolve_variable): If the namespace of a select
type temporary is marked with 'assoc_name_inferred' call
gfc_fixup_inferred_type_refs to ensure references are OK.
(gfc_fixup_inferred_type_refs): Catch invalid array refs..

gcc/testsuite/
PR fortran/114874
* gfortran.dg/pr114874_1.f90: New test for valid code.
* gfortran.dg/pr114874_2.f90: New test for invalid code.

Diff:
---
 gcc/fortran/gfortran.h   |  4 +++
 gcc/fortran/match.cc | 21 +
 gcc/fortran/primary.cc   | 10 +++---
 gcc/fortran/resolve.cc   | 17 +++---
 gcc/testsuite/gfortran.dg/pr114874_1.f90 | 32 +++
 gcc/testsuite/gfortran.dg/pr114874_2.f90 | 53 
 6 files changed, 128 insertions(+), 9 deletions(-)

diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index a7a0fdba3dd3..de1a7cd09352 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -2242,6 +2242,10 @@ typedef struct gfc_namespace
   /* Set when resolve_types has been called for this namespace.  */
   unsigned types_resolved:1;
 
+  /* Set if the associate_name in a select type statement is an
+ inferred type.  */
+  unsigned assoc_name_inferred:1;
+
   /* Set to 1 if code has been generated for this namespace.  */
   unsigned translated:1;
 
diff --git a/gcc/fortran/match.cc b/gcc/fortran/match.cc
index 4539c9bb1344..1851a8f94a54 100644
--- a/gcc/fortran/match.cc
+++ b/gcc/fortran/match.cc
@@ -6721,6 +6721,27 @@ gfc_match_select_type (void)
   goto cleanup;
 }
 
+  /* Select type namespaces are not filled until resolution. Therefore, the
+ namespace must be marked as having an inferred type associate name if
+ either expr1 is an inferred type variable or expr2 is. In the latter
+ case, as well as the symbol being marked as inferred type, it might be
+ that it has not been detected to be so. In this case the target has
+ unknown type. Once the namespace is marked, the fixups in resolution can
+ be triggered.  */
+  if (!expr2
+  && expr1->symtree->n.sym->assoc
+  && expr1->symtree->n.sym->assoc->inferred_type)
+gfc_current_ns->assoc_name_inferred = 1;
+  else if (expr2 && expr2->expr_type == EXPR_VARIABLE
+  && expr2->symtree->n.sym->assoc)
+{
+  if (expr2->symtree->n.sym->assoc->inferred_type)
+   gfc_current_ns->assoc_name_inferred = 1;
+  else if (expr2->symtree->n.sym->assoc->target
+  && expr2->symtree->n.sym->assoc->target->ts.type == BT_UNKNOWN)
+   gfc_current_ns->assoc_name_inferred = 1;
+}
+
   new_st.op = EXEC_SELECT_TYPE;
   new_st.expr1 = expr1;
   new_st.expr2 = expr2;
diff --git a/gcc/fortran/primary.cc b/gcc/fortran/primary.cc
index 8e7833769a8f..76f6bcb8a789 100644
--- a/gcc/fortran/primary.cc
+++ b/gcc/fortran/primary.cc
@@ -2113,13 +2113,13 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag, 
bool sub_flag,
 
   inferred_type = IS_INFERRED_TYPE (primary);
 
-  /* SELECT TYPE and SELECT RANK temporaries within an ASSOCIATE block, whose
- selector has not been parsed, can generate errors with array and component
- refs.. Use 'inferred_type' as a flag to suppress these errors.  */
+  /* SELECT TYPE temporaries within an ASSOCIATE block, whose selector has not
+ been parsed, can generate errors with array refs.. The SELECT TYPE
+ namespace is marked with 'assoc_name_inferred'. During resolution, this is
+ detected and gfc_fixup_inferred_type_refs is called.  */
   if (!inferred_type
-  && (gfc_peek_ascii_char () == '(' && !sym->attr.dimension)
-  && !sym->attr.codimension
   && sym->attr.select_type_temporary
+  && sym->ns->assoc_name_inferred
   && !sym->attr.select_rank_temporary)
 inferred_type = true;
 
diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc
index 4368627041ed..d7a0856fcca1 100644
--- a/gcc/fortran/resolve.cc
+++ b/gcc/fortran/resolve.cc
@@ -5888,6 +5888,9 @@ resolve_variable (gfc_expr *e)
   if (e->expr_type == EXPR_CONSTANT)
return true;
 }
+  

[gcc r15-632] [prange] Drop range to VARYING if the bitmask intersection made it so [PR115131]

2024-05-17 Thread Aldy Hernandez via Gcc-cvs
https://gcc.gnu.org/g:1accf4454a2ab57c4d681d1f6db332c46c61c058

commit r15-632-g1accf4454a2ab57c4d681d1f6db332c46c61c058
Author: Aldy Hernandez 
Date:   Fri May 17 13:44:08 2024 +0200

[prange] Drop range to VARYING if the bitmask intersection made it so 
[PR115131]

If the intersection of the bitmasks made the range span the entire
domain, normalize the range to VARYING.

gcc/ChangeLog:

PR middle-end/115131
* value-range.cc (prange::intersect): Set VARYING if intersection
of bitmasks made the range span the entire domain.
(range_tests_misc): New test.

Diff:
---
 gcc/value-range.cc | 21 +
 1 file changed, 21 insertions(+)

diff --git a/gcc/value-range.cc b/gcc/value-range.cc
index 334ffb70fbc2..b38d6159a856 100644
--- a/gcc/value-range.cc
+++ b/gcc/value-range.cc
@@ -589,6 +589,11 @@ prange::intersect (const vrange )
   irange_bitmask new_bitmask = get_bitmask_from_range (m_type, m_min, m_max);
   m_bitmask.intersect (new_bitmask);
   m_bitmask.intersect (r.m_bitmask);
+  if (varying_compatible_p ())
+{
+  set_varying (type ());
+  return true;
+}
 
   if (flag_checking)
 verify_range ();
@@ -2889,6 +2894,22 @@ range_tests_misc ()
   p0.invert ();
   ASSERT_TRUE (p0 == p1);
 
+  // The intersection of:
+  //[0, +INF] MASK 0xff..00 VALUE 0xf8
+  //[0, +INF] MASK 0xff..00 VALUE 0x00
+  // is [0, +INF] MASK 0xff..ff VALUE 0x00, which is VARYING.
+  // Test that we normalized to VARYING.
+  unsigned prec = TYPE_PRECISION (voidp);
+  p0.set_varying (voidp);
+  wide_int mask = wi::mask (8, true, prec);
+  wide_int value = wi::uhwi (0xf8, prec);
+  irange_bitmask bm (wi::uhwi (0xf8, prec), mask);
+  p0.update_bitmask (bm);
+  p1.set_varying (voidp);
+  bm = irange_bitmask (wi::zero (prec), mask);
+  p1.update_bitmask (bm);
+  p0.intersect (p1);
+
   // [10,20] U [15, 30] => [10, 30].
   r0 = range_int (10, 20);
   r1 = range_int (15, 30);


[gcc r15-631] libstdc++: detect DLLs on windows with

2024-05-17 Thread Jonathan Wakely via Libstdc++-cvs
https://gcc.gnu.org/g:d4635b504c73b653b815d2c2543c86c91b00e373

commit r15-631-gd4635b504c73b653b815d2c2543c86c91b00e373
Author: Björn Schäpers 
Date:   Fri May 17 11:45:28 2024 +0100

libstdc++: detect DLLs on windows with 

libstdc++-v3/ChangeLog:

* acinclude.m4 (GLIBCXX_ENABLE_BACKTACE): Add check for
tlhelp32.h, matching libbacktrace.
* config.h.in: Regenerate.
* configure: Regenerate.

Signed-off-by: Björn Schäpers 

Diff:
---
 libstdc++-v3/acinclude.m4 |  5 +
 libstdc++-v3/config.h.in  |  3 +++
 libstdc++-v3/configure| 16 
 3 files changed, 24 insertions(+)

diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index 51a08bcc8b1d..e04aae25360d 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -5481,6 +5481,11 @@ AC_DEFUN([GLIBCXX_ENABLE_BACKTRACE], [
 BACKTRACE_CPPFLAGS="$BACKTRACE_CPPFLAGS -DHAVE_DL_ITERATE_PHDR=1"
   fi
   AC_CHECK_HEADERS(windows.h)
+  AC_CHECK_HEADERS(tlhelp32.h, [], [],
+  [#ifdef HAVE_WINDOWS_H
+  #  include 
+  #endif
+  ])
 
   # Check for the fcntl function.
   if test -n "${with_target_subdir}"; then
diff --git a/libstdc++-v3/config.h.in b/libstdc++-v3/config.h.in
index 906e0143099e..486ba4507499 100644
--- a/libstdc++-v3/config.h.in
+++ b/libstdc++-v3/config.h.in
@@ -490,6 +490,9 @@
 /* Define to 1 if you have the `timespec_get' function. */
 #undef HAVE_TIMESPEC_GET
 
+/* Define to 1 if you have the  header file. */
+#undef HAVE_TLHELP32_H
+
 /* Define to 1 if the target supports thread-local storage. */
 #undef HAVE_TLS
 
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index 21abaeb07788..5179cc507f12 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -53865,6 +53865,22 @@ _ACEOF
 
 fi
 
+done
+
+  for ac_header in tlhelp32.h
+do :
+  ac_fn_c_check_header_compile "$LINENO" "tlhelp32.h" 
"ac_cv_header_tlhelp32_h" "#ifdef HAVE_WINDOWS_H
+  #  include 
+  #endif
+
+"
+if test "x$ac_cv_header_tlhelp32_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_TLHELP32_H 1
+_ACEOF
+
+fi
+
 done


[gcc r14-10215] libstdc++: Fix typo in _Grapheme_cluster_view::_Iterator [PR115119]

2024-05-17 Thread Jonathan Wakely via Libstdc++-cvs
https://gcc.gnu.org/g:e909d360dfaeafa9f45eda2461a1bedffac99ac2

commit r14-10215-ge909d360dfaeafa9f45eda2461a1bedffac99ac2
Author: Jonathan Wakely 
Date:   Thu May 16 17:15:55 2024 +0100

libstdc++: Fix typo in _Grapheme_cluster_view::_Iterator [PR115119]

libstdc++-v3/ChangeLog:

PR libstdc++/115119
* include/bits/unicode.h (_Iterator::operator++(int)): Fix typo
in increment expression.
* testsuite/ext/unicode/grapheme_view.cc: Check post-increment
on view's iterator.

(cherry picked from commit c9e05b03c18e898be604ab90401476e9c473cc52)

Diff:
---
 libstdc++-v3/include/bits/unicode.h |  6 --
 libstdc++-v3/testsuite/ext/unicode/grapheme_view.cc | 11 +++
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/include/bits/unicode.h 
b/libstdc++-v3/include/bits/unicode.h
index 46238143fb61..a14a17c5dfcf 100644
--- a/libstdc++-v3/include/bits/unicode.h
+++ b/libstdc++-v3/include/bits/unicode.h
@@ -34,10 +34,12 @@
 #include 
 #include   // bit_width
 #include  // __detail::__from_chars_alnum_to_val_table
+#include 
 #include 
 #include 
 #include 
-#include 
+#include  // iterator_t, sentinel_t, input_range, etc.
+#include  // view_interface
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
@@ -802,7 +804,7 @@ inline namespace __v15_1_0
operator++(int)
{
  auto __tmp = *this;
- ++this;
+ ++*this;
  return __tmp;
}
 
diff --git a/libstdc++-v3/testsuite/ext/unicode/grapheme_view.cc 
b/libstdc++-v3/testsuite/ext/unicode/grapheme_view.cc
index ac1e8c50b059..a3bb36e14b8e 100644
--- a/libstdc++-v3/testsuite/ext/unicode/grapheme_view.cc
+++ b/libstdc++-v3/testsuite/ext/unicode/grapheme_view.cc
@@ -83,10 +83,21 @@ test_breaks()
   VERIFY( iter == gv.end() );
 }
 
+constexpr void
+test_pr115119()
+{
+  // PR 115119 Typo in _Grapheme_cluster_view::_Iterator::operator++(int)
+  uc::_Grapheme_cluster_view gv(" "sv);
+  auto it = std::ranges::begin(gv);
+  it++;
+  VERIFY( it == std::ranges::end(gv) );
+}
+
 int main()
 {
   auto run_tests = []{
 test_breaks();
+test_pr115119();
 return true;
   };


[gcc r15-630] c++: aggregate CTAD w/ paren init and bases [PR115114]

2024-05-17 Thread Patrick Palka via Gcc-cvs
https://gcc.gnu.org/g:5aaf47cb1987bbc5508c4b9b7dad5ea7d69af2c2

commit r15-630-g5aaf47cb1987bbc5508c4b9b7dad5ea7d69af2c2
Author: Patrick Palka 
Date:   Fri May 17 09:02:52 2024 -0400

c++: aggregate CTAD w/ paren init and bases [PR115114]

During aggregate CTAD with paren init, we're accidentally overlooking
base classes since TYPE_FIELDS of a template type doesn't contain
corresponding base fields.  So we need to consider them separately.

PR c++/115114

gcc/cp/ChangeLog:

* pt.cc (maybe_aggr_guide): Consider bases in the paren init case.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/class-deduction-aggr15.C: New test.

Reviewed-by: Jason Merrill 

Diff:
---
 gcc/cp/pt.cc   |  7 +++
 .../g++.dg/cpp2a/class-deduction-aggr15.C  | 23 ++
 2 files changed, 30 insertions(+)

diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index 32640f8e946d..e77c48e463e2 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -30200,6 +30200,13 @@ maybe_aggr_guide (tree tmpl, tree init, 
vec *args)
   else if (TREE_CODE (init) == TREE_LIST)
 {
   int len = list_length (init);
+  for (tree binfo : BINFO_BASE_BINFOS (TYPE_BINFO (template_type)))
+   {
+ if (!len)
+   break;
+ parms = tree_cons (NULL_TREE, BINFO_TYPE (binfo), parms);
+ --len;
+   }
   for (tree field = TYPE_FIELDS (template_type);
   len;
   --len, field = DECL_CHAIN (field))
diff --git a/gcc/testsuite/g++.dg/cpp2a/class-deduction-aggr15.C 
b/gcc/testsuite/g++.dg/cpp2a/class-deduction-aggr15.C
new file mode 100644
index ..16dc0f52b64c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/class-deduction-aggr15.C
@@ -0,0 +1,23 @@
+// PR c++/115114
+// { dg-do compile { target c++20 } }
+
+struct X {} x;
+struct Y {} y;
+
+template
+struct A : T {
+  U m;
+};
+
+using ty1 = decltype(A{x, 42}); // OK
+using ty1 = decltype(A(x, 42)); // OK, used to fail
+using ty1 = A;
+
+template
+struct B : T, V {
+  U m = 42;
+};
+
+using ty2 = decltype(B{x, y}); // OK
+using ty2 = decltype(B(x, y)); // OK, used to fail
+using ty2 = B;


[gcc r15-629] libstdc++: Fix typo in _Grapheme_cluster_view::_Iterator [PR115119]

2024-05-17 Thread Jonathan Wakely via Libstdc++-cvs
https://gcc.gnu.org/g:c9e05b03c18e898be604ab90401476e9c473cc52

commit r15-629-gc9e05b03c18e898be604ab90401476e9c473cc52
Author: Jonathan Wakely 
Date:   Thu May 16 17:15:55 2024 +0100

libstdc++: Fix typo in _Grapheme_cluster_view::_Iterator [PR115119]

libstdc++-v3/ChangeLog:

PR libstdc++/115119
* include/bits/unicode.h (_Iterator::operator++(int)): Fix typo
in increment expression.
* testsuite/ext/unicode/grapheme_view.cc: Check post-increment
on view's iterator.

Diff:
---
 libstdc++-v3/include/bits/unicode.h |  6 --
 libstdc++-v3/testsuite/ext/unicode/grapheme_view.cc | 11 +++
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/include/bits/unicode.h 
b/libstdc++-v3/include/bits/unicode.h
index 46238143fb61..a14a17c5dfcf 100644
--- a/libstdc++-v3/include/bits/unicode.h
+++ b/libstdc++-v3/include/bits/unicode.h
@@ -34,10 +34,12 @@
 #include 
 #include   // bit_width
 #include  // __detail::__from_chars_alnum_to_val_table
+#include 
 #include 
 #include 
 #include 
-#include 
+#include  // iterator_t, sentinel_t, input_range, etc.
+#include  // view_interface
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
@@ -802,7 +804,7 @@ inline namespace __v15_1_0
operator++(int)
{
  auto __tmp = *this;
- ++this;
+ ++*this;
  return __tmp;
}
 
diff --git a/libstdc++-v3/testsuite/ext/unicode/grapheme_view.cc 
b/libstdc++-v3/testsuite/ext/unicode/grapheme_view.cc
index ac1e8c50b059..a3bb36e14b8e 100644
--- a/libstdc++-v3/testsuite/ext/unicode/grapheme_view.cc
+++ b/libstdc++-v3/testsuite/ext/unicode/grapheme_view.cc
@@ -83,10 +83,21 @@ test_breaks()
   VERIFY( iter == gv.end() );
 }
 
+constexpr void
+test_pr115119()
+{
+  // PR 115119 Typo in _Grapheme_cluster_view::_Iterator::operator++(int)
+  uc::_Grapheme_cluster_view gv(" "sv);
+  auto it = std::ranges::begin(gv);
+  it++;
+  VERIFY( it == std::ranges::end(gv) );
+}
+
 int main()
 {
   auto run_tests = []{
 test_breaks();
+test_pr115119();
 return true;
   };


[gcc r15-628] tree-into-ssa: speed up sorting in prune_unused_phi_nodes [PR114480]

2024-05-17 Thread Alexander Monakov via Gcc-cvs
https://gcc.gnu.org/g:4b9e68a6f3b22800a7f12b58ef6b25e3b339bb3c

commit r15-628-g4b9e68a6f3b22800a7f12b58ef6b25e3b339bb3c
Author: Alexander Monakov 
Date:   Wed May 15 16:23:17 2024 +0300

tree-into-ssa: speed up sorting in prune_unused_phi_nodes [PR114480]

In PR 114480 we are hitting a case where tree-into-ssa scales
quadratically due to prune_unused_phi_nodes doing O(N log N)
work for N basic blocks, for each variable individually.
Sorting the 'defs' array is especially costly.

It is possible to assist gcc_qsort by laying out dfs_out entries
in the reverse order in the 'defs' array, starting from its tail.
This is not always a win (in fact it flips most of 7-element qsorts
in this testcase from 9 comparisons (best case) to 15 (worst case)),
but overall it helps on the testcase and on libstdc++ build.
On the testcase we go from 1.28e9 comparator invocations to 1.05e9,
on libstdc++ from 2.91e6 to 2.84e6.

gcc/ChangeLog:

PR c++/114480
* tree-into-ssa.cc (prune_unused_phi_nodes): Add dfs_out entries
to the 'defs' array in the reverse order.

Diff:
---
 gcc/tree-into-ssa.cc | 17 +
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/gcc/tree-into-ssa.cc b/gcc/tree-into-ssa.cc
index 3732c269ca3d..5b367c358125 100644
--- a/gcc/tree-into-ssa.cc
+++ b/gcc/tree-into-ssa.cc
@@ -805,21 +805,22 @@ prune_unused_phi_nodes (bitmap phis, bitmap kills, bitmap 
uses)
  locate the nearest dominating def in logarithmic time by binary search.*/
   bitmap_ior (to_remove, kills, phis);
   n_defs = bitmap_count_bits (to_remove);
-  defs = XNEWVEC (struct dom_dfsnum, 2 * n_defs + 1);
+  adef = 2 * n_defs + 1;
+  defs = XNEWVEC (struct dom_dfsnum, adef);
   defs[0].bb_index = 1;
   defs[0].dfs_num = 0;
-  adef = 1;
+  struct dom_dfsnum *head = defs + 1, *tail = defs + adef;
   EXECUTE_IF_SET_IN_BITMAP (to_remove, 0, i, bi)
 {
   def_bb = BASIC_BLOCK_FOR_FN (cfun, i);
-  defs[adef].bb_index = i;
-  defs[adef].dfs_num = bb_dom_dfs_in (CDI_DOMINATORS, def_bb);
-  defs[adef + 1].bb_index = i;
-  defs[adef + 1].dfs_num = bb_dom_dfs_out (CDI_DOMINATORS, def_bb);
-  adef += 2;
+  head->bb_index = i;
+  head->dfs_num = bb_dom_dfs_in (CDI_DOMINATORS, def_bb);
+  head++, tail--;
+  tail->bb_index = i;
+  tail->dfs_num = bb_dom_dfs_out (CDI_DOMINATORS, def_bb);
 }
+  gcc_checking_assert (head == tail);
   BITMAP_FREE (to_remove);
-  gcc_assert (adef == 2 * n_defs + 1);
   qsort (defs, adef, sizeof (struct dom_dfsnum), cmp_dfsnum);
   gcc_assert (defs[0].bb_index == 1);


gcc-wwwdocs branch master updated. 48be8366fcbf9246b2b5b1625febb5e9202842b8

2024-05-17 Thread Richard Biener via Gcc-cvs-wwwdocs
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gcc-wwwdocs".

The branch, master has been updated
   via  48be8366fcbf9246b2b5b1625febb5e9202842b8 (commit)
  from  ed9ceba9b8b038f0e0f333798da7abe046679d0c (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -
commit 48be8366fcbf9246b2b5b1625febb5e9202842b8
Author: Richard Biener 
Date:   Fri May 17 13:48:56 2024 +0200

Fix trunk status

diff --git a/htdocs/index.html b/htdocs/index.html
index 63fbcdcd..c52bb30b 100644
--- a/htdocs/index.html
+++ b/htdocs/index.html
@@ -222,7 +222,7 @@ More news? Let ger...@pfeifer.com know!
   
   https://gcc.gnu.org/pipermail/gcc/2024-April/243824.html;>2024-04-26
   
-  (regression fixes  docs only).
+  (general development).
   
   https://gcc.gnu.org/bugzilla/buglist.cgi?query_format=advancedshort_desc_type=regexpshort_desc=%5C%5B(%5B%200-9.%2F%5D*%5B%20%2F%5D)*15%5B%20%2F%5D%5B%200-9.%2F%5D*%5BRr%5Degression%20*%5C%5Dtarget_milestone=11.5target_milestone=12.4target_milestone=13.3target_milestone=14.2target_milestone=15.0known_to_fail_type=allwordssubstrknown_to_work_type=allwordssubstrlong_desc_type=allwordssubstrlong_desc=bug_file_loc_type=allwordssubstrbug_file_loc=gcchost_type=allwordssubstrgcchost=gcctarget_type=allwordssubstrgcctarget=gccbuild_type=allwordssubstrgccbuild=keywords_type=allwordskeywords=bug_status=UNCONFIRMEDbug_status=NEWbug_status=ASSIGNEDbug_status=SUSPENDEDbug_status=WAITINGbug_status=REOPENEDpriority=P1priority=P2priority=P3emailtype1=substringemail1=emailtype2=substringemail2=bugidtype=includebug_i
 
d=votes=chfieldfrom=chfieldto=Nowchfieldvalue=cmdtype=doitorder=Reuse+same+sort+as+last+timefield0-0-0=nooptype0-0-0=noopvalue0-0-0=">Serious

---

Summary of changes:
 htdocs/index.html | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


hooks/post-receive
-- 
gcc-wwwdocs


[gcc r12-10456] tree-optimization/112281 - loop distribution and zero dependence distances

2024-05-17 Thread Richard Biener via Gcc-cvs
https://gcc.gnu.org/g:5db4b5449df8f59a61438f8db1836dbc9b53f02e

commit r12-10456-g5db4b5449df8f59a61438f8db1836dbc9b53f02e
Author: Richard Biener 
Date:   Mon Nov 20 13:39:52 2023 +0100

tree-optimization/112281 - loop distribution and zero dependence distances

The following fixes an omission in dependence testing for loop
distribution.  When the overall dependence distance is not zero but
the dependence direction in the innermost common loop is = there is
a conflict between the partitions and we have to merge them.

PR tree-optimization/112281
* tree-loop-distribution.cc
(loop_distribution::pg_add_dependence_edges): For = in the
innermost common loop record a partition conflict.

* gcc.dg/torture/pr112281-1.c: New testcase.
* gcc.dg/torture/pr112281-2.c: Likewise.

(cherry picked from commit 3b34902417259031823bff7f853f615a60464bbd)

Diff:
---
 gcc/testsuite/gcc.dg/torture/pr112281-1.c | 18 ++
 gcc/testsuite/gcc.dg/torture/pr112281-2.c | 18 ++
 gcc/tree-loop-distribution.cc | 18 ++
 3 files changed, 50 insertions(+), 4 deletions(-)

diff --git a/gcc/testsuite/gcc.dg/torture/pr112281-1.c 
b/gcc/testsuite/gcc.dg/torture/pr112281-1.c
new file mode 100644
index ..711f5663195c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr112281-1.c
@@ -0,0 +1,18 @@
+/* { dg-do run } */
+/* { dg-additional-options "-ftree-loop-distribution" } */
+
+struct {
+  int : 8;
+  int a;
+} b, d[4] = {{0}, {0}, {0}, {5}};
+int c, e;
+int main() {
+  for (c = 2; c; c--)
+for (e = 0; e < 2; e++) {
+  d[c] = b = d[c + 1];
+  d[c + 1].a = 0;
+}
+  if (b.a != 0)
+__builtin_abort();
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr112281-2.c 
b/gcc/testsuite/gcc.dg/torture/pr112281-2.c
new file mode 100644
index ..d7671e3322b4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr112281-2.c
@@ -0,0 +1,18 @@
+/* { dg-do run } */
+/* { dg-additional-options "-ftree-loop-distribution" } */
+
+struct {
+  int : 8;
+  int a;
+} b, d[4] = {{5}, {0}, {0}, {0}};
+int c, e;
+int main() {
+  for (c = 0; c < 2; c++)
+for (e = 0; e < 2; e++) {
+  d[c + 1] = b = d[c];
+  d[c].a = 0;
+}
+  if (b.a != 0)
+__builtin_abort();
+  return 0;
+}
diff --git a/gcc/tree-loop-distribution.cc b/gcc/tree-loop-distribution.cc
index 606eb05e64a5..1b7d2a1ea7d2 100644
--- a/gcc/tree-loop-distribution.cc
+++ b/gcc/tree-loop-distribution.cc
@@ -2117,9 +2117,6 @@ loop_distribution::pg_add_dependence_edges (struct graph 
*rdg, int dir,
}
  else if (DDR_ARE_DEPENDENT (ddr) == NULL_TREE)
{
- if (DDR_REVERSED_P (ddr))
-   this_dir = -this_dir;
-
  /* Known dependences can still be unordered througout the
 iteration space, see gcc.dg/tree-ssa/ldist-16.c and
 gcc.dg/tree-ssa/pr94969.c.  */
@@ -2132,7 +2129,20 @@ loop_distribution::pg_add_dependence_edges (struct graph 
*rdg, int dir,
  /* Else as the distance vector is lexicographic positive swap
 the dependence direction.  */
  else
-   this_dir = -this_dir;
+   {
+ if (DDR_REVERSED_P (ddr))
+   this_dir = -this_dir;
+ this_dir = -this_dir;
+
+ /* When then dependence distance of the innermost common
+loop of the DRs is zero we have a conflict.  */
+ auto l1 = gimple_bb (DR_STMT (dr1))->loop_father;
+ auto l2 = gimple_bb (DR_STMT (dr2))->loop_father;
+ int idx = index_in_loop_nest (find_common_loop (l1, l2)->num,
+   DDR_LOOP_NEST (ddr));
+ if (DDR_DIST_VECT (ddr, 0)[idx] == 0)
+   this_dir = 2;
+   }
}
  else
this_dir = 0;


[gcc r12-10458] middle-end/110176 - wrong zext (bool) <= (int) 4294967295u folding

2024-05-17 Thread Richard Biener via Gcc-cvs
https://gcc.gnu.org/g:65e5547e5468ce404d0f9ebd646a1d63abf3a772

commit r12-10458-g65e5547e5468ce404d0f9ebd646a1d63abf3a772
Author: Richard Biener 
Date:   Wed Jan 31 14:40:24 2024 +0100

middle-end/110176 - wrong zext (bool) <= (int) 4294967295u folding

The following fixes a wrong pattern that didn't match the behavior
of the original fold_widened_comparison in that get_unwidened
returned a constant always in the wider type.  But here we're
using (int) 4294967295u without the conversion applied.  Fixed
by doing as earlier in the pattern - matching constants only
if the conversion was actually applied.

PR middle-end/110176
* match.pd (zext (bool) <= (int) 4294967295u): Make sure
to match INTEGER_CST only without outstanding conversion.

* gcc.dg/torture/pr110176.c: New testcase.

(cherry picked from commit 22dbfbe8767ff4c1d93e39f68ec7c2d5b1358beb)

Diff:
---
 gcc/match.pd| 12 -
 gcc/testsuite/gcc.dg/torture/pr110176.c | 46 +
 2 files changed, 52 insertions(+), 6 deletions(-)

diff --git a/gcc/match.pd b/gcc/match.pd
index 0938d56fa45f..45ed34205106 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -5379,19 +5379,19 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
   >= TYPE_PRECISION (TREE_TYPE (@10)))
  && (TYPE_UNSIGNED (TREE_TYPE (@00))
  == TYPE_UNSIGNED (TREE_TYPE (@10
- || (TREE_CODE (@10) == INTEGER_CST
+ || (TREE_CODE (@1) == INTEGER_CST
  && INTEGRAL_TYPE_P (TREE_TYPE (@00))
- && int_fits_type_p (@10, TREE_TYPE (@00)
+ && int_fits_type_p (@1, TREE_TYPE (@00)
   (cmp @00 (convert @10))
-  (if (TREE_CODE (@10) == INTEGER_CST
+  (if (TREE_CODE (@1) == INTEGER_CST
   && INTEGRAL_TYPE_P (TREE_TYPE (@00))
-  && !int_fits_type_p (@10, TREE_TYPE (@00)))
+  && !int_fits_type_p (@1, TREE_TYPE (@00)))
(with
{
  tree min = lower_bound_in_type (TREE_TYPE (@10), TREE_TYPE (@00));
  tree max = upper_bound_in_type (TREE_TYPE (@10), TREE_TYPE (@00));
- bool above = integer_nonzerop (const_binop (LT_EXPR, type, max, @10));
- bool below = integer_nonzerop (const_binop (LT_EXPR, type, @10, min));
+ bool above = integer_nonzerop (const_binop (LT_EXPR, type, max, @1));
+ bool below = integer_nonzerop (const_binop (LT_EXPR, type, @1, min));
}
(if (above || below)
 (if (cmp == EQ_EXPR || cmp == NE_EXPR)
diff --git a/gcc/testsuite/gcc.dg/torture/pr110176.c 
b/gcc/testsuite/gcc.dg/torture/pr110176.c
new file mode 100644
index ..e41e3a0c3a7e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr110176.c
@@ -0,0 +1,46 @@
+/* { dg-do run } */
+
+int f(_Bool t)
+{
+int tt = t;
+unsigned x = -1;
+int xx = x;
+return xx <= tt;
+}
+
+int a, b;
+void c() {}
+__attribute__((noipa))
+void h() {__builtin_abort();}
+int d() {
+  unsigned f[1];
+  int i;
+  if (a)
+goto h;
+  f[0] = -1;
+  while (1) {
+c();
+for (; a < 1; a++) {
+  if (0) {
+  j:
+continue;
+  }
+  i = f[0];
+  if (a)
+break;
+  b = i >= (b == 0);
+}
+if (!b) {
+  if (0) {
+  h:
+goto j;
+  }
+  return 0;
+}
+h();
+  }
+}
+int main() {
+  d();
+  return 0;
+}


[gcc r12-10454] tree-optimization/112505 - bit-precision induction vectorization

2024-05-17 Thread Richard Biener via Gcc-cvs
https://gcc.gnu.org/g:4a71557fbebe3fb4031d1c2adc4f89c89a8c6c62

commit r12-10454-g4a71557fbebe3fb4031d1c2adc4f89c89a8c6c62
Author: Richard Biener 
Date:   Thu Jan 11 14:00:33 2024 +0100

tree-optimization/112505 - bit-precision induction vectorization

Vectorization of bit-precision inductions isn't implemented but we
don't check this, instead we ICE during transform.

PR tree-optimization/112505
* tree-vect-loop.cc (vectorizable_induction): Reject
bit-precision induction.

* gcc.dg/vect/pr112505.c: New testcase.

(cherry picked from commit ec345df53556ec581590347f71c3d9ff3cdbca76)

Diff:
---
 gcc/testsuite/gcc.dg/vect/pr112505.c | 14 ++
 gcc/tree-vect-loop.cc|  9 +
 2 files changed, 23 insertions(+)

diff --git a/gcc/testsuite/gcc.dg/vect/pr112505.c 
b/gcc/testsuite/gcc.dg/vect/pr112505.c
new file mode 100644
index ..56546c1095aa
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr112505.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-O3" } */
+
+short int w9;
+struct T {
+  short a : 14;
+  int b;
+};
+struct T v;
+void zc()
+{
+  for(int i = 0; i < 4; i ++)
+w9 *= v.b ? v.a-- < 0 : 0;
+}
diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index 86ee9e449e19..fd0e5a70a962 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -8211,6 +8211,15 @@ vectorizable_induction (loop_vec_info loop_vinfo,
 
   step_expr = STMT_VINFO_LOOP_PHI_EVOLUTION_PART (stmt_info);
   gcc_assert (step_expr != NULL_TREE);
+  if (INTEGRAL_TYPE_P (TREE_TYPE (step_expr))
+  && !type_has_mode_precision_p (TREE_TYPE (step_expr)))
+{
+  if (dump_enabled_p ())
+   dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+"bit-precision induction vectorization not "
+"supported.\n");
+  return false;
+}
   tree step_vectype = get_same_sized_vectype (TREE_TYPE (step_expr), vectype);
 
   /* Check for backend support of PLUS/MINUS_EXPR. */


[gcc r15-627] [prange] Avoid looking at type() for undefined ranges

2024-05-17 Thread Aldy Hernandez via Gcc-cvs
https://gcc.gnu.org/g:bc6e336cb7c85094ddc77757be97c3d8588f35ca

commit r15-627-gbc6e336cb7c85094ddc77757be97c3d8588f35ca
Author: Aldy Hernandez 
Date:   Fri May 17 10:30:03 2024 +0200

[prange] Avoid looking at type() for undefined ranges

Undefined ranges have no type.  This patch fixes the thinko.

gcc/ChangeLog:

PR middle-end/115128
* ipa-cp.cc (ipa_value_range_from_jfunc): Check for undefined_p
before looking at type.
(propagate_vr_across_jump_function): Same.

gcc/testsuite/ChangeLog:

* gcc.dg/tree-ssa/pr115128.c: New test.

Diff:
---
 gcc/ipa-cp.cc|  4 
 gcc/testsuite/gcc.dg/tree-ssa/pr115128.c | 31 +++
 2 files changed, 35 insertions(+)

diff --git a/gcc/ipa-cp.cc b/gcc/ipa-cp.cc
index 09cab7618226..408166b8044b 100644
--- a/gcc/ipa-cp.cc
+++ b/gcc/ipa-cp.cc
@@ -1744,6 +1744,8 @@ ipa_value_range_from_jfunc (vrange ,
 pointer type to hold the result instead of a boolean
 type.  Avoid trapping in the sanity check in
 fold_range until this is fixed.  */
+ || srcvr.undefined_p ()
+ || op_vr.undefined_p ()
  || !handler.operand_check_p (vr_type, srcvr.type (), op_vr.type 
())
  || !handler.fold_range (op_res, vr_type, srcvr, op_vr))
op_res.set_varying (vr_type);
@@ -2556,6 +2558,8 @@ propagate_vr_across_jump_function (cgraph_edge *cs, 
ipa_jump_func *jfunc,
 pointer type to hold the result instead of a boolean
 type.  Avoid trapping in the sanity check in
 fold_range until this is fixed.  */
+ || src_lats->m_value_range.m_vr.undefined_p ()
+ || op_vr.undefined_p ()
  || !handler.operand_check_p (operand_type,
   src_lats->m_value_range.m_vr.type (),
   op_vr.type ())
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr115128.c 
b/gcc/testsuite/gcc.dg/tree-ssa/pr115128.c
new file mode 100644
index ..14bd4dbd6e51
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr115128.c
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -w" } */
+
+long XXH3_len_4to8_64b_len, XXH3_len_0to16_64b___trans_tmp_3, 
XXH3_mix2Accs_acc,
+XXH3_64bits_internal___trans_tmp_8;
+typedef unsigned long XXH3_hashLong64_f();
+void *XXH3_64bits_internal_input;
+int XXH3_64bits_internal___trans_tmp_1;
+void XXH3_mul128_fold64();
+static void XXH3_mergeAccs(unsigned long) {
+  for (;;)
+XXH3_mul128_fold64(XXH3_mix2Accs_acc);
+}
+static __attribute__((noinline)) unsigned long
+XXH3_hashLong_64b_default(void *, unsigned long len) {
+  XXH3_mergeAccs(len * 7);
+}
+__attribute__((always_inline)) long
+XXH3_64bits_internal(unsigned long len, XXH3_hashLong64_f f_hashLong) {
+  if (len <= 16) {
+long keyed =
+XXH3_64bits_internal___trans_tmp_1 ^ XXH3_len_0to16_64b___trans_tmp_3;
+XXH3_mul128_fold64(keyed, XXH3_len_4to8_64b_len);
+return XXH3_64bits_internal___trans_tmp_8;
+  }
+  f_hashLong(XXH3_64bits_internal_input, len);
+}
+static void XXH_INLINE_XXH3_64bits(unsigned long len) {
+  XXH3_64bits_internal(len, XXH3_hashLong_64b_default);
+}
+void __cmplog_rtn_hook() { XXH_INLINE_XXH3_64bits(sizeof(long)); }


[gcc r12-10457] tree-optimization/111039 - abnormals and bit test merging

2024-05-17 Thread Richard Biener via Gcc-cvs
https://gcc.gnu.org/g:47e6bff94d980e2fcb6bcb42df04d3b73bd67da7

commit r12-10457-g47e6bff94d980e2fcb6bcb42df04d3b73bd67da7
Author: Richard Biener 
Date:   Thu Aug 17 13:10:14 2023 +0200

tree-optimization/111039 - abnormals and bit test merging

The following guards the bit test merging code in if-combine against
the appearance of SSA names used in abnormal PHIs.

PR tree-optimization/111039
* tree-ssa-ifcombine.cc (ifcombine_ifandif): Check for
SSA_NAME_OCCURS_IN_ABNORMAL_PHI.

* gcc.dg/pr111039.c: New testcase.

(cherry picked from commit 482551a79a3d3f107f6239679ee74655cfe8707e)

Diff:
---
 gcc/testsuite/gcc.dg/pr111039.c | 15 +++
 gcc/tree-ssa-ifcombine.cc   |  7 +++
 2 files changed, 22 insertions(+)

diff --git a/gcc/testsuite/gcc.dg/pr111039.c b/gcc/testsuite/gcc.dg/pr111039.c
new file mode 100644
index ..bec9983b35f8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr111039.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O" } */
+
+int _setjmp ();
+void abcd ();
+void abcde ();
+void compiler_corruption_function(int flags)
+{
+  int nowait = flags & 1048576, isexpand = flags & 8388608;
+  abcd();
+  _setjmp(flags);
+  if (nowait && isexpand)
+flags &= 0;
+  abcde();
+}
diff --git a/gcc/tree-ssa-ifcombine.cc b/gcc/tree-ssa-ifcombine.cc
index ce9bbebf9480..b139328af224 100644
--- a/gcc/tree-ssa-ifcombine.cc
+++ b/gcc/tree-ssa-ifcombine.cc
@@ -415,6 +415,9 @@ ifcombine_ifandif (basic_block inner_cond_bb, bool 
inner_inv,
 {
   tree t, t2;
 
+  if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name1))
+   return false;
+
   /* Do it.  */
   gsi = gsi_for_stmt (inner_cond);
   t = fold_build2 (LSHIFT_EXPR, TREE_TYPE (name1),
@@ -465,6 +468,10 @@ ifcombine_ifandif (basic_block inner_cond_bb, bool 
inner_inv,
   gimple_stmt_iterator gsi;
   tree t;
 
+  if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name1)
+ || SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name2))
+   return false;
+
   /* Find the common name which is bit-tested.  */
   if (name1 == name2)
;


[gcc r12-10455] tree-optimization/112495 - alias versioning and address spaces

2024-05-17 Thread Richard Biener via Gcc-cvs
https://gcc.gnu.org/g:dbb5273996259b04350a1e3d35e633c51fc9310f

commit r12-10455-gdbb5273996259b04350a1e3d35e633c51fc9310f
Author: Richard Biener 
Date:   Mon Nov 13 10:20:37 2023 +0100

tree-optimization/112495 - alias versioning and address spaces

We are not correctly handling differing address spaces in dependence
analysis runtime alias check generation so refuse to do that.

PR tree-optimization/112495
* tree-data-ref.cc (runtime_alias_check_p): Reject checks
between different address spaces.

* gcc.target/i386/pr112495.c: New testcase.

(cherry picked from commit 0f593c0521caab8cfac53514b1a5e7d0d0dd1932)

Diff:
---
 gcc/testsuite/gcc.target/i386/pr112495.c | 12 
 gcc/tree-data-ref.cc |  7 +++
 2 files changed, 19 insertions(+)

diff --git a/gcc/testsuite/gcc.target/i386/pr112495.c 
b/gcc/testsuite/gcc.target/i386/pr112495.c
new file mode 100644
index ..21afbaa6945d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr112495.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+typedef struct { int v; } T1;
+typedef struct { T1 v[32]; } T2;
+
+T1 s;
+T1 f1() { return s; }
+
+void f2(__seg_gs T2 *p, int n) {
+  for (int i = 0; i < n; ++i) p->v[i] = f1();
+}
diff --git a/gcc/tree-data-ref.cc b/gcc/tree-data-ref.cc
index 397792c3584c..0df4a3525f4c 100644
--- a/gcc/tree-data-ref.cc
+++ b/gcc/tree-data-ref.cc
@@ -1632,6 +1632,13 @@ runtime_alias_check_p (ddr_p ddr, class loop *loop, bool 
speed_p)
   "runtime alias check not supported for"
   " outer loop.\n");
 
+  /* FORNOW: We don't support handling different address spaces.  */
+  if (TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (DR_BASE_ADDRESS (DDR_A (ddr)
+  != TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (DR_BASE_ADDRESS (DDR_B 
(ddr))
+return opt_result::failure_at (DR_STMT (DDR_A (ddr)),
+  "runtime alias check between different "
+  "address spaces not supported.\n");
+
   return opt_result::success ();
 }


[gcc r12-10453] debug/112718 - reset all type units with -ffat-lto-objects

2024-05-17 Thread Richard Biener via Gcc-cvs
https://gcc.gnu.org/g:1f41e8eef3da1d76c18fe1a93846054c53dc5a47

commit r12-10453-g1f41e8eef3da1d76c18fe1a93846054c53dc5a47
Author: Richard Biener 
Date:   Mon Jan 22 15:42:59 2024 +0100

debug/112718 - reset all type units with -ffat-lto-objects

When mixing -flto, -ffat-lto-objects and -fdebug-type-section we
fail to reset all type units after early output resulting in an
ICE when attempting to add then duplicate sibling attributes.

PR debug/112718
* dwarf2out.cc (dwarf2out_finish): Reset all type units
for the fat part of an LTO compile.

* gcc.dg/debug/pr112718.c: New testcase.

(cherry picked from commit 7218f5050cb7163edae331f54ca163248ab48bfa)

Diff:
---
 gcc/dwarf2out.cc  | 12 
 gcc/testsuite/gcc.dg/debug/pr112718.c | 12 
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc
index d14ec0261b6b..cfe87cba4c4c 100644
--- a/gcc/dwarf2out.cc
+++ b/gcc/dwarf2out.cc
@@ -32162,24 +32162,12 @@ dwarf2out_finish (const char *filename)
   reset_dies (comp_unit_die ());
   for (limbo_die_node *node = cu_die_list; node; node = node->next)
reset_dies (node->die);
-
-  hash_table comdat_type_table (100);
   for (ctnode = comdat_type_list; ctnode != NULL; ctnode = ctnode->next)
{
- comdat_type_node **slot
- = comdat_type_table.find_slot (ctnode, INSERT);
-
- /* Don't reset types twice.  */
- if (*slot != HTAB_EMPTY_ENTRY)
-   continue;
-
  /* Remove the pointer to the line table.  */
  remove_AT (ctnode->root_die, DW_AT_stmt_list);
-
  if (debug_info_level >= DINFO_LEVEL_TERSE)
reset_dies (ctnode->root_die);
-
- *slot = ctnode;
}
 
   /* Reset die CU symbol so we don't output it twice.  */
diff --git a/gcc/testsuite/gcc.dg/debug/pr112718.c 
b/gcc/testsuite/gcc.dg/debug/pr112718.c
new file mode 100644
index ..ff80ca5a2981
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/pr112718.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target lto } */
+/* { dg-options "-g -fdebug-types-section -flto -ffat-lto-objects" } */
+
+struct {
+  int h;
+  unsigned char data[20 + 24 * 6];
+} _EC_X9_62_PRIME_192V2;
+struct {
+  int h;
+  unsigned char data[20 + 24 * 6];
+} _EC_X9_62_PRIME_192V3;


[gcc r12-10452] tree-optimization/112793 - SLP of constant/external code-generated twice

2024-05-17 Thread Richard Biener via Gcc-cvs
https://gcc.gnu.org/g:9bad5cf9ae446b367f666176537eb76e94cc4448

commit r12-10452-g9bad5cf9ae446b367f666176537eb76e94cc4448
Author: Richard Biener 
Date:   Wed Dec 13 14:23:31 2023 +0100

tree-optimization/112793 - SLP of constant/external code-generated twice

The following makes the attempt at code-generating a constant/external
SLP node twice well-formed as that can happen when partitioning BB
vectorization attempts where we keep constants/externals unpartitioned.

PR tree-optimization/112793
* tree-vect-slp.cc (vect_schedule_slp_node): Already
code-generated constant/external nodes are OK.

* g++.dg/vect/pr112793.cc: New testcase.

(cherry picked from commit d782ec8362eadc3169286eb1e39c631effd02323)

Diff:
---
 gcc/testsuite/g++.dg/vect/pr112793.cc | 32 
 gcc/tree-vect-slp.cc  | 16 +---
 2 files changed, 41 insertions(+), 7 deletions(-)

diff --git a/gcc/testsuite/g++.dg/vect/pr112793.cc 
b/gcc/testsuite/g++.dg/vect/pr112793.cc
new file mode 100644
index ..258d7c1b1119
--- /dev/null
+++ b/gcc/testsuite/g++.dg/vect/pr112793.cc
@@ -0,0 +1,32 @@
+// { dg-do compile }
+// { dg-require-effective-target c++11 }
+// { dg-additional-options "-march=znver2" { target x86_64-*-* i?86-*-* } }
+
+typedef double T;
+T c, s;
+T a[16];
+struct Matrix4 {
+  Matrix4(){}
+  Matrix4(T e, T f, T i, T j) {
+r[1] = r[4] = e;
+r[5] = f;
+r[8] = i;
+r[9] = j;
+  }
+  Matrix4 operator*(Matrix4 a) {
+return Matrix4(
+   r[0] * a.r[4] + r[4] + r[15] + r[6],
+   r[1] * a.r[4] + 1 + 2 + 3,  r[0] * r[8] + 1 + 2 + 3,
+   r[1] * r[8] + r[1] + r[14] + r[2] * r[3]);
+  }
+  T r[16] = {};
+};
+Matrix4 t1, t2;
+Matrix4 tt;
+Matrix4 getRotAltAzToEquatorial()
+{
+  t2.r[4] =  0;
+  t1.r[1] =  -s;
+  t1.r[8] = 0;
+  return t1 * t2;
+}
diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index 26c989cbff9a..54e6a9e4224f 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -7240,12 +7240,6 @@ vect_schedule_slp_node (vec_info *vinfo,
   int i;
   slp_tree child;
 
-  /* For existing vectors there's nothing to do.  */
-  if (SLP_TREE_VEC_DEFS (node).exists ())
-return;
-
-  gcc_assert (SLP_TREE_VEC_STMTS (node).is_empty ());
-
   /* Vectorize externals and constants.  */
   if (SLP_TREE_DEF_TYPE (node) == vect_constant_def
   || SLP_TREE_DEF_TYPE (node) == vect_external_def)
@@ -7256,10 +7250,18 @@ vect_schedule_slp_node (vec_info *vinfo,
   if (!SLP_TREE_VECTYPE (node))
return;
 
-  vect_create_constant_vectors (vinfo, node);
+  /* There are two reasons vector defs might already exist.  The first
+is that we are vectorizing an existing vector def.  The second is
+when performing BB vectorization shared constant/external nodes
+are not split apart during partitioning so during the code-gen
+DFS walk we can end up visiting them twice.  */
+  if (! SLP_TREE_VEC_DEFS (node).exists ())
+   vect_create_constant_vectors (vinfo, node);
   return;
 }
 
+  gcc_assert (SLP_TREE_VEC_DEFS (node).is_empty ());
+
   stmt_vec_info stmt_info = SLP_TREE_REPRESENTATIVE (node);
 
   gcc_assert (SLP_TREE_NUMBER_OF_VEC_STMTS (node) != 0);


[gcc r14-10214] tree-optimization/114998 - use-after-free with loop distribution

2024-05-17 Thread Richard Biener via Gcc-cvs
https://gcc.gnu.org/g:1e9ae50d4d160f6d557fc4cbbe95c4a36897c09f

commit r14-10214-g1e9ae50d4d160f6d557fc4cbbe95c4a36897c09f
Author: Richard Biener 
Date:   Fri May 10 14:19:49 2024 +0200

tree-optimization/114998 - use-after-free with loop distribution

When loop distribution releases a PHI node of the original IL it
can end up clobbering memory that's re-used when it upon releasing
its RDG resets all stmt UIDs back to -1, even those that got released.

The fix is to avoid resetting UIDs based on stmts in the RDG but
instead reset only those still present in the loop.

PR tree-optimization/114998
* tree-loop-distribution.cc (free_rdg): Take loop argument.
Reset UIDs of stmts still in the IL rather than all stmts
referenced from the RDG.
(loop_distribution::build_rdg): Pass loop to free_rdg.
(loop_distribution::distribute_loop): Likewise.
(loop_distribution::transform_reduction_loop): Likewise.

* gcc.dg/torture/pr114998.c: New testcase.

(cherry picked from commit 34d15a4d630a0d54eddb99bdab086c506e10dac5)

Diff:
---
 gcc/testsuite/gcc.dg/torture/pr114998.c | 35 +
 gcc/tree-loop-distribution.cc   | 24 --
 2 files changed, 53 insertions(+), 6 deletions(-)

diff --git a/gcc/testsuite/gcc.dg/torture/pr114998.c 
b/gcc/testsuite/gcc.dg/torture/pr114998.c
new file mode 100644
index ..81fc1e077cb9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr114998.c
@@ -0,0 +1,35 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fno-tree-dce -ftree-loop-distribution" } */
+
+short a, d;
+int b, c, f, g, h, i, j[2], o;
+__attribute__((const)) int s(char r);
+int main() {
+  int l, m, k, n;
+  if (b) {
+char p;
+for (; p >= 0; p--) {
+  int e[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0,
+ 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1,
+ 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0};
+  if (j[p]) {
+int q[1];
+i = o;
+o = q[h];
+if (g)
+  n = d;
+m = 4;
+for (; m; m--) {
+  if (l)
+k |= c;
+  if (a)
+break;
+}
+  }
+  s(n);
+  f |= b;
+}
+  }
+  return 0;
+}
diff --git a/gcc/tree-loop-distribution.cc b/gcc/tree-loop-distribution.cc
index 95203fefa188..45932bae5e7f 100644
--- a/gcc/tree-loop-distribution.cc
+++ b/gcc/tree-loop-distribution.cc
@@ -778,7 +778,7 @@ loop_distribution::stmts_from_loop (class loop *loop, 
vec *stmts)
 /* Free the reduced dependence graph RDG.  */
 
 static void
-free_rdg (struct graph *rdg)
+free_rdg (struct graph *rdg, loop_p loop)
 {
   int i;
 
@@ -792,13 +792,25 @@ free_rdg (struct graph *rdg)
 
   if (v->data)
{
- gimple_set_uid (RDGV_STMT (v), -1);
  (RDGV_DATAREFS (v)).release ();
  free (v->data);
}
 }
 
   free_graph (rdg);
+
+  /* Reset UIDs of stmts still in the loop.  */
+  basic_block *bbs = get_loop_body (loop);
+  for (unsigned i = 0; i < loop->num_nodes; ++i)
+{
+  basic_block bb = bbs[i];
+  gimple_stmt_iterator gsi;
+  for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next ())
+   gimple_set_uid (gsi_stmt (gsi), -1);
+  for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next ())
+   gimple_set_uid (gsi_stmt (gsi), -1);
+}
+  free (bbs);
 }
 
 struct graph *
@@ -812,7 +824,7 @@ loop_distribution::build_rdg (class loop *loop, 
control_dependences *cd)
   rdg = new_graph (stmts.length ());
   if (!create_rdg_vertices (rdg, stmts, loop))
 {
-  free_rdg (rdg);
+  free_rdg (rdg, loop);
   return NULL;
 }
   stmts.release ();
@@ -3062,7 +3074,7 @@ loop_distribution::distribute_loop (class loop *loop,
 "Loop %d not distributed: too many memory references.\n",
 loop->num);
 
-  free_rdg (rdg);
+  free_rdg (rdg, loop);
   loop_nest.release ();
   free_data_refs (datarefs_vec);
   delete ddrs_table;
@@ -3259,7 +3271,7 @@ loop_distribution::distribute_loop (class loop *loop,
   FOR_EACH_VEC_ELT (partitions, i, partition)
 partition_free (partition);
 
-  free_rdg (rdg);
+  free_rdg (rdg, loop);
   return nbp - *nb_calls;
 }
 
@@ -3665,7 +3677,7 @@ loop_distribution::transform_reduction_loop (loop_p loop)
   auto_bitmap partition_stmts;
   bitmap_set_range (partition_stmts, 0, rdg->n_vertices);
   find_single_drs (loop, rdg, partition_stmts, _dr, _dr);
-  free_rdg (rdg);
+  free_rdg (rdg, loop);
 
   /* Bail out if there is no single load.  */
   if (load_dr == NULL)


[gcc r15-626] middle-end/115110 - Fix view_converted_memref_p

2024-05-17 Thread Richard Biener via Gcc-cvs
https://gcc.gnu.org/g:a5b3721c06646bf5b9b50a22964e8e2bd4d03f5f

commit r15-626-ga5b3721c06646bf5b9b50a22964e8e2bd4d03f5f
Author: Richard Biener 
Date:   Fri May 17 11:02:29 2024 +0200

middle-end/115110 - Fix view_converted_memref_p

view_converted_memref_p was checking the reference type against the
pointer type of the offset operand rather than its pointed-to type
which leads to all refs being subject to view-convert treatment
in get_alias_set causing numerous testsuite fails but with its
new uses from r15-512-g9b7cad5884f21c is also a wrong-code issue.

PR middle-end/115110
* tree-ssa-alias.cc (view_converted_memref_p): Fix.

Diff:
---
 gcc/tree-ssa-alias.cc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gcc/tree-ssa-alias.cc b/gcc/tree-ssa-alias.cc
index 9f5f69bcfad2..d64d6d02f4a8 100644
--- a/gcc/tree-ssa-alias.cc
+++ b/gcc/tree-ssa-alias.cc
@@ -2077,8 +2077,9 @@ view_converted_memref_p (tree base)
 {
   if (TREE_CODE (base) != MEM_REF && TREE_CODE (base) != TARGET_MEM_REF)
 return false;
-  return same_type_for_tbaa (TREE_TYPE (base),
-TREE_TYPE (TREE_OPERAND (base, 1))) != 1;
+  return (same_type_for_tbaa (TREE_TYPE (base),
+ TREE_TYPE (TREE_TYPE (TREE_OPERAND (base, 1
+ != 1);
 }
 
 /* Return true if an indirect reference based on *PTR1 constrained


[gcc/aoliva/heads/testbase] (666 commits) make -freg-struct-return visibly a negative alias of -fpcc-

2024-05-17 Thread Alexandre Oliva via Gcc-cvs
The branch 'aoliva/heads/testbase' was updated to point to:

 b7483de99536... make -freg-struct-return visibly a negative alias of -fpcc-

It previously pointed to:

 f17d31e709af... Fortran: Detect 'no implicit type' error in right place [PR

Diff:

Summary of changes (added commits):
---

  b7483de... make -freg-struct-return visibly a negative alias of -fpcc- (*)
  d477d68... RISC-V: Cleanup some temporally files [NFC] (*)
  0b2c333... Update gcc sv.po (*)
  556e777... RISC-V: Enable vectorizable early exit testsuite (*)
  6c1de78... RISC-V: Implement vectorizable early exit with vcond_mask_l (*)
  96d5325... Fix points_to_local_or_readonly_memory_p wrt TARGET_MEM_REF (*)
  f3e5f4c... tree-optimization/13962 - handle ptr-ptr compares in ptrs_c (*)
  a9251ab... wrong code with points-to and volatile (*)
  57f8a2f... Vect: Support loop len in vectorizable early exit (*)
  d4dee34... Vect: Support new IFN SAT_ADD for unsigned vector int (*)
  52b0536... Internal-fn: Support new IFN SAT_ADD for unsigned scalar in (*)
  da73261... Revert "Revert: "Enable prange support."" (*)
  b8e3574... Cleanup prange sanity checks. (*)
  f6bed6d... Use a boolean type when folding conditionals in simplify_us (*)
  b8b82bb... RISC-V: testsuite: Drop march-string in cmpmemsi/cpymemsi t (*)
  1e0ae1f... tree-optimization/79958 - make DSE track multiple paths (*)
  bff5328... ada: Remove obsolete reference in comment (*)
  f72988a... ada: Reset scope of top level object declaration during unn (*)
  584ade0... ada: Redundant validity checks (*)
  9ec20f1... ada: Exception on Indefinite_Vector aggregate with loop_par (*)
  568c795... ada: Implement new experimental attribute 'Super (*)
  33ae453... ada: Fix reference to RM clause in comment (*)
  5c9205a... ada: Fix missing length checks with case expressions (*)
  ea64884... ada: Fix standalone Windows builds of adaint.c (*)
  c3b570b... ada: Avoid checking parameters of protected procedures (*)
  c485a15... ada: Ignore ghost nodes in call graph information for dispa (*)
  a802cb3... ada: Fix reason code for length check (*)
  8e22376... ada: Propagate Program_Error from failed finalization of co (*)
  55d11e8... ada: Improve recovery from illegal occurrence of 'Old in if (*)
  f5c7870... ada: No need to follow New_Occurrence_Of with Set_Etype (*)
  7d2a5db... ada: Fix detection of if_expressions that are known on entr (*)
  fa832b4... ada: Fix comments about Get_Ranged_Checks (*)
  8560a06... ada: Minor performance improvement for dynamically-allocate (*)
  513f6b8... ada: Fixup one more pattern of broken scope information (*)
  bc35098... ada: Fix typo in CUDA error message (*)
  4806875... ada: Fix latent alignment issue for dynamically-allocated c (*)
  b98e256... ada: Fix resolving tagged operations in array aggregates (*)
  81a5815... ada: Fix bogus error on function returning noncontrolling r (*)
  7c487eb... ada: Fix casing of CUDA in error messages (*)
  f039057... ada: Fix crash with -gnatdJ and -gnatw_q (*)
  a58b6be... ada: Follow up fixes for Put_Image/streaming regressions (*)
  50a... ada: Implement per-finalization-collection spinlocks (*)
  91c6302... ada: Formal_Derived_Type'Size is not static (*)
  e730d52... ada: Fix bug in maintaining dimension info (*)
  8b73cb9... ada: Remove Aspect_Specifications field from N_Procedure_Sp (*)
  0607818... ada: Reuse existing expression when rewriting aspects to pr (*)
  492f896... ada: Cleanup reporting locations for Ada 2022 and GNAT exte (*)
  1d992c4... ada: Fix alphabetic ordering of aspect identifiers (*)
  61751ee... ada: Fix ordering of code for pragma Preelaborable_Initiali (*)
  3549a58... ada: Fix casing in error messages (*)
  fd3a9ee... ada: Fix docs and comments about pragmas for Boolean-valued (*)
  e656656... diagnostics: use unicode art for interprocedural depth (*)
  0b7ebe5... diagnostics: add warning emoji to events with VERB_danger (*)
  3cd2674... diagnostics: simplify output of purely intraprocedural exec (*)
  a7be993... diagnostics: handle SGR codes in line_label::m_display_widt (*)
  38dd4e2... RISC-V: Add Zvfbfwma extension to the -march= option (*)
  090714e... Set d.one_operand_p to true when TARGET_SSSE3 in ix86_expan (*)
  0cc0956... Optimize ashift >> 7 to vpcmpgtb for vector int8. (*)
  25456c0... Daily bump. (*)
  d7e6fe0... Add missing hunk in recent change. (*)
  1779e22... analyzer: fix ICE seen with -fsanitize=undefined [PR114899] (*)
  1fbbae1... [v2,2/2] RISC-V: strcmp expansion: Use adjust_address() for (*)
  4bf1aa1... [v2,1/2] RISC-V: Add cmpmemsi expansion (*)
  1a05332... c++: ICE with reference NSDMI [PR114854] (*)
  0b3eac4... c++: DR 569, DR 1693: fun with semicolons [PR113760] (*)
  6ad7ca1... c++: Optimize in maybe_clone_body aliases even when not at_ (*)
  0b93a0a... combine: Fix up simplify_compare_const [PR115092] (*)
  7fdbefc... openmp: Diagnose using grainsize+num_tasks clauses together (*)
  99b1daa... tree-optimization/114589 - 

[gcc(refs/users/aoliva/heads/testme)] [testsuite] xfail pr79004 on longdouble64; drop long_double_64bit

2024-05-17 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:7c08855190502bca6a1e59577ffe304677f126ed

commit 7c08855190502bca6a1e59577ffe304677f126ed
Author: Alexandre Oliva 
Date:   Fri May 17 06:40:10 2024 -0300

[testsuite] xfail pr79004 on longdouble64; drop long_double_64bit

Diff:
---
 gcc/testsuite/gcc.target/powerpc/pr79004.c | 14 +-
 gcc/testsuite/lib/target-supports.exp  | 43 --
 2 files changed, 8 insertions(+), 49 deletions(-)

diff --git a/gcc/testsuite/gcc.target/powerpc/pr79004.c 
b/gcc/testsuite/gcc.target/powerpc/pr79004.c
index caf1f6c1eefe..2cb8bf4bc14b 100644
--- a/gcc/testsuite/gcc.target/powerpc/pr79004.c
+++ b/gcc/testsuite/gcc.target/powerpc/pr79004.c
@@ -100,10 +100,12 @@ void to_uns_short_store_n (TYPE a, unsigned short *p, 
long n) { p[n] = (unsigned
 void to_uns_int_store_n (TYPE a, unsigned int *p, long n) { p[n] = (unsigned 
int)a; }
 void to_uns_long_store_n (TYPE a, unsigned long *p, long n) { p[n] = (unsigned 
long)a; }
 
-/* { dg-final { scan-assembler-not {\mbl __}   } } */
-/* { dg-final { scan-assembler {\mxscvdpqp\M}  } } */
-/* { dg-final { scan-assembler {\mxscvqpdp\M}  } } */
-/* { dg-final { scan-assembler {\mxscvqpdpo\M} } } */
+/* On targets with 64-bit long double, some opcodes to deal with __float128 are
+   disabled, see PR target/105359.  */
+/* { dg-final { scan-assembler-not {\mbl __}   { xfail longdouble64 } } } 
*/
+/* { dg-final { scan-assembler {\mxscvdpqp\M}  { xfail longdouble64 } } } 
*/
+/* { dg-final { scan-assembler {\mxscvqpdp\M}  { xfail longdouble64 } } } 
*/
+/* { dg-final { scan-assembler {\mxscvqpdpo\M} { xfail longdouble64 } } } 
*/
 /* { dg-final { scan-assembler {\mxscvqpsdz\M} } } */
 /* { dg-final { scan-assembler {\mxscvqpswz\M} } } */
 /* { dg-final { scan-assembler {\mxscvsdqp\M}  } } */
@@ -111,7 +113,7 @@ void to_uns_long_store_n (TYPE a, unsigned long *p, long n) 
{ p[n] = (unsigned l
 /* { dg-final { scan-assembler {\mlxsd\M}  } } */
 /* { dg-final { scan-assembler {\mlxsiwax\M}   } } */
 /* { dg-final { scan-assembler {\mlxsiwzx\M}   } } */
-/* { dg-final { scan-assembler {\mlxssp\M} } } */
+/* { dg-final { scan-assembler {\mlxssp\M} { xfail longdouble64 } } } 
*/
 /* { dg-final { scan-assembler {\mstxsd\M} } } */
 /* { dg-final { scan-assembler {\mstxsiwx\M}   } } */
-/* { dg-final { scan-assembler {\mstxssp\M}} } */
+/* { dg-final { scan-assembler {\mstxssp\M}{ xfail longdouble64 } } } 
*/
diff --git a/gcc/testsuite/lib/target-supports.exp 
b/gcc/testsuite/lib/target-supports.exp
index ec9baa4f32a3..dc7d4f2b5f39 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -2930,49 +2930,6 @@ proc add_options_for_long_double_ieee128 { flags } {
 return "$flags"
 }
 
-# Check if GCC and GLIBC supports explicitly specifying that the long double
-# format uses the IEEE 64-bit.  Under little endian PowerPC Linux, you need
-# GLIBC 2.32 or later to be able to use a different long double format for
-# running a program than the system default.
-
-proc check_effective_target_long_double_64bit { } {
-return [check_runtime_nocache long_double_64bit {
-   #include 
-   #include 
-   /* use volatile to prevent optimization.  */
-   volatile double a = 3.0;
-   volatile long double one = 1.0L;
-   volatile long double two = 2.0L;
-   volatile long double b;
-   char buffer[20];
-   int main()
-   {
- double a2;
- long double b2;
- if (sizeof (long double) != 8)
-   return 1;
- b = one + two;
- /* eliminate removing volatile cast warning.  */
- a2 = a;
- b2 = b;
- if (memcmp (, , 16) != 0)
-   return 1;
- sprintf (buffer, "%lg", b);
- return strcmp (buffer, "3") != 0;
-   }
-}  [add_options_for_ppc_long_double_override_64bit ""]]
-}
-
-# Return the appropriate options to specify that long double uses the IEEE
-# 64-bit format on PowerPC.
-
-proc add_options_for_long_double_64bit { flags } {
-if { [istarget powerpc*-*-*] } {
-   return "$flags -mlong-double-64"
-}
-return "$flags"
-}
-
 # Return 1 if the target supports executing VSX instructions, 0
 # otherwise.  Cache the result.


[gcc(refs/users/aoliva/heads/testme)] [testsuite] cope with rtems implicit -ftls-model=local-exec

2024-05-17 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:db37e042c4b3ab0fc594c207a4ebe34ed84350d7

commit db37e042c4b3ab0fc594c207a4ebe34ed84350d7
Author: Alexandre Oliva 
Date:   Fri May 17 02:02:08 2024 -0300

[testsuite] cope with rtems implicit -ftls-model=local-exec

gcc/config/rtems.h's OS_CC1_SPEC changes the -ftls-model default to
local-exec, which breaks some tests that compile with PIC and thus
expect dynamic TLS access models.

I assume the default overriding even with PIC is intended, so I'm
adjusting the testcases.

For those in gcc.dg/tls, I adjusted the ipa dump expectations, so that
they check for tls-local- only, which covers both -dynamic and -exec.

For those in g{cc,++}.target/aarch64/sve, I've added a -ftls-local
overrider, so that the expected opcodes for dynamic TLS are generated.


for  gcc/testsuite/ChangeLog

* gcc.dg/tls/vis-attr-hidden.c: Match tls-local- for both
-dynamic and -exec.  Note rtems's default.
* gcc.dg/tls/vis-flag-hidden.c: Likewise.
* gcc.dg/tls/vis-pragma-hidden.c: Likewise.
* gcc.target/aarch64/sve/tls_1.c: Override -ftls-model default
on rtems.
* gcc.target/aarch64/sve/tls_preserve_2.c: Likewise.
* gcc.target/aarch64/sve/tls_preserve_3.c: Likewise.
* g++.target/aarch64/sve/tls_2.C: Likewise.

Diff:
---
 gcc/testsuite/g++.target/aarch64/sve/tls_2.C  | 1 +
 gcc/testsuite/gcc.dg/tls/vis-attr-hidden.c| 3 ++-
 gcc/testsuite/gcc.dg/tls/vis-flag-hidden.c| 3 ++-
 gcc/testsuite/gcc.dg/tls/vis-pragma-hidden.c  | 3 ++-
 gcc/testsuite/gcc.target/aarch64/sve/tls_1.c  | 1 +
 gcc/testsuite/gcc.target/aarch64/sve/tls_preserve_2.c | 1 +
 gcc/testsuite/gcc.target/aarch64/sve/tls_preserve_3.c | 1 +
 7 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/gcc/testsuite/g++.target/aarch64/sve/tls_2.C 
b/gcc/testsuite/g++.target/aarch64/sve/tls_2.C
index a1a2c85e5910..23004d9984d5 100644
--- a/gcc/testsuite/g++.target/aarch64/sve/tls_2.C
+++ b/gcc/testsuite/g++.target/aarch64/sve/tls_2.C
@@ -2,6 +2,7 @@
 /* { dg-require-effective-target tls } */
 /* { dg-options "-O2 -fPIC -msve-vector-bits=256" } */
 /* { dg-require-effective-target fpic } */
+/* { dg-additional-options "-ftls-model=global-dynamic" { target *-*-rtems* } 
} */
 
 #include 
 
diff --git a/gcc/testsuite/gcc.dg/tls/vis-attr-hidden.c 
b/gcc/testsuite/gcc.dg/tls/vis-attr-hidden.c
index 0d43fc565b09..007d382fa9a0 100644
--- a/gcc/testsuite/gcc.dg/tls/vis-attr-hidden.c
+++ b/gcc/testsuite/gcc.dg/tls/vis-attr-hidden.c
@@ -9,4 +9,5 @@ __thread int x;
 
 void reference() { x++; }
 
-/* { dg-final { scan-ipa-dump "Varpool flags: tls-local-dynamic" 
"whole-program" } } */
+/* rtems defaults to local-exec, others should get local-dynamic.  */
+/* { dg-final { scan-ipa-dump "Varpool flags: tls-local-" "whole-program" } } 
*/
diff --git a/gcc/testsuite/gcc.dg/tls/vis-flag-hidden.c 
b/gcc/testsuite/gcc.dg/tls/vis-flag-hidden.c
index a15df092d4d0..baf248dc3bab 100644
--- a/gcc/testsuite/gcc.dg/tls/vis-flag-hidden.c
+++ b/gcc/testsuite/gcc.dg/tls/vis-flag-hidden.c
@@ -9,4 +9,5 @@ __thread int x;
 
 void reference() { x++; }
 
-/* { dg-final { scan-ipa-dump "Varpool flags: tls-local-dynamic" 
"whole-program" } } */
+/* rtems defaults to local-exec, others should get local-dynamic.  */
+/* { dg-final { scan-ipa-dump "Varpool flags: tls-local-" "whole-program" } } 
*/
diff --git a/gcc/testsuite/gcc.dg/tls/vis-pragma-hidden.c 
b/gcc/testsuite/gcc.dg/tls/vis-pragma-hidden.c
index 1be97644243a..50cd010924cf 100644
--- a/gcc/testsuite/gcc.dg/tls/vis-pragma-hidden.c
+++ b/gcc/testsuite/gcc.dg/tls/vis-pragma-hidden.c
@@ -13,4 +13,5 @@ __thread int x;
 
 void reference() { x++; }
 
-/* { dg-final { scan-ipa-dump "Varpool flags: tls-local-dynamic" 
"whole-program" } } */
+/* rtems defaults to local-exec, others should get local-dynamic.  */
+/* { dg-final { scan-ipa-dump "Varpool flags: tls-local-" "whole-program" } } 
*/
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/tls_1.c 
b/gcc/testsuite/gcc.target/aarch64/sve/tls_1.c
index 43c52bc2b906..71f354dfe1b4 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/tls_1.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/tls_1.c
@@ -1,5 +1,6 @@
 /* { dg-options "-O2 -fPIC -msve-vector-bits=256" } */
 /* { dg-require-effective-target fpic } */
+/* { dg-additional-options "-ftls-model=global-dynamic" { target *-*-rtems* } 
} */
 
 typedef unsigned int v8si __attribute__((vector_size(32)));
 
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/tls_preserve_2.c 
b/gcc/testsuite/gcc.target/aarch64/sve/tls_preserve_2.c
index 20e939fbb85b..1f477ba8c259 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/tls_preserve_2.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/tls_preserve_2.c
@@ -2,6 +2,7 @@
 /* { dg-options "-O3 -fpic -msve-vector-bits=256 -fno-schedule-insns" } */
 /* { dg-require-effective-target fpic } */
 /* { 

[gcc/aoliva/heads/testme] (668 commits) [testsuite] xfail pr79004 on longdouble64; drop long_double

2024-05-17 Thread Alexandre Oliva via Gcc-cvs
The branch 'aoliva/heads/testme' was updated to point to:

 7c0885519050... [testsuite] xfail pr79004 on longdouble64; drop long_double

It previously pointed to:

 ec1d688d102c... adjust iteration count for ppc costmodel 76b

Diff:

!!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST):
---

  ec1d688... adjust iteration count for ppc costmodel 76b
  df13301... [testsuite] require sqrt_insn effective target where needed
  22b9a80... xfail fetestexcept test - ppc always uses fcmpu
  b40c8c9... ppc: testsuite: pr79004 needs -mlong-double-128
  1275905... ppc: testsuite: vec-mul requires vsx runtime
  4c42bea... make -freg-struct-return visibly a negative alias of -fpcc-
  7ef6054... add explicit ABI and align options to pr88233.c
  760577d... [testsuite] [powerpc] adjust -m32 counts for fold-vec-extra
  7d97712... decay vect tests from run to link for pr95401
  9cb06df... Request check for hw support in ppc run tests with -maltive
  5b0e0d4... disable ldist for test, to restore vectorizing-candidate lo
  6996207... [testsuite] [ppc64] expect error on vxworks too
  0cbe329... [testsuite] [arm] add effective target and options for pacb


Summary of changes (added commits):
---

  7c08855... [testsuite] xfail pr79004 on longdouble64; drop long_double
  db37e04... [testsuite] cope with rtems implicit -ftls-model=local-exec
  b7483de... make -freg-struct-return visibly a negative alias of -fpcc- (*)
  d477d68... RISC-V: Cleanup some temporally files [NFC] (*)
  0b2c333... Update gcc sv.po (*)
  556e777... RISC-V: Enable vectorizable early exit testsuite (*)
  6c1de78... RISC-V: Implement vectorizable early exit with vcond_mask_l (*)
  96d5325... Fix points_to_local_or_readonly_memory_p wrt TARGET_MEM_REF (*)
  f3e5f4c... tree-optimization/13962 - handle ptr-ptr compares in ptrs_c (*)
  a9251ab... wrong code with points-to and volatile (*)
  57f8a2f... Vect: Support loop len in vectorizable early exit (*)
  d4dee34... Vect: Support new IFN SAT_ADD for unsigned vector int (*)
  52b0536... Internal-fn: Support new IFN SAT_ADD for unsigned scalar in (*)
  da73261... Revert "Revert: "Enable prange support."" (*)
  b8e3574... Cleanup prange sanity checks. (*)
  f6bed6d... Use a boolean type when folding conditionals in simplify_us (*)
  b8b82bb... RISC-V: testsuite: Drop march-string in cmpmemsi/cpymemsi t (*)
  1e0ae1f... tree-optimization/79958 - make DSE track multiple paths (*)
  bff5328... ada: Remove obsolete reference in comment (*)
  f72988a... ada: Reset scope of top level object declaration during unn (*)
  584ade0... ada: Redundant validity checks (*)
  9ec20f1... ada: Exception on Indefinite_Vector aggregate with loop_par (*)
  568c795... ada: Implement new experimental attribute 'Super (*)
  33ae453... ada: Fix reference to RM clause in comment (*)
  5c9205a... ada: Fix missing length checks with case expressions (*)
  ea64884... ada: Fix standalone Windows builds of adaint.c (*)
  c3b570b... ada: Avoid checking parameters of protected procedures (*)
  c485a15... ada: Ignore ghost nodes in call graph information for dispa (*)
  a802cb3... ada: Fix reason code for length check (*)
  8e22376... ada: Propagate Program_Error from failed finalization of co (*)
  55d11e8... ada: Improve recovery from illegal occurrence of 'Old in if (*)
  f5c7870... ada: No need to follow New_Occurrence_Of with Set_Etype (*)
  7d2a5db... ada: Fix detection of if_expressions that are known on entr (*)
  fa832b4... ada: Fix comments about Get_Ranged_Checks (*)
  8560a06... ada: Minor performance improvement for dynamically-allocate (*)
  513f6b8... ada: Fixup one more pattern of broken scope information (*)
  bc35098... ada: Fix typo in CUDA error message (*)
  4806875... ada: Fix latent alignment issue for dynamically-allocated c (*)
  b98e256... ada: Fix resolving tagged operations in array aggregates (*)
  81a5815... ada: Fix bogus error on function returning noncontrolling r (*)
  7c487eb... ada: Fix casing of CUDA in error messages (*)
  f039057... ada: Fix crash with -gnatdJ and -gnatw_q (*)
  a58b6be... ada: Follow up fixes for Put_Image/streaming regressions (*)
  50a... ada: Implement per-finalization-collection spinlocks (*)
  91c6302... ada: Formal_Derived_Type'Size is not static (*)
  e730d52... ada: Fix bug in maintaining dimension info (*)
  8b73cb9... ada: Remove Aspect_Specifications field from N_Procedure_Sp (*)
  0607818... ada: Reuse existing expression when rewriting aspects to pr (*)
  492f896... ada: Cleanup reporting locations for Ada 2022 and GNAT exte (*)
  1d992c4... ada: Fix alphabetic ordering of aspect identifiers (*)
  61751ee... ada: Fix ordering of code for pragma Preelaborable_Initiali (*)
  3549a58... ada: Fix casing in error messages (*)
  fd3a9ee... ada: Fix docs and comments about pragmas for Boolean-valued (*)
  e656656... diagnostics: use unicode art for interprocedural depth (*)

[gcc r15-623] Add widening expansion of MULT_HIGHPART_EXPR for integral modes

2024-05-17 Thread Eric Botcazou via Gcc-cvs
https://gcc.gnu.org/g:f53f8a859631bef97adba1522a8049a8fce57c1b

commit r15-623-gf53f8a859631bef97adba1522a8049a8fce57c1b
Author: Eric Botcazou 
Date:   Wed May 8 10:07:56 2024 +0200

Add widening expansion of MULT_HIGHPART_EXPR for integral modes

For integral modes the expansion of MULT_HIGHPART_EXPR requires the presence
of an {s,u}mul_highpart optab whereas, for vector modes, widening expansion
is supported.  This adds a widening expansion for integral modes too, which
is in fact already implemented in expmed_mult_highpart_optab.

gcc/
* expmed.h (expmed_mult_highpart_optab): Declare.
* expmed.cc (expmed_mult_highpart_optab): Remove static keyword.
Do not assume that OP1 is a constant integer.  Fix pasto.
(expmed_mult_highpart): Pass OP1 narrowed to MODE in all the calls
to expmed_mult_highpart_optab.
* optabs-query.cc (can_mult_highpart_p): Use 2 for integer widening
and shift subsequent values accordingly.
* optabs.cc (expand_mult_highpart): Call expmed_mult_highpart_optab
when can_mult_highpart_p returns 2 and adjust to above change.

Diff:
---
 gcc/expmed.cc   | 54 +
 gcc/expmed.h|  2 ++
 gcc/optabs-query.cc | 24 
 gcc/optabs.cc   |  7 +--
 4 files changed, 52 insertions(+), 35 deletions(-)

diff --git a/gcc/expmed.cc b/gcc/expmed.cc
index 248940fe4147..50d22762cae0 100644
--- a/gcc/expmed.cc
+++ b/gcc/expmed.cc
@@ -2748,8 +2748,7 @@ static rtx expand_mult_const (machine_mode, rtx, 
HOST_WIDE_INT, rtx,
 static unsigned HOST_WIDE_INT invert_mod2n (unsigned HOST_WIDE_INT, int);
 static rtx extract_high_half (scalar_int_mode, rtx);
 static rtx expmed_mult_highpart (scalar_int_mode, rtx, rtx, rtx, int, int);
-static rtx expmed_mult_highpart_optab (scalar_int_mode, rtx, rtx, rtx,
-  int, int);
+
 /* Compute and return the best algorithm for multiplying by T.
The algorithm must cost less than cost_limit
If retval.cost >= COST_LIMIT, no algorithm was found and all
@@ -3856,30 +3855,25 @@ extract_high_half (scalar_int_mode mode, rtx op)
   return convert_modes (mode, wider_mode, op, 0);
 }
 
-/* Like expmed_mult_highpart, but only consider using a multiplication
-   optab.  OP1 is an rtx for the constant operand.  */
+/* Like expmed_mult_highpart, but only consider using multiplication optab.  */
 
-static rtx
+rtx
 expmed_mult_highpart_optab (scalar_int_mode mode, rtx op0, rtx op1,
rtx target, int unsignedp, int max_cost)
 {
-  rtx narrow_op1 = gen_int_mode (INTVAL (op1), mode);
+  const scalar_int_mode wider_mode = GET_MODE_WIDER_MODE (mode).require ();
+  const bool speed = optimize_insn_for_speed_p ();
+  const int size = GET_MODE_BITSIZE (mode);
   optab moptab;
   rtx tem;
-  int size;
-  bool speed = optimize_insn_for_speed_p ();
-
-  scalar_int_mode wider_mode = GET_MODE_WIDER_MODE (mode).require ();
-
-  size = GET_MODE_BITSIZE (mode);
 
   /* Firstly, try using a multiplication insn that only generates the needed
  high part of the product, and in the sign flavor of unsignedp.  */
   if (mul_highpart_cost (speed, mode) < max_cost)
 {
   moptab = unsignedp ? umul_highpart_optab : smul_highpart_optab;
-  tem = expand_binop (mode, moptab, op0, narrow_op1, target,
- unsignedp, OPTAB_DIRECT);
+  tem = expand_binop (mode, moptab, op0, op1, target, unsignedp,
+ OPTAB_DIRECT);
   if (tem)
return tem;
 }
@@ -3892,12 +3886,12 @@ expmed_mult_highpart_optab (scalar_int_mode mode, rtx 
op0, rtx op1,
  + 4 * add_cost (speed, mode) < max_cost))
 {
   moptab = unsignedp ? smul_highpart_optab : umul_highpart_optab;
-  tem = expand_binop (mode, moptab, op0, narrow_op1, target,
- unsignedp, OPTAB_DIRECT);
+  tem = expand_binop (mode, moptab, op0, op1, target, !unsignedp,
+ OPTAB_DIRECT);
   if (tem)
/* We used the wrong signedness.  Adjust the result.  */
-   return expand_mult_highpart_adjust (mode, tem, op0, narrow_op1,
-   tem, unsignedp);
+   return expand_mult_highpart_adjust (mode, tem, op0, op1, tem,
+   unsignedp);
 }
 
   /* Try widening multiplication.  */
@@ -3905,8 +3899,8 @@ expmed_mult_highpart_optab (scalar_int_mode mode, rtx 
op0, rtx op1,
   if (convert_optab_handler (moptab, wider_mode, mode) != CODE_FOR_nothing
   && mul_widen_cost (speed, wider_mode) < max_cost)
 {
-  tem = expand_binop (wider_mode, moptab, op0, narrow_op1, 0,
- unsignedp, OPTAB_WIDEN);
+  tem = expand_binop (wider_mode, moptab, op0, op1, NULL_RTX, unsignedp,
+ OPTAB_WIDEN);
   if (tem)
return 

[gcc r15-625] Small fix to implementation of -fdump-ada-spec

2024-05-17 Thread Eric Botcazou via Gcc-cvs
https://gcc.gnu.org/g:6a0a46c57999d1f805f6c604a8868ae588a104f2

commit r15-625-g6a0a46c57999d1f805f6c604a8868ae588a104f2
Author: Eric Botcazou 
Date:   Fri May 17 11:44:30 2024 +0200

Small fix to implementation of -fdump-ada-spec

gcc/c-family/
* c-ada-spec.cc (bitfield_used): Move around.
(packed_layout): Likewise.
(dump_ada_array_type): Do not put "aliased" for a packed layout.

Diff:
---
 gcc/c-family/c-ada-spec.cc | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/gcc/c-family/c-ada-spec.cc b/gcc/c-family/c-ada-spec.cc
index e56ef10f443a..46fee30b6b90 100644
--- a/gcc/c-family/c-ada-spec.cc
+++ b/gcc/c-family/c-ada-spec.cc
@@ -699,6 +699,8 @@ compare_comment (const void *lp, const void *rp)
 
 static tree *to_dump = NULL;
 static int to_dump_count = 0;
+static bool bitfield_used = false;
+static bool packed_layout = false;
 
 /* Collect a list of declarations from T relevant to SOURCE_FILE to be dumped
by a subsequent call to dump_ada_nodes.  */
@@ -1825,7 +1827,7 @@ dump_ada_array_type (pretty_printer *buffer, tree node, 
int spc)
 
   pp_string (buffer, " of ");
 
-  if (TREE_CODE (tmp) != POINTER_TYPE)
+  if (TREE_CODE (tmp) != POINTER_TYPE && !packed_layout)
pp_string (buffer, "aliased ");
 
   if (TYPE_NAME (tmp)
@@ -2083,9 +2085,6 @@ is_float128 (tree node)
 || id_equal (name, "_Float128x");
 }
 
-static bool bitfield_used = false;
-static bool packed_layout = false;
-
 /* Recursively dump in BUFFER Ada declarations corresponding to NODE of type
TYPE.  SPC is the indentation level.  LIMITED_ACCESS indicates whether NODE
can be referenced via a "limited with" clause.  NAME_ONLY indicates whether


[gcc r15-624] Remove spurious line

2024-05-17 Thread Eric Botcazou via Gcc-cvs
https://gcc.gnu.org/g:4da8be4f46b5dad4f5f610fc142538054446f44b

commit r15-624-g4da8be4f46b5dad4f5f610fc142538054446f44b
Author: Eric Botcazou 
Date:   Wed May 8 11:20:40 2024 +0200

Remove spurious line

Diff:
---
 gcc/ada/ChangeLog | 1 -
 1 file changed, 1 deletion(-)

diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 2095166460ec..f0ec83e56d39 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1139,7 +1139,6 @@
 2024-05-06  Eric Botcazou  
 
* fe.h: Remove unused declarations and add 'extern' to others.
-   no-issue-check
 
 2024-05-06  Piotr Trojanek  


[gcc r15-622] Add missing check for const_pool in the escaped solutions

2024-05-17 Thread Richard Biener via Gcc-cvs
https://gcc.gnu.org/g:b420e0b920613c42f63252aa2478a8315dc37a13

commit r15-622-gb420e0b920613c42f63252aa2478a8315dc37a13
Author: Richard Biener 
Date:   Fri May 17 09:31:52 2024 +0200

Add missing check for const_pool in the escaped solutions

The ptr-vs-ptr compare folding using points-to info was missing a
check for const_pool being included in the escaped solution.  The
following fixes that, fixing the observed execute FAIL of
experimental/functional/searchers.cc

* tree-ssa-alias.h (pt_solution_includes_const_pool): Declare.
* tree-ssa-alias.cc (ptrs_compare_unequal): Use
pt_solution_includes_const_pool.
* tree-ssa-structalias.cc (pt_solution_includes_const_pool): New.

* gcc.dg/torture/20240517-1.c: New testcase.

Diff:
---
 gcc/testsuite/gcc.dg/torture/20240517-1.c | 26 ++
 gcc/tree-ssa-alias.cc |  3 ++-
 gcc/tree-ssa-alias.h  |  1 +
 gcc/tree-ssa-structalias.cc   | 11 +++
 4 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/gcc/testsuite/gcc.dg/torture/20240517-1.c 
b/gcc/testsuite/gcc.dg/torture/20240517-1.c
new file mode 100644
index ..ab83d3ca6fba
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/20240517-1.c
@@ -0,0 +1,26 @@
+/* { dg-do run } */
+/* { dg-additional-options "-fmerge-all-constants" } */
+
+char *p;
+
+char * __attribute__((noipa))
+foo () { return p+1; }
+
+volatile int z;
+
+int main()
+{
+  /* ESCAPED = CONST_POOL */
+  p = "Hello";
+  /* PT = ESCAPED */
+  char *x = foo ();
+  char *y;
+  /* y PT = CONST_POOL */
+  if (z)
+y = "Baz";
+  else
+y = "Hello" + 1;
+  if (y != x)
+__builtin_abort ();
+  return 0;
+}
diff --git a/gcc/tree-ssa-alias.cc b/gcc/tree-ssa-alias.cc
index 6d31fc836917..9f5f69bcfad2 100644
--- a/gcc/tree-ssa-alias.cc
+++ b/gcc/tree-ssa-alias.cc
@@ -501,7 +501,8 @@ ptrs_compare_unequal (tree ptr1, tree ptr2)
  || pi2->pt.vars_contains_interposable)
return false;
  if ((!pi1->pt.null || !pi2->pt.null)
- && (!pi1->pt.const_pool || !pi2->pt.const_pool))
+ && (!pt_solution_includes_const_pool (>pt)
+ || !pt_solution_includes_const_pool (>pt)))
return !pt_solutions_intersect (>pt, >pt);
}
 }
diff --git a/gcc/tree-ssa-alias.h b/gcc/tree-ssa-alias.h
index e29dff583750..5cd64e722955 100644
--- a/gcc/tree-ssa-alias.h
+++ b/gcc/tree-ssa-alias.h
@@ -178,6 +178,7 @@ extern bool pt_solution_empty_p (const pt_solution *);
 extern bool pt_solution_singleton_or_null_p (struct pt_solution *, unsigned *);
 extern bool pt_solution_includes_global (struct pt_solution *, bool);
 extern bool pt_solution_includes (struct pt_solution *, const_tree);
+extern bool pt_solution_includes_const_pool (struct pt_solution *);
 extern bool pt_solutions_intersect (struct pt_solution *, struct pt_solution 
*);
 extern void pt_solution_reset (struct pt_solution *);
 extern void pt_solution_set (struct pt_solution *, bitmap, bool);
diff --git a/gcc/tree-ssa-structalias.cc b/gcc/tree-ssa-structalias.cc
index 0c6085b17662..61fb3610a172 100644
--- a/gcc/tree-ssa-structalias.cc
+++ b/gcc/tree-ssa-structalias.cc
@@ -7080,6 +7080,17 @@ pt_solution_includes (struct pt_solution *pt, const_tree 
decl)
   return res;
 }
 
+/* Return true if the points-to solution *PT contains a reference to a
+   constant pool entry.  */
+
+bool
+pt_solution_includes_const_pool (struct pt_solution *pt)
+{
+  return (pt->const_pool
+ || (pt->escaped && (!cfun || cfun->gimple_df->escaped.const_pool))
+ || (pt->ipa_escaped && ipa_escaped_pt.const_pool));
+}
+
 /* Return true if both points-to solutions PT1 and PT2 have a non-empty
intersection.  */


[gcc r15-619] ada: Start the initialization of the tasking runtime earlier

2024-05-17 Thread Marc Poulhi?s via Gcc-cvs
https://gcc.gnu.org/g:fc477a3f361dd5e72512e4ad42ef204af7c4c3e5

commit r15-619-gfc477a3f361dd5e72512e4ad42ef204af7c4c3e5
Author: Eric Botcazou 
Date:   Fri Mar 15 16:46:16 2024 +0100

ada: Start the initialization of the tasking runtime earlier

This installs the tasking versions of the RTS_Lock manipulation routines
very early, before the elaboration of all the Ada units of the program,
including those of the runtime, because this elaboration may require the
initialization of RTS_Lock objects.

gcc/ada/

* bindgen.adb (Gen_Adainit): Generate declaration and call to the
imported procedure __gnat_tasking_runtime_initialize if need be.
* libgnat/s-soflin.ads (Locking Soft-Links): Add commentary.
* libgnarl/s-tasini.adb (Tasking_Runtime_Initialize): New procedure
exported as __gnat_tasking_runtime_initialize.  Initialize RTS_Lock
manipulation routines here instead of...
(Init_RTS): ...here.

Diff:
---
 gcc/ada/bindgen.adb   | 18 --
 gcc/ada/libgnarl/s-tasini.adb | 30 +-
 gcc/ada/libgnat/s-soflin.ads  |  4 +++-
 3 files changed, 40 insertions(+), 12 deletions(-)

diff --git a/gcc/ada/bindgen.adb b/gcc/ada/bindgen.adb
index fc834e3a9b6b..f15f96495df2 100644
--- a/gcc/ada/bindgen.adb
+++ b/gcc/ada/bindgen.adb
@@ -819,8 +819,7 @@ package body Bindgen is
 WBI ("  pragma Import (C, XDR_Stream, ""__gl_xdr_stream"");");
  end if;
 
- --  Import entry point for elaboration time signal handler
- --  installation, and indication of if it's been called previously.
+ --  Import entry point for initialization of the runtime
 
  WBI ("");
  WBI ("  procedure Runtime_Initialize " &
@@ -828,6 +827,15 @@ package body Bindgen is
  WBI ("  pragma Import (C, Runtime_Initialize, " &
   """__gnat_runtime_initialize"");");
 
+ --  Import entry point for initialization of the tasking runtime
+
+ if With_GNARL then
+WBI ("");
+WBI ("  procedure Tasking_Runtime_Initialize;");
+WBI ("  pragma Import (C, Tasking_Runtime_Initialize, " &
+ """__gnat_tasking_runtime_initialize"");");
+ end if;
+
  --  Import handlers attach procedure for sequential elaboration policy
 
  if System_Interrupts_Used
@@ -1090,6 +1098,12 @@ package body Bindgen is
  --  Generate call to Runtime_Initialize
 
  WBI ("  Runtime_Initialize (1);");
+
+ --  Generate call to Tasking_Runtime_Initialize
+
+ if With_GNARL then
+WBI ("  Tasking_Runtime_Initialize;");
+ end if;
   end if;
 
   --  Generate call to set Initialize_Scalar values if active
diff --git a/gcc/ada/libgnarl/s-tasini.adb b/gcc/ada/libgnarl/s-tasini.adb
index 22294145bed7..794183f5356a 100644
--- a/gcc/ada/libgnarl/s-tasini.adb
+++ b/gcc/ada/libgnarl/s-tasini.adb
@@ -102,10 +102,6 @@ package body System.Tasking.Initialization is
procedure Release_RTS_Lock (Addr : Address);
--  Release the RTS lock at Addr
 
-   
-   --  Local Subprograms --
-   
-

-- Tasking Initialization --

@@ -116,6 +112,15 @@ package body System.Tasking.Initialization is
--  of initializing global locks, and installing tasking versions of certain
--  operations used by the compiler. Init_RTS is called during elaboration.
 
+   procedure Tasking_Runtime_Initialize;
+   pragma Export (Ada, Tasking_Runtime_Initialize,
+  "__gnat_tasking_runtime_initialize");
+   --  This procedure starts the initialization of the GNARL. It installs the
+   --  tasking versions of the RTS_Lock manipulation routines. It is called
+   --  very early before the elaboration of all the Ada units of the program,
+   --  including those of the runtime, because this elaboration may require
+   --  the initialization of RTS_Lock objects.
+
--
-- Change_Base_Priority --
--
@@ -414,11 +419,6 @@ package body System.Tasking.Initialization is
   SSL.Task_Name  := Task_Name'Access;
   SSL.Get_Current_Excep  := Get_Current_Excep'Access;
 
-  SSL.Initialize_RTS_Lock := Initialize_RTS_Lock'Access;
-  SSL.Finalize_RTS_Lock   := Finalize_RTS_Lock'Access;
-  SSL.Acquire_RTS_Lock:= Acquire_RTS_Lock'Access;
-  SSL.Release_RTS_Lock:= Release_RTS_Lock'Access;
-
   --  Initialize the tasking soft links (if not done yet) that are common
   --  to the full and the restricted run times.
 
@@ -430,6 +430,18 @@ package body System.Tasking.Initialization is
   Undefer_Abort (Environment_Task);
end Init_RTS;
 
+   
+   -- Tasking_Runtime_Initialize --
+   

[gcc r15-605] ada: Couple of adjustments coming from aliasing considerations

2024-05-17 Thread Marc Poulhi?s via Gcc-cvs
https://gcc.gnu.org/g:485d595d22c7800eb214034c9b58211ab232dbbf

commit r15-605-g485d595d22c7800eb214034c9b58211ab232dbbf
Author: Eric Botcazou 
Date:   Sun Mar 10 15:51:21 2024 +0100

ada: Couple of adjustments coming from aliasing considerations

The first adjustment is to the expansion of implementation types for array
types with peculiar index types, for which the aliased property set on the
component of the original type must be copied; the implicit base type also
needs to be properly marked if the implementation type is constrained.

The second adjustment is to selected types in the runtime, which need to
be marked with pragma Universal_Aliasing because of their special usage.

gcc/ada/

* exp_pakd.adb (Create_Packed_Array_Impl_Type): For non-bit-packed
array types, propagate the aliased property of the component.
(Install_PAT): Set fields on the implicit base type of an array.
* libgnat/a-stream.ads (private part): Add pragma Universal_Aliasing
for Stream_Element.
* libgnat/g-alleve.ads: Add pragma Universal_Aliasing for all the
vector types.
* libgnat/g-alleve__hard.ads: Likewise.

Diff:
---
 gcc/ada/exp_pakd.adb   | 12 +++--
 gcc/ada/libgnat/a-stream.ads   |  3 +++
 gcc/ada/libgnat/g-alleve.ads   | 54 +-
 gcc/ada/libgnat/g-alleve__hard.ads | 11 
 4 files changed, 71 insertions(+), 9 deletions(-)

diff --git a/gcc/ada/exp_pakd.adb b/gcc/ada/exp_pakd.adb
index 3f26c3527fa4..59dfe5df8df4 100644
--- a/gcc/ada/exp_pakd.adb
+++ b/gcc/ada/exp_pakd.adb
@@ -598,6 +598,14 @@ package body Exp_Pakd is
  Set_Associated_Node_For_Itype (PAT, Typ);
  Set_Original_Array_Type   (PAT, Typ);
 
+ --  In the case of a constrained array type, also set fields on the
+ --  implicit base type built during the analysis of its declaration.
+
+ if Ekind (PAT) = E_Array_Subtype then
+Set_Is_Packed_Array_Impl_Type (Etype (PAT), True);
+Set_Original_Array_Type   (Etype (PAT), Base_Type (Typ));
+ end if;
+
  --  Propagate representation aspects
 
  Set_Is_Atomic   (PAT, Is_Atomic(Typ));
@@ -818,7 +826,7 @@ package body Exp_Pakd is
Subtype_Marks => Indexes,
Component_Definition =>
  Make_Component_Definition (Loc,
-   Aliased_Present=> False,
+   Aliased_Present=> Has_Aliased_Components (Typ),
Subtype_Indication =>
   New_Occurrence_Of (Ctyp, Loc)));
 
@@ -828,7 +836,7 @@ package body Exp_Pakd is
 Discrete_Subtype_Definitions => Indexes,
 Component_Definition =>
   Make_Component_Definition (Loc,
-Aliased_Present=> False,
+Aliased_Present=> Has_Aliased_Components (Typ),
 Subtype_Indication =>
   New_Occurrence_Of (Ctyp, Loc)));
 end if;
diff --git a/gcc/ada/libgnat/a-stream.ads b/gcc/ada/libgnat/a-stream.ads
index 0a0cabce3f2b..dcb5a9aa81ce 100644
--- a/gcc/ada/libgnat/a-stream.ads
+++ b/gcc/ada/libgnat/a-stream.ads
@@ -84,4 +84,7 @@ private
for Stream_Element_Array'Read use Read_SEA;
for Stream_Element_Array'Write use Write_SEA;
 
+   pragma Universal_Aliasing (Stream_Element);
+   --  This type is used to stream any other type
+
 end Ada.Streams;
diff --git a/gcc/ada/libgnat/g-alleve.ads b/gcc/ada/libgnat/g-alleve.ads
index 0f3ec36d0f1b..4e22a3e63876 100644
--- a/gcc/ada/libgnat/g-alleve.ads
+++ b/gcc/ada/libgnat/g-alleve.ads
@@ -313,22 +313,62 @@ private
---
 
--  We simply use the natural array definitions corresponding to each
-   --  user-level vector type.
+   --  user-level vector type. We need to put pragma Universal_Aliasing
+   --  on these types because the common operations are implemented by
+   --  means of Unchecked_Conversion betwwen different representations.
 
-   type LL_VUI is new VUI_View;
-   type LL_VSI is new VSI_View;
-   type LL_VBI is new VBI_View;
+   --
+   -- char Core Components --
+   --
+
+   type LL_VUC is new VUC_View;
+   pragma Universal_Aliasing (LL_VUC);
+
+   type LL_VSC is new VSC_View;
+   pragma Universal_Aliasing (LL_VSC);
+
+   type LL_VBC is new VBC_View;
+   pragma Universal_Aliasing (LL_VBC);
+
+   ---
+   -- short Core Components --
+   ---
 
type LL_VUS is new VUS_View;
+   pragma Universal_Aliasing (LL_VUS);
+
type LL_VSS is new VSS_View;
+   pragma Universal_Aliasing (LL_VSS);
+
type LL_VBS is new VBS_View;
+   pragma Universal_Aliasing (LL_VBS);
 
-   type LL_VUC is 

[gcc r15-595] ada: Simplify code for private types with unknown discriminants

2024-05-17 Thread Marc Poulhi?s via Gcc-cvs
https://gcc.gnu.org/g:8e4069566e5ce4f2d936635187fd90c300e475e9

commit r15-595-g8e4069566e5ce4f2d936635187fd90c300e475e9
Author: Piotr Trojanek 
Date:   Tue Mar 5 13:06:18 2024 +0100

ada: Simplify code for private types with unknown discriminants

Private type entities have Is_Constrained set when they have no
discriminants and no unknown discriminants; it is now set slightly
later, but simpler (this change could only affect Process_Discriminants,
but this flag should not be needed there).

Also, we now reuse this flag to detect private types with discriminants.

Code cleanup; behavior is unaffected.

gcc/ada/

* sem_ch7.adb (New_Private_Type): Simplify setting of
Is_Constrained flag.
* sem_prag.adb (Is_Unconstrained_Or_Tagged_Item): Simplify
detection of private types with no discriminant.

Diff:
---
 gcc/ada/sem_ch7.adb  | 7 +++
 gcc/ada/sem_prag.adb | 3 +--
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/gcc/ada/sem_ch7.adb b/gcc/ada/sem_ch7.adb
index 746462244529..a70d72c94c1e 100644
--- a/gcc/ada/sem_ch7.adb
+++ b/gcc/ada/sem_ch7.adb
@@ -2746,10 +2746,6 @@ package body Sem_Ch7 is
   Set_Is_First_Subtype (Id);
   Reinit_Size_Align (Id);
 
-  Set_Is_Constrained (Id,
-No (Discriminant_Specifications (N))
-  and then not Unknown_Discriminants_Present (N));
-
   --  Set tagged flag before processing discriminants, to catch illegal
   --  usage.
 
@@ -2765,6 +2761,9 @@ package body Sem_Ch7 is
 
   elsif Unknown_Discriminants_Present (N) then
  Set_Has_Unknown_Discriminants (Id);
+
+  else
+ Set_Is_Constrained (Id);
   end if;
 
   Set_Private_Dependents (Id, New_Elmt_List);
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index 0302cdb00ba5..e57f42d9a54d 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -32978,8 +32978,7 @@ package body Sem_Prag is
  return Has_Discriminants (Typ) and then not Is_Constrained (Typ);
 
   elsif Is_Private_Type (Typ) then
- return Has_Discriminants (Typ)
-   or else Has_Unknown_Discriminants (Typ);
+ return not Is_Constrained (Typ);
 
   else
  return False;


[gcc r15-594] ada: Allow private items with unknown discriminants as Depends inputs

2024-05-17 Thread Marc Poulhi?s via Gcc-cvs
https://gcc.gnu.org/g:4b5eeb74a20028e493b520887cc9fd97d6fc0f3d

commit r15-594-g4b5eeb74a20028e493b520887cc9fd97d6fc0f3d
Author: Piotr Trojanek 
Date:   Tue Mar 5 13:03:18 2024 +0100

ada: Allow private items with unknown discriminants as Depends inputs

Objects of private types with unknown discriminants are now allowed as
inputs in the Depends contracts.

gcc/ada/

* sem_prag.adb (Is_Unconstrained_Or_Tagged_Item): Allow objects
of private types with unknown discriminants.

Diff:
---
 gcc/ada/sem_prag.adb | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index 9dc22e3edc17..0302cdb00ba5 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -283,7 +283,8 @@ package body Sem_Prag is
function Is_Unconstrained_Or_Tagged_Item (Item : Entity_Id) return Boolean;
--  Subsidiary to Collect_Subprogram_Inputs_Outputs and the analysis of
--  pragma Depends. Determine whether the type of dependency item Item is
-   --  tagged, unconstrained array or unconstrained record.
+   --  tagged, unconstrained array, unconstrained private or unconstrained
+   --  record.
 
procedure Record_Possible_Body_Reference
  (State_Id : Entity_Id;
@@ -32977,7 +32978,8 @@ package body Sem_Prag is
  return Has_Discriminants (Typ) and then not Is_Constrained (Typ);
 
   elsif Is_Private_Type (Typ) then
- return Has_Discriminants (Typ);
+ return Has_Discriminants (Typ)
+   or else Has_Unknown_Discriminants (Typ);
 
   else
  return False;


[gcc r15-592] ada: Fix probable copy/paste error

2024-05-17 Thread Marc Poulhi?s via Gcc-cvs
https://gcc.gnu.org/g:7dbd854509277059581e94167bbadf9d71cda0dc

commit r15-592-g7dbd854509277059581e94167bbadf9d71cda0dc
Author: Marc Poulhiès 
Date:   Fri Mar 1 15:30:55 2024 +0100

ada: Fix probable copy/paste error

gcc/ada/

* doc/gnat_rm/implementation_defined_attributes.rst: Fix
copy/paste.
* gnat_rm.texi: Regenerate.
* gnat_ugn.texi: Regenerate.

Diff:
---
 gcc/ada/doc/gnat_rm/implementation_defined_attributes.rst | 7 +++
 gcc/ada/gnat_rm.texi  | 7 +++
 gcc/ada/gnat_ugn.texi | 4 ++--
 3 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/gcc/ada/doc/gnat_rm/implementation_defined_attributes.rst 
b/gcc/ada/doc/gnat_rm/implementation_defined_attributes.rst
index f8700b1be4e3..728d63a8e924 100644
--- a/gcc/ada/doc/gnat_rm/implementation_defined_attributes.rst
+++ b/gcc/ada/doc/gnat_rm/implementation_defined_attributes.rst
@@ -81,10 +81,9 @@ Attribute Atomic_Always_Lock_Free
 =
 .. index:: Atomic_Always_Lock_Free
 
-The prefix of the ``Atomic_Always_Lock_Free`` attribute is a type.
-The result is a Boolean value which is True if the type has discriminants,
-and False otherwise.  The result indicate whether atomic operations are
-supported by the target for the given type.
+The prefix of the ``Atomic_Always_Lock_Free`` attribute is a type. The
+result indicates whether atomic operations are supported by the target
+for the given type.
 
 Attribute Bit
 =
diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi
index 6da3f3131d54..8dcdd6ca14c9 100644
--- a/gcc/ada/gnat_rm.texi
+++ b/gcc/ada/gnat_rm.texi
@@ -10373,10 +10373,9 @@ either be omitted, or explicitly given as 
@code{No_Output_Operands}.
 
 @geindex Atomic_Always_Lock_Free
 
-The prefix of the @code{Atomic_Always_Lock_Free} attribute is a type.
-The result is a Boolean value which is True if the type has discriminants,
-and False otherwise.  The result indicate whether atomic operations are
-supported by the target for the given type.
+The prefix of the @code{Atomic_Always_Lock_Free} attribute is a type. The
+result indicates whether atomic operations are supported by the target
+for the given type.
 
 @node Attribute Bit,Attribute Bit_Position,Attribute 
Atomic_Always_Lock_Free,Implementation Defined Attributes
 @anchor{gnat_rm/implementation_defined_attributes attribute-bit}@anchor{178}
diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi
index 997086c67bdb..7bad8b4e161b 100644
--- a/gcc/ada/gnat_ugn.texi
+++ b/gcc/ada/gnat_ugn.texi
@@ -19,7 +19,7 @@
 
 @copying
 @quotation
-GNAT User's Guide for Native Platforms , Apr 15, 2024
+GNAT User's Guide for Native Platforms , Apr 16, 2024
 
 AdaCore
 
@@ -29580,8 +29580,8 @@ to permit their use in free software.
 
 @printindex ge
 
-@anchor{gnat_ugn/gnat_utility_programs switches-related-to-project-files}@w{   
   }
 @anchor{d1}@w{  }
+@anchor{gnat_ugn/gnat_utility_programs switches-related-to-project-files}@w{   
   }
 
 @c %**end of body
 @bye


[gcc r15-620] ada: Remove outdated workaround in aggregate expansion

2024-05-17 Thread Marc Poulhi?s via Gcc-cvs
https://gcc.gnu.org/g:167462f1977e7ed52a0d0aec8508b45bfe78c54b

commit r15-620-g167462f1977e7ed52a0d0aec8508b45bfe78c54b
Author: Ronan Desplanques 
Date:   Mon Mar 18 09:58:00 2024 +0100

ada: Remove outdated workaround in aggregate expansion

Before this patch, the compiler refrained from rewriting aggregates
into purely positional form in some cases of one-component aggregates.
As explained in comments, this was because the back end could not
handle positional aggregates in those situations.

As the back end seems to have grown more capable, this patch removes
the workaround. It also extends the comments describing a warning that
is emitted in the same configuration with aggregates.

gcc/ada/

* exp_aggr.adb (Aggr_Size_OK): Remove workaround and extend
comment.

Diff:
---
 gcc/ada/exp_aggr.adb | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb
index 9c5944a917d0..892f47ceb050 100644
--- a/gcc/ada/exp_aggr.adb
+++ b/gcc/ada/exp_aggr.adb
@@ -711,9 +711,10 @@ package body Exp_Aggr is
 return True;
  end if;
 
- --  One-component aggregates are suspicious, and if the context type
- --  is an object declaration with nonstatic bounds it will trip gcc;
- --  such an aggregate must be expanded into a single assignment.
+ --  One-component named aggregates where the index constraint is not
+ --  known at compile time are suspicious as the user might have
+ --  intended to write a subtype name but wrote the name of an object
+ --  instead. We emit a warning if we're in such a case.
 
  if Hiv = Lov and then Nkind (Parent (N)) = N_Object_Declaration then
 declare
@@ -741,8 +742,6 @@ package body Exp_Aggr is
 Error_Msg_N ("\maybe subtype name was meant??", Indx);
  end if;
   end if;
-
-  return False;
end if;
 end;
  end if;


[gcc r15-621] ada: Improve deriving initial sizes for container aggregates

2024-05-17 Thread Marc Poulhi?s via Gcc-cvs
https://gcc.gnu.org/g:9bd0b709ddb70589436c326142b1566f49f5e979

commit r15-621-g9bd0b709ddb70589436c326142b1566f49f5e979
Author: Viljar Indus 
Date:   Wed Mar 13 11:24:59 2024 +0200

ada: Improve deriving initial sizes for container aggregates

Deriving the initial size of container aggregates is necessary
for deriving the correct capacity for bounded containers.

Add support for deriving the correct initial size
when the container aggregate is iterating over an array
object.

gcc/ada/

* exp_aggr.adb (Expand_Container_Aggregate):
Derive the size for iterable aggregates in the case of
one-dimensional array objects.

Diff:
---
 gcc/ada/exp_aggr.adb | 83 ++--
 1 file changed, 55 insertions(+), 28 deletions(-)

diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb
index 892f47ceb050..2476675604cc 100644
--- a/gcc/ada/exp_aggr.adb
+++ b/gcc/ada/exp_aggr.adb
@@ -6693,9 +6693,9 @@ package body Exp_Aggr is
 
 --  If one or more of the associations is one of the iterated
 --  forms, and is either an association with nonstatic bounds
---  or is an iterator over an iterable object, then treat the
---  whole container aggregate as having a nonstatic number of
---  elements.
+--  or is an iterator over an iterable object where the size
+--  cannot be derived, then treat the whole container aggregate as
+--  having a nonstatic number of elements.
 
 declare
Has_Nonstatic_Length : Boolean := False;
@@ -6725,37 +6725,43 @@ package body Exp_Aggr is
 Comp := First (Component_Associations (N));
 
 while Present (Comp) loop
-   Choice := First (Choice_List (Comp));
+   if Present (Choice_List (Comp)) then
+  Choice := First (Choice_List (Comp));
 
-   while Present (Choice) loop
-  Analyze (Choice);
+  while Present (Choice) loop
+ Analyze (Choice);
 
-  if Nkind (Choice) = N_Range then
- Lo := Low_Bound (Choice);
- Hi := High_Bound (Choice);
- Add_Range_Size;
+ if Nkind (Choice) = N_Range then
+Lo := Low_Bound (Choice);
+Hi := High_Bound (Choice);
+Add_Range_Size;
 
-  elsif Is_Entity_Name (Choice)
-and then Is_Type (Entity (Choice))
-  then
- Lo := Type_Low_Bound (Entity (Choice));
- Hi := Type_High_Bound (Entity (Choice));
- Add_Range_Size;
+ elsif Is_Entity_Name (Choice)
+   and then Is_Type (Entity (Choice))
+ then
+Lo := Type_Low_Bound (Entity (Choice));
+Hi := Type_High_Bound (Entity (Choice));
+Add_Range_Size;
 
- Rewrite (Choice,
-   Make_Range (Loc,
- New_Copy_Tree (Lo),
- New_Copy_Tree (Hi)));
+Rewrite (Choice,
+  Make_Range (Loc,
+New_Copy_Tree (Lo),
+New_Copy_Tree (Hi)));
 
-  else
- --  Single choice (syntax excludes a subtype
- --  indication).
+ else
+--  Single choice (syntax excludes a subtype
+--  indication).
 
- Siz := Siz + 1;
-  end if;
+Siz := Siz + 1;
+ end if;
 
-  Next (Choice);
-   end loop;
+ Next (Choice);
+  end loop;
+
+   elsif Nkind (Comp) = N_Iterated_Component_Association then
+
+  Siz := Siz + Build_Siz_Exp (Comp);
+   end if;
Next (Comp);
 end loop;
  end if;
@@ -6770,6 +6776,7 @@ package body Exp_Aggr is
   function Build_Siz_Exp (Comp : Node_Id) return Int is
  Lo, Hi   : Node_Id;
  Temp_Siz_Exp : Node_Id;
+ It   : Node_Id;
 
   begin
  if Nkind (Comp) = N_Range then
@@ -6835,8 +6842,28 @@ package body Exp_Aggr is
 end if;
 
  elsif Nkind (Comp) = N_Iterated_Component_Association then
-return Build_Siz_Exp (First (Discrete_Choices (Comp)));
+if Present (Iterator_Specification (Comp)) then
+
+   --  If the static size of the iterable object is known,
+   --  attempt to return it.
+
+   It := Name (Iterator_Specification (Comp));
+   

[gcc r15-588] ada: Small cleanup in aggregate expansion code

2024-05-17 Thread Marc Poulhi?s via Gcc-cvs
https://gcc.gnu.org/g:1da18c25593fceed40233cd2cd49409ea817372a

commit r15-588-g1da18c25593fceed40233cd2cd49409ea817372a
Author: Ronan Desplanques 
Date:   Fri Mar 1 10:31:12 2024 +0100

ada: Small cleanup in aggregate expansion code

This patch moves a statement outside of a loop because it didn't
need to be inside that loop. The behavior of the program is not
affected.

gcc/ada/

* exp_aggr.adb (Flatten): Small cleanup.

Diff:
---
 gcc/ada/exp_aggr.adb | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb
index 5d2b334722a2..cff04fc1b79c 100644
--- a/gcc/ada/exp_aggr.adb
+++ b/gcc/ada/exp_aggr.adb
@@ -4626,6 +4626,14 @@ package body Exp_Aggr is
 Component_Loop : while Present (Elmt) loop
Expr := Expression (Elmt);
 
+   --  If the expression involves a construct that generates a
+   --  loop, we must generate individual assignments and no
+   --  flattening is possible.
+
+   if Nkind (Expr) = N_Quantified_Expression then
+  return False;
+   end if;
+
--  In the case of a multidimensional array, check that the
--  aggregate can be recursively flattened.
 
@@ -4642,14 +4650,6 @@ package body Exp_Aggr is
   if Nkind (Choice) = N_Others_Choice then
  Rep_Count := 0;
 
- --  If the expression involves a construct that generates
- --  a loop, we must generate individual assignments and
- --  no flattening is possible.
-
- if Nkind (Expr) = N_Quantified_Expression then
-return False;
- end if;
-
  for J in Vals'Range loop
 if No (Vals (J)) then
Vals (J)  := New_Copy_Tree (Expr);


[gcc r15-618] ada: Improve test for unprocessed preprocessor directives

2024-05-17 Thread Marc Poulhi?s via Gcc-cvs
https://gcc.gnu.org/g:15b5a95d36a3c8cc35189aa951bdcdbf59ad4160

commit r15-618-g15b5a95d36a3c8cc35189aa951bdcdbf59ad4160
Author: Steve Baird 
Date:   Wed Mar 13 17:46:56 2024 -0700

ada: Improve test for unprocessed preprocessor directives

Preprocessor directives are case insensitive and may have spaces or tabs
between the '#' and the keyword. When checking for the error case of
unprocessed preprocessor directives, take these rules into account.

gcc/ada/

* scng.adb (scan): When checking for an unprocessed preprocessor
directive, take into account the preprocessor's rules about case
insensitivity and about white space between the '#' and the
keyword.

Diff:
---
 gcc/ada/scng.adb | 183 ---
 1 file changed, 122 insertions(+), 61 deletions(-)

diff --git a/gcc/ada/scng.adb b/gcc/ada/scng.adb
index 9b1d00e34521..8b2829ffbbfc 100644
--- a/gcc/ada/scng.adb
+++ b/gcc/ada/scng.adb
@@ -40,6 +40,7 @@ with Widechar; use Widechar;
 
 pragma Warnings (Off);
 --  This package is used also by gnatcoll
+with System.Case_Util;
 with System.CRC32;
 with System.UTF_32;  use System.UTF_32;
 with System.WCh_Con; use System.WCh_Con;
@@ -2250,86 +2251,146 @@ package body Scng is
 
  when Special_Preprocessor_Character =>
 
---  If Set_Special_Character has been called for this character,
---  set Scans.Special_Character and return a Special token.
+declare
+   function Matches_After_Skipping_White_Space
+ (S : String) return Boolean;
+
+   --  Return True iff after skipping past white space the
+   --  next Source characters match the given string.
+
+   
+   -- Matches_After_Skipping_White_Space --
+   
+
+   function Matches_After_Skipping_White_Space
+ (S : String) return Boolean
+   is
+  function To_Lower_Case_String (Buff : Text_Buffer)
+return String;
+  --  Convert a text buffer to a lower-case string.
+
+  --
+  -- To_Lower_Case_String --
+  --
+
+  function To_Lower_Case_String (Buff : Text_Buffer)
+return String
+  is
+ subtype One_Based is Text_Buffer (1 .. Buff'Length);
+ Result : String := String (One_Based (Buff));
+  begin
+ --  The System.Case_Util.To_Lower function (the overload
+ --  that takes a string parameter) cannot be called
+ --  here due to bootstrapping problems. That function
+ --  was added too recently.
+
+ System.Case_Util.To_Lower (Result);
+ return Result;
+  end To_Lower_Case_String;
+
+  pragma Assert (Source (Scan_Ptr) = '#');
+  Local_Scan_Ptr : Source_Ptr := Scan_Ptr + 1;
+
+   --  Start of processing for Matches_After_Skipping_White_Space
 
-if Special_Characters (Source (Scan_Ptr)) then
-   Token_Ptr := Scan_Ptr;
-   Token := Tok_Special;
-   Special_Character := Source (Scan_Ptr);
-   Scan_Ptr := Scan_Ptr + 1;
-   return;
+   begin
+  while Local_Scan_Ptr in Source'Range
+and then Source (Local_Scan_Ptr) in ' ' | HT
+  loop
+ Local_Scan_Ptr := Local_Scan_Ptr + 1;
+  end loop;
 
---  Check for something looking like a preprocessor directive
+  return Local_Scan_Ptr in Source'Range
+and then Local_Scan_Ptr + (S'Length - 1) in Source'Range
+and then S = To_Lower_Case_String (
+   Source (Local_Scan_Ptr ..
+   Local_Scan_Ptr + (S'Length - 1)));
+   end Matches_After_Skipping_White_Space;
 
-elsif Source (Scan_Ptr) = '#'
-  and then (Source (Scan_Ptr + 1 .. Scan_Ptr + 2) = "if"
-  or else
-Source (Scan_Ptr + 1 .. Scan_Ptr + 5) = "elsif"
-  or else
-Source (Scan_Ptr + 1 .. Scan_Ptr + 4) = "else"
-  or else
-Source (Scan_Ptr + 1 .. Scan_Ptr + 3) = "end")
-then
-   Error_Msg_S
- ("preprocessor directive ignored, preprocessor not active");
+begin
+   --  If Set_Special_Character has been called for this character,
+   --  set 

[gcc r15-617] ada: Restore dependency on System.OS_Interface in System.Task_Primitives

2024-05-17 Thread Marc Poulhi?s via Gcc-cvs
https://gcc.gnu.org/g:22928da141a8bbee9994fbae00c595877ed060ad

commit r15-617-g22928da141a8bbee9994fbae00c595877ed060ad
Author: Eric Botcazou 
Date:   Thu Mar 14 19:48:59 2024 +0100

ada: Restore dependency on System.OS_Interface in System.Task_Primitives

The dependency is relied upon by the binder to drag the tasking runtime.

gcc/ada/

* libgnarl/s-taspri__mingw.ads: Add clause for System.OS_Interface.
(Private_Data): Change type of Thread component.

Diff:
---
 gcc/ada/libgnarl/s-taspri__mingw.ads | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/ada/libgnarl/s-taspri__mingw.ads 
b/gcc/ada/libgnarl/s-taspri__mingw.ads
index a51f752d8056..6eae97d4af65 100644
--- a/gcc/ada/libgnarl/s-taspri__mingw.ads
+++ b/gcc/ada/libgnarl/s-taspri__mingw.ads
@@ -31,6 +31,7 @@
 
 --  This is a NT (native) version of this package
 
+with System.OS_Interface;
 with System.OS_Locks;
 with System.Win32;
 
@@ -87,7 +88,7 @@ private
end record;
 
type Private_Data is limited record
-  Thread : aliased Win32.HANDLE;
+  Thread : aliased System.OS_Interface.Thread_Id;
   pragma Atomic (Thread);
   --  Thread field may be updated by two different threads of control.
   --  (See, Enter_Task and Create_Task in s-taprop.adb).


[gcc r15-615] ada: Replace spinlocks with fully-fledged locks in finalization collections

2024-05-17 Thread Marc Poulhi?s via Gcc-cvs
https://gcc.gnu.org/g:c8e5d90c4a0b736c2c4c5be3e8a3e9744e602d9d

commit r15-615-gc8e5d90c4a0b736c2c4c5be3e8a3e9744e602d9d
Author: Eric Botcazou 
Date:   Tue Mar 5 23:30:51 2024 +0100

ada: Replace spinlocks with fully-fledged locks in finalization collections

This replaces spinlocks with fully-fledged locks in finalization collections
because the former are deemed problematic with tasks that can be preempted.

Because of the requirement to avoid dragging the tasking runtime when it is
not necessary, the implementation goes through the usual soft links, with an
additional hurdle that space must be reserved for the lock in any case since
it is part of the ABI.  This entails the introduction of the System.OS_Locks
unit in the non-tasking runtime and the modification of the tasking runtime
to also use this unit.

This in turn requires a small adjustment: because of the presence of pre-
and post-conditions in Interfaces.C and of the limitations of the RTSfind
mechanism, the System.Finalization_Primitives unit must be preloaded, as
what is done for the Ada.Strings.Text_Buffers unit.

This effectively reverts the implementation to using the global task lock on
bare board platforms.

gcc/ada/

* Makefile.rtl (GNATRTL_NONTASKING_OBJS): Add s-oslock$(objext).
(LIBGNAT_TARGET_PAIRS): Use s-oslock__dummy.ads by default.
Set specific s-oslock.ads source file for all the platforms.
* exp_ch7.ads (Preload_Finalization_Collection): New procedure.
* exp_ch7.adb (Allows_Finalization_Collection): Return False if
System.Finalization_Primitives has not been preloaded.
(Preload_Finalization_Collection): New procedure.
* opt.ads (Interface_Seen): New boolean variable.
* s-oscons-tmplt.c: Use "N" string for pragma Style_Checks.
* scng.adb (Scan): Set Interface_Seen upon seeing "interface".
* sem_ch10.adb: Add clause for Exp_Ch7.
(Analyze_Compilation_Unit): Call Preload_Finalization_Collection
after the context of the unit is analyzed.
* libgnarl/a-rttiev.adb: Add with clause for System.OS_Locks and
alphabetize others.
(Event_Queue_Lock): Adjust qualified name of subtype.
* libgnarl/s-osinte__aix.ads: Add with clause for System.OS_Locks
and change pthread_mutex_t into a local subtype.
* libgnarl/s-osinte__android.ads: Likewise.
* libgnarl/s-osinte__darwin.ads: Likewise.
* libgnarl/s-osinte__dragonfly.ads: Likewise.
* libgnarl/s-osinte__freebsd.ads: Likewise.
* libgnarl/s-osinte__gnu.ads: Likewise.
* libgnarl/s-osinte__hpux-dce.ads: Likewise.
* libgnarl/s-osinte__hpux.ads: Add Likewise.
* libgnarl/s-osinte__kfreebsd-gnu.ads: Likewise.
* libgnarl/s-osinte__linux.ads: Likewise.
* libgnarl/s-osinte__lynxos178e.ads: Likewise.
* libgnarl/s-osinte__qnx.ads: Likewise.
* libgnarl/s-osinte__rtems.ads: Likewise.
* libgnarl/s-osinte__mingw.ads: Add with clause for System.OS_Locks
and change CRITICAL_SECTION into a local subtype.  Add declarations
for imported procedures dealing with CRITICAL_SECTION.
* libgnarl/s-osinte__solaris.ads: Add with clause for 
System.OS_Locks
and change mutex_t into a local subtype.
* libgnarl/s-osinte__vxworks.ads: Add missing blank line.
* libgnarl/s-taprop.ads: Alphabetize clauses and package renamings.
Use qualified name for RTS_Lock throughout.
* libgnarl/s-taprop__dummy.adb: Add use clause for System.OS_Locks
and alphabetize others.
* libgnarl/s-taprop__hpux-dce.adb: Likewise.
* libgnarl/s-taprop__linux.adb: Likewise.
* libgnarl/s-taprop__posix.adb: Likewise.
* libgnarl/s-taprop__qnx.adb: Likewise.
* libgnarl/s-taprop__rtems.adb: Likewise.
* libgnarl/s-taprop__solaris.adb: Likewise.
* libgnarl/s-taprop__vxworks.adb: Likewise.
* libgnarl/s-taprop__mingw.adb: Likewise.  Remove declarations for
imported procedures dealing with CRITICAL_SECTION.
* libgnarl/s-tarest.adb: Add with clause for System.OS_Locks and
alphabetize others.
(Global_Task_Lock): Adjust qualified name of subtype.
* libgnarl/s-tasini.adb: Add clause for System.OS_Locks.
(Initialize_RTS_Lock): New procedure.
(Finalize_RTS_Lock): Likewise.
(Acquire_RTS_Lock): Likewise.
(Release_RTS_Lock): Likewise.
(Init_RTS): Add compile-time assertions for RTS_Lock types.
Set the soft links for the RTS lock manipulation routines.
* libgnarl/s-taspri__dummy.ads: Add 

[gcc r15-616] ada: Further adjustments coming from aliasing considerations

2024-05-17 Thread Marc Poulhi?s via Gcc-cvs
https://gcc.gnu.org/g:9ff83f013eb1ea2eac11c17cc3be2024e96101a5

commit r15-616-g9ff83f013eb1ea2eac11c17cc3be2024e96101a5
Author: Eric Botcazou 
Date:   Thu Mar 14 12:58:29 2024 +0100

ada: Further adjustments coming from aliasing considerations

They are needed on 32-bit platforms because of different calling conventions
and again in the units implementing AltiVec and Streams support.

gcc/ada/

* libgnat/g-alvevi.ads: Add pragma Universal_Aliasing for all the
view types.
* libgnat/s-stratt.ads: Likewise for Fat_Pointer type.

Diff:
---
 gcc/ada/libgnat/g-alvevi.ads | 11 +++
 gcc/ada/libgnat/s-stratt.ads |  3 +++
 2 files changed, 14 insertions(+)

diff --git a/gcc/ada/libgnat/g-alvevi.ads b/gcc/ada/libgnat/g-alvevi.ads
index b2beac7284c7..b0f58790adf8 100644
--- a/gcc/ada/libgnat/g-alvevi.ads
+++ b/gcc/ada/libgnat/g-alvevi.ads
@@ -58,6 +58,7 @@ package GNAT.Altivec.Vector_Views is
type VUC_View is record
   Values : Varray_unsigned_char;
end record;
+   pragma Universal_Aliasing (VUC_View);
 
type Varray_signed_char is array (Vchar_Range) of signed_char;
for Varray_signed_char'Alignment use VECTOR_ALIGNMENT;
@@ -65,6 +66,7 @@ package GNAT.Altivec.Vector_Views is
type VSC_View is record
   Values : Varray_signed_char;
end record;
+   pragma Universal_Aliasing (VSC_View);
 
type Varray_bool_char is array (Vchar_Range) of bool_char;
for Varray_bool_char'Alignment use VECTOR_ALIGNMENT;
@@ -72,6 +74,7 @@ package GNAT.Altivec.Vector_Views is
type VBC_View is record
   Values : Varray_bool_char;
end record;
+   pragma Universal_Aliasing (VBC_View);
 
--
-- short components --
@@ -85,6 +88,7 @@ package GNAT.Altivec.Vector_Views is
type VUS_View is record
   Values : Varray_unsigned_short;
end record;
+   pragma Universal_Aliasing (VUS_View);
 
type Varray_signed_short is array (Vshort_Range) of signed_short;
for Varray_signed_short'Alignment use VECTOR_ALIGNMENT;
@@ -92,6 +96,7 @@ package GNAT.Altivec.Vector_Views is
type VSS_View is record
   Values : Varray_signed_short;
end record;
+   pragma Universal_Aliasing (VSS_View);
 
type Varray_bool_short is array (Vshort_Range) of bool_short;
for Varray_bool_short'Alignment use VECTOR_ALIGNMENT;
@@ -99,6 +104,7 @@ package GNAT.Altivec.Vector_Views is
type VBS_View is record
   Values : Varray_bool_short;
end record;
+   pragma Universal_Aliasing (VBS_View);
 

-- int components --
@@ -112,6 +118,7 @@ package GNAT.Altivec.Vector_Views is
type VUI_View is record
   Values : Varray_unsigned_int;
end record;
+   pragma Universal_Aliasing (VUI_View);
 
type Varray_signed_int is array (Vint_Range) of signed_int;
for Varray_signed_int'Alignment use VECTOR_ALIGNMENT;
@@ -119,6 +126,7 @@ package GNAT.Altivec.Vector_Views is
type VSI_View is record
   Values : Varray_signed_int;
end record;
+   pragma Universal_Aliasing (VSI_View);
 
type Varray_bool_int is array (Vint_Range) of bool_int;
for Varray_bool_int'Alignment use VECTOR_ALIGNMENT;
@@ -126,6 +134,7 @@ package GNAT.Altivec.Vector_Views is
type VBI_View is record
   Values : Varray_bool_int;
end record;
+   pragma Universal_Aliasing (VBI_View);
 
--
-- float components --
@@ -139,6 +148,7 @@ package GNAT.Altivec.Vector_Views is
type VF_View is record
   Values : Varray_float;
end record;
+   pragma Universal_Aliasing (VF_View);
 
--
-- pixel components --
@@ -152,5 +162,6 @@ package GNAT.Altivec.Vector_Views is
type VP_View is record
   Values : Varray_pixel;
end record;
+   pragma Universal_Aliasing (VP_View);
 
 end GNAT.Altivec.Vector_Views;
diff --git a/gcc/ada/libgnat/s-stratt.ads b/gcc/ada/libgnat/s-stratt.ads
index 1d4c82d17abd..eee19f4bdced 100644
--- a/gcc/ada/libgnat/s-stratt.ads
+++ b/gcc/ada/libgnat/s-stratt.ads
@@ -74,6 +74,9 @@ package System.Stream_Attributes is
   P2 : System.Address;
end record;
 
+   pragma Universal_Aliasing (Fat_Pointer);
+   --  This avoids a copy for the aforementioned unchecked conversions
+

-- Treatment of enumeration types --



[gcc r15-613] ada: Bug in computing local restrictions inherited from enclosing scopes.

2024-05-17 Thread Marc Poulhi?s via Gcc-cvs
https://gcc.gnu.org/g:7b5b67dc1960b4b2f72c003e747b34049a5e04a7

commit r15-613-g7b5b67dc1960b4b2f72c003e747b34049a5e04a7
Author: Steve Baird 
Date:   Mon Mar 11 17:45:58 2024 -0700

ada: Bug in computing local restrictions inherited from enclosing scopes.

In the function Local_Restrict.Active_Restriction, we traverse enclosing
scopes looking for a relevant Local_Restrictions aspect specification.
Fix a bug in this traversal.

gcc/ada/

* local_restrict.adb (Active_Restriction): When traversing scopes,
do not skip over a subprogram body.

Diff:
---
 gcc/ada/local_restrict.adb | 32 +++-
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/gcc/ada/local_restrict.adb b/gcc/ada/local_restrict.adb
index 6e91c8a2e2a2..3be940499283 100644
--- a/gcc/ada/local_restrict.adb
+++ b/gcc/ada/local_restrict.adb
@@ -90,22 +90,28 @@ package body Local_Restrict is
 return Result;
  end if;
 
- Scop := Enclosing_Declaration (Scop);
- if Present (Scop) then
-Scop := Parent (Scop);
+ declare
+Saved_Scope : constant Node_Id := Scop;
+ begin
+Scop := Enclosing_Declaration (Scop);
 if Present (Scop) then
-   --  For a subprogram associated with a type, we don't care
-   --  where the type was frozen; continue from the type.
-
-   if Nkind (Scop) = N_Freeze_Entity then
-  Scop := Scope (Entity (Scop));
-   elsif Nkind (Parent (Scop)) = N_Freeze_Entity then
-  Scop := Scope (Entity (Parent (Scop)));
-   else
-  Scop := Find_Enclosing_Scope (Scop);
+   Scop := Parent (Scop);
+   if Present (Scop) then
+  --  For a subprogram associated with a type, we don't care
+  --  where the type was frozen; continue from the type.
+
+  if Nkind (Scop) = N_Freeze_Entity then
+ Scop := Scope (Entity (Scop));
+  elsif Nkind (Parent (Scop)) = N_Freeze_Entity then
+ Scop := Scope (Entity (Parent (Scop)));
+  elsif Present (Scope (Saved_Scope)) then
+ Scop := Scope (Saved_Scope);
+  else
+ Scop := Find_Enclosing_Scope (Scop);
+  end if;
end if;
 end if;
- end if;
+ end;
   end loop;
 
   return Empty;


[gcc r15-614] ada: Document secondary usage of Materialize_Entity flag

2024-05-17 Thread Marc Poulhi?s via Gcc-cvs
https://gcc.gnu.org/g:d7dbf6c7ae69ff4d8e26b8dc7ee14104f5a9843e

commit r15-614-gd7dbf6c7ae69ff4d8e26b8dc7ee14104f5a9843e
Author: Eric Botcazou 
Date:   Tue Mar 12 18:57:08 2024 +0100

ada: Document secondary usage of Materialize_Entity flag

The flag is also used by the semantic analyzer.

gcc/ada/

* einfo.ads (Materialize_Entity): Document secondary usage.

Diff:
---
 gcc/ada/einfo.ads | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads
index 71c560d52727..e5110f516708 100644
--- a/gcc/ada/einfo.ads
+++ b/gcc/ada/einfo.ads
@@ -3584,10 +3584,11 @@ package Einfo is
 --   tasks implementing such interface.
 
 --Materialize_Entity
---   Defined in all entities. Set only for renamed obects which should be
+--   Defined in all entities. Set mostly for renamed objects that should be
 --   materialized for debugging purposes. This means that a memory location
 --   containing the renamed address should be allocated. This is needed so
---   that the debugger can find the entity.
+--   that the debugger can find the entity. Also set on types built in the
+--   case of unanalyzed packages referenced through a limited_with clause.
 
 --May_Inherit_Delayed_Rep_Aspects
 --   Defined in all entities for types and subtypes. Set if the type is


[gcc r15-611] ada: Fix for validity checking and conditional evaluation of 'Old

2024-05-17 Thread Marc Poulhi?s via Gcc-cvs
https://gcc.gnu.org/g:75de817d88aade7fc5e8b4bebe3f179f1c5b6a87

commit r15-611-g75de817d88aade7fc5e8b4bebe3f179f1c5b6a87
Author: Piotr Trojanek 
Date:   Mon Mar 11 23:02:50 2024 +0100

ada: Fix for validity checking and conditional evaluation of 'Old

Detection of expression that are "known on entry" (as defined in Ada
2022 RM 6.1.1(20/5)) was confused by validity checks when used from
within expansion of attribute 'Old.

gcc/ada/

* sem_util.adb (Is_Known_On_Entry): Handle constants introduced
by validity checks.

Diff:
---
 gcc/ada/sem_util.adb | 8 
 1 file changed, 8 insertions(+)

diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index be777d26e465..d512d462b443 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -30791,6 +30791,14 @@ package body Sem_Util is
   return False;
end if;
 
+   --  Handle constants introduced by side-effect
+   --  removal, e.g. by validity checks.
+
+   if not Comes_From_Source (Obj) then
+  return
+Is_Known_On_Entry (Expression (Parent (Obj)));
+   end if;
+
--  return False if not "all views are constant".
if Is_Immutably_Limited_Type (Obj_Typ)
  or Needs_Finalization (Obj_Typ)


[gcc r15-612] ada: Factor out duplicated code in bodies of System.Task_Primitives.Operations

2024-05-17 Thread Marc Poulhi?s via Gcc-cvs
https://gcc.gnu.org/g:3a5c4f926676bada86b7862ec0257ac5170b7976

commit r15-612-g3a5c4f926676bada86b7862ec0257ac5170b7976
Author: Eric Botcazou 
Date:   Mon Mar 4 12:44:11 2024 +0100

ada: Factor out duplicated code in bodies of 
System.Task_Primitives.Operations

The duplication is present in some POSIX-like implementations (POSIX
and RTEMS) while it has already been eliminated in others (Linux, QNX).  The
latter implementations are also slightly modified for consistency's sake.

No functional changes.

gcc/ada/

* libgnarl/s-taprop__dummy.adb (Initialize_Lock): Fix formatting.
* libgnarl/s-taprop__linux.adb (RTS_Lock_Ptr): Delete.
(Init_Mutex): Rename into...
(Initialize_Lock): ...this.
(Initialize_Lock [Lock]): Call above procedure.
(Initialize_Lock [RTS_Lock]): Likewise.
(Initialize_TCB): Likewise.
* libgnarl/s-taprop__posix.adb (Initialize_Lock): New procedure
factored out from the other two homonyms.
(Initialize_Lock [Lock]): Call above procedure.
(Initialize_Lock [RTS_Lock]): Likewise.
* libgnarl/s-taprop__qnx.adb (RTS_Lock_Ptr): Delete.
(Init_Mutex): Rename into...
(Initialize_Lock): ...this.
(Initialize_Lock [Lock]): Call above procedure.
(Initialize_Lock [RTS_Lock]): Likewise.
(Initialize_TCB): Likewise.
* libgnarl/s-taprop__rtems.adb (Initialize_Lock): New procedure
factored out from the other two homonyms.
(Initialize_Lock [Lock]): Call above procedure.
(Initialize_Lock [RTS_Lock]): Likewise.

Diff:
---
 gcc/ada/libgnarl/s-taprop__dummy.adb |  4 ++-
 gcc/ada/libgnarl/s-taprop__linux.adb | 47 +--
 gcc/ada/libgnarl/s-taprop__posix.adb | 61 
 gcc/ada/libgnarl/s-taprop__qnx.adb   | 46 +--
 gcc/ada/libgnarl/s-taprop__rtems.adb | 61 
 5 files changed, 90 insertions(+), 129 deletions(-)

diff --git a/gcc/ada/libgnarl/s-taprop__dummy.adb 
b/gcc/ada/libgnarl/s-taprop__dummy.adb
index 90c4cd4cf72f..829d595694c3 100644
--- a/gcc/ada/libgnarl/s-taprop__dummy.adb
+++ b/gcc/ada/libgnarl/s-taprop__dummy.adb
@@ -239,7 +239,9 @@ package body System.Task_Primitives.Operations is
end Initialize_Lock;
 
procedure Initialize_Lock
- (L : not null access RTS_Lock; Level : Lock_Level) is
+ (L : not null access RTS_Lock;
+  Level : Lock_Level)
+   is
begin
   null;
end Initialize_Lock;
diff --git a/gcc/ada/libgnarl/s-taprop__linux.adb 
b/gcc/ada/libgnarl/s-taprop__linux.adb
index d6a29b5e1581..74717cb2d2b1 100644
--- a/gcc/ada/libgnarl/s-taprop__linux.adb
+++ b/gcc/ada/libgnarl/s-taprop__linux.adb
@@ -248,10 +248,10 @@ package body System.Task_Primitives.Operations is
--  as in "sudo /sbin/setcap cap_sys_nice=ep exe_file". If it doesn't have
--  permission, then a request for Ceiling_Locking is ignored.
 
-   type RTS_Lock_Ptr is not null access all RTS_Lock;
-
-   function Init_Mutex (L : RTS_Lock_Ptr; Prio : Any_Priority) return C.int;
-   --  Initialize the mutex L. If Ceiling_Support is True, then set the ceiling
+   function Initialize_Lock
+ (L: not null access RTS_Lock;
+  Prio : Any_Priority) return C.int;
+   --  Initialize the lock L. If Ceiling_Support is True, then set the ceiling
--  to Prio. Returns 0 for success, or ENOMEM for out-of-memory.
 
---
@@ -340,11 +340,20 @@ package body System.Task_Primitives.Operations is
 
function Self return Task_Id renames Specific.Self;
 
-   
-   -- Init_Mutex --
-   
+   -
+   -- Initialize_Lock --
+   -
 
-   function Init_Mutex (L : RTS_Lock_Ptr; Prio : Any_Priority) return C.int is
+   --  Note: mutexes and cond_variables needed per-task basis are initialized
+   --  in Initialize_TCB and the Storage_Error is handled. Other mutexes (such
+   --  as RTS_Lock, Memory_Lock...) used in RTS is initialized before any
+   --  status change of RTS. Therefore raising Storage_Error in the following
+   --  routines should be able to be handled safely.
+
+   function Initialize_Lock
+ (L: not null access RTS_Lock;
+  Prio : Any_Priority) return C.int
+   is
   Mutex_Attr : aliased pthread_mutexattr_t;
   Result, Result_2 : C.int;
 
@@ -377,17 +386,7 @@ package body System.Task_Primitives.Operations is
   Result_2 := pthread_mutexattr_destroy (Mutex_Attr'Access);
   pragma Assert (Result_2 = 0);
   return Result; -- of pthread_mutex_init, not pthread_mutexattr_destroy
-   end Init_Mutex;
-
-   -
-   -- Initialize_Lock --
-   -
-
-   --  Note: mutexes and cond_variables needed per-task basis are initialized
-   --  in Initialize_TCB and the 

[gcc r15-608] ada: Clarify code for aggregate warnings

2024-05-17 Thread Marc Poulhi?s via Gcc-cvs
https://gcc.gnu.org/g:d87d0f331523684af0c975afa95232e9bf7070f6

commit r15-608-gd87d0f331523684af0c975afa95232e9bf7070f6
Author: Ronan Desplanques 
Date:   Mon Mar 11 09:55:55 2024 +0100

ada: Clarify code for aggregate warnings

This patch improves comments in code that emits warnings about
particular situations involving aggregates. It also removes a
conjunct in a condition that's useless because always true in the
context of the test.

gcc/ada/

* sem_aggr.adb (Resolve_Array_Aggregate): Improve comments
and condition.

Diff:
---
 gcc/ada/sem_aggr.adb | 52 +---
 1 file changed, 25 insertions(+), 27 deletions(-)

diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb
index ee9beb04c9ad..14c68b5eaf3b 100644
--- a/gcc/ada/sem_aggr.adb
+++ b/gcc/ada/sem_aggr.adb
@@ -2873,9 +2873,9 @@ package body Sem_Aggr is
 --  No others clause present
 
 else
-   --  Special processing if others allowed and not present. This
-   --  means that the bounds of the aggregate come from the index
-   --  constraint (and the length must match).
+   --  Special processing if others allowed and not present. In
+   --  this case, the bounds of the aggregate come from the
+   --  choices (RM 4.3.3 (27)).
 
if Others_Allowed then
   Get_Index_Bounds (Index_Constr, Aggr_Low, Aggr_High);
@@ -2890,30 +2890,28 @@ package body Sem_Aggr is
  return False;
   end if;
 
-  --  If others allowed, and no others present, then the array
-  --  should cover all index values. If it does not, we will
-  --  get a length check warning, but there is two cases where
-  --  an additional warning is useful:
-
-  --  If we have no positional components, and the length is
-  --  wrong (which we can tell by others being allowed with
-  --  missing components), and the index type is an enumeration
-  --  type, then issue appropriate warnings about these missing
-  --  components. They are only warnings, since the aggregate
-  --  is fine, it's just the wrong length. We skip this check
-  --  for standard character types (since there are no literals
-  --  and it is too much trouble to concoct them), and also if
-  --  any of the bounds have values that are not known at
-  --  compile time.
-
-  --  Another case warranting a warning is when the length
-  --  is right, but as above we have an index type that is
-  --  an enumeration, and the bounds do not match. This is a
-  --  case where dubious sliding is allowed and we generate a
-  --  warning that the bounds do not match.
-
-  if No (Expressions (N))
-and then Nkind (Index) = N_Range
+  --  If there is an applicable index constraint and others is
+  --  not present, then sliding is allowed and only a length
+  --  check will be performed. However, additional warnings are
+  --  useful if the index type is an enumeration type, as
+  --  sliding is dubious in this case. We emit two kinds of
+  --  warnings:
+  --
+  --1. If the length is wrong then there are missing
+  --   components; we issue appropriate warnings about
+  --   these missing components. They are only warnings,
+  --   since the aggregate is fine, it's just the wrong
+  --   length. We skip this check for standard character
+  --   types (since there are no literals and it is too
+  --   much trouble to concoct them), and also if any of
+  --   the bounds have values that are not known at compile
+  --   time.
+  --
+  --2. If the length is right but the bounds do not match,
+  --   we issue a warning, as we consider sliding dubious
+  --   when the index type is an enumeration type.
+
+  if Nkind (Index) = N_Range
 and then Is_Enumeration_Type (Etype (Index))
 and then not Is_Standard_Character_Type (Etype (Index))
 and then Compile_Time_Known_Value (Aggr_Low)


[gcc r15-610] ada: Do not query the modification time of a special file.

2024-05-17 Thread Marc Poulhi?s via Gcc-cvs
https://gcc.gnu.org/g:615c29a8c5d47a28887087d3ff49b9df7f74fe9e

commit r15-610-g615c29a8c5d47a28887087d3ff49b9df7f74fe9e
Author: Steve Baird 
Date:   Fri Mar 8 15:48:32 2024 -0800

ada: Do not query the modification time of a special file.

In Ada.Directories, the function Modification_Time raises Name_Error if it 
is
called for a special file. So don't do that in Start_Search_Internal.

gcc/ada/

* libgnat/a-direct.adb (Start_Search_Internal): Do not call
Modification_Time for a special file; declare a Calendar.Time
constant No_Time and use that instead.

Diff:
---
 gcc/ada/libgnat/a-direct.adb | 18 --
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/gcc/ada/libgnat/a-direct.adb b/gcc/ada/libgnat/a-direct.adb
index 32e020c48c37..adff12277e89 100644
--- a/gcc/ada/libgnat/a-direct.adb
+++ b/gcc/ada/libgnat/a-direct.adb
@@ -29,7 +29,7 @@
 --  --
 --
 
-with Ada.Calendar;   use Ada.Calendar;
+with Ada.Calendar.Formatting;use Ada.Calendar;
 with Ada.Characters.Handling;use Ada.Characters.Handling;
 with Ada.Containers.Vectors;
 with Ada.Directories.Validity;   use Ada.Directories.Validity;
@@ -1392,6 +1392,17 @@ package body Ada.Directories is
   end record;
 
   Res : Result := (Found => False);
+
+  --  This declaration of No_Time copied from GNAT.Calendar
+  --  because adding a "with GNAT.Calendar;" to this unit
+  --  results in problems.
+
+  No_Time : constant Ada.Calendar.Time :=
+Ada.Calendar.Formatting.Time_Of
+  (Ada.Calendar.Year_Number'First,
+   Ada.Calendar.Month_Number'First,
+   Ada.Calendar.Day_Number'First,
+   Time_Zone => 0);
begin
   --  Get the file attributes for the directory item
 
@@ -1452,7 +1463,10 @@ package body Ada.Directories is
   Full_Name => To_Unbounded_String (Path),
   Attr_Error_Code   => 0,
   Kind  => Res.Kind,
-  Modification_Time => Modification_Time (Path),
+  Modification_Time =>
+   (if Res.Kind = Special_File
+  then No_Time
+  else Modification_Time (Path)),
   Size  => Res.Size));
  end if;
   end if;


[gcc r15-609] ada: Disable Equivalent_Array_Aggregate optimization if predicates involved

2024-05-17 Thread Marc Poulhi?s via Gcc-cvs
https://gcc.gnu.org/g:591ddf34a1e759560d89627eefae1d0e13b61ee8

commit r15-609-g591ddf34a1e759560d89627eefae1d0e13b61ee8
Author: Steve Baird 
Date:   Fri Mar 8 16:17:41 2024 -0800

ada: Disable Equivalent_Array_Aggregate optimization if predicates involved

In most paths, the function Build_Equivalent_Record_Aggregate was already
testing Has_Predicates for a given component type and conditionally 
returning
an Empty result. This is also needed in the case of a scalar component type.
Without it, we can build corrupt trees that fail use-before-definition
detection checks in gigi.

gcc/ada/

* exp_ch3.adb (Build_Equivalent_Record_Aggregate): Add
Has_Predicates test for a scalar component to match what is
already done for other kinds of components.

Diff:
---
 gcc/ada/exp_ch3.adb | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb
index 5764b22b8002..f6314dff285f 100644
--- a/gcc/ada/exp_ch3.adb
+++ b/gcc/ada/exp_ch3.adb
@@ -1950,6 +1950,7 @@ package body Exp_Ch3 is
   or else not Compile_Time_Known_Value (Type_Low_Bound (Comp_Type))
   or else not
 Compile_Time_Known_Value (Type_High_Bound (Comp_Type))
+  or else Has_Predicates (Etype (Comp))
 then
Initialization_Warning (T);
return Empty;


[gcc r15-606] ada: Expose utility routine for processing of Depends contracts in SPARK

2024-05-17 Thread Marc Poulhi?s via Gcc-cvs
https://gcc.gnu.org/g:d77c12eb33c7a0a461f6928a8fb303378aaf2e2f

commit r15-606-gd77c12eb33c7a0a461f6928a8fb303378aaf2e2f
Author: Piotr Trojanek 
Date:   Fri Mar 8 17:02:16 2024 +0100

ada: Expose utility routine for processing of Depends contracts in SPARK

Routine Is_Unconstrained_Or_Tagged_Item is now used both in the GNAT
frontend (for checking legality of Depends clauses) and in the GNATprove
backend (for representing implicit inputs in flow graphs).

gcc/ada/

* sem_prag.adb (Is_Unconstrained_Or_Tagged_Item): Move to
Sem_Util, so it can be used from GNATprove.
* sem_util.ads (Is_Unconstrained_Or_Tagged_Item): Move from
Sem_Prag; spec.
* sem_util.adb (Is_Unconstrained_Or_Tagged_Item): Move from
Sem_Prag; body.

Diff:
---
 gcc/ada/sem_prag.adb | 29 -
 gcc/ada/sem_util.adb | 23 +++
 gcc/ada/sem_util.ads |  5 +
 3 files changed, 28 insertions(+), 29 deletions(-)

diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index 02aad4d1caa2..f27e40edcbbf 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -280,12 +280,6 @@ package body Sem_Prag is
--  Determine whether dependency clause Clause is surrounded by extra
--  parentheses. If this is the case, issue an error message.
 
-   function Is_Unconstrained_Or_Tagged_Item (Item : Entity_Id) return Boolean;
-   --  Subsidiary to Collect_Subprogram_Inputs_Outputs and the analysis of
-   --  pragma Depends. Determine whether the type of dependency item Item is
-   --  tagged, unconstrained array, unconstrained private or unconstrained
-   --  record.
-
procedure Record_Possible_Body_Reference
  (State_Id : Entity_Id;
   Ref  : Node_Id);
@@ -32959,29 +32953,6 @@ package body Sem_Prag is
   and then List_Containing (N) = Private_Declarations (Parent (N));
end Is_Private_SPARK_Mode;
 
-   -
-   -- Is_Unconstrained_Or_Tagged_Item --
-   -
-
-   function Is_Unconstrained_Or_Tagged_Item
- (Item : Entity_Id) return Boolean
-   is
-  Typ : constant Entity_Id := Etype (Item);
-   begin
-  if Is_Tagged_Type (Typ) then
- return True;
-
-  elsif Is_Array_Type (Typ)
-or else Is_Record_Type (Typ)
-or else Is_Private_Type (Typ)
-  then
- return not Is_Constrained (Typ);
-
-  else
- return False;
-  end if;
-   end Is_Unconstrained_Or_Tagged_Item;
-
-
-- Is_Valid_Assertion_Kind --
-
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index dd9f868b696f..be777d26e465 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -20709,6 +20709,29 @@ package body Sem_Util is
   return T = Universal_Integer or else T = Universal_Real;
end Is_Universal_Numeric_Type;
 
+   -
+   -- Is_Unconstrained_Or_Tagged_Item --
+   -
+
+   function Is_Unconstrained_Or_Tagged_Item
+ (Item : Entity_Id) return Boolean
+   is
+  Typ : constant Entity_Id := Etype (Item);
+   begin
+  if Is_Tagged_Type (Typ) then
+ return True;
+
+  elsif Is_Array_Type (Typ)
+or else Is_Record_Type (Typ)
+or else Is_Private_Type (Typ)
+  then
+ return not Is_Constrained (Typ);
+
+  else
+ return False;
+  end if;
+   end Is_Unconstrained_Or_Tagged_Item;
+
--
-- Is_User_Defined_Equality --
--
diff --git a/gcc/ada/sem_util.ads b/gcc/ada/sem_util.ads
index 99c60ddf708c..4fef89663805 100644
--- a/gcc/ada/sem_util.ads
+++ b/gcc/ada/sem_util.ads
@@ -2397,6 +2397,11 @@ package Sem_Util is
pragma Inline (Is_Universal_Numeric_Type);
--  True if T is Universal_Integer or Universal_Real
 
+   function Is_Unconstrained_Or_Tagged_Item (Item : Entity_Id) return Boolean;
+   --  Subsidiary to Collect_Subprogram_Inputs_Outputs and the analysis of
+   --  pragma Depends. Determine whether the type of dependency item Item is
+   --  tagged, unconstrained array or unconstrained record.
+
function Is_User_Defined_Equality (Id : Entity_Id) return Boolean;
--  Determine whether an entity denotes a user-defined equality


[gcc r15-607] ada: Fix others error message location

2024-05-17 Thread Marc Poulhi?s via Gcc-cvs
https://gcc.gnu.org/g:34ac60eb88e489991b420e82b98a039a31df262f

commit r15-607-g34ac60eb88e489991b420e82b98a039a31df262f
Author: Ronan Desplanques 
Date:   Fri Mar 8 14:42:59 2024 +0100

ada: Fix others error message location

Before this patch, the compiler pointed at the wrong component
association when reporting an illegal occurrence of "others" in an
aggregate. This patch fixes this by keeping track of which choice
contains the occurrence of "others" when resolving array aggregates.

gcc/ada/

* sem_aggr.adb (Resolve_Array_Aggregate): Fix location of error
message.

Diff:
---
 gcc/ada/sem_aggr.adb | 43 +++
 1 file changed, 19 insertions(+), 24 deletions(-)

diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb
index 64e7db79ecc9..ee9beb04c9ad 100644
--- a/gcc/ada/sem_aggr.adb
+++ b/gcc/ada/sem_aggr.adb
@@ -1335,7 +1335,7 @@ package body Sem_Aggr is
   Index_Base_High : constant Node_Id   := Type_High_Bound (Index_Base);
   --  Ditto for the base type
 
-  Others_Present : Boolean := False;
+  Others_N : Node_Id := Empty;
 
   Nb_Choices : Nat := 0;
   --  Contains the overall number of named choices in this sub-aggregate
@@ -1870,7 +1870,7 @@ package body Sem_Aggr is
 
 while Present (Choice) loop
if Nkind (Choice) = N_Others_Choice then
-  Others_Present := True;
+  Others_N := Choice;
 
else
   Analyze (Choice);
@@ -2189,7 +2189,7 @@ package body Sem_Aggr is
 Delete_Choice := False;
 while Present (Choice) loop
if Nkind (Choice) = N_Others_Choice then
-  Others_Present := True;
+  Others_N := Choice;
 
   if Choice /= First (Choice_List (Assoc))
 or else Present (Next (Choice))
@@ -2289,7 +2289,7 @@ package body Sem_Aggr is
 
   if Present (Expressions (N))
 and then (Nb_Choices > 1
-   or else (Nb_Choices = 1 and then not Others_Present))
+   or else (Nb_Choices = 1 and then No (Others_N)))
   then
  Error_Msg_N
("cannot mix named and positional associations in array aggregate",
@@ -2299,16 +2299,11 @@ package body Sem_Aggr is
 
   --  Test for the validity of an others choice if present
 
-  if Others_Present and then not Others_Allowed then
- declare
-Others_N : constant Node_Id :=
-  First (Choice_List (First (Component_Associations (N;
- begin
-Error_Msg_N ("OTHERS choice not allowed here", Others_N);
-Error_Msg_N ("\qualify the aggregate with a constrained subtype "
- & "to provide bounds for it", Others_N);
-return Failure;
- end;
+  if Present (Others_N) and then not Others_Allowed then
+ Error_Msg_N ("OTHERS choice not allowed here", Others_N);
+ Error_Msg_N ("\qualify the aggregate with a constrained subtype "
+  & "to provide bounds for it", Others_N);
+ return Failure;
   end if;
 
   --  Protect against cascaded errors
@@ -2320,7 +2315,7 @@ package body Sem_Aggr is
   --  STEP 2: Process named components
 
   if No (Expressions (N)) then
- if Others_Present then
+ if Present (Others_N) then
 Case_Table_Size := Nb_Choices - 1;
  else
 Case_Table_Size := Nb_Choices;
@@ -2709,7 +2704,7 @@ package body Sem_Aggr is
 
  if Lo_Val <= Hi_Val
or else (Lo_Val > Hi_Val + 1
- and then not Others_Present)
+ and then No (Others_N))
  then
 Missing_Or_Duplicates := True;
 exit;
@@ -2796,7 +2791,7 @@ package body Sem_Aggr is
  --  Loop through entries in table to find missing indexes.
  --  Not needed if others, since missing impossible.
 
- if not Others_Present then
+ if No (Others_N) then
 for J in 2 .. Nb_Discrete_Choices loop
Lo_Val := Expr_Value (Table (J).Lo);
Hi_Val := Table (J - 1).Highest;
@@ -2862,7 +2857,7 @@ package body Sem_Aggr is
 --  If Others is present, then bounds of aggregate come from the
 --  index constraint (not the choices in the aggregate itself).
 
-if Others_Present then
+if Present (Others_N) then
Get_Index_Bounds (Index_Constr, Aggr_Low, Aggr_High);
 
--  Abandon processing if either bound is already signalled as
@@ -3043,7 +3038,7 @@ package body Sem_Aggr is
 Next (Expr);
  end loop;
 
- if Others_Present then
+ 

[gcc r15-604] ada: gnatbind: subprogram spec no longer exists

2024-05-17 Thread Marc Poulhi?s via Gcc-cvs
https://gcc.gnu.org/g:d2a118197c767ccbd3905c14ff2ebe82bd0fe9ed

commit r15-604-gd2a118197c767ccbd3905c14ff2ebe82bd0fe9ed
Author: Bob Duff 
Date:   Fri Mar 8 09:32:51 2024 -0500

ada: gnatbind: subprogram spec no longer exists

If a subprogram spec S is present while compiling something that
says "with S;", but the spec is absent while compiling the body
of S, then gnatbind fails to detect the mismatch.  The spec and
body of S might have different parameter and result types.
This patch fixes gnatbind to detect this case and give an error.

gcc/ada/

* bcheck.adb (Check_Consistency_Of_Sdep): Split out new procedure.
Add check for special case of subprogram spec that no longer
exists.
(Check_Consistency): Call Check_Consistency_Of_Sdep, except when
Reified_Child_Spec is True. No need for "goto Continue" or "exit
Sdep_Loop".
* ali.ads (Subunit_Name, Unit_Name): Change the type to
Unit_Name_Type. Add a comment pointing to the ALI file
documentation, because it's in a somewhat-surprising place.
* ali.adb (Scan_ALI): Subunit_Name and Unit_Name are now
Unit_Name_Type. Remove comment explaining why Name_Find is used;
Name_Find is the usual case. Do not remove the "%s" or "%b" from
the Unit_Name. We need to be able to distinguish specs and bodies.
This is also necessary to obey the invariant of Unit_Name_Type.
* binde.adb (Write_Closure): Subunit_Name is now Unit_Name_Type.
* clean.adb (Clean_Executables): Likewise.

Diff:
---
 gcc/ada/ali.adb|   9 +--
 gcc/ada/ali.ads|  10 +--
 gcc/ada/bcheck.adb | 216 -
 gcc/ada/binde.adb  |   2 +-
 gcc/ada/clean.adb  |   2 +-
 5 files changed, 141 insertions(+), 98 deletions(-)

diff --git a/gcc/ada/ali.adb b/gcc/ada/ali.adb
index 6bf48c04afeb..69a91bce5ab9 100644
--- a/gcc/ada/ali.adb
+++ b/gcc/ada/ali.adb
@@ -3287,8 +3287,8 @@ package body ALI is
 
 --  Acquire (sub)unit and reference file name entries
 
-Sdep.Table (Sdep.Last).Subunit_Name := No_Name;
-Sdep.Table (Sdep.Last).Unit_Name:= No_Name;
+Sdep.Table (Sdep.Last).Subunit_Name := No_Unit_Name;
+Sdep.Table (Sdep.Last).Unit_Name:= No_Unit_Name;
 Sdep.Table (Sdep.Last).Rfile:=
   Sdep.Table (Sdep.Last).Sfile;
 Sdep.Table (Sdep.Last).Start_Line   := 1;
@@ -3304,16 +3304,13 @@ package body ALI is
  Add_Char_To_Name_Buffer (Getc);
   end loop;
 
-  --  Set the (sub)unit name. Note that we use Name_Find rather
-  --  than Name_Enter here as the subunit name may already
-  --  have been put in the name table by the Project Manager.
+  --  Set the (sub)unit name.
 
   if Name_Len <= 2
 or else Name_Buffer (Name_Len - 1) /= '%'
   then
  Sdep.Table (Sdep.Last).Subunit_Name := Name_Find;
   else
- Name_Len := Name_Len - 2;
  Sdep.Table (Sdep.Last).Unit_Name := Name_Find;
   end if;
 
diff --git a/gcc/ada/ali.ads b/gcc/ada/ali.ads
index 67b8fcd1b803..1f4522686818 100644
--- a/gcc/ada/ali.ads
+++ b/gcc/ada/ali.ads
@@ -25,7 +25,7 @@
 
 --  This package defines the internal data structures used for representation
 --  of Ada Library Information (ALI) acquired from the ALI files generated by
---  the front end.
+--  the front end. The format of the ALI files is documented in Lib.Writ.
 
 with Casing;  use Casing;
 with Gnatvsn; use Gnatvsn;
@@ -882,11 +882,11 @@ package ALI is
   --  Set True for dummy entries that correspond to missing files or files
   --  where no dependency relationship exists.
 
-  Subunit_Name : Name_Id;
-  --  Name_Id for subunit name if present, else No_Name
+  Subunit_Name : Unit_Name_Type;
+  --  Subunit name if present, else No_Unit_Name
 
-  Unit_Name : Name_Id;
-  --  Name_Id for the unit name if not a subunit (No_Name for a subunit)
+  Unit_Name : Unit_Name_Type;
+  --  Unit name if not a subunit (No_Unit_Name for a subunit)
 
   Rfile : File_Name_Type;
   --  Reference file name. Same as Sfile unless a Source_Reference pragma
diff --git a/gcc/ada/bcheck.adb b/gcc/ada/bcheck.adb
index dd2ece80d01c..56a417cc5176 100644
--- a/gcc/ada/bcheck.adb
+++ b/gcc/ada/bcheck.adb
@@ -36,6 +36,7 @@ with Osint;
 with Output;   use Output;
 with Rident;   use Rident;
 with Types;use Types;
+with Uname;
 
 package body Bcheck is
 
@@ -68,6 +69,12 @@ package body Bcheck is
--  Used to compare two unit names for No_Dependence checks. U1 is in
--  standard unit name format, and U2 is in literal form with periods.
 
+   procedure 

[gcc r15-602] ada: Fix containers' Reference_Preserving_Key functions' memory leaks

2024-05-17 Thread Marc Poulhi?s via Gcc-cvs
https://gcc.gnu.org/g:ecf17346ff112ccf58cd2920a23fa756b068e1bc

commit r15-602-gecf17346ff112ccf58cd2920a23fa756b068e1bc
Author: Steve Baird 
Date:   Wed Mar 6 14:27:44 2024 -0800

ada: Fix containers' Reference_Preserving_Key functions' memory leaks

Fix memory leaks in containers' Reference_Preserving_Key functions

Make the same change in each of 3 Ada.Containers child units: Ordered_Sets,
Indefinite_Ordered_Sets, and Bounded_Ordered_Sets. The function
Reference_Preserving_Key evaluates an allocator of type Key_Access whose
storage was not being reclaimed. Update the Finalize procedure for
type Reference_Control_Type to free that storage. But this change introduces
a possible erroneous double-free situation if an object is copied (because
the original and the copy will each be finalized at some point). So also
introduce an Adjust procedure which allocates a copy of the allocated 
object.
Another possible solution to this problem (which is not being implemented
yet) is based on implementing AI22-0082. Also include a fix for a bug in
Sem_Util.Has_Some_Controlled_Component that was discovered while working
on this.

gcc/ada/

* sem_util.adb (Has_Some_Controlled_Component): Fix a bug which
causes (in some cases involving a Disable_Controlled aspect
specification) Needs_Finalization to return different answers for
one type depending on whether the function is called before or
after the type is frozen.
* libgnat/a-coorse.ads: Type Control_Reference_Type gets an Adjust
procedure.
* libgnat/a-cborse.ads: Likewise.
* libgnat/a-ciorse.ads: Likewise
* libgnat/a-coorse.adb:
(Finalize): Reclaim allocated Key_Type object.
(Adjust): New procedure; prevent sharing of non-null Key_Access
values by allocating a copy.
* libgnat/a-cborse.adb: Likewise.
* libgnat/a-ciorse.adb: Likewise.

Diff:
---
 gcc/ada/libgnat/a-cborse.adb | 17 +
 gcc/ada/libgnat/a-cborse.ads |  3 +++
 gcc/ada/libgnat/a-ciorse.adb | 16 +++-
 gcc/ada/libgnat/a-ciorse.ads |  3 +++
 gcc/ada/libgnat/a-coorse.adb | 16 +++-
 gcc/ada/libgnat/a-coorse.ads |  3 +++
 gcc/ada/sem_util.adb |  6 +-
 7 files changed, 61 insertions(+), 3 deletions(-)

diff --git a/gcc/ada/libgnat/a-cborse.adb b/gcc/ada/libgnat/a-cborse.adb
index b649c5eb6e79..9d2a02163426 100644
--- a/gcc/ada/libgnat/a-cborse.adb
+++ b/gcc/ada/libgnat/a-cborse.adb
@@ -40,6 +40,8 @@ with 
Ada.Containers.Red_Black_Trees.Generic_Bounded_Set_Operations;
 pragma Elaborate_All
   (Ada.Containers.Red_Black_Trees.Generic_Bounded_Set_Operations);
 
+with Ada.Unchecked_Deallocation;
+
 with System; use type System.Address;
 with System.Put_Images;
 
@@ -775,6 +777,18 @@ is
Is_Less_Key_Node=> Is_Less_Key_Node,
Is_Greater_Key_Node => Is_Greater_Key_Node);
 
+  
+  -- Adjust --
+  
+
+  procedure Adjust (Control : in out Reference_Control_Type) is
+  begin
+ Impl.Reference_Control_Type (Control).Adjust;
+ if Control.Old_Key /= null then
+Control.Old_Key := new Key_Type'(Control.Old_Key.all);
+ end if;
+  end Adjust;
+
   -
   -- Ceiling --
   -
@@ -872,6 +886,8 @@ is
   --
 
   procedure Finalize (Control : in out Reference_Control_Type) is
+ procedure Deallocate is
+   new Ada.Unchecked_Deallocation (Key_Type, Key_Access);
   begin
  if Control.Container /= null then
 Impl.Reference_Control_Type (Control).Finalize;
@@ -883,6 +899,7 @@ is
 end if;
 
 Control.Container := null;
+Deallocate (Control.Old_Key);
  end if;
   end Finalize;
 
diff --git a/gcc/ada/libgnat/a-cborse.ads b/gcc/ada/libgnat/a-cborse.ads
index 2366d1adcc28..650f4a40384b 100644
--- a/gcc/ada/libgnat/a-cborse.ads
+++ b/gcc/ada/libgnat/a-cborse.ads
@@ -324,6 +324,9 @@ is
  Old_Key   : Key_Access;
   end record;
 
+  overriding procedure Adjust (Control : in out Reference_Control_Type);
+  pragma Inline (Adjust);
+
   overriding procedure Finalize (Control : in out Reference_Control_Type);
   pragma Inline (Finalize);
 
diff --git a/gcc/ada/libgnat/a-ciorse.adb b/gcc/ada/libgnat/a-ciorse.adb
index d90fb882b433..fe91345cdd43 100644
--- a/gcc/ada/libgnat/a-ciorse.adb
+++ b/gcc/ada/libgnat/a-ciorse.adb
@@ -807,6 +807,18 @@ is
Is_Less_Key_Node=> Is_Less_Key_Node,
Is_Greater_Key_Node => Is_Greater_Key_Node);
 
+  
+  -- Adjust --
+  
+
+  procedure Adjust (Control : in out Reference_Control_Type) is
+  begin
+ Impl.Reference_Control_Type (Control).Adjust;
+ if Control.Old_Key /= null 

[gcc r15-603] ada: Update docs for Resolve_Null_Array_Aggregate

2024-05-17 Thread Marc Poulhi?s via Gcc-cvs
https://gcc.gnu.org/g:a666066298f29bc08379aac75e65d1edb3eb415f

commit r15-603-ga666066298f29bc08379aac75e65d1edb3eb415f
Author: Ronan Desplanques 
Date:   Thu Mar 7 10:24:49 2024 +0100

ada: Update docs for Resolve_Null_Array_Aggregate

The documentation comments for Sem_Aggr.Resolve_Null_Array_Aggregate
suggested that this subprogram created a subtype, which it didn't.
This patch replaces those comments with ones that better match the
behavior.

gcc/ada/

* sem_aggr.adb (Resolve_Null_Array_Aggregate): Update
documentation comments.

Diff:
---
 gcc/ada/sem_aggr.adb | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb
index 508c86bc5de7..64e7db79ecc9 100644
--- a/gcc/ada/sem_aggr.adb
+++ b/gcc/ada/sem_aggr.adb
@@ -409,11 +409,10 @@ package body Sem_Aggr is
--  string as an aggregate, prior to resolution.
 
function Resolve_Null_Array_Aggregate (N : Node_Id) return Boolean;
-   --  For the Ada 2022 construct, build a subtype with a null range for each
-   --  dimension, using the bounds from the context subtype (if the subtype
-   --  is constrained). If the subtype is unconstrained, then the bounds
-   --  are determined in much the same way as the bounds for a null string
-   --  literal with no applicable index constraint.
+   --  The recursive method used to construct an aggregate's bounds in
+   --  Resolve_Array_Aggregate cannot work for null array aggregates. This
+   --  function constructs an appropriate list of ranges and stores its first
+   --  element in Aggregate_Bounds (N).
 
-
--  Delta aggregate processing --
@@ -4540,7 +4539,8 @@ package body Sem_Aggr is
 
   Set_Parent (Constr, N);
 
-  --  Create a constrained subtype with null dimensions
+  --  Populate the list with null ranges. The relevant RM clauses are
+  --  RM 4.3.3 (26.1) and RM 4.3.3 (26).
 
   Index := First_Index (Typ);
   while Present (Index) loop


  1   2   >