[gcc r14-9382] testsuite/108355 - make gcc.dg/tree-ssa/ssa-fre-104.c properly XFAIL

2024-03-07 Thread Richard Biener via Gcc-cvs
https://gcc.gnu.org/g:0bd04d9ae2d5447fd11fa43db20371140e955eff

commit r14-9382-g0bd04d9ae2d5447fd11fa43db20371140e955eff
Author: Richard Biener 
Date:   Fri Mar 8 08:26:15 2024 +0100

testsuite/108355 - make gcc.dg/tree-ssa/ssa-fre-104.c properly XFAIL

The testcase only XFAILs on targets where int has an alignment
of sizeof(int).  Align the respective array this way to make it
XFAIL consistenlty.

PR testsuite/108355
* gcc.dg/tree-ssa/ssa-fre-104.c: Align e.

Diff:
---
 gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-104.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-104.c 
b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-104.c
index 425c32dd93c..52756bb7e40 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-104.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-104.c
@@ -8,7 +8,7 @@ int d;
 void bar25_(void);
 void foo(void);
 int main() {
-  int e[][1] = {0, 0, 0, 0, 0, 1};
+  int __attribute__((aligned(sizeof(int e[][1] = {0, 0, 0, 0, 0, 1};
   for (;;) {
 bar25_();
 /* We should optimistically treat a == 0 because of the bounds of


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

2024-03-07 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:39310cc7731a28cc7be4e7a5f5aa911fff9891ca

commit 39310cc7731a28cc7be4e7a5f5aa911fff9891ca
Author: Michael Meissner 
Date:   Fri Mar 8 01:52:08 2024 -0500

Update ChangeLog.*

Diff:
---
 gcc/ChangeLog.meissner | 119 +
 1 file changed, 31 insertions(+), 88 deletions(-)

diff --git a/gcc/ChangeLog.meissner b/gcc/ChangeLog.meissner
index 602c23aa17a..4ed95d0b991 100644
--- a/gcc/ChangeLog.meissner
+++ b/gcc/ChangeLog.meissner
@@ -1,108 +1,51 @@
- Branch work162, patch #7 
-
-Fix thinko
-
-2024-03-07  Michael Meissner  
-
-   * config/rs6000/rs6000.cc (rs6000_sched_reorder2): Fix thinko.
-
- Branch work162, patch #6 
-
-Add power11 to rs6000-string.cc
-
-2024-03-07  Michael Meissner  
-
-   * config/rs6000/rs6000-string.cc (expand_compare_loop): Add power11.
-
- Branch work162, patch #5 
-
-Allow configuration of power11
-
-2024-03-07  Michael Meissner  
-
-   * config.gcc (rs6000*-*-*, powerpc*-*-*): Allow configuration of
-   power11.
-
- Branch work162, patch #4 
-
-Reallow power11 2nd sched charges for sched pass one.
-
-2024-03-07  Michael Meissner  
-
-gcc/
-
-   * config/rs6000/rs6000.cc (rs6000_option_override_internal): Set power10
-   fusion if -mcpu=power11
-   (rs6000_sched_reorder2): Add power11 change.
-
- Branch work162, patch #3 
-
-Reallow power11 sched charges for sched pass one.
-
-2024-03-07  Michael Meissner  
-
-gcc/
-
-   * config/rs6000/rs6000.cc (rs6000_sched_reorder): Add power11 change.
-
- Branch work162, patch #2 
-
-Revert some changes.
-
-2024-03-07  Michael Meissner  
-
-gcc/
-
-   * config/rs6000/rs6000.cc (rs6000_sched_reorder): Revert changes.
-   (rs6000_sched_reorder2): Likewise.
-
- Branch work162, patch #1 
+ Branch work162, patch #11 
 
 Add -mcpu=power11 support.
 
-This patch adds support for -mcpu=power11.  At the current time, no new
-instructions are implemented.  The tuning for the power11 processor is exactly
-the same as for power10.
-
-If -mcpu=power11 is used, the macro _ARCH_PWR11 will be defined.
-
-In order to use -mcpu=power11, you will need an assembler that supports the
--mpower11 option.
-
-2024-02-29  Michael Meissner  
+2024-03-08  Michael Meissner  
 
 gcc/
 
-   * config.gcc (powerpc*-*-*, rs6000-*-*): Add support for the power11
-   processor.
-   * config/rs6000/aix71.h (ASM_CPU_SPEC): Likewise.
+   * 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.c (asm_names): Likewise.
-   * config/rs6000/rs6000-builtin.cc (cpu_is_info): Likewise.
+   * config/rs6000/driver-rs6000.cc (asm_names): Likewise.
+   * config/rs6000/power10.md (all reservations): Add power11 as an
+   alterntive to power10.
+   * 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 macro.
-   (POWERPC_MASKS): Add support for -mcpu=power11.
-   (power11 cpu): Add power11 cpu.
-   * config/rs6000/rs6000-opts.h (PROCESSOR_POWER11): New macro.
+   * config/rs6000/rs6000-cpus.def (ISA_POWER11_MASKS_SERVER): New define.
+   (POWERPC_MASKS): Add power11 isa bit.
+   (power11 cpu): Add power11 definition.
+   * rs6000-opts.h (PROCESSOR_POWER11): Add power11 processor.
* config/rs6000/rs6000-tables.opt: Regenerate.
-   * config/rs6000/rs6000.cc (rs6000_machine_from_flags): If -mcpu=power11,
-   emit .machine power11.
-   (rs6000_opt_masks): Add support for the power11 ISA bits.
-   * config/rs6000/rs6000.h (ASM_CPU_SPEC): Add support for the power11
-   processor.
-   * config/rs6000/rs6000.opt (-mpower11): New internal ISA bit for
-   power11 cpu.
-   * doc/invoke.texi (PowerPC options): Document -mcpu=power11.
+   * config/rs6000/rs6000.cc (power11_cost): Add power11 support.
+   (rs6000_option_override_internal): Likewise.
+   (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): 

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

2024-03-07 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:cc5432bc4c113635ea5f1289565becafa9f548e3

commit cc5432bc4c113635ea5f1289565becafa9f548e3
Author: Michael Meissner 
Date:   Fri Mar 8 01:50:56 2024 -0500

Add -mcpu=power11 support.

2024-03-08  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/power10.md (all reservations): Add power11 as an
alterntive to power10.
* 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.
* rs6000-opts.h (PROCESSOR_POWER11): Add power11 processor.
* config/rs6000/rs6000-tables.opt: Regenerate.
* config/rs6000/rs6000.cc (power11_cost): Add power11 support.
(rs6000_option_override_internal): Likewise.
(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.

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/config.gcc   |   5 +-
 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/power10.md | 142 +--
 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  |  50 --
 gcc/config/rs6000/rs6000.h   |   1 +
 gcc/config/rs6000/rs6000.md  |   2 +-
 gcc/config/rs6000/rs6000.opt |   3 +
 gcc/doc/invoke.texi  |   5 +-
 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 
 22 files changed, 206 insertions(+), 85 deletions(-)

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 624e0dae191..02004bee30b 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -531,7 +531,8 @@ 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
@@ -5558,7 +5559,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 

[gcc(refs/users/meissner/heads/work162)] Revert some changes

2024-03-07 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:799fc05a46ef574e0ab369103f71b59ee593d887

commit 799fc05a46ef574e0ab369103f71b59ee593d887
Author: Michael Meissner 
Date:   Fri Mar 8 01:42:13 2024 -0500

Revert some changes

Diff:
---
 gcc/config.gcc   |   5 +-
 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/power10.md | 142 +--
 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  |  50 ++
 gcc/config/rs6000/rs6000.h   |   1 -
 gcc/config/rs6000/rs6000.md  |   2 +-
 gcc/config/rs6000/rs6000.opt |   3 -
 gcc/doc/invoke.texi  |   5 +-
 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 
 22 files changed, 85 insertions(+), 206 deletions(-)

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 02004bee30b..624e0dae191 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -531,8 +531,7 @@ 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] \
-   | xpower1[01]|xpower6x|xrs64a|xcell|xa2|xe500mc64|xe5500|xe6500)
+   
xpowerpc64|xdefault64|x6[23]0|x970|xG5|xpower[3456789]|xpower10|xpower6x|xrs64a|xcell|xa2|xe500mc64|xe5500|xe6500)
cpu_is_64bit=yes
;;
esac
@@ -5559,7 +5558,7 @@ case "${target}" in
eval "with_$which=405"
;;
"" | common | native \
-   | power[3456789] | power1[01] | power5+ | power6x \
+   | power[3456789] | power10 | 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 41037b3852d..24bc301e37d 100644
--- a/gcc/config/rs6000/aix71.h
+++ b/gcc/config/rs6000/aix71.h
@@ -79,7 +79,6 @@ do {  
\
 #undef ASM_CPU_SPEC
 #define ASM_CPU_SPEC \
 "%{mcpu=native: %(asm_cpu_native); \
-  mcpu=power11: -mpwr11; \
   mcpu=power10: -mpwr10; \
   mcpu=power9: -mpwr9; \
   mcpu=power8: -mpwr8; \
diff --git a/gcc/config/rs6000/aix72.h b/gcc/config/rs6000/aix72.h
index fe59f8319b4..c43974f577a 100644
--- a/gcc/config/rs6000/aix72.h
+++ b/gcc/config/rs6000/aix72.h
@@ -79,7 +79,6 @@ do {  
\
 #undef ASM_CPU_SPEC
 #define ASM_CPU_SPEC \
 "%{mcpu=native: %(asm_cpu_native); \
-  mcpu=power11: -mpwr11; \
   mcpu=power10: -mpwr10; \
   mcpu=power9: -mpwr9; \
   mcpu=power8: -mpwr8; \
diff --git a/gcc/config/rs6000/aix73.h b/gcc/config/rs6000/aix73.h
index 1318b0b3662..b1572bde81f 100644
--- a/gcc/config/rs6000/aix73.h
+++ b/gcc/config/rs6000/aix73.h
@@ -79,7 +79,6 @@ do {  
\
 #undef ASM_CPU_SPEC
 #define ASM_CPU_SPEC \
 "%{mcpu=native: %(asm_cpu_native); \
-  mcpu=power11: -mpwr11; \
   mcpu=power10: -mpwr10; \
   mcpu=power9: -mpwr9; \
   mcpu=power8: -mpwr8; \
diff --git a/gcc/config/rs6000/driver-rs6000.cc 
b/gcc/config/rs6000/driver-rs6000.cc
index f4900724b98..3ebbaa42622 100644
--- a/gcc/config/rs6000/driver-rs6000.cc
+++ b/gcc/config/rs6000/driver-rs6000.cc
@@ -451,7 +451,6 @@ static const struct asm_name asm_names[] = {
   { "power8",  "-mpwr8" },
   { "power9",  "-mpwr9" },
   { "power10", "-mpwr10" },
-  { "power11", "-mpwr11" },
   { "powerpc", "-mppc" },
   { "rs64","-mppc" },
   { "603", "-m603" },
@@ -480,7 +479,6 @@ static const struct asm_name asm_names[] = {
   { "power8",  "-mpower8" },
   { "power9",  "-mpower9" },
   { "power10", "-mpower10" },
-  { "power11", "-mpower11" },
   { "a2",  "-ma2" },
   { "powerpc", "-mppc" },
   { "powerpc64", "-mppc64" },
diff --git a/gcc/config/rs6000/power10.md b/gcc/config/rs6000/power10.md
index 22851db3318..fcc2199ab29 100644
--- a/gcc/config/rs6000/power10.md
+++ b/gcc/config/rs6000/power10.md
@@ -97,12 +97,12 @@
(eq_attr "update" 

[gcc r14-9381] modula2: Add constant aggregate tests

2024-03-07 Thread Gaius Mulley via Gcc-cvs
https://gcc.gnu.org/g:131d1753ac71eb62f0b14fa9a1cb0e125e9a3ca1

commit r14-9381-g131d1753ac71eb62f0b14fa9a1cb0e125e9a3ca1
Author: Gaius Mulley 
Date:   Fri Mar 8 06:26:55 2024 +

modula2: Add constant aggregate tests

This patch adds four constant aggregate tests and assignment of
arrays by a constant in two different scopes.

gcc/testsuite/ChangeLog:

* gm2/iso/pass/arrayconst.mod: New test.
* gm2/iso/pass/arrayconst2.mod: New test.
* gm2/iso/pass/arrayconst3.mod: New test.
* gm2/iso/pass/arrayconst4.mod: New test.

Signed-off-by: Gaius Mulley 

Diff:
---
 gcc/testsuite/gm2/iso/pass/arrayconst.mod  | 31 ++
 gcc/testsuite/gm2/iso/pass/arrayconst2.mod | 31 ++
 gcc/testsuite/gm2/iso/pass/arrayconst3.mod | 35 ++
 gcc/testsuite/gm2/iso/pass/arrayconst4.mod | 35 ++
 4 files changed, 132 insertions(+)

diff --git a/gcc/testsuite/gm2/iso/pass/arrayconst.mod 
b/gcc/testsuite/gm2/iso/pass/arrayconst.mod
new file mode 100644
index 000..05ce4c911d1
--- /dev/null
+++ b/gcc/testsuite/gm2/iso/pass/arrayconst.mod
@@ -0,0 +1,31 @@
+MODULE arrayconst ;
+
+
+PROCEDURE foo ;
+TYPE
+   array = ARRAY [0..3] OF REAL ;
+CONST
+   value = array {1.0, 2.0, 3.0, 4.0} ;
+VAR
+   r: REAL ;
+BEGIN
+   r := value[1] ;
+END foo ;
+
+
+PROCEDURE bar ;
+TYPE
+   array = ARRAY [0..3] OF REAL ;
+CONST
+   value = array {5.0, 6.0, 7.0, 8.0} ;
+VAR
+   r: REAL ;
+BEGIN
+   r := value[1] ;
+END bar ;
+
+
+BEGIN
+   foo ;
+   bar
+END arrayconst.
diff --git a/gcc/testsuite/gm2/iso/pass/arrayconst2.mod 
b/gcc/testsuite/gm2/iso/pass/arrayconst2.mod
new file mode 100644
index 000..cee4b1457cb
--- /dev/null
+++ b/gcc/testsuite/gm2/iso/pass/arrayconst2.mod
@@ -0,0 +1,31 @@
+MODULE arrayconst ;
+
+
+PROCEDURE foo ;
+TYPE
+   array = ARRAY [0..3] OF REAL ;
+CONST
+   value = array {1.0, 2.0, 3.0, 4.0} ;
+VAR
+   c: array ;
+BEGIN
+   c := value
+END foo ;
+
+
+PROCEDURE bar ;
+TYPE
+   array = ARRAY [0..3] OF REAL ;
+CONST
+   value = array {5.0, 6.0, 7.0, 8.0} ;
+VAR
+   c: array ;
+BEGIN
+   c := value
+END bar ;
+
+
+BEGIN
+   foo ;
+   bar
+END arrayconst.
diff --git a/gcc/testsuite/gm2/iso/pass/arrayconst3.mod 
b/gcc/testsuite/gm2/iso/pass/arrayconst3.mod
new file mode 100644
index 000..0402e6f6bac
--- /dev/null
+++ b/gcc/testsuite/gm2/iso/pass/arrayconst3.mod
@@ -0,0 +1,35 @@
+MODULE arrayconst3 ;
+
+
+PROCEDURE foo ;
+CONST
+   len = 4 ;
+TYPE
+   array = ARRAY [0..len -1] OF REAL ;
+CONST
+   value = array {1.0, 2.0, 3.0, 4.0} ;
+VAR
+   r: REAL ;
+BEGIN
+   r := value[1] ;
+END foo ;
+
+
+PROCEDURE bar ;
+CONST
+   len = 2 ;
+TYPE
+   array = ARRAY [0..len -1] OF REAL ;
+CONST
+   value = array {5.0, 6.0} ;
+VAR
+   r: REAL ;
+BEGIN
+   r := value[1] ;
+END bar ;
+
+
+BEGIN
+   foo ;
+   bar
+END arrayconst3.
diff --git a/gcc/testsuite/gm2/iso/pass/arrayconst4.mod 
b/gcc/testsuite/gm2/iso/pass/arrayconst4.mod
new file mode 100644
index 000..0b14229cd8a
--- /dev/null
+++ b/gcc/testsuite/gm2/iso/pass/arrayconst4.mod
@@ -0,0 +1,35 @@
+MODULE arrayconst4 ;
+
+
+PROCEDURE foo ;
+CONST
+   len = 4 ;
+TYPE
+   array = ARRAY [0..len -1] OF REAL ;
+CONST
+   value = array {1.0, 2.0, 3.0, 4.0} ;
+VAR
+   c: array ;
+BEGIN
+   c := value
+END foo ;
+
+
+PROCEDURE bar ;
+CONST
+   len = 2 ;
+TYPE
+   array = ARRAY [0..len -1] OF REAL ;
+CONST
+   value = array {5.0, 6.0} ;
+VAR
+   c: array ;
+BEGIN
+   c := value
+END bar ;
+
+
+BEGIN
+   foo ;
+   bar
+END arrayconst4.


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

2024-03-07 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:9e3ef76042582fe1d2840a65aa0dfa5dfd5d028a

commit 9e3ef76042582fe1d2840a65aa0dfa5dfd5d028a
Author: Michael Meissner 
Date:   Thu Mar 7 22:26:52 2024 -0500

Update ChangeLog.*

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

diff --git a/gcc/ChangeLog.meissner b/gcc/ChangeLog.meissner
index c6a81c391cd..602c23aa17a 100644
--- a/gcc/ChangeLog.meissner
+++ b/gcc/ChangeLog.meissner
@@ -1,3 +1,11 @@
+ Branch work162, patch #7 
+
+Fix thinko
+
+2024-03-07  Michael Meissner  
+
+   * config/rs6000/rs6000.cc (rs6000_sched_reorder2): Fix thinko.
+
  Branch work162, patch #6 
 
 Add power11 to rs6000-string.cc


[gcc(refs/users/meissner/heads/work162)] Fix thinko

2024-03-07 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:1153585d8cc18cdc945cd8c92041a1d3aee0186a

commit 1153585d8cc18cdc945cd8c92041a1d3aee0186a
Author: Michael Meissner 
Date:   Thu Mar 7 22:25:17 2024 -0500

Fix thinko

2024-03-07  Michael Meissner  

* config/rs6000/rs6000.cc (rs6000_sched_reorder2): Fix thinko.

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

diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index c980d94d84a..5380dce7a07 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -19598,6 +19598,7 @@ rs6000_sched_reorder2 (FILE *dump, int sched_verbose, 
rtx_insn **ready,
   if (last_scheduled_insn
   && (rs6000_tune == PROCESSOR_POWER10
  || rs6000_tune == PROCESSOR_POWER11))
+return power10_sched_reorder (ready, *pn_ready - 1);
 
   return cached_can_issue_more;
 }


[gcc r14-9380] RISC-V: Fix ICE in riscv vector costs

2024-03-07 Thread Demin Han via Gcc-cvs
https://gcc.gnu.org/g:42187c6968af9907de1f9b7563d87de739857684

commit r14-9380-g42187c6968af9907de1f9b7563d87de739857684
Author: demin.han 
Date:   Wed Mar 6 17:34:34 2024 +0800

RISC-V: Fix ICE in riscv vector costs

The following code can result in ICE:
-march=rv64gcv --param riscv-autovec-lmul=dynamic -O3

char *jpeg_difference7_input_buf;
void jpeg_difference7(int *diff_buf) {
  unsigned width;
  int samp, Rb;
  while (--width) {
Rb = samp = *jpeg_difference7_input_buf;
*diff_buf++ = -(int)(samp + (long)Rb >> 1);
  }
}

One biggest_mode update missed in one branch and trigger assertion fail.
gcc_assert (biggest_size >= mode_size);

Tested On RV64 and no regression.

PR target/114264

gcc/ChangeLog:

* config/riscv/riscv-vector-costs.cc: Fix ICE

gcc/testsuite/ChangeLog:

* gcc.dg/vect/costmodel/riscv/rvv/pr114264.c: New test.

Signed-off-by: demin.han 

Diff:
---
 gcc/config/riscv/riscv-vector-costs.cc   |  2 ++
 gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/pr114264.c | 15 +++
 2 files changed, 17 insertions(+)

diff --git a/gcc/config/riscv/riscv-vector-costs.cc 
b/gcc/config/riscv/riscv-vector-costs.cc
index adf9c197df5..5ac8655b4d8 100644
--- a/gcc/config/riscv/riscv-vector-costs.cc
+++ b/gcc/config/riscv/riscv-vector-costs.cc
@@ -414,6 +414,8 @@ compute_local_live_ranges (
  auto *r = get_live_range (live_ranges, arg);
  gcc_assert (r);
  (*r).second = MAX (point, (*r).second);
+ biggest_mode = get_biggest_mode (
+   biggest_mode, TYPE_MODE (TREE_TYPE (arg)));
}
}
  else
diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/pr114264.c 
b/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/pr114264.c
new file mode 100644
index 000..7853f292af7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/pr114264.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gcv -mabi=lp64d -O3 -ftree-vectorize 
--param=riscv-autovec-lmul=dynamic" } */
+
+char *jpeg_difference7_input_buf;
+void
+jpeg_difference7 (int *diff_buf)
+{
+  unsigned width;
+  int samp, Rb;
+  while (--width)
+{
+  Rb = samp = *jpeg_difference7_input_buf;
+  *diff_buf++ = -(int) (samp + (long) Rb >> 1);
+}
+}


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

2024-03-07 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:a6d56748ed376f22b51a85bcb792b311ddae9faa

commit a6d56748ed376f22b51a85bcb792b311ddae9faa
Author: Michael Meissner 
Date:   Thu Mar 7 21:21:07 2024 -0500

Update ChangeLog.*

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

diff --git a/gcc/ChangeLog.meissner b/gcc/ChangeLog.meissner
index ed35ebfc472..c6a81c391cd 100644
--- a/gcc/ChangeLog.meissner
+++ b/gcc/ChangeLog.meissner
@@ -1,3 +1,11 @@
+ Branch work162, patch #6 
+
+Add power11 to rs6000-string.cc
+
+2024-03-07  Michael Meissner  
+
+   * config/rs6000/rs6000-string.cc (expand_compare_loop): Add power11.
+
  Branch work162, patch #5 
 
 Allow configuration of power11


[gcc(refs/users/meissner/heads/work162)] Add power11 to rs6000-string.cc

2024-03-07 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:c7f6d4b8612845aee842a1fd29c6fc788aafd63d

commit c7f6d4b8612845aee842a1fd29c6fc788aafd63d
Author: Michael Meissner 
Date:   Thu Mar 7 21:19:56 2024 -0500

Add power11 to rs6000-string.cc

2024-03-07  Michael Meissner  

* config/rs6000/rs6000-string.cc (expand_compare_loop): Add power11.

Diff:
---
 gcc/config/rs6000/rs6000-string.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/config/rs6000/rs6000-string.cc 
b/gcc/config/rs6000/rs6000-string.cc
index 917f5572a6d..9c8a81172e3 100644
--- a/gcc/config/rs6000/rs6000-string.cc
+++ b/gcc/config/rs6000/rs6000-string.cc
@@ -964,6 +964,7 @@ expand_compare_loop (rtx operands[])
   break;
 case PROCESSOR_POWER9:
 case PROCESSOR_POWER10:
+case PROCESSOR_POWER11:
   if (bytes_is_const)
max_bytes = 191;
   else


[gcc r14-9379] fwprop: Avoid volatile rtx to be propagated

2024-03-07 Thread HaoChen Gui via Gcc-cvs
https://gcc.gnu.org/g:a0e945888d973fc1a4a9d2944aa7e96d2a4d7581

commit r14-9379-ga0e945888d973fc1a4a9d2944aa7e96d2a4d7581
Author: Haochen Gui 
Date:   Fri Mar 8 09:30:35 2024 +0800

fwprop: Avoid volatile rtx to be propagated

The patch for PR111267 (commit id 86de9b66480b710202a2898cf513db105d8c432f)
which introduces an exception for propagation on single set insn.  The
propagation which might not be profitable (checked by profitable_p) is still
allowed to be propagated to single set insn.  It has a potential problem
that a volatile operand might be propagated to a singel set insn.  If the
define insn is not eliminated after propagation, the volatile operand will
be executed for multiple times.  This patch fixes the problem by skipping
volatile set source rtx in propagation.

gcc/
* fwprop.cc (forward_propagate_into): Return false for volatile set
source rtx.

gcc/testsuite/
* gcc.target/powerpc/fwprop-1.c: New.

Diff:
---
 gcc/fwprop.cc   |  2 ++
 gcc/testsuite/gcc.target/powerpc/fwprop-1.c | 15 +++
 2 files changed, 17 insertions(+)

diff --git a/gcc/fwprop.cc b/gcc/fwprop.cc
index 7872609b336..cb6fd6700ca 100644
--- a/gcc/fwprop.cc
+++ b/gcc/fwprop.cc
@@ -854,6 +854,8 @@ forward_propagate_into (use_info *use, bool reg_prop_only = 
false)
 
   rtx dest = SET_DEST (def_set);
   rtx src = SET_SRC (def_set);
+  if (volatile_refs_p (src))
+return false;
 
   /* Allow propagations into a loop only for reg-to-reg copies, since
  replacing one register by another shouldn't increase the cost.
diff --git a/gcc/testsuite/gcc.target/powerpc/fwprop-1.c 
b/gcc/testsuite/gcc.target/powerpc/fwprop-1.c
new file mode 100644
index 000..07b207f980c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/fwprop-1.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fdump-rtl-fwprop1-details" } */
+/* { dg-final { scan-rtl-dump-not "propagating insn" "fwprop1" } } */
+
+/* Verify that volatile asm operands doesn't try to be propagated.  */
+long long foo ()
+{
+  long long res;
+  __asm__ __volatile__(
+""
+  : "=r" (res)
+  :
+  : "memory");
+  return res;
+}


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

2024-03-07 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:d6d22a477badc9432624c0acd56800b92b52

commit d6d22a477badc9432624c0acd56800b92b52
Author: Michael Meissner 
Date:   Thu Mar 7 20:03:52 2024 -0500

Update ChangeLog.*

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

diff --git a/gcc/ChangeLog.meissner b/gcc/ChangeLog.meissner
index 66c4a0ec58e..ed35ebfc472 100644
--- a/gcc/ChangeLog.meissner
+++ b/gcc/ChangeLog.meissner
@@ -1,3 +1,24 @@
+ Branch work162, patch #5 
+
+Allow configuration of power11
+
+2024-03-07  Michael Meissner  
+
+   * config.gcc (rs6000*-*-*, powerpc*-*-*): Allow configuration of
+   power11.
+
+ Branch work162, patch #4 
+
+Reallow power11 2nd sched charges for sched pass one.
+
+2024-03-07  Michael Meissner  
+
+gcc/
+
+   * config/rs6000/rs6000.cc (rs6000_option_override_internal): Set power10
+   fusion if -mcpu=power11
+   (rs6000_sched_reorder2): Add power11 change.
+
  Branch work162, patch #3 
 
 Reallow power11 sched charges for sched pass one.


[gcc(refs/users/meissner/heads/work162)] Allow configuration of power11

2024-03-07 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:e94d4f5d5766aac50fe01f85192adbc3b9d47107

commit e94d4f5d5766aac50fe01f85192adbc3b9d47107
Author: Michael Meissner 
Date:   Thu Mar 7 20:02:30 2024 -0500

Allow configuration of power11

2024-03-07  Michael Meissner  

* config.gcc (rs6000*-*-*, powerpc*-*-*): Allow configuration of
power11.

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

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 624e0dae191..02004bee30b 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -531,7 +531,8 @@ 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
@@ -5558,7 +5559,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 \


[gcc(refs/users/meissner/heads/work162)] Reallow power11 2nd sched charges for sched pass one.

2024-03-07 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:367973168e05868aa68e838ed6aac32442d8717b

commit 367973168e05868aa68e838ed6aac32442d8717b
Author: Michael Meissner 
Date:   Thu Mar 7 19:55:39 2024 -0500

Reallow power11 2nd sched charges for sched pass one.

2024-03-07  Michael Meissner  

gcc/

* config/rs6000/rs6000.cc (rs6000_option_override_internal): Set 
power10
fusion if -mcpu=power11
(rs6000_sched_reorder2): Add power11 change.

Diff:
---
 gcc/config/rs6000/rs6000.cc | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index 62f94695c1d..c980d94d84a 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -4399,7 +4399,8 @@ rs6000_option_override_internal (bool global_init_p)
  generating power10 instructions.  */
   if (!(rs6000_isa_flags_explicit & OPTION_MASK_P10_FUSION))
 {
-  if (rs6000_tune == PROCESSOR_POWER10)
+  if (rs6000_tune == PROCESSOR_POWER10
+ || rs6000_tune == PROCESSOR_POWER11)
rs6000_isa_flags |= OPTION_MASK_P10_FUSION;
   else
rs6000_isa_flags &= ~OPTION_MASK_P10_FUSION;
@@ -19594,9 +19595,9 @@ rs6000_sched_reorder2 (FILE *dump, int sched_verbose, 
rtx_insn **ready,
   && recog_memoized (last_scheduled_insn) >= 0)
 return power9_sched_reorder2 (ready, *pn_ready - 1);
 
-  /* Do Power10 dependent reordering.  */
-  if (rs6000_tune == PROCESSOR_POWER10 && last_scheduled_insn)
-return power10_sched_reorder (ready, *pn_ready - 1);
+  if (last_scheduled_insn
+  && (rs6000_tune == PROCESSOR_POWER10
+ || rs6000_tune == PROCESSOR_POWER11))
 
   return cached_can_issue_more;
 }


[gcc r13-8411] libgfortran: [PR105473] Fix checks for decimal='comma'.

2024-03-07 Thread Jerry DeLisle via Gcc-cvs
https://gcc.gnu.org/g:7ecea49245bc6aeb6c889a4914961f94417f16e5

commit r13-8411-g7ecea49245bc6aeb6c889a4914961f94417f16e5
Author: Jerry DeLisle 
Date:   Sat Feb 17 09:24:58 2024 -0800

libgfortran: [PR105473] Fix checks for decimal='comma'.

PR libfortran/105473

libgfortran/ChangeLog:

* io/list_read.c (eat_separator): Reject comma as a
separator when it is being used as a decimal point.
(parse_real): Reject a '.' when it should be a comma.
(read_real): Likewise.
* io/read.c (read_f): Add more checks for ',' and '.'
conditions.

gcc/testsuite/ChangeLog:

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

(cherry picked from commit a71d87431d0c4e04a402ef6566be090c470b2b53)

Diff:
---
 gcc/testsuite/gfortran.dg/pr105473.f90 | 46 
 libgfortran/io/list_read.c | 48 --
 libgfortran/io/read.c  | 11 +++-
 3 files changed, 96 insertions(+), 9 deletions(-)

diff --git a/gcc/testsuite/gfortran.dg/pr105473.f90 
b/gcc/testsuite/gfortran.dg/pr105473.f90
new file mode 100644
index 000..b309217540d
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr105473.f90
@@ -0,0 +1,46 @@
+! { dg-do run }
+! PR libgfortran/105473
+  implicit none
+  integer n,m,ios
+  real r
+  complex z
+  character(40):: testinput
+  n = 999; m = 777; r=1.2345
+  z = cmplx(0.0,0.0)
+
+! Check that semi-colon is not allowed as separator with decimal=point.
+  ios=0
+  testinput = '1;17;3.14159'
+  read(testinput,*,decimal='point',iostat=ios) n, m, r
+  if (ios /= 5010) print *, "stop 1"
+
+! Check that comma is not allowed as a separator with decimal=comma.
+  ios=0
+  testinput = '1,17,3,14159'
+  read(testinput,*,decimal='comma',iostat=ios) n, m, r
+  if (ios /= 5010) print *, "stop 2"
+
+! Check a good read.
+  ios=99
+  testinput = '1;17;3,14159'
+  read(testinput,*,decimal='comma',iostat=ios) n, m, r
+  if (ios /= 0) print *, "stop 3"
+
+! Check that comma is not allowed as a separator with decimal=comma.
+  ios=99; z = cmplx(0.0,0.0)
+  testinput = '1,17, (3,14159, 1,7182)'
+  read(testinput,*,decimal='comma', iostat=ios) n, m, z
+  if (ios /= 5010) stop 4
+
+! Check that semi-colon is not allowed as separator with decimal=point.
+  ios=99; z = cmplx(0.0,0.0)
+  testinput = '1,17; (3.14159; 1.7182)'
+  read(testinput,*,decimal='point', iostat=ios) n, m, z
+  if (ios /= 5010) stop 5
+
+! Check a good read.
+  ios=99;z = cmplx(0.0,0.0)
+  testinput = '1;17; (3,14159; 1,7182)'
+  read(testinput,*,decimal='comma', iostat=ios) n, m, z
+  if (ios /= 0) stop 6
+end program
diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c
index 109313c15b1..6ae8de548bb 100644
--- a/libgfortran/io/list_read.c
+++ b/libgfortran/io/list_read.c
@@ -475,11 +475,23 @@ eat_separator (st_parameter_dt *dtp)
 case ',':
   if (dtp->u.p.current_unit->decimal_status == DECIMAL_COMMA)
{
+ generate_error (>common, LIBERROR_READ_VALUE,
+  "Comma not allowed as separator with DECIMAL='comma'");
  unget_char (dtp, c);
  break;
}
-  /* Fall through.  */
+  dtp->u.p.comma_flag = 1;
+  eat_spaces (dtp);
+  break;
+
 case ';':
+  if (dtp->u.p.current_unit->decimal_status == DECIMAL_POINT)
+   {
+ generate_error (>common, LIBERROR_READ_VALUE,
+  "Semicolon not allowed as separator with DECIMAL='point'");
+ unget_char (dtp, c);
+ break;
+   }
   dtp->u.p.comma_flag = 1;
   eat_spaces (dtp);
   break;
@@ -1318,8 +1330,13 @@ parse_real (st_parameter_dt *dtp, void *buffer, int 
length)
 {
   if ((c = next_char (dtp)) == EOF)
goto bad;
-  if (c == ',' && dtp->u.p.current_unit->decimal_status == DECIMAL_COMMA)
-   c = '.';
+  if (dtp->u.p.current_unit->decimal_status == DECIMAL_COMMA)
+   {
+ if (c == '.')
+   goto bad;
+ if (c == ',')
+   c = '.';
+   }
   switch (c)
{
CASE_DIGITS:
@@ -1628,8 +1645,18 @@ read_real (st_parameter_dt *dtp, void *dest, int length)
   seen_dp = 0;
 
   c = next_char (dtp);
-  if (c == ',' && dtp->u.p.current_unit->decimal_status == DECIMAL_COMMA)
-c = '.';
+  if (dtp->u.p.current_unit->decimal_status == DECIMAL_COMMA)
+{
+  if (c == '.')
+   goto bad_real;
+  if (c == ',')
+   c = '.';
+}
+  if (dtp->u.p.current_unit->decimal_status == DECIMAL_POINT)
+{
+  if (c == ';')
+   goto bad_real;
+}
   switch (c)
 {
 CASE_DIGITS:
@@ -1669,8 +1696,13 @@ read_real (st_parameter_dt *dtp, void *dest, int length)
   for (;;)
 {
   c = next_char (dtp);
-  if (c == ',' && dtp->u.p.current_unit->decimal_status == DECIMAL_COMMA)
-   c = '.';
+  if (dtp->u.p.current_unit->decimal_status == DECIMAL_COMMA)
+   {
+ if (c == '.')
+   goto 

[gcc r14-9377] libstdc++: Use std::from_chars to speed up parsing subsecond durations

2024-03-07 Thread Jonathan Wakely via Libstdc++-cvs
https://gcc.gnu.org/g:715127b63d19ed3b9a92d3e5f5007b36cc9834dd

commit r14-9377-g715127b63d19ed3b9a92d3e5f5007b36cc9834dd
Author: Jonathan Wakely 
Date:   Thu Mar 7 13:47:46 2024 +

libstdc++: Use std::from_chars to speed up parsing subsecond durations

With std::from_chars we can parse subsecond durations much faster than
with std::num_get, as shown in the microbenchmarks below. We were using
std::num_get and std::numpunct in order to parse a number with the
locale's decimal point character. But we copy the chars from the input
stream into a new buffer anyway, so we can replace the locale's decimal
point with '.' in that buffer, and then we can use std::from_chars on
it.

BenchmarkTime CPU   Iterations
--
from_chars_millisec158 ns  158 ns  4524046
num_get_millisec   192 ns  192 ns  3644626
from_chars_microsec164 ns  163 ns  4330627
num_get_microsec   205 ns  205 ns  3413452
from_chars_nanosec 173 ns  173 ns  4072653
num_get_nanosec227 ns  227 ns  3105161

libstdc++-v3/ChangeLog:

* include/bits/chrono_io.h (_Parser::operator()): Use
std::from_chars to parse fractional seconds.

Diff:
---
 libstdc++-v3/include/bits/chrono_io.h | 28 ++--
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/libstdc++-v3/include/bits/chrono_io.h 
b/libstdc++-v3/include/bits/chrono_io.h
index b8f0657bee9..412e8b83fb7 100644
--- a/libstdc++-v3/include/bits/chrono_io.h
+++ b/libstdc++-v3/include/bits/chrono_io.h
@@ -37,6 +37,7 @@
 #include  // ostringstream
 #include  // setw, setfill
 #include 
+#include  // from_chars
 
 #include 
 
@@ -3597,13 +3598,17 @@ namespace __detail
__err |= ios_base::eofbit;
  else
{
- auto& __np = use_facet>(__loc);
- auto __dp = __np.decimal_point();
+ _CharT __dp = '.';
+ if (__loc != locale::classic())
+   {
+ auto& __np = use_facet>(__loc);
+ __dp = __np.decimal_point();
+   }
  _CharT __c = _Traits::to_char_type(__i);
  if (__c == __dp)
{
  (void) __is.get();
- __buf.put(__c);
+ __buf.put('.');
  int __prec
= hh_mm_ss<_Duration>::fractional_width;
  do
@@ -3618,14 +3623,17 @@ namespace __detail
}
}
 
- if (!__is_failed(__err))
+ if (!__is_failed(__err)) [[likely]]
{
- auto& __ng = use_facet>(__loc);
- long double __val;
- ios_base::iostate __err2{};
- __ng.get(__buf, {}, __buf, __err2, __val);
- if (__is_failed(__err2)) [[unlikely]]
-   __err |= __err2;
+ long double __val{};
+ string __str = std::move(__buf).str();
+ auto __first = __str.data();
+ auto __last = __first + __str.size();
+ using enum chars_format;
+ auto [ptr, ec] = std::from_chars(__first, __last,
+  __val, fixed);
+ if ((bool)ec || ptr != __last) [[unlikely]]
+   __err |= ios_base::failbit;
  else
{
  duration __fs(__val);


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

2024-03-07 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:654bc8fc9b5af099824f3a27e8a1ec35bc95a4e4

commit 654bc8fc9b5af099824f3a27e8a1ec35bc95a4e4
Author: Michael Meissner 
Date:   Thu Mar 7 18:50:14 2024 -0500

Update ChangeLog.*

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

diff --git a/gcc/ChangeLog.meissner b/gcc/ChangeLog.meissner
index 36030613b23..66c4a0ec58e 100644
--- a/gcc/ChangeLog.meissner
+++ b/gcc/ChangeLog.meissner
@@ -1,4 +1,14 @@
- Branch work162, patch #1 
+ Branch work162, patch #3 
+
+Reallow power11 sched charges for sched pass one.
+
+2024-03-07  Michael Meissner  
+
+gcc/
+
+   * config/rs6000/rs6000.cc (rs6000_sched_reorder): Add power11 change.
+
+ Branch work162, patch #2 
 
 Revert some changes.


[gcc(refs/users/meissner/heads/work162)] Reallow power11 sched charges for sched pass one.

2024-03-07 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:4b97e79eb4527af687eb304851d6d2373a642eae

commit 4b97e79eb4527af687eb304851d6d2373a642eae
Author: Michael Meissner 
Date:   Thu Mar 7 18:49:17 2024 -0500

Reallow power11 sched charges for sched pass one.

2024-03-07  Michael Meissner  

gcc/

* config/rs6000/rs6000.cc (rs6000_sched_reorder): Add power11 
change.

Diff:
---
 gcc/config/rs6000/rs6000.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index c653763923f..62f94695c1d 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -19568,7 +19568,9 @@ rs6000_sched_reorder (FILE *dump ATTRIBUTE_UNUSED, int 
sched_verbose,
 load_store_pendulum = 0;
 
   /* Do Power10 dependent reordering.  */
-  if (rs6000_tune == PROCESSOR_POWER10 && last_scheduled_insn)
+  if (last_scheduled_insn
+  && (rs6000_tune == PROCESSOR_POWER10
+ || rs6000_tune == PROCESSOR_POWER11))
 power10_sched_reorder (ready, n_ready - 1);
 
   return rs6000_issue_rate ();


[gcc r14-9376] libstdc++: Fix parsing of fractional seconds [PR114244]

2024-03-07 Thread Jonathan Wakely via Libstdc++-cvs
https://gcc.gnu.org/g:5f9d7a5b6cf64639274e63051caf70fbc8418ea2

commit r14-9376-g5f9d7a5b6cf64639274e63051caf70fbc8418ea2
Author: Jonathan Wakely 
Date:   Thu Mar 7 13:15:41 2024 +

libstdc++: Fix parsing of fractional seconds [PR114244]

When converting a chrono::duration to a result type with an
integer representation we should use chrono::round<_Duration> so that we
don't truncate towards zero. Rounding ensures that e.g. 0.001999s
becomes 2ms not 1ms.

We can also remove some redundant uses of chrono::duration_cast to
convert from seconds to _Duration, because the _Parser class template
requires _Duration type to be able to represent seconds without loss of
precision.

This also fixes a bug where no fractional part would be parsed for
chrono::duration because its period is ratio<1>. We should
also consider treat_as_floating_point when deciding whether to skip
reading a fractional part.

libstdc++-v3/ChangeLog:

PR libstdc++/114244
* include/bits/chrono_io.h (_Parser::operator()): Remove
redundant uses of duration_cast. Use chrono::round to convert
long double value to durations with integer representations.
Check represenation type when deciding whether to skip parsing
fractional seconds.
* testsuite/20_util/duration/114244.cc: New test.
* testsuite/20_util/duration/io.cc: Check that a floating-point
duration with ratio<1> precision can be parsed.

Diff:
---
 libstdc++-v3/include/bits/chrono_io.h | 18 
 libstdc++-v3/testsuite/20_util/duration/114244.cc | 36 +++
 libstdc++-v3/testsuite/20_util/duration/io.cc | 12 
 3 files changed, 60 insertions(+), 6 deletions(-)

diff --git a/libstdc++-v3/include/bits/chrono_io.h 
b/libstdc++-v3/include/bits/chrono_io.h
index 82f2d39ec44..b8f0657bee9 100644
--- a/libstdc++-v3/include/bits/chrono_io.h
+++ b/libstdc++-v3/include/bits/chrono_io.h
@@ -3113,6 +3113,9 @@ namespace __detail
  unsigned __num = 0; // Non-zero for N modifier.
  bool __is_flag = false; // True if we're processing a % flag.
 
+ constexpr bool __is_floating
+   = treat_as_floating_point_v;
+
  // If an out-of-range value is extracted (e.g. 61min for %M),
  // do not set failbit immediately because we might not need it
  // (e.g. parsing chrono::year doesn't care about invalid %M values).
@@ -3195,7 +3198,7 @@ namespace __detail
  __d = day(__tm.tm_mday);
  __h = hours(__tm.tm_hour);
  __min = minutes(__tm.tm_min);
- __s = duration_cast<_Duration>(seconds(__tm.tm_sec));
+ __s = seconds(__tm.tm_sec);
}
}
  __parts |= _ChronoParts::_DateTime;
@@ -3564,8 +3567,8 @@ namespace __detail
  if (!__is_failed(__err))
__s = seconds(__tm.tm_sec);
}
- else if constexpr (ratio_equal_v>)
+ else if constexpr (_Duration::period::den == 1
+  && !__is_floating)
{
  auto __val = __read_unsigned(__num ? __num : 2);
  if (0 <= __val && __val <= 59) [[likely]]
@@ -3577,7 +3580,7 @@ namespace __detail
  break;
}
}
- else
+ else // Read fractional seconds
{
  basic_stringstream<_CharT> __buf;
  auto __digit = _S_try_read_digit(__is, __err);
@@ -3626,7 +3629,10 @@ namespace __detail
  else
{
  duration __fs(__val);
- __s = duration_cast<_Duration>(__fs);
+ if constexpr (__is_floating)
+   __s = __fs;
+ else
+   __s = chrono::round<_Duration>(__fs);
}
}
}
@@ -3737,7 +3743,7 @@ namespace __detail
{
  __h = hours(__tm.tm_hour);
  __min = minutes(__tm.tm_min);
- __s = duration_cast<_Duration>(seconds(__tm.tm_sec));
+ __s = seconds(__tm.tm_sec);
}
}
  __parts |= _ChronoParts::_TimeOfDay;
diff --git a/libstdc++-v3/testsuite/20_util/duration/114244.cc 
b/libstdc++-v3/testsuite/20_util/duration/114244.cc
new file mode 100644
index 000..55a7670522a
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/duration/114244.cc
@@ -0,0 +1,36 @@
+// { dg-do 

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

2024-03-07 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:f03992d06623104510e06632936d4c212bc34d2a

commit f03992d06623104510e06632936d4c212bc34d2a
Author: Michael Meissner 
Date:   Thu Mar 7 17:58:51 2024 -0500

Update ChangeLog.*

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

diff --git a/gcc/ChangeLog.meissner b/gcc/ChangeLog.meissner
index bf6f79d1721..36030613b23 100644
--- a/gcc/ChangeLog.meissner
+++ b/gcc/ChangeLog.meissner
@@ -1,5 +1,16 @@
  Branch work162, patch #1 
 
+Revert some changes.
+
+2024-03-07  Michael Meissner  
+
+gcc/
+
+   * config/rs6000/rs6000.cc (rs6000_sched_reorder): Revert changes.
+   (rs6000_sched_reorder2): Likewise.
+
+ Branch work162, patch #1 
+
 Add -mcpu=power11 support.
 
 This patch adds support for -mcpu=power11.  At the current time, no new


[gcc(refs/users/meissner/heads/work162)] Revert some changes

2024-03-07 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:e6c7ed948016293942b95f9a97461b6568998fa1

commit e6c7ed948016293942b95f9a97461b6568998fa1
Author: Michael Meissner 
Date:   Thu Mar 7 17:56:19 2024 -0500

Revert some changes

Diff:
---
 gcc/config/rs6000/rs6000.cc | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index d8c1c188d73..c653763923f 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -19568,9 +19568,7 @@ rs6000_sched_reorder (FILE *dump ATTRIBUTE_UNUSED, int 
sched_verbose,
 load_store_pendulum = 0;
 
   /* Do Power10 dependent reordering.  */
-  if (last_scheduled_insn
-  && (rs6000_tune == PROCESSOR_POWER10
- || rs6000_tune == PROCESSOR_POWER11))
+  if (rs6000_tune == PROCESSOR_POWER10 && last_scheduled_insn)
 power10_sched_reorder (ready, n_ready - 1);
 
   return rs6000_issue_rate ();
@@ -19594,9 +19592,9 @@ rs6000_sched_reorder2 (FILE *dump, int sched_verbose, 
rtx_insn **ready,
   && recog_memoized (last_scheduled_insn) >= 0)
 return power9_sched_reorder2 (ready, *pn_ready - 1);
 
-  if (last_scheduled_insn
-  && (rs6000_tune == PROCESSOR_POWER10
- || rs6000_tune == PROCESSOR_POWER11))
+  /* Do Power10 dependent reordering.  */
+  if (rs6000_tune == PROCESSOR_POWER10 && last_scheduled_insn)
+return power10_sched_reorder (ready, *pn_ready - 1);
 
   return cached_can_issue_more;
 }


[gcc r14-9375] c++: Redetermine whether to write vtables on stream-in [PR114229]

2024-03-07 Thread Nathaniel Shead via Gcc-cvs
https://gcc.gnu.org/g:9ccd03dee4c35a24c6699a58a7251a5277a91cf5

commit r14-9375-g9ccd03dee4c35a24c6699a58a7251a5277a91cf5
Author: Nathaniel Shead 
Date:   Thu Mar 7 23:09:03 2024 +1100

c++: Redetermine whether to write vtables on stream-in [PR114229]

We currently always stream DECL_INTERFACE_KNOWN, which is needed since
many kinds of declarations already have their interface determined at
parse time.  But for vtables and type-info declarations we need to
re-evaluate on stream-in as whether they need to be emitted or not
changes in each TU, so this patch clears DECL_INTERFACE_KNOWN on these
kinds of declarations so that they can go through 'import_export_decl'
again.

Note that the precise details of the virt-2 tests will need to change
when we implement the resolution of [1], for now I just updated the test
to not fail with the new (current) semantics.

[1]: https://github.com/itanium-cxx-abi/cxx-abi/pull/171

PR c++/114229

gcc/cp/ChangeLog:

* module.cc (trees_out::core_bools): Redetermine
DECL_INTERFACE_KNOWN on stream-in for vtables and tinfo.
* decl2.cc (import_export_decl): Add fixme for ABI changes with
module vtables and tinfo.

gcc/testsuite/ChangeLog:

* g++.dg/modules/virt-2_b.C: Update test to acknowledge that we
now emit vtables here too.
* g++.dg/modules/virt-3_a.C: New test.
* g++.dg/modules/virt-3_b.C: New test.
* g++.dg/modules/virt-3_c.C: New test.
* g++.dg/modules/virt-3_d.C: New test.

Signed-off-by: Nathaniel Shead 

Diff:
---
 gcc/cp/decl2.cc |  4 
 gcc/cp/module.cc| 12 +++-
 gcc/testsuite/g++.dg/modules/virt-2_b.C |  5 ++---
 gcc/testsuite/g++.dg/modules/virt-3_a.C |  9 +
 gcc/testsuite/g++.dg/modules/virt-3_b.C |  6 ++
 gcc/testsuite/g++.dg/modules/virt-3_c.C |  3 +++
 gcc/testsuite/g++.dg/modules/virt-3_d.C |  7 +++
 7 files changed, 42 insertions(+), 4 deletions(-)

diff --git a/gcc/cp/decl2.cc b/gcc/cp/decl2.cc
index 1dddbaab38b..6c9fd415d40 100644
--- a/gcc/cp/decl2.cc
+++ b/gcc/cp/decl2.cc
@@ -3398,6 +3398,10 @@ import_export_decl (tree decl)
  unit.  */
   import_p = false;
 
+  /* FIXME: Since https://github.com/itanium-cxx-abi/cxx-abi/pull/171,
+ the ABI specifies that classes attached to named modules should
+ have their vtables uniquely emitted in the object for the module
+ unit in which it is defined.  And similarly for RTTI structures.  */
   if (VAR_P (decl) && DECL_VTABLE_OR_VTT_P (decl))
 {
   class_type = DECL_CONTEXT (decl);
diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc
index 53104753737..99055523d91 100644
--- a/gcc/cp/module.cc
+++ b/gcc/cp/module.cc
@@ -5376,7 +5376,17 @@ trees_out::core_bools (tree t)
   WB (t->decl_common.lang_flag_2);
   WB (t->decl_common.lang_flag_3);
   WB (t->decl_common.lang_flag_4);
-  WB (t->decl_common.lang_flag_5);
+
+  {
+   /* This is DECL_INTERFACE_KNOWN: We should redetermine whether
+  we need to import or export any vtables or typeinfo objects
+  on stream-in.  */
+   bool interface_known = t->decl_common.lang_flag_5;
+   if (VAR_P (t) && (DECL_VTABLE_OR_VTT_P (t) || DECL_TINFO_P (t)))
+ interface_known = false;
+   WB (interface_known);
+  }
+
   WB (t->decl_common.lang_flag_6);
   WB (t->decl_common.lang_flag_7);
   WB (t->decl_common.lang_flag_8);
diff --git a/gcc/testsuite/g++.dg/modules/virt-2_b.C 
b/gcc/testsuite/g++.dg/modules/virt-2_b.C
index e041f0721f9..2bc5eced013 100644
--- a/gcc/testsuite/g++.dg/modules/virt-2_b.C
+++ b/gcc/testsuite/g++.dg/modules/virt-2_b.C
@@ -21,8 +21,7 @@ int main ()
   return !(Visit () == 1);
 }
 
-// We do not emit Visitor vtable
-// but we do emit rtti here
-// { dg-final { scan-assembler-not {_ZTVW3foo7Visitor:} } }
+// Again, we emit Visitor vtable and rtti here
+// { dg-final { scan-assembler {_ZTVW3foo7Visitor:} } }
 // { dg-final { scan-assembler {_ZTIW3foo7Visitor:} } }
 // { dg-final { scan-assembler {_ZTSW3foo7Visitor:} } }
diff --git a/gcc/testsuite/g++.dg/modules/virt-3_a.C 
b/gcc/testsuite/g++.dg/modules/virt-3_a.C
new file mode 100644
index 000..a7eae7f9d35
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/virt-3_a.C
@@ -0,0 +1,9 @@
+// PR c++/114229
+// { dg-additional-options "-fmodules-ts -Wno-global-module" }
+// { dg-module-cmi modA }
+
+module;
+template struct basic_streambuf { virtual void overflow() { } };
+extern template struct basic_streambuf;
+export module modA;
+export basic_streambuf *p;
diff --git a/gcc/testsuite/g++.dg/modules/virt-3_b.C 
b/gcc/testsuite/g++.dg/modules/virt-3_b.C
new file mode 100644
index 000..4d87b965bbf
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/virt-3_b.C
@@ -0,0 +1,6 @@
+// PR c++/114229
+// { dg-additional-options 

[gcc r14-9374] c++/modules: member alias tmpl partial inst [PR103994]

2024-03-07 Thread Patrick Palka via Gcc-cvs
https://gcc.gnu.org/g:f5c1224708a0cf9cc2770c44bbbe7d0c883942be

commit r14-9374-gf5c1224708a0cf9cc2770c44bbbe7d0c883942be
Author: Patrick Palka 
Date:   Thu Mar 7 16:39:20 2024 -0500

c++/modules: member alias tmpl partial inst [PR103994]

Alias templates are weird in that their specializations can appear in
both decl_specializations and type_specializations.  They're always in
the decl table, and additionally appear in the type table only at parse
time via finish_template_type.  There seems to be no good reason for
them to appear in both tables, and the code paths end up stepping over
each other in particular for a partial instantiation such as
A::key_arg in the below modules testcase: the type code path
(lookup_template_class) wants to set TI_TEMPLATE to the most general
template whereas the decl code path (tsubst_template_decl called during
instantiation of A) already set TI_TEMPLATE to the partially
instantiated TEMPLATE_DECL.  This TI_TEMPLATE change ends up confusing
modules which decides to stream the logically equivalent TYPE_DECL and
TEMPLATE_DECL for this partial instantiation separately.

This patch fixes this by making lookup_template_class dispatch to
instantiate_alias_template early for alias template specializations.
In turn we now add such specializations only to the decl table.  This
admits some nice simplification in the modules code which otherwise has
to cope with such specializations appearing in both tables.

PR c++/103994

gcc/cp/ChangeLog:

* cp-tree.h (add_mergeable_specialization): Remove second
parameter.
* module.cc (depset::disc_bits::DB_ALIAS_TMPL_INST_BIT): Remove.
(depset::disc_bits::DB_ALIAS_SPEC_BIT): Remove.
(depset::is_alias_tmpl_inst): Remove.
(depset::is_alias): Remove.
(merge_kind::MK_tmpl_alias_mask): Remove.
(merge_kind::MK_alias_spec): Remove.
(merge_kind_name): Remove entries for alias specializations.
(trees_out::core_vals) : Adjust after
removing is_alias_tmpl_inst.
(trees_in::decl_value): Adjust add_mergeable_specialization
calls.
(trees_out::get_merge_kind) :
Use MK_decl_spec for alias template specializations.
(trees_out::key_mergeable): Simplify after MK_tmpl_alias_mask
removal.
(depset::hash::make_dependency): Adjust after removing
DB_ALIAS_TMPL_INST_BIT.
(specialization_add): Don't allow alias templates when !decl_p.
(depset::hash::add_specializations): Remove now-dead code
accomodating alias template specializations in the type table.
* pt.cc (lookup_template_class): Dispatch early to
instantiate_alias_template for alias templates.  Simplify
accordingly.
(add_mergeable_specialization): Remove alias_p parameter and
simplify accordingly.

gcc/testsuite/ChangeLog:

* g++.dg/modules/pr99425-1_b.H: s/alias/decl in dump scan.
* g++.dg/modules/tpl-alias-1_a.H: Likewise.
* g++.dg/modules/tpl-alias-2_a.H: New test.
* g++.dg/modules/tpl-alias-2_b.C: New test.

Reviewed-by: Jason Merrill 

Diff:
---
 gcc/cp/cp-tree.h |  3 +-
 gcc/cp/module.cc | 86 ++--
 gcc/cp/pt.cc | 84 +++
 gcc/testsuite/g++.dg/modules/pr99425-1_b.H   |  2 +-
 gcc/testsuite/g++.dg/modules/tpl-alias-1_a.H |  2 +-
 gcc/testsuite/g++.dg/modules/tpl-alias-2_a.H | 15 +
 gcc/testsuite/g++.dg/modules/tpl-alias-2_b.C |  9 +++
 7 files changed, 77 insertions(+), 124 deletions(-)

diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 4469d965ef0..14895bc6585 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -7642,8 +7642,7 @@ extern void walk_specializations  (bool,
 void *);
 extern tree match_mergeable_specialization (bool is_decl, spec_entry *);
 extern unsigned get_mergeable_specialization_flags (tree tmpl, tree spec);
-extern void add_mergeable_specialization(bool is_decl, bool is_alias,
-spec_entry *,
+extern void add_mergeable_specialization(bool is_decl, spec_entry *,
 tree outer, unsigned);
 extern tree add_to_template_args   (tree, tree);
 extern tree add_outermost_template_args(tree, tree);
diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc
index d52db76f59f..53104753737 100644
--- a/gcc/cp/module.cc
+++ b/gcc/cp/module.cc
@@ -2305,11 +2305,7 @@ private:
 DB_HIDDEN_BIT, /* A hidden binding.  */
 /* The following bits are not independent, but 

[gcc r14-9373] AArch64: memcpy/memset expansions should not emit LDP/STP [PR113618]

2024-03-07 Thread Wilco Dijkstra via Gcc-cvs
https://gcc.gnu.org/g:19b23bf3c32df3cbb96b3d898a1d7142f7bea4a0

commit r14-9373-g19b23bf3c32df3cbb96b3d898a1d7142f7bea4a0
Author: Wilco Dijkstra 
Date:   Wed Feb 21 23:33:58 2024 +

AArch64: memcpy/memset expansions should not emit LDP/STP [PR113618]

The new RTL introduced for LDP/STP results in regressions due to use of 
UNSPEC.
Given the new LDP fusion pass is good at finding LDP opportunities, change 
the
memcpy, memmove and memset expansions to emit single vector loads/stores.
This fixes the regression and enables more RTL optimization on the standard
memory accesses.  Handling of unaligned tail of memcpy/memmove is improved
with -mgeneral-regs-only.  SPEC2017 performance improves slightly.  Codesize
is a bit worse due to missed LDP opportunities as discussed in the PR.

gcc/ChangeLog:
PR target/113618
* config/aarch64/aarch64.cc (aarch64_copy_one_block): Remove.
(aarch64_expand_cpymem): Emit single load/store only.
(aarch64_set_one_block): Emit single stores only.

gcc/testsuite/ChangeLog:
PR target/113618
* gcc.target/aarch64/pr113618.c: New test.

Diff:
---
 gcc/config/aarch64/aarch64.cc   | 68 +
 gcc/testsuite/gcc.target/aarch64/pr113618.c | 36 +++
 2 files changed, 57 insertions(+), 47 deletions(-)

diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc
index 16318bf9258..0a28e033088 100644
--- a/gcc/config/aarch64/aarch64.cc
+++ b/gcc/config/aarch64/aarch64.cc
@@ -26465,33 +26465,6 @@ aarch64_progress_pointer (rtx pointer)
   return aarch64_move_pointer (pointer, GET_MODE_SIZE (GET_MODE (pointer)));
 }
 
-typedef auto_vec, 12> copy_ops;
-
-/* Copy one block of size MODE from SRC to DST at offset OFFSET.  */
-static void
-aarch64_copy_one_block (copy_ops , rtx src, rtx dst,
-   int offset, machine_mode mode)
-{
-  /* Emit explict load/store pair instructions for 32-byte copies.  */
-  if (known_eq (GET_MODE_SIZE (mode), 32))
-{
-  mode = V4SImode;
-  rtx src1 = adjust_address (src, mode, offset);
-  rtx dst1 = adjust_address (dst, mode, offset);
-  rtx reg1 = gen_reg_rtx (mode);
-  rtx reg2 = gen_reg_rtx (mode);
-  rtx load = aarch64_gen_load_pair (reg1, reg2, src1);
-  rtx store = aarch64_gen_store_pair (dst1, reg1, reg2);
-  ops.safe_push ({ load, store });
-  return;
-}
-
-  rtx reg = gen_reg_rtx (mode);
-  rtx load = gen_move_insn (reg, adjust_address (src, mode, offset));
-  rtx store = gen_move_insn (adjust_address (dst, mode, offset), reg);
-  ops.safe_push ({ load, store });
-}
-
 /* Expand a cpymem/movmem using the MOPS extension.  OPERANDS are taken
from the cpymem/movmem pattern.  IS_MEMMOVE is true if this is a memmove
rather than memcpy.  Return true iff we succeeded.  */
@@ -26527,7 +26500,7 @@ aarch64_expand_cpymem (rtx *operands, bool is_memmove)
   rtx src = operands[1];
   unsigned align = UINTVAL (operands[3]);
   rtx base;
-  machine_mode cur_mode = BLKmode, next_mode;
+  machine_mode mode = BLKmode, next_mode;
 
   /* Variable-sized or strict-align copies may use the MOPS expansion.  */
   if (!CONST_INT_P (operands[2]) || (STRICT_ALIGNMENT && align < 16))
@@ -26550,16 +26523,12 @@ aarch64_expand_cpymem (rtx *operands, bool is_memmove)
   if (size > max_copy_size || (TARGET_MOPS && size > mops_threshold))
 return aarch64_expand_cpymem_mops (operands, is_memmove);
 
-  unsigned copy_max = 32;
-
-  /* Default to 32-byte LDP/STP on large copies, however small copies, no SIMD
- support or slow LDP/STP fall back to 16-byte chunks.
-
+  /* Default to 32-byte LDP/STP on large copies, however small copies or
+ no SIMD support fall back to 16-byte chunks.
  ??? Although it would be possible to use LDP/STP Qn in streaming mode
  (so using TARGET_BASE_SIMD instead of TARGET_SIMD), it isn't clear
  whether that would improve performance.  */
-  if (size <= 24 || !use_ldpq)
-copy_max = 16;
+  bool use_qregs = size > 24 && TARGET_SIMD;
 
   base = copy_to_mode_reg (Pmode, XEXP (dst, 0));
   dst = adjust_automodify_address (dst, VOIDmode, base, 0);
@@ -26567,7 +26536,7 @@ aarch64_expand_cpymem (rtx *operands, bool is_memmove)
   base = copy_to_mode_reg (Pmode, XEXP (src, 0));
   src = adjust_automodify_address (src, VOIDmode, base, 0);
 
-  copy_ops ops;
+  auto_vec, 16> ops;
   int offset = 0;
 
   while (size > 0)
@@ -26576,23 +26545,27 @@ aarch64_expand_cpymem (rtx *operands, bool is_memmove)
 or writing.  */
   opt_scalar_int_mode mode_iter;
   FOR_EACH_MODE_IN_CLASS (mode_iter, MODE_INT)
-   if (GET_MODE_SIZE (mode_iter.require ()) <= MIN (size, copy_max))
- cur_mode = mode_iter.require ();
+   if (GET_MODE_SIZE (mode_iter.require ()) <= MIN (size, 16))
+ mode = mode_iter.require ();
 
-  gcc_assert (cur_mode != BLKmode);
+  gcc_assert (mode 

[gcc r14-9372] c++/modules: inline namespace abi_tag streaming [PR110730]

2024-03-07 Thread Patrick Palka via Gcc-cvs
https://gcc.gnu.org/g:0552560f6d2eaa1ae6df5c80660b489de1d5c772

commit r14-9372-g0552560f6d2eaa1ae6df5c80660b489de1d5c772
Author: Patrick Palka 
Date:   Thu Mar 7 16:23:22 2024 -0500

c++/modules: inline namespace abi_tag streaming [PR110730]

The unreduced testcase from PR110730 crashes at runtime ultimately
because we don't stream the abi_tag attribute on inline namespaces and
so the filesystem::current_path() call resolves to the non-C++11 ABI
version even though the C++11 ABI is active, leading to a crash when
destroying the path temporary (which contains an std::string member).
Similar story for the PR105512 testcase.

While we do stream the DECL_ATTRIBUTES of all decls that go through
the generic tree streaming routines, it seems namespaces are streamed
separately from other decls and we don't use the generic routines for
them.  So this patch makes us stream the abi_tag manually for (inline)
namespaces.

PR c++/110730
PR c++/105512

gcc/cp/ChangeLog:

* module.cc (module_state::write_namespaces): Stream the
abi_tag attribute of an inline namespace.
(module_state::read_namespaces): Likewise.

gcc/testsuite/ChangeLog:

* g++.dg/modules/hello-2_a.C: New test.
* g++.dg/modules/hello-2_b.C: New test.
* g++.dg/modules/namespace-6_a.H: New test.
* g++.dg/modules/namespace-6_b.C: New test.

Reviewed-by: Jason Merrill 

Diff:
---
 gcc/cp/module.cc | 28 
 gcc/testsuite/g++.dg/modules/hello-2_a.C | 11 +++
 gcc/testsuite/g++.dg/modules/hello-2_b.C | 10 ++
 gcc/testsuite/g++.dg/modules/namespace-6_a.H | 10 ++
 gcc/testsuite/g++.dg/modules/namespace-6_b.C |  7 +++
 5 files changed, 66 insertions(+)

diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc
index f7e8b357fc2..d52db76f59f 100644
--- a/gcc/cp/module.cc
+++ b/gcc/cp/module.cc
@@ -15276,6 +15276,19 @@ module_state::write_namespaces (elf_out *to, 
vec spaces,
 
   sec.u (flags);
   write_location (sec, DECL_SOURCE_LOCATION (ns));
+
+  if (DECL_NAMESPACE_INLINE_P (ns))
+   {
+ if (tree attr = lookup_attribute ("abi_tag", DECL_ATTRIBUTES (ns)))
+   {
+ tree tags = TREE_VALUE (attr);
+ sec.u (list_length (tags));
+ for (tree tag = tags; tag; tag = TREE_CHAIN (tag))
+   sec.str (TREE_STRING_POINTER (TREE_VALUE (tag)));
+   }
+ else
+   sec.u (0);
+   }
 }
 
   sec.end (to, to->name (MOD_SNAME_PFX ".nms"), crc_p);
@@ -15306,11 +15319,22 @@ module_state::read_namespaces (unsigned num)
   /* See comment in write_namespace about why not bits.  */
   unsigned flags = sec.u ();
   location_t src_loc = read_location (sec);
+  unsigned tags_count = (flags & 2) ? sec.u () : 0;
 
   if (entity_index >= entity_num
  || !parent
  || (flags & 0xc) == 0x8)
sec.set_overrun ();
+
+  tree tags = NULL_TREE;
+  while (tags_count--)
+   {
+ size_t len;
+ const char *str = sec.str ();
+ tags = tree_cons (NULL_TREE, build_string (len + 1, str), tags);
+ tags = nreverse (tags);
+   }
+
   if (sec.get_overrun ())
break;
 
@@ -15342,6 +15366,10 @@ module_state::read_namespaces (unsigned num)
DECL_MODULE_EXPORT_P (inner) = true;
}
 
+  if (tags)
+   DECL_ATTRIBUTES (inner)
+ = tree_cons (get_identifier ("abi_tag"), tags, DECL_ATTRIBUTES 
(inner));
+
   /* Install the namespace.  */
   (*entity_ary)[entity_lwm + entity_index] = inner;
   if (DECL_MODULE_IMPORT_P (inner))
diff --git a/gcc/testsuite/g++.dg/modules/hello-2_a.C 
b/gcc/testsuite/g++.dg/modules/hello-2_a.C
new file mode 100644
index 000..a8f8b813839
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/hello-2_a.C
@@ -0,0 +1,11 @@
+// PR c++/105512
+// { dg-additional-options -fmodules-ts }
+// { dg-module-cmi Hello2 }
+
+module;
+#include 
+export module Hello2;
+
+export std::string tester() {
+  return "hello world\n";
+}
diff --git a/gcc/testsuite/g++.dg/modules/hello-2_b.C 
b/gcc/testsuite/g++.dg/modules/hello-2_b.C
new file mode 100644
index 000..dafd3c2f7a1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/hello-2_b.C
@@ -0,0 +1,10 @@
+// PR c++/105512
+// { dg-additional-options -fmodules-ts }
+// { dg-module-do run }
+
+#include 
+import Hello2;
+
+int main() {
+  std::cout << tester();
+}
diff --git a/gcc/testsuite/g++.dg/modules/namespace-6_a.H 
b/gcc/testsuite/g++.dg/modules/namespace-6_a.H
new file mode 100644
index 000..b412cbe6cbf
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/namespace-6_a.H
@@ -0,0 +1,10 @@
+// PR c++/110730
+// { dg-additional-options -fmodule-header }
+// { dg-module-cmi {} }
+
+namespace std::filesystem {
+  inline namespace 

[gcc r14-9371] libstdc++: Do not define lock-free atomic aliases if not fully lock-free [PR114103]

2024-03-07 Thread Jonathan Wakely via Libstdc++-cvs
https://gcc.gnu.org/g:e162b2ff52c5e20f6624ff6b66845fe573cef183

commit r14-9371-ge162b2ff52c5e20f6624ff6b66845fe573cef183
Author: Jonathan Wakely 
Date:   Mon Feb 26 13:17:32 2024 +

libstdc++: Do not define lock-free atomic aliases if not fully lock-free 
[PR114103]

The whole point of these typedefs is to guarantee lock-freedom, so if
the target has no such types, we shouldn't defined the typedefs at all.

libstdc++-v3/ChangeLog:

PR libstdc++/114103
* include/bits/version.def (atomic_lock_free_type_aliases): Add
extra_cond to check for at least one always-lock-free type.
* include/bits/version.h: Regenerate.
* include/std/atomic (atomic_signed_lock_free)
(atomic_unsigned_lock_free): Only use always-lock-free types.
* src/c++20/tzdb.cc (time_zone::_Impl::RulesCounter): Don't use
atomic counter if lock-free aliases aren't available.
* testsuite/29_atomics/atomic/lock_free_aliases.cc: XFAIL for
targets without lock-free word-size compare_exchange.

Diff:
---
 libstdc++-v3/include/bits/version.def | 1 +
 libstdc++-v3/include/bits/version.h   | 2 +-
 libstdc++-v3/include/std/atomic   | 6 +++---
 libstdc++-v3/src/c++20/tzdb.cc| 7 ++-
 libstdc++-v3/testsuite/29_atomics/atomic/lock_free_aliases.cc | 1 +
 5 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/libstdc++-v3/include/bits/version.def 
b/libstdc++-v3/include/bits/version.def
index 502961eb269..d298420121b 100644
--- a/libstdc++-v3/include/bits/version.def
+++ b/libstdc++-v3/include/bits/version.def
@@ -739,6 +739,7 @@ ftms = {
   values = {
 v = 201907;
 cxxmin = 20;
+extra_cond = "(__GCC_ATOMIC_INT_LOCK_FREE | __GCC_ATOMIC_LONG_LOCK_FREE | 
__GCC_ATOMIC_CHAR_LOCK_FREE) & 2";
   };
 };
 
diff --git a/libstdc++-v3/include/bits/version.h 
b/libstdc++-v3/include/bits/version.h
index 7a6fbd35e2e..9107b45a484 100644
--- a/libstdc++-v3/include/bits/version.h
+++ b/libstdc++-v3/include/bits/version.h
@@ -819,7 +819,7 @@
 #undef __glibcxx_want_atomic_float
 
 #if !defined(__cpp_lib_atomic_lock_free_type_aliases)
-# if (__cplusplus >= 202002L)
+# if (__cplusplus >= 202002L) && ((__GCC_ATOMIC_INT_LOCK_FREE | 
__GCC_ATOMIC_LONG_LOCK_FREE | __GCC_ATOMIC_CHAR_LOCK_FREE) & 2)
 #  define __glibcxx_atomic_lock_free_type_aliases 201907L
 #  if defined(__glibcxx_want_all) || 
defined(__glibcxx_want_atomic_lock_free_type_aliases)
 #   define __cpp_lib_atomic_lock_free_type_aliases 201907L
diff --git a/libstdc++-v3/include/std/atomic b/libstdc++-v3/include/std/atomic
index 559f8370459..1462cf5ec23 100644
--- a/libstdc++-v3/include/std/atomic
+++ b/libstdc++-v3/include/std/atomic
@@ -1774,13 +1774,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 = atomic>;
   using atomic_unsigned_lock_free
 = atomic>;
-# elif ATOMIC_INT_LOCK_FREE || !(ATOMIC_LONG_LOCK_FREE || 
ATOMIC_CHAR_LOCK_FREE)
+# elif ATOMIC_INT_LOCK_FREE == 2
   using atomic_signed_lock_free = atomic;
   using atomic_unsigned_lock_free = atomic;
-# elif ATOMIC_LONG_LOCK_FREE
+# elif ATOMIC_LONG_LOCK_FREE == 2
   using atomic_signed_lock_free = atomic;
   using atomic_unsigned_lock_free = atomic;
-# elif ATOMIC_CHAR_LOCK_FREE
+# elif ATOMIC_CHAR_LOCK_FREE == 2
   using atomic_signed_lock_free = atomic;
   using atomic_unsigned_lock_free = atomic;
 # else
diff --git a/libstdc++-v3/src/c++20/tzdb.cc b/libstdc++-v3/src/c++20/tzdb.cc
index e03f4a5c32a..890a4c53e2d 100644
--- a/libstdc++-v3/src/c++20/tzdb.cc
+++ b/libstdc++-v3/src/c++20/tzdb.cc
@@ -651,7 +651,7 @@ namespace std::chrono
 template requires _Tp::is_always_lock_free
   struct RulesCounter<_Tp>
   {
-   atomic_signed_lock_free counter{0};
+   _Tp counter{0};
 
void
increment()
@@ -703,7 +703,12 @@ namespace std::chrono
   };
 #endif // __GTHREADS && __cpp_lib_atomic_wait
 
+#if __cpp_lib_atomic_lock_free_type_aliases
 RulesCounter rules_counter;
+#else
+RulesCounter rules_counter;
+#endif
+
 #else // TZDB_DISABLED
 _Impl(weak_ptr) { }
 struct {
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/lock_free_aliases.cc 
b/libstdc++-v3/testsuite/29_atomics/atomic/lock_free_aliases.cc
index 372a63129ff..489d181d136 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic/lock_free_aliases.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic/lock_free_aliases.cc
@@ -1,5 +1,6 @@
 // { dg-do compile { target c++20 } }
 // { dg-add-options no_pch }
+// { dg-require-atomic-cmpxchg-word "PR libstdc++/114103" }
 
 #include 


[gcc r14-9370] libstdc++: Update expiry times for leap seconds lists

2024-03-07 Thread Jonathan Wakely via Libstdc++-cvs
https://gcc.gnu.org/g:ddd347fca0685804bf68d6c768282573f3ea6442

commit r14-9370-gddd347fca0685804bf68d6c768282573f3ea6442
Author: Jonathan Wakely 
Date:   Fri Mar 1 20:55:10 2024 +

libstdc++: Update expiry times for leap seconds lists

The list in tzdb.cc isn't the only hardcoded list of leap seconds in the
library, there's the one defined inline in  (to avoid loading
the tzdb for the common case) and another in a testcase. This updates
them to note that there are no new leap seconds in 2024 either, until at
least 2024-12-28.

libstdc++-v3/ChangeLog:

* include/std/chrono (__get_leap_second_info): Update expiry
time for hardcoded list of leap seconds.
* testsuite/std/time/tzdb/leap_seconds.cc: Update comment.

Diff:
---
 libstdc++-v3/include/std/chrono  | 2 +-
 libstdc++-v3/testsuite/std/time/tzdb/leap_seconds.cc | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/include/std/chrono b/libstdc++-v3/include/std/chrono
index a59af34567c..3a9751781d2 100644
--- a/libstdc++-v3/include/std/chrono
+++ b/libstdc++-v3/include/std/chrono
@@ -3243,7 +3243,7 @@ namespace __detail
   };
   // The list above is known to be valid until (at least) this date
   // and only contains positive leap seconds.
-  const sys_seconds __expires(1703721600s); // 2023-12-28 00:00:00 UTC
+  const sys_seconds __expires(1735344000s); // 2024-12-28 00:00:00 UTC
 
 #if _GLIBCXX_USE_CXX11_ABI || ! _GLIBCXX_USE_DUAL_ABI
   if (__ss > __expires)
diff --git a/libstdc++-v3/testsuite/std/time/tzdb/leap_seconds.cc 
b/libstdc++-v3/testsuite/std/time/tzdb/leap_seconds.cc
index f5401a24526..5999635a89f 100644
--- a/libstdc++-v3/testsuite/std/time/tzdb/leap_seconds.cc
+++ b/libstdc++-v3/testsuite/std/time/tzdb/leap_seconds.cc
@@ -21,7 +21,7 @@ void
 test_load_leapseconds()
 {
   std::ofstream("leapseconds") << R"(
-# These are all the real leap seconds as of 2022:
+# These are all the real leap seconds as of 2024:
 Leap   1972Jun 30  23:59:60+   S
 Leap   1972Dec 31  23:59:60+   S
 Leap   1973Dec 31  23:59:60+   S


[gcc r14-9369] libstdc++: Replace unnecessary uses of built-ins in testsuite

2024-03-07 Thread Jonathan Wakely via Libstdc++-cvs
https://gcc.gnu.org/g:709d8474bcc50737a74f5d6d4d43462f6f125b64

commit r14-9369-g709d8474bcc50737a74f5d6d4d43462f6f125b64
Author: Jonathan Wakely 
Date:   Fri Mar 1 17:40:22 2024 +

libstdc++: Replace unnecessary uses of built-ins in testsuite

I don't see why we should rely on __builtin_memset etc. in tests. We can
just include  and use the public API.

libstdc++-v3/ChangeLog:

* testsuite/23_containers/deque/allocator/default_init.cc: Use
std::memset instead of __builtin_memset.
* testsuite/23_containers/forward_list/allocator/default_init.cc:
Likewise.
* testsuite/23_containers/list/allocator/default_init.cc:
Likewise.
* testsuite/23_containers/map/allocator/default_init.cc:
Likewise.
* testsuite/23_containers/set/allocator/default_init.cc:
Likewise.
* testsuite/23_containers/unordered_map/allocator/default_init.cc:
Likewise.
* testsuite/23_containers/unordered_set/allocator/default_init.cc:
Likewise.
* testsuite/23_containers/vector/allocator/default_init.cc:
Likewise.
* testsuite/23_containers/vector/bool/allocator/default_init.cc:
Likewise.
* testsuite/29_atomics/atomic/compare_exchange_padding.cc:
Likewise.
* testsuite/util/atomic/wait_notify_util.h: Likewise.

Diff:
---
 .../testsuite/23_containers/deque/allocator/default_init.cc   |  5 +++--
 .../23_containers/forward_list/allocator/default_init.cc  |  5 +++--
 .../testsuite/23_containers/list/allocator/default_init.cc|  5 +++--
 .../testsuite/23_containers/map/allocator/default_init.cc |  5 +++--
 .../testsuite/23_containers/set/allocator/default_init.cc |  5 +++--
 .../23_containers/unordered_map/allocator/default_init.cc |  5 +++--
 .../23_containers/unordered_set/allocator/default_init.cc |  5 +++--
 .../testsuite/23_containers/vector/allocator/default_init.cc  |  5 +++--
 .../23_containers/vector/bool/allocator/default_init.cc   |  5 +++--
 .../testsuite/29_atomics/atomic/compare_exchange_padding.cc   |  5 +++--
 libstdc++-v3/testsuite/util/atomic/wait_notify_util.h | 11 +--
 11 files changed, 35 insertions(+), 26 deletions(-)

diff --git 
a/libstdc++-v3/testsuite/23_containers/deque/allocator/default_init.cc 
b/libstdc++-v3/testsuite/23_containers/deque/allocator/default_init.cc
index ce8c6ba8114..63ada98d048 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/allocator/default_init.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/allocator/default_init.cc
@@ -22,6 +22,7 @@
 #include 
 #include 
 
+#include 
 #include 
 
 using T = int;
@@ -34,7 +35,7 @@ void test01()
   typedef std::deque test_type;
 
   __gnu_cxx::__aligned_buffer buf;
-  __builtin_memset(buf._M_addr(), ~0, sizeof(test_type));
+  std::memset(buf._M_addr(), ~0, sizeof(test_type));
 
   test_type *tmp = ::new(buf._M_addr()) test_type;
 
@@ -49,7 +50,7 @@ void test02()
   typedef std::deque test_type;
 
   __gnu_cxx::__aligned_buffer buf;
-  __builtin_memset(buf._M_addr(), ~0, sizeof(test_type));
+  std::memset(buf._M_addr(), ~0, sizeof(test_type));
 
   test_type *tmp = ::new(buf._M_addr()) test_type();
 
diff --git 
a/libstdc++-v3/testsuite/23_containers/forward_list/allocator/default_init.cc 
b/libstdc++-v3/testsuite/23_containers/forward_list/allocator/default_init.cc
index 1865e39a885..d8a8bdf05a9 100644
--- 
a/libstdc++-v3/testsuite/23_containers/forward_list/allocator/default_init.cc
+++ 
b/libstdc++-v3/testsuite/23_containers/forward_list/allocator/default_init.cc
@@ -22,6 +22,7 @@
 #include 
 #include 
 
+#include 
 #include 
 
 using T = int;
@@ -34,7 +35,7 @@ void test01()
   typedef std::forward_list test_type;
 
   __gnu_cxx::__aligned_buffer buf;
-  __builtin_memset(buf._M_addr(), ~0, sizeof(test_type));
+  std::memset(buf._M_addr(), ~0, sizeof(test_type));
 
   test_type *tmp = ::new(buf._M_addr()) test_type;
 
@@ -49,7 +50,7 @@ void test02()
   typedef std::forward_list test_type;
 
   __gnu_cxx::__aligned_buffer buf;
-  __builtin_memset(buf._M_addr(), ~0, sizeof(test_type));
+  std::memset(buf._M_addr(), ~0, sizeof(test_type));
 
   test_type *tmp = ::new(buf._M_addr()) test_type();
 
diff --git 
a/libstdc++-v3/testsuite/23_containers/list/allocator/default_init.cc 
b/libstdc++-v3/testsuite/23_containers/list/allocator/default_init.cc
index ab19ca7070c..cffad227bc0 100644
--- a/libstdc++-v3/testsuite/23_containers/list/allocator/default_init.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/allocator/default_init.cc
@@ -22,6 +22,7 @@
 #include 
 #include 
 
+#include 
 #include 
 
 using T = int;
@@ -34,7 +35,7 @@ void test01()
   typedef std::list test_type;
 
   __gnu_cxx::__aligned_buffer buf;
-  __builtin_memset(buf._M_addr(), ~0, sizeof(test_type));
+  std::memset(buf._M_addr(), ~0, sizeof(test_type));
 
   VERIFY( 

[gcc r14-9368] libstdc++: Better diagnostics for std::format errors

2024-03-07 Thread Jonathan Wakely via Libstdc++-cvs
https://gcc.gnu.org/g:24a2b5def06940f3f181418a439c408388f7eb56

commit r14-9368-g24a2b5def06940f3f181418a439c408388f7eb56
Author: Jonathan Wakely 
Date:   Thu Feb 29 16:13:13 2024 +

libstdc++: Better diagnostics for std::format errors

This adds two new static_assert messages to the internals of
std::make_format_args to give better diagnostics for invalid format
args. Rather than just getting an error saying that basic_format_arg
cannot be constructed, we get more specific errors for the cases where
std::formatter isn't specialized for the type at all, and where it's
specialized but only meets the BasicFormatter requirements and so can
only format non-const arguments.

Also add a test for the existing static_assert when constructing a
format_string for non-formattable args.

libstdc++-v3/ChangeLog:

* include/std/format (_Arg_store::_S_make_elt): Add two
static_assert checks to give more user-friendly error messages.
* testsuite/lib/prune.exp (libstdc++-dg-prune): Prune another
form of "in requirements with" note.
* testsuite/std/format/arguments/args_neg.cc: Check for
user-friendly diagnostics for non-formattable types.
* testsuite/std/format/string_neg.cc: Likewise.

Diff:
---
 libstdc++-v3/include/std/format| 13 +
 libstdc++-v3/testsuite/lib/prune.exp   |  1 +
 .../testsuite/std/format/arguments/args_neg.cc | 34 +-
 libstdc++-v3/testsuite/std/format/string_neg.cc|  4 +++
 4 files changed, 51 insertions(+), 1 deletion(-)

diff --git a/libstdc++-v3/include/std/format b/libstdc++-v3/include/std/format
index ee189f9086c..1e839e88db4 100644
--- a/libstdc++-v3/include/std/format
+++ b/libstdc++-v3/include/std/format
@@ -3704,6 +3704,19 @@ namespace __format
static _Element_t
_S_make_elt(_Tp& __v)
{
+ using _Tq = remove_const_t<_Tp>;
+ using _CharT = typename _Context::char_type;
+ static_assert(is_default_constructible_v>,
+   "std::formatter must be specialized for the type "
+   "of each format arg");
+ using __format::__formattable_with;
+ if constexpr (is_const_v<_Tp>)
+   if constexpr (!__formattable_with<_Tp, _Context>)
+ if constexpr (__formattable_with<_Tq, _Context>)
+   static_assert(__formattable_with<_Tp, _Context>,
+ "format arg must be non-const because its "
+ "std::formatter specialization has a "
+ "non-const reference parameter");
  basic_format_arg<_Context> __arg(__v);
  if constexpr (_S_values_only)
return __arg._M_val;
diff --git a/libstdc++-v3/testsuite/lib/prune.exp 
b/libstdc++-v3/testsuite/lib/prune.exp
index 24a15ccad22..071dcf34c1e 100644
--- a/libstdc++-v3/testsuite/lib/prune.exp
+++ b/libstdc++-v3/testsuite/lib/prune.exp
@@ -54,6 +54,7 @@ proc libstdc++-dg-prune { system text } {
 regsub -all "(^|\n)\[^\n\]*:   . skipping \[0-9\]* instantiation contexts 
\[^\n\]*" $text "" text
 regsub -all "(^|\n)\[^\n\]*:   in .constexpr. expansion \[^\n\]*" $text "" 
text
 regsub -all "(^|\n)\[^\n\]*:   in requirements  .with\[^\n\]*" $text "" 
text
+regsub -all "(^|\n)\[^\n\]*:   in requirements with\[^\n\]*" $text "" text
 regsub -all "(^|\n)inlined from \[^\n\]*" $text "" text
 # Why doesn't GCC need these to strip header context?
 regsub -all "(^|\n)In file included from \[^\n\]*" $text "" text
diff --git a/libstdc++-v3/testsuite/std/format/arguments/args_neg.cc 
b/libstdc++-v3/testsuite/std/format/arguments/args_neg.cc
index 16ac3040146..ded56fe63ab 100644
--- a/libstdc++-v3/testsuite/std/format/arguments/args_neg.cc
+++ b/libstdc++-v3/testsuite/std/format/arguments/args_neg.cc
@@ -6,7 +6,39 @@
 
 std::string rval() { return "path/etic/experience"; }
 
-void f()
+void test_rval()
 {
   (void)std::make_format_args(rval()); // { dg-error "cannot bind non-const 
lvalue reference" }
 }
+
+void test_missing_specialization()
+{
+  struct X { };
+  X x;
+  (void)std::make_format_args(x); // { dg-error "here" }
+// { dg-error "std::formatter must be specialized" "" { target *-*-* } 0 }
+}
+
+struct Y { };
+template<> class std::formatter {
+public:
+  constexpr typename format_parse_context::iterator
+  parse(format_parse_context& c)
+  { return c.begin(); }
+
+  template
+  typename C::iterator format(Y&, C&) const;
+};
+
+void test(std::formatter& f, std::format_parse_context& pc) {
+  f.parse(pc);
+}
+
+void test_const_arg()
+{
+  const Y y;
+  (void)std::make_format_args(y); // { dg-error "here" }
+// { dg-error "format arg must be non-const" "" { target *-*-* } 0 }
+}
+
+// { dg-prune-output "no matching function for call to .*::basic_format_arg<" }
diff --git 

[gcc r14-9367] testsuite, darwin: improve check for -shared support

2024-03-07 Thread François-Xavier Coudert via Gcc-cvs
https://gcc.gnu.org/g:0ed6e5b4820e01fa86b48a7b1d62f752ec97ea41

commit r14-9367-g0ed6e5b4820e01fa86b48a7b1d62f752ec97ea41
Author: Francois-Xavier Coudert 
Date:   Thu Mar 7 17:27:17 2024 +0100

testsuite, darwin: improve check for -shared support

The undefined symbols are allowed for C checks, but when
this is run as C++, the mangled foo() symbol is still
seen as undefined, and the testsuite thinks darwin does not
support -shared.

gcc/testsuite/ChangeLog:

PR target/114233
* lib/target-supports.exp: Fix test for C++.

Diff:
---
 gcc/testsuite/lib/target-supports.exp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/testsuite/lib/target-supports.exp 
b/gcc/testsuite/lib/target-supports.exp
index ae33c4f1e3a..467b539b20d 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -1390,7 +1390,7 @@ proc check_effective_target_shared { } {
 # here to be undefined.
 set extra_flags ""
 if { [istarget *-*-darwin\[912\]*] } {
-  set extra_flags "-Wl,-U,_foo,-U,_bar"
+  set extra_flags "-Wl,-U,_foo,-U,_bar,-U,__Z3foov"
 }
 # Note that M68K has a multilib that supports -fpic but not
 # -fPIC, so we need to check both.  We test with a program that


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

2024-03-07 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:2f02fdf29b0913e1568dd776828047565592291a

commit 2f02fdf29b0913e1568dd776828047565592291a
Author: Michael Meissner 
Date:   Thu Mar 7 15:25:30 2024 -0500

Update ChangeLog.*

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

diff --git a/gcc/ChangeLog.meissner b/gcc/ChangeLog.meissner
index c61e5b768e0..bf6f79d1721 100644
--- a/gcc/ChangeLog.meissner
+++ b/gcc/ChangeLog.meissner
@@ -1,5 +1,86 @@
+ Branch work162, patch #1 
+
+Add -mcpu=power11 support.
+
+This patch adds support for -mcpu=power11.  At the current time, no new
+instructions are implemented.  The tuning for the power11 processor is exactly
+the same as for power10.
+
+If -mcpu=power11 is used, the macro _ARCH_PWR11 will be defined.
+
+In order to use -mcpu=power11, you will need an assembler that supports the
+-mpower11 option.
+
+2024-02-29  Michael Meissner  
+
+gcc/
+
+   * config.gcc (powerpc*-*-*, rs6000-*-*): Add support for the power11
+   processor.
+   * config/rs6000/aix71.h (ASM_CPU_SPEC): Likewise.
+   * config/rs6000/aix72.h (ASM_CPU_SPEC): Likewise.
+   * config/rs6000/aix73.h (ASM_CPU_SPEC): Likewise.
+   * config/rs6000/driver-rs6000.c (asm_names): Likewise.
+   * config/rs6000/rs6000-builtin.cc (cpu_is_info): Likewise.
+   * 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 macro.
+   (POWERPC_MASKS): Add support for -mcpu=power11.
+   (power11 cpu): Add power11 cpu.
+   * config/rs6000/rs6000-opts.h (PROCESSOR_POWER11): New macro.
+   * config/rs6000/rs6000-tables.opt: Regenerate.
+   * config/rs6000/rs6000.cc (rs6000_machine_from_flags): If -mcpu=power11,
+   emit .machine power11.
+   (rs6000_opt_masks): Add support for the power11 ISA bits.
+   * config/rs6000/rs6000.h (ASM_CPU_SPEC): Add support for the power11
+   processor.
+   * config/rs6000/rs6000.opt (-mpower11): New internal ISA bit for
+   power11 cpu.
+   * doc/invoke.texi (PowerPC options): Document -mcpu=power11.
+
+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-support.exp (check_effective_target_power11_ok): Add
+   power11 support.
+
  Branch work162, baseline 
 
+Add ChangeLog.meissner and REVISION.
+
+2024-02-28  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.
+
 2024-03-07   Michael Meissner  
 
Clone branch


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

2024-03-07 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:a82d2910acc0bdeb924a0c0287f0f22c8cfda58b

commit a82d2910acc0bdeb924a0c0287f0f22c8cfda58b
Author: Michael Meissner 
Date:   Thu Mar 7 15:23:27 2024 -0500

Add -mcpu=power11 support.

2024-03-07  Michael Meissner  

gcc/

* 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/power10.md (all reservations): Add power11 as an
alterntive to power10.
* 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.
* rs6000-opts.h (PROCESSOR_POWER11): Add power11 processor.
* config/rs6000/rs6000-tables.opt: Regenerate.
* config/rs6000/rs6000.cc (power11_cost): Add power11 support.
(rs6000_option_override_internal): Likewise.
(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.

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/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/power10.md | 142 +--
 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-tables.opt  |   3 +
 gcc/config/rs6000/rs6000.cc  |  48 +++--
 gcc/config/rs6000/rs6000.h   |   1 +
 gcc/config/rs6000/rs6000.md  |   2 +-
 gcc/config/rs6000/rs6000.opt |   3 +
 gcc/doc/invoke.texi  |   5 +-
 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 
 20 files changed, 200 insertions(+), 83 deletions(-)

diff --git a/gcc/config/rs6000/aix71.h b/gcc/config/rs6000/aix71.h
index 24bc301e37d..41037b3852d 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=power11: -mpwr11; \
   mcpu=power10: -mpwr10; \
   mcpu=power9: -mpwr9; \
   mcpu=power8: -mpwr8; \
diff --git a/gcc/config/rs6000/aix72.h b/gcc/config/rs6000/aix72.h
index c43974f577a..fe59f8319b4 100644
--- a/gcc/config/rs6000/aix72.h
+++ b/gcc/config/rs6000/aix72.h
@@ -79,6 +79,7 @@ do {  
\
 #undef ASM_CPU_SPEC
 #define ASM_CPU_SPEC \
 "%{mcpu=native: %(asm_cpu_native); \
+  mcpu=power11: -mpwr11; \
   mcpu=power10: -mpwr10; \
   mcpu=power9: -mpwr9; \
   mcpu=power8: -mpwr8; \
diff --git a/gcc/config/rs6000/aix73.h b/gcc/config/rs6000/aix73.h
index b1572bde81f..1318b0b3662 100644
--- a/gcc/config/rs6000/aix73.h
+++ b/gcc/config/rs6000/aix73.h
@@ -79,6 +79,7 @@ do {  
\
 #undef ASM_CPU_SPEC
 #define ASM_CPU_SPEC \
 "%{mcpu=native: %(asm_cpu_native); \
+  mcpu=power11: -mpwr11; \
   mcpu=power10: -mpwr10; \
   mcpu=power9: -mpwr9; \
   mcpu=power8: -mpwr8; \
diff --git a/gcc/config/rs6000/driver-rs6000.cc 
b/gcc/config/rs6000/driver-rs6000.cc
index 

[gcc r14-9366] vect: Do not peel epilogue for partial vectors.

2024-03-07 Thread Robin Dapp via Gcc-cvs
https://gcc.gnu.org/g:226043a4d8fb23c7fe7bf16e485b3cfaa094db21

commit r14-9366-g226043a4d8fb23c7fe7bf16e485b3cfaa094db21
Author: Robin Dapp 
Date:   Wed Mar 6 16:54:35 2024 +0100

vect: Do not peel epilogue for partial vectors.

r14-7036-gcbf569486b2dec added an epilogue vectorization guard for early
break but PR114196 shows that we also run into the problem without early
break.  Therefore merge the condition into the topmost vectorization
guard.

gcc/ChangeLog:

PR middle-end/114196

* tree-vect-loop-manip.cc (vect_can_peel_nonlinear_iv_p): Merge
vectorization guards.

gcc/testsuite/ChangeLog:

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

Diff:
---
 gcc/testsuite/gcc.target/aarch64/pr114196.c| 19 ++
 .../gcc.target/riscv/rvv/autovec/pr114196.c| 19 ++
 gcc/tree-vect-loop-manip.cc| 30 +-
 3 files changed, 45 insertions(+), 23 deletions(-)

diff --git a/gcc/testsuite/gcc.target/aarch64/pr114196.c 
b/gcc/testsuite/gcc.target/aarch64/pr114196.c
new file mode 100644
index 000..15e4b0e31b8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/pr114196.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options { -O3 -fno-vect-cost-model -march=armv9-a 
-msve-vector-bits=256 } } */
+
+unsigned a;
+int b;
+long *c;
+
+int
+main ()
+{
+  for (int d = 0; d < 22; d += 4) {
+  b = ({
+   int e = c[d];
+   e;
+   })
+  ? 0 : -c[d];
+  a *= 3;
+  }
+}
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr114196.c 
b/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr114196.c
new file mode 100644
index 000..7ba9cbbed70
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr114196.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options { -O3 -fno-vect-cost-model -march=rv64gcv_zvl256b -mabi=lp64d 
-mrvv-vector-bits=zvl } } */
+
+unsigned a;
+int b;
+long *c;
+
+int
+main ()
+{
+  for (int d = 0; d < 22; d += 4) {
+  b = ({
+   int e = c[d];
+   e;
+   })
+  ? 0 : -c[d];
+  a *= 3;
+  }
+}
diff --git a/gcc/tree-vect-loop-manip.cc b/gcc/tree-vect-loop-manip.cc
index f72da915103..56a6d8e4a8d 100644
--- a/gcc/tree-vect-loop-manip.cc
+++ b/gcc/tree-vect-loop-manip.cc
@@ -2129,16 +2129,19 @@ vect_can_peel_nonlinear_iv_p (loop_vec_info loop_vinfo,
  For mult, don't known how to generate
  init_expr * pow (step, niters) for variable niters.
  For neg, it should be ok, since niters of vectorized main loop
- will always be multiple of 2.  */
-  if ((!LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo)
-   || !LOOP_VINFO_VECT_FACTOR (loop_vinfo).is_constant ())
+ will always be multiple of 2.
+ See also PR113163 and PR114196.  */
+  if ((!LOOP_VINFO_VECT_FACTOR (loop_vinfo).is_constant ()
+   || LOOP_VINFO_USING_PARTIAL_VECTORS_P (loop_vinfo)
+   || !LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo))
   && induction_type != vect_step_op_neg)
 {
   if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
 "Peeling for epilogue is not supported"
 " for nonlinear induction except neg"
-" when iteration count is unknown.\n");
+" when iteration count is unknown or"
+" when using partial vectorization.\n");
   return false;
 }
 
@@ -2178,25 +2181,6 @@ vect_can_peel_nonlinear_iv_p (loop_vec_info loop_vinfo,
   return false;
 }
 
-  /* We can't support partial vectors and early breaks with an induction
- type other than add or neg since we require the epilog and can't
- perform the peeling.  The below condition mirrors that of
- vect_gen_vector_loop_niters  where niters_vector_mult_vf_var then sets
- step_vector to VF rather than 1.  This is what creates the nonlinear
- IV.  PR113163.  */
-  if (LOOP_VINFO_EARLY_BREAKS (loop_vinfo)
-  && LOOP_VINFO_VECT_FACTOR (loop_vinfo).is_constant ()
-  && LOOP_VINFO_USING_PARTIAL_VECTORS_P (loop_vinfo)
-  && induction_type != vect_step_op_neg)
-{
-  if (dump_enabled_p ())
-   dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
-"Peeling for epilogue is not supported"
-" for nonlinear induction except neg"
-" when VF is known and early breaks.\n");
-  return false;
-}
-
   return true;
 }


[gcc r14-9365] PR modula2/109969 Linking large project causes an ICE

2024-03-07 Thread Gaius Mulley via Gcc-cvs
https://gcc.gnu.org/g:99309b98c2e80a42886da36668e1e8d3d082699e

commit r14-9365-g99309b98c2e80a42886da36668e1e8d3d082699e
Author: Gaius Mulley 
Date:   Thu Mar 7 19:41:58 2024 +

PR modula2/109969 Linking large project causes an ICE

This patch contains a re-write of M2LexBuf.mod which removes the linked
list of token buckets and simplifies the implementation using a dynamic
array.  It contains more checking (for empty source files for example).
The patch also contains a fix for an ICE in gcc/m2/gm2-gcc/builtins.cc

gcc/m2/ChangeLog:

PR modula2/109969
* gm2-compiler/M2LexBuf.def (TokenToLineNo): Rename parameter.
(TokenToColumnNo): Rename parameter.
(TokenToLocation): Rename parameter.
(FindFileNameFromToken): Rename parameter.
(DumpTokens): Rewrite comment.
* gm2-compiler/M2LexBuf.mod: Rewrite.
* gm2-compiler/P0SyntaxCheck.bnf (CheckInsertCandidate):
DumpTokens before and after inserting recovery token.
* gm2-gcc/m2builtins.cc (do_target_support_exists): Add
bf_c99_compl case.
* gm2-libs/Indexing.def (InitIndexTuned): New procedure
function.
(IsEmpty): New procedure function.
* gm2-libs/Indexing.mod (InitIndexTuned): New procedure
function.
(IsEmpty): New procedure function.
(Index): New field GrowFactor.
(PutIndice): Use GrowFactor to extend dynamic array.

Signed-off-by: Gaius Mulley 

Diff:
---
 gcc/m2/gm2-compiler/M2LexBuf.def  |  32 +-
 gcc/m2/gm2-compiler/M2LexBuf.mod  | 810 --
 gcc/m2/gm2-compiler/P0SyntaxCheck.bnf |  10 +-
 gcc/m2/gm2-gcc/m2builtins.cc  |   2 +
 gcc/m2/gm2-libs/Indexing.def  |  22 +-
 gcc/m2/gm2-libs/Indexing.mod  |  46 +-
 6 files changed, 451 insertions(+), 471 deletions(-)

diff --git a/gcc/m2/gm2-compiler/M2LexBuf.def b/gcc/m2/gm2-compiler/M2LexBuf.def
index 27610ec49dd..07f5934a631 100644
--- a/gcc/m2/gm2-compiler/M2LexBuf.def
+++ b/gcc/m2/gm2-compiler/M2LexBuf.def
@@ -1,4 +1,4 @@
-(* M2LexBuf.def provides a buffer for m2.lex.
+(* M2LexBuf.def provides a buffer for m2.flex.
 
 Copyright (C) 2001-2024 Free Software Foundation, Inc.
 Contributed by Gaius Mulley .
@@ -35,18 +35,6 @@ FROM DynamicStrings IMPORT String ;
 FROM m2linemap IMPORT location_t ;
 FROM NameKey IMPORT Name ;
 
-EXPORT QUALIFIED OpenSource, CloseSource, ReInitialize, GetToken, InsertToken,
- InsertTokenAndRewind, GetPreviousTokenLineNo, GetLineNo,
- GetColumnNo, GetTokenNo, TokenToLineNo, TokenToColumnNo,
- TokenToLocation, GetTokenName,
- FindFileNameFromToken, GetFileName,
- ResetForNewPass,
- currenttoken, currentstring, currentinteger,
- AddTok, AddTokCharStar, AddTokInteger,
- MakeVirtualTok, MakeVirtual2Tok,
- SetFile, PushFile, PopFile,
- PrintTokenNo, DisplayToken, DumpTokens,
- BuiltinTokenNo, UnknownTokenNo ;
 
 CONST
UnknownTokenNo = 0 ;
@@ -143,13 +131,13 @@ PROCEDURE GetTokenName (tokenno: CARDINAL) : Name ;
 
 (*
TokenToLineNo - returns the line number of the current file for the
-   TokenNo. The depth refers to the include depth.
+   tokenno. The depth refers to the include depth.
A depth of 0 is the current file, depth of 1 is the file
which included the current file. Zero is returned if the
depth exceeds the file nesting level.
 *)
 
-PROCEDURE TokenToLineNo (TokenNo: CARDINAL; depth: CARDINAL) : CARDINAL ;
+PROCEDURE TokenToLineNo (tokenno: CARDINAL; depth: CARDINAL) : CARDINAL ;
 
 
 (*
@@ -162,31 +150,31 @@ PROCEDURE GetColumnNo () : CARDINAL ;
 
 (*
TokenToColumnNo - returns the column number of the current file for the
- TokenNo. The depth refers to the include depth.
+ tokenno. The depth refers to the include depth.
  A depth of 0 is the current file, depth of 1 is the file
  which included the current file. Zero is returned if the
  depth exceeds the file nesting level.
 *)
 
-PROCEDURE TokenToColumnNo (TokenNo: CARDINAL; depth: CARDINAL) : CARDINAL ;
+PROCEDURE TokenToColumnNo (tokenno: CARDINAL; depth: CARDINAL) : CARDINAL ;
 
 
 (*
-   TokenToLocation - returns the location_t corresponding to, TokenNo.
+   TokenToLocation - returns the location_t corresponding to tokenno.
 *)
 
-PROCEDURE TokenToLocation (TokenNo: CARDINAL) : location_t ;
+PROCEDURE TokenToLocation (tokenno: CARDINAL) : location_t ;
 
 
 (*
FindFileNameFromToken - returns the complete FileName for the appropriate
-   source file yields the token number, TokenNo.
+

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

2024-03-07 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:f1d8f6c66186e6a9237b764b791e1bbdd354f79d

commit f1d8f6c66186e6a9237b764b791e1bbdd354f79d
Author: Michael Meissner 
Date:   Thu Mar 7 11:10:38 2024 -0500

Add REVISION.

2024-03-07  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 000..0ede337fd30
--- /dev/null
+++ b/gcc/REVISION
@@ -0,0 +1 @@
+work162-orig branch


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

2024-03-07 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:13f39d24c7caad4b3a1e3e5caf0c3f242d0e6524

commit 13f39d24c7caad4b3a1e3e5caf0c3f242d0e6524
Author: Michael Meissner 
Date:   Thu Mar 7 11:09:39 2024 -0500

Add ChangeLog.test and update REVISION.

2024-03-07  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 000..9512bcddaf9
--- /dev/null
+++ b/gcc/ChangeLog.test
@@ -0,0 +1,6 @@
+ Branch work162-test, baseline 
+
+2024-03-07   Michael Meissner  
+
+   Clone branch
+
diff --git a/gcc/REVISION b/gcc/REVISION
index 1f2b7b56b83..6bf4941fb03 100644
--- a/gcc/REVISION
+++ b/gcc/REVISION
@@ -1 +1 @@
-work162 branch
+work162-test branch


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

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

 9f915684624... c++: ICE with variable template and [[deprecated]] [PR11003


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

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

 5ca0c21b61a... Add ChangeLog.meissner and REVISION.


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

2024-03-07 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:6ff76c0056bfcfa2b2fbe225c2ddd5a9f38e

commit 6ff76c0056bfcfa2b2fbe225c2ddd5a9f38e
Author: Michael Meissner 
Date:   Thu Mar 7 11:08:43 2024 -0500

Add ChangeLog.ajit and update REVISION.

2024-03-07  Michael Meissner  

gcc/

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

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

diff --git a/gcc/ChangeLog.ajit b/gcc/ChangeLog.ajit
new file mode 100644
index 000..eb5570e2484
--- /dev/null
+++ b/gcc/ChangeLog.ajit
@@ -0,0 +1,6 @@
+ Branch work162-ajit, baseline 
+
+2024-03-07   Michael Meissner  
+
+   Clone branch
+
diff --git a/gcc/REVISION b/gcc/REVISION
index 1f2b7b56b83..1fa4bd9178d 100644
--- a/gcc/REVISION
+++ b/gcc/REVISION
@@ -1 +1 @@
-work162 branch
+work162-ajit branch


[gcc] Created branch 'meissner/heads/work162-ajit' in namespace 'refs/users'

2024-03-07 Thread Michael Meissner via Gcc-cvs
The branch 'meissner/heads/work162-ajit' was created in namespace 'refs/users' 
pointing to:

 5ca0c21b61a... Add ChangeLog.meissner and REVISION.


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

2024-03-07 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:9a1cabc3c3cce1782847e1e764a52d3a3b788c81

commit 9a1cabc3c3cce1782847e1e764a52d3a3b788c81
Author: Michael Meissner 
Date:   Thu Mar 7 11:07:00 2024 -0500

Add ChangeLog.vpair and update REVISION.

2024-03-07  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 000..faeb03cac7b
--- /dev/null
+++ b/gcc/ChangeLog.vpair
@@ -0,0 +1,6 @@
+ Branch work162-vpair, baseline 
+
+2024-03-07   Michael Meissner  
+
+   Clone branch
+
diff --git a/gcc/REVISION b/gcc/REVISION
index 1f2b7b56b83..5f53efe48c3 100644
--- a/gcc/REVISION
+++ b/gcc/REVISION
@@ -1 +1 @@
-work162 branch
+work162-vpair branch


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

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

 5ca0c21b61a... Add ChangeLog.meissner and REVISION.


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

2024-03-07 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:4b27e55d4c6c76a600cf3321ccf0dc1cd317f62f

commit 4b27e55d4c6c76a600cf3321ccf0dc1cd317f62f
Author: Michael Meissner 
Date:   Thu Mar 7 11:05:59 2024 -0500

Add ChangeLog.dmf and update REVISION.

2024-03-07  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 000..4bf550e6556
--- /dev/null
+++ b/gcc/ChangeLog.dmf
@@ -0,0 +1,6 @@
+ Branch work162-dmf, baseline 
+
+2024-03-07   Michael Meissner  
+
+   Clone branch
+
diff --git a/gcc/REVISION b/gcc/REVISION
index 1f2b7b56b83..58945f7a1ad 100644
--- a/gcc/REVISION
+++ b/gcc/REVISION
@@ -1 +1 @@
-work162 branch
+work162-dmf branch


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

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

 5ca0c21b61a... Add ChangeLog.meissner and REVISION.


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

2024-03-07 Thread Michael Meissner via Libstdc++-cvs
https://gcc.gnu.org/g:5ca0c21b61aecd4f2c9250fec98d3e053d58f2c4

commit 5ca0c21b61aecd4f2c9250fec98d3e053d58f2c4
Author: Michael Meissner 
Date:   Thu Mar 7 10:59:01 2024 -0500

Add ChangeLog.meissner and REVISION.

2024-03-07  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 000..c61e5b768e0
--- /dev/null
+++ b/gcc/ChangeLog.meissner
@@ -0,0 +1,6 @@
+ Branch work162, baseline 
+
+2024-03-07   Michael Meissner  
+
+   Clone branch
+
diff --git a/gcc/REVISION b/gcc/REVISION
new file mode 100644
index 000..1f2b7b56b83
--- /dev/null
+++ b/gcc/REVISION
@@ -0,0 +1 @@
+work162 branch
diff --git a/gcc/c-family/ChangeLog.meissner b/gcc/c-family/ChangeLog.meissner
new file mode 100644
index 000..c61e5b768e0
--- /dev/null
+++ b/gcc/c-family/ChangeLog.meissner
@@ -0,0 +1,6 @@
+ Branch work162, baseline 
+
+2024-03-07   Michael Meissner  
+
+   Clone branch
+
diff --git a/gcc/c/ChangeLog.meissner b/gcc/c/ChangeLog.meissner
new file mode 100644
index 000..c61e5b768e0
--- /dev/null
+++ b/gcc/c/ChangeLog.meissner
@@ -0,0 +1,6 @@
+ Branch work162, baseline 
+
+2024-03-07   Michael Meissner  
+
+   Clone branch
+
diff --git a/gcc/cp/ChangeLog.meissner b/gcc/cp/ChangeLog.meissner
new file mode 100644
index 000..c61e5b768e0
--- /dev/null
+++ b/gcc/cp/ChangeLog.meissner
@@ -0,0 +1,6 @@
+ Branch work162, baseline 
+
+2024-03-07   Michael Meissner  
+
+   Clone branch
+
diff --git a/gcc/fortran/ChangeLog.meissner b/gcc/fortran/ChangeLog.meissner
new file mode 100644
index 000..c61e5b768e0
--- /dev/null
+++ b/gcc/fortran/ChangeLog.meissner
@@ -0,0 +1,6 @@
+ Branch work162, baseline 
+
+2024-03-07   Michael Meissner  
+
+   Clone branch
+
diff --git a/gcc/testsuite/ChangeLog.meissner b/gcc/testsuite/ChangeLog.meissner
new file mode 100644
index 000..c61e5b768e0
--- /dev/null
+++ b/gcc/testsuite/ChangeLog.meissner
@@ -0,0 +1,6 @@
+ Branch work162, baseline 
+
+2024-03-07   Michael Meissner  
+
+   Clone branch
+
diff --git a/libgcc/ChangeLog.meissner b/libgcc/ChangeLog.meissner
new file mode 100644
index 000..c61e5b768e0
--- /dev/null
+++ b/libgcc/ChangeLog.meissner
@@ -0,0 +1,6 @@
+ Branch work162, baseline 
+
+2024-03-07   Michael Meissner  
+
+   Clone branch
+
diff --git a/libstdc++-v3/ChangeLog.meissner b/libstdc++-v3/ChangeLog.meissner
new file mode 100644
index 000..c61e5b768e0
--- /dev/null
+++ b/libstdc++-v3/ChangeLog.meissner
@@ -0,0 +1,6 @@
+ Branch work162, baseline 
+
+2024-03-07   Michael Meissner  
+
+   Clone branch
+


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

2024-03-07 Thread Michael Meissner via Gcc-cvs
The branch 'meissner/heads/work162' was created in namespace 'refs/users' 
pointing to:

 9f915684624... c++: ICE with variable template and [[deprecated]] [PR11003


[gcc r14-9364] c++: ICE with variable template and [[deprecated]] [PR110031]

2024-03-07 Thread Marek Polacek via Gcc-cvs
https://gcc.gnu.org/g:9f915684624413f96e1a5ffada398ccd1c533e38

commit r14-9364-g9f915684624413f96e1a5ffada398ccd1c533e38
Author: Marek Polacek 
Date:   Mon Mar 4 12:35:18 2024 -0500

c++: ICE with variable template and [[deprecated]] [PR110031]

lookup_and_finish_template_variable already has and uses the complain
parameter but it is not passing it down to mark_used so we got the
default tf_warning_or_error, which causes various problems when
lookup_and_finish_template_variable gets called with complain=tf_none.

PR c++/110031

gcc/cp/ChangeLog:

* pt.cc (lookup_and_finish_template_variable): Pass complain to
mark_used.

gcc/testsuite/ChangeLog:

* g++.dg/cpp1z/inline-var11.C: New test.

Diff:
---
 gcc/cp/pt.cc  |  2 +-
 gcc/testsuite/g++.dg/cpp1z/inline-var11.C | 32 +++
 2 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index d73f6d93485..040ced45187 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -10533,7 +10533,7 @@ lookup_and_finish_template_variable (tree templ, tree 
targs,
   if (var == error_mark_node)
 return error_mark_node;
   var = finish_template_variable (var, complain);
-  mark_used (var);
+  mark_used (var, complain);
   return var;
 }
 
diff --git a/gcc/testsuite/g++.dg/cpp1z/inline-var11.C 
b/gcc/testsuite/g++.dg/cpp1z/inline-var11.C
new file mode 100644
index 000..d92911ed3a9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/inline-var11.C
@@ -0,0 +1,32 @@
+// PR c++/110031
+// { dg-do compile { target c++17 } }
+
+template 
+[[deprecated]]
+inline constexpr bool t = true ;
+
+template 
+struct enableif;
+
+template<>
+struct enableif
+{
+using y = int;
+};
+template 
+using enableif_t = typename enableif::y;
+
+template > = 0>   // { dg-warning "deprecated" }
+struct A {  A(T &&)  {  }};
+
+template 
+struct A {
+  A(T &&) = delete;
+  A() = delete;
+};
+
+int main(void)
+{
+  A a(5.3); // { dg-error "use of deleted function" }
+  return 0;
+}


[gcc(refs/users/rguenth/heads/vect-force-slp)] Fix last commit WRT patterns

2024-03-07 Thread Richard Biener via Gcc-cvs
https://gcc.gnu.org/g:e2bef5c639ab5a1b519b738cf67a03b85432d5dd

commit e2bef5c639ab5a1b519b738cf67a03b85432d5dd
Author: Richard Biener 
Date:   Thu Mar 7 15:36:00 2024 +0100

Fix last commit WRT patterns

* tree-vect-slp.cc (vect_analyze_slp): Look at the pattern
stmt for unused-only-live stmts.

Diff:
---
 gcc/tree-vect-slp.cc | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index f39a122e035..ae749ff11ff 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -3956,10 +3956,12 @@ vect_analyze_slp (vec_info *vinfo, unsigned 
max_tree_size)
gphi *lc_phi = *gsi;
tree def = gimple_phi_arg_def_from_edge (lc_phi, e);
stmt_vec_info stmt_info;
-   if (TREE_CODE (def) == SSA_NAME
-   && !virtual_operand_p (def)
-   && (stmt_info = loop_vinfo->lookup_def (def))
-   && STMT_VINFO_RELEVANT (stmt_info) == vect_used_only_live
+   if (TREE_CODE (def) != SSA_NAME
+   || virtual_operand_p (def)
+   || !(stmt_info = loop_vinfo->lookup_def (def)))
+ continue;
+   stmt_info = vect_stmt_to_vectorize (stmt_info);
+   if (STMT_VINFO_RELEVANT (stmt_info) == vect_used_only_live
&& STMT_VINFO_LIVE_P (stmt_info)
&& (STMT_VINFO_DEF_TYPE (stmt_info) == vect_induction_def
|| (STMT_VINFO_DEF_TYPE (stmt_info) == vect_internal_def
@@ -3969,9 +3971,9 @@ vect_analyze_slp (vec_info *vinfo, unsigned max_tree_size)
vec roots = vNULL;
vec remain = vNULL;
stmts.create (1);
-   stmts.quick_push (vect_stmt_to_vectorize (stmt_info));
+   stmts.quick_push (stmt_info);
bool res = vect_build_slp_instance (vinfo,
-   
slp_inst_kind_reduc_group,
+   /* ??? */ 
slp_inst_kind_reduc_group,
stmts, roots, remain,
max_tree_size, ,
bst_map, NULL);


[gcc r11-11272] Fix bogus error on allocator for array type with Dynamic_Predicate

2024-03-07 Thread Eric Botcazou via Gcc-cvs
https://gcc.gnu.org/g:b26501b6e310345ad9f6423b3f8b9df178c5e7d9

commit r11-11272-gb26501b6e310345ad9f6423b3f8b9df178c5e7d9
Author: Eric Botcazou 
Date:   Thu Mar 7 15:05:54 2024 +0100

Fix bogus error on allocator for array type with Dynamic_Predicate

This is a regression present on all active branches: the compiler gives
a bogus error on an allocator for an unconstrained array type declared
with a Dynamic_Predicate because Apply_Predicate_Check is invoked directly
on a subtype reference, which it cannot handle.

This moves the check to the resulting access value (after dereference) like
in Expand_Allocator_Expression.

gcc/ada/
PR ada/113979
* exp_ch4.adb (Expand_N_Allocator): In the subtype indication case,
remove call to Apply_Predicate_Check.

gcc/testsuite/
* gnat.dg/predicate15.adb: New test.

Diff:
---
 gcc/ada/exp_ch4.adb   |  2 --
 gcc/testsuite/gnat.dg/predicate15.adb | 15 +++
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index 44370786a3d..48dae8396d0 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -4970,8 +4970,6 @@ package body Exp_Ch4 is
  if Is_Array_Type (Dtyp) and then not No_Initialization (N) then
 Apply_Constraint_Check (Expression (N), Dtyp, No_Sliding => True);
 
-Apply_Predicate_Check (Expression (N), Dtyp);
-
 if Nkind (Expression (N)) = N_Raise_Constraint_Error then
Rewrite (N, New_Copy (Expression (N)));
Set_Etype (N, PtrT);
diff --git a/gcc/testsuite/gnat.dg/predicate15.adb 
b/gcc/testsuite/gnat.dg/predicate15.adb
new file mode 100644
index 000..cf9e1d9e17f
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/predicate15.adb
@@ -0,0 +1,15 @@
+-- { dg-do compile }
+-- { dg-options "-gnata" }
+
+procedure Predicate15 is
+
+   type Grid is array (Positive range <>) of Integer with
+  Dynamic_Predicate => Grid'First = 1;
+
+   type Grid_Ptr is access Grid;
+
+   Data : Grid_Ptr := new Grid (1 .. 10);
+
+begin
+   null;
+end;


[gcc r12-10197] Fix bogus error on allocator for array type with Dynamic_Predicate

2024-03-07 Thread Eric Botcazou via Gcc-cvs
https://gcc.gnu.org/g:f9e1d7aa8b4f0b8afff1de59fcadf1db0244b4e1

commit r12-10197-gf9e1d7aa8b4f0b8afff1de59fcadf1db0244b4e1
Author: Eric Botcazou 
Date:   Thu Mar 7 15:05:54 2024 +0100

Fix bogus error on allocator for array type with Dynamic_Predicate

This is a regression present on all active branches: the compiler gives
a bogus error on an allocator for an unconstrained array type declared
with a Dynamic_Predicate because Apply_Predicate_Check is invoked directly
on a subtype reference, which it cannot handle.

This moves the check to the resulting access value (after dereference) like
in Expand_Allocator_Expression.

gcc/ada/
PR ada/113979
* exp_ch4.adb (Expand_N_Allocator): In the subtype indication case,
remove call to Apply_Predicate_Check.

gcc/testsuite/
* gnat.dg/predicate15.adb: New test.

Diff:
---
 gcc/ada/exp_ch4.adb   |  2 --
 gcc/testsuite/gnat.dg/predicate15.adb | 15 +++
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index 2506c67e936..6429c6e9d69 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -4823,8 +4823,6 @@ package body Exp_Ch4 is
  if Is_Array_Type (Dtyp) and then not No_Initialization (N) then
 Apply_Constraint_Check (Expression (N), Dtyp, No_Sliding => True);
 
-Apply_Predicate_Check (Expression (N), Dtyp);
-
 if Nkind (Expression (N)) = N_Raise_Constraint_Error then
Rewrite (N, New_Copy (Expression (N)));
Set_Etype (N, PtrT);
diff --git a/gcc/testsuite/gnat.dg/predicate15.adb 
b/gcc/testsuite/gnat.dg/predicate15.adb
new file mode 100644
index 000..cf9e1d9e17f
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/predicate15.adb
@@ -0,0 +1,15 @@
+-- { dg-do compile }
+-- { dg-options "-gnata" }
+
+procedure Predicate15 is
+
+   type Grid is array (Positive range <>) of Integer with
+  Dynamic_Predicate => Grid'First = 1;
+
+   type Grid_Ptr is access Grid;
+
+   Data : Grid_Ptr := new Grid (1 .. 10);
+
+begin
+   null;
+end;


[gcc r14-9363] doc: Fix docs for -dD regarding predefined macros

2024-03-07 Thread Jonathan Wakely via Gcc-cvs
https://gcc.gnu.org/g:e2e4b603ced350447a8d0e2c5f4d419b8f69b6a6

commit r14-9363-ge2e4b603ced350447a8d0e2c5f4d419b8f69b6a6
Author: Jonathan Wakely 
Date:   Tue Mar 5 16:09:06 2024 +

doc: Fix docs for -dD regarding predefined macros

The manual has always claimed that -dD differs from -dM by not
outputting predefined macros, but that's untrue. It has been untrue
since GCC 3.0 (probably with the change to use libcpp as the default
preprocessor implementation).

gcc/ChangeLog:

* doc/cppopts.texi: Remove incorrect claim about -dD not
outputting predefined macros.

Diff:
---
 gcc/doc/cppopts.texi | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/gcc/doc/cppopts.texi b/gcc/doc/cppopts.texi
index fa8f3d88c89..5b5b0848ae8 100644
--- a/gcc/doc/cppopts.texi
+++ b/gcc/doc/cppopts.texi
@@ -524,8 +524,7 @@ interpreted as a synonym for @option{-fdump-rtl-mach}.
 
 @opindex dD
 @item -dD
-Like @option{-dM} except in two respects: it does @emph{not} include the
-predefined macros, and it outputs @emph{both} the @samp{#define}
+Like @option{-dM} except that it outputs @emph{both} the @samp{#define}
 directives and the result of preprocessing.  Both kinds of output go to
 the standard output file.


[gcc r14-9362] rs6000: Don't ICE when compiling the __builtin_vsx_splat_2di [PR113950]

2024-03-07 Thread jeevitha via Gcc-cvs
https://gcc.gnu.org/g:fa0468877869f52b05742de6deef582e4dd296fc

commit r14-9362-gfa0468877869f52b05742de6deef582e4dd296fc
Author: Jeevitha 
Date:   Thu Mar 7 07:41:38 2024 -0600

rs6000: Don't ICE when compiling the __builtin_vsx_splat_2di [PR113950]

When we expand the __builtin_vsx_splat_2di built-in, we were allowing 
immediate
value for second operand which causes an unrecognizable insn ICE. Even 
though
the immediate value was forced into a register, it wasn't correctly assigned
to the second operand. So corrected the assignment of op1 to operands[1].

2024-03-07  Jeevitha Palanisamy  

gcc/
PR target/113950
* config/rs6000/vsx.md (vsx_splat_): Correct assignment to 
operand1
and simplify else if with else.

gcc/testsuite/
PR target/113950
* gcc.target/powerpc/pr113950.c: New testcase.

Diff:
---
 gcc/config/rs6000/vsx.md|  4 ++--
 gcc/testsuite/gcc.target/powerpc/pr113950.c | 24 
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/gcc/config/rs6000/vsx.md b/gcc/config/rs6000/vsx.md
index 6111cc90eb7..f135fa079bd 100644
--- a/gcc/config/rs6000/vsx.md
+++ b/gcc/config/rs6000/vsx.md
@@ -4666,8 +4666,8 @@
   rtx op1 = operands[1];
   if (MEM_P (op1))
 operands[1] = rs6000_force_indexed_or_indirect_mem (op1);
-  else if (!REG_P (op1))
-op1 = force_reg (mode, op1);
+  else
+operands[1] = force_reg (mode, op1);
 })
 
 (define_insn "vsx_splat__reg"
diff --git a/gcc/testsuite/gcc.target/powerpc/pr113950.c 
b/gcc/testsuite/gcc.target/powerpc/pr113950.c
new file mode 100644
index 000..359963d1041
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr113950.c
@@ -0,0 +1,24 @@
+/* PR target/113950 */
+/* { dg-require-effective-target powerpc_vsx_ok } */
+/* { dg-options "-O2 -mvsx" } */
+
+/* Verify we do not ICE on the following.  */
+
+void abort (void);
+
+int main ()
+{
+  int i;
+  vector signed long long vsll_result, vsll_expected_result;
+  signed long long sll_arg1;
+
+  sll_arg1 = 300;
+  vsll_expected_result = (vector signed long long) {300, 300};
+  vsll_result = __builtin_vsx_splat_2di (sll_arg1);  
+
+  for (i = 0; i < 2; i++)
+if (vsll_result[i] != vsll_expected_result[i])
+  abort();
+
+  return 0;
+}


[gcc r13-8409] Fix bogus error on allocator for array type with Dynamic_Predicate

2024-03-07 Thread Eric Botcazou via Gcc-cvs
https://gcc.gnu.org/g:0e591e6f27a20c26672ea8c0550a6ef673c1fccf

commit r13-8409-g0e591e6f27a20c26672ea8c0550a6ef673c1fccf
Author: Eric Botcazou 
Date:   Thu Mar 7 15:05:54 2024 +0100

Fix bogus error on allocator for array type with Dynamic_Predicate

This is a regression present on all active branches: the compiler gives
a bogus error on an allocator for an unconstrained array type declared
with a Dynamic_Predicate because Apply_Predicate_Check is invoked directly
on a subtype reference, which it cannot handle.

This moves the check to the resulting access value (after dereference) like
in Expand_Allocator_Expression.

gcc/ada/
PR ada/113979
* exp_ch4.adb (Expand_N_Allocator): In the subtype indication case,
remove call to Apply_Predicate_Check.

gcc/testsuite/
* gnat.dg/predicate15.adb: New test.

Diff:
---
 gcc/ada/exp_ch4.adb   |  2 --
 gcc/testsuite/gnat.dg/predicate15.adb | 15 +++
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index 8442de6f90c..5cb6ee25702 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -4785,8 +4785,6 @@ package body Exp_Ch4 is
  if Is_Array_Type (Dtyp) and then not No_Initialization (N) then
 Apply_Constraint_Check (Expression (N), Dtyp, No_Sliding => True);
 
-Apply_Predicate_Check (Expression (N), Dtyp);
-
 if Nkind (Expression (N)) = N_Raise_Constraint_Error then
Rewrite (N, New_Copy (Expression (N)));
Set_Etype (N, PtrT);
diff --git a/gcc/testsuite/gnat.dg/predicate15.adb 
b/gcc/testsuite/gnat.dg/predicate15.adb
new file mode 100644
index 000..cf9e1d9e17f
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/predicate15.adb
@@ -0,0 +1,15 @@
+-- { dg-do compile }
+-- { dg-options "-gnata" }
+
+procedure Predicate15 is
+
+   type Grid is array (Positive range <>) of Integer with
+  Dynamic_Predicate => Grid'First = 1;
+
+   type Grid_Ptr is access Grid;
+
+   Data : Grid_Ptr := new Grid (1 .. 10);
+
+begin
+   null;
+end;


[gcc(refs/users/rguenth/heads/vect-force-slp)] Handle unused-only-live stmts in SLP discovery

2024-03-07 Thread Richard Biener via Gcc-cvs
https://gcc.gnu.org/g:fa45f8f652fc050336ea80783c5b195b5bc1f40e

commit fa45f8f652fc050336ea80783c5b195b5bc1f40e
Author: Richard Biener 
Date:   Thu Mar 7 15:13:33 2024 +0100

Handle unused-only-live stmts in SLP discovery

The following adds SLP discovery for roots that are only live but
otherwise unused.

* tree-vect-slp.cc (vect_analyze_slp): Analyze SLP for live
but otherwise unused defs.

Diff:
---
 gcc/tree-vect-slp.cc | 34 ++
 1 file changed, 34 insertions(+)

diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index 3d65364ae37..f39a122e035 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -3945,6 +3945,40 @@ vect_analyze_slp (vec_info *vinfo, unsigned 
max_tree_size)
  saved_stmts.release ();
}
}
+
+  if (param_vect_single_lane_slp != 0)
+   {
+ /* Make sure to vectorize only-live stmts, usually inductions.  */
+ for (edge e : get_loop_exit_edges (LOOP_VINFO_LOOP (loop_vinfo)))
+   for (auto gsi = gsi_start_phis (e->dest); !gsi_end_p (gsi);
+gsi_next ())
+ {
+   gphi *lc_phi = *gsi;
+   tree def = gimple_phi_arg_def_from_edge (lc_phi, e);
+   stmt_vec_info stmt_info;
+   if (TREE_CODE (def) == SSA_NAME
+   && !virtual_operand_p (def)
+   && (stmt_info = loop_vinfo->lookup_def (def))
+   && STMT_VINFO_RELEVANT (stmt_info) == vect_used_only_live
+   && STMT_VINFO_LIVE_P (stmt_info)
+   && (STMT_VINFO_DEF_TYPE (stmt_info) == vect_induction_def
+   || (STMT_VINFO_DEF_TYPE (stmt_info) == vect_internal_def
+   && STMT_VINFO_REDUC_IDX (stmt_info) == -1)))
+ {
+   vec stmts;
+   vec roots = vNULL;
+   vec remain = vNULL;
+   stmts.create (1);
+   stmts.quick_push (vect_stmt_to_vectorize (stmt_info));
+   bool res = vect_build_slp_instance (vinfo,
+   
slp_inst_kind_reduc_group,
+   stmts, roots, remain,
+   max_tree_size, ,
+   bst_map, NULL);
+   gcc_assert (res);
+ }
+ }
+   }
 }
 
   hash_set visited_patterns;


[gcc r14-9361] Fix bogus error on allocator for array type with Dynamic_Predicate

2024-03-07 Thread Eric Botcazou via Gcc-cvs
https://gcc.gnu.org/g:e71a4e81729516eed8782a255ff37617e6fd4b69

commit r14-9361-ge71a4e81729516eed8782a255ff37617e6fd4b69
Author: Eric Botcazou 
Date:   Thu Mar 7 15:05:54 2024 +0100

Fix bogus error on allocator for array type with Dynamic_Predicate

This is a regression present on all active branches: the compiler gives
a bogus error on an allocator for an unconstrained array type declared
with a Dynamic_Predicate because Apply_Predicate_Check is invoked directly
on a subtype reference, which it cannot handle.

This moves the check to the resulting access value (after dereference) like
in Expand_Allocator_Expression.

gcc/ada/
PR ada/113979
* exp_ch4.adb (Expand_N_Allocator): In the subtype indication case,
call Apply_Predicate_Check on the resulting access value if needed.

gcc/testsuite/
* gnat.dg/predicate15.adb: New test.

Diff:
---
 gcc/ada/exp_ch4.adb   |  6 --
 gcc/testsuite/gnat.dg/predicate15.adb | 15 +++
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index 4f83cd4737a..e4a40414872 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -4657,8 +4657,6 @@ package body Exp_Ch4 is
  if Is_Array_Type (Dtyp) and then not No_Initialization (N) then
 Apply_Constraint_Check (Expression (N), Dtyp, No_Sliding => True);
 
-Apply_Predicate_Check (Expression (N), Dtyp);
-
 if Nkind (Expression (N)) = N_Raise_Constraint_Error then
Rewrite (N, New_Copy (Expression (N)));
Set_Etype (N, PtrT);
@@ -4752,6 +4750,8 @@ package body Exp_Ch4 is
 Rewrite (N, New_Occurrence_Of (Temp, Loc));
 Analyze_And_Resolve (N, PtrT);
 
+Apply_Predicate_Check (N, Dtyp, Deref => True);
+
  --  Case of no initialization procedure present
 
  elsif not Has_Non_Null_Base_Init_Proc (T) then
@@ -5119,6 +5119,8 @@ package body Exp_Ch4 is
Rewrite (N, New_Occurrence_Of (Temp, Loc));
Analyze_And_Resolve (N, PtrT);
 
+   Apply_Predicate_Check (N, Dtyp, Deref => True);
+
--  When designated type has Default_Initial_Condition aspects,
--  make a call to the type's DIC procedure to perform the
--  checks. Theoretically this might also be needed for cases
diff --git a/gcc/testsuite/gnat.dg/predicate15.adb 
b/gcc/testsuite/gnat.dg/predicate15.adb
new file mode 100644
index 000..cf9e1d9e17f
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/predicate15.adb
@@ -0,0 +1,15 @@
+-- { dg-do compile }
+-- { dg-options "-gnata" }
+
+procedure Predicate15 is
+
+   type Grid is array (Positive range <>) of Integer with
+  Dynamic_Predicate => Grid'First = 1;
+
+   type Grid_Ptr is access Grid;
+
+   Data : Grid_Ptr := new Grid (1 .. 10);
+
+begin
+   null;
+end;


[gcc r14-9360] Include safe-ctype.h after C++ standard headers, to avoid over-poisoning

2024-03-07 Thread François-Xavier Coudert via Gcc-cvs
https://gcc.gnu.org/g:9970b576b7e4ae337af1268395ff221348c4b34a

commit r14-9360-g9970b576b7e4ae337af1268395ff221348c4b34a
Author: Francois-Xavier Coudert 
Date:   Thu Mar 7 14:36:03 2024 +0100

Include safe-ctype.h after C++ standard headers, to avoid over-poisoning

When building gcc's C++ sources against recent libc++, the poisoning of
the ctype macros due to including safe-ctype.h before including C++
standard headers such as , , etc, causes many compilation
errors, similar to:

  In file included from /home/dim/src/gcc/master/gcc/gensupport.cc:23:
  In file included from /home/dim/src/gcc/master/gcc/system.h:233:
  In file included from /usr/include/c++/v1/vector:321:
  In file included from
  /usr/include/c++/v1/__format/formatter_bool.h:20:
  In file included from
  /usr/include/c++/v1/__format/formatter_integral.h:32:
  In file included from /usr/include/c++/v1/locale:202:
  /usr/include/c++/v1/__locale:546:5: error: '__abi_tag__' attribute
  only applies to structs, variables, functions, and namespaces
546 | _LIBCPP_INLINE_VISIBILITY
| ^
  /usr/include/c++/v1/__config:813:37: note: expanded from macro
  '_LIBCPP_INLINE_VISIBILITY'
813 | #  define _LIBCPP_INLINE_VISIBILITY _LIBCPP_HIDE_FROM_ABI
| ^
  /usr/include/c++/v1/__config:792:26: note: expanded from macro
  '_LIBCPP_HIDE_FROM_ABI'
792 |
__attribute__((__abi_tag__(_LIBCPP_TOSTRING(
  _LIBCPP_VERSIONED_IDENTIFIER
|  ^
  In file included from /home/dim/src/gcc/master/gcc/gensupport.cc:23:
  In file included from /home/dim/src/gcc/master/gcc/system.h:233:
  In file included from /usr/include/c++/v1/vector:321:
  In file included from
  /usr/include/c++/v1/__format/formatter_bool.h:20:
  In file included from
  /usr/include/c++/v1/__format/formatter_integral.h:32:
  In file included from /usr/include/c++/v1/locale:202:
  /usr/include/c++/v1/__locale:547:37: error: expected ';' at end of
  declaration list
547 | char_type toupper(char_type __c) const
| ^
  /usr/include/c++/v1/__locale:553:48: error: too many arguments
  provided to function-like macro invocation
553 | const char_type* toupper(char_type* __low, const
char_type* __high) const
|^
  /home/dim/src/gcc/master/gcc/../include/safe-ctype.h:146:9: note:
  macro 'toupper' defined here
146 | #define toupper(c) do_not_use_toupper_with_safe_ctype
| ^

This is because libc++ uses different transitive includes than
libstdc++, and some of those transitive includes pull in various ctype
declarations (typically via ).

There was already a special case for including  before
safe-ctype.h, so move the rest of the C++ standard header includes to
the same location, to fix the problem.

gcc/ChangeLog:

* system.h: Include safe-ctype.h after C++ standard headers.

Signed-off-by: Dimitry Andric 

Diff:
---
 gcc/system.h | 39 ++-
 1 file changed, 18 insertions(+), 21 deletions(-)

diff --git a/gcc/system.h b/gcc/system.h
index b0edab02885..ab29fc19776 100644
--- a/gcc/system.h
+++ b/gcc/system.h
@@ -194,27 +194,8 @@ extern int fprintf_unlocked (FILE *, const char *, ...);
 #undef fread_unlocked
 #undef fwrite_unlocked
 
-/* Include  before "safe-ctype.h" to avoid GCC poisoning
-   the ctype macros through safe-ctype.h */
-
-#ifdef __cplusplus
-#ifdef INCLUDE_STRING
-# include 
-#endif
-#endif
-
-/* There are an extraordinary number of issues with .
-   The last straw is that it varies with the locale.  Use libiberty's
-   replacement instead.  */
-#include "safe-ctype.h"
-
-#include 
-
-#include 
-
-#if !defined (errno) && defined (HAVE_DECL_ERRNO) && !HAVE_DECL_ERRNO
-extern int errno;
-#endif
+/* Include C++ standard headers before "safe-ctype.h" to avoid GCC
+   poisoning the ctype macros through safe-ctype.h */
 
 #ifdef __cplusplus
 #if defined (INCLUDE_ALGORITHM) || !defined (HAVE_SWAP_IN_UTILITY)
@@ -229,6 +210,9 @@ extern int errno;
 #ifdef INCLUDE_SET
 # include 
 #endif
+#ifdef INCLUDE_STRING
+# include 
+#endif
 #ifdef INCLUDE_VECTOR
 # include 
 #endif
@@ -245,6 +229,19 @@ extern int errno;
 # include 
 #endif
 
+/* There are an extraordinary number of issues with .
+   The last straw is that it varies with the locale.  Use libiberty's
+   replacement instead.  */
+#include "safe-ctype.h"
+
+#include 
+
+#include 
+
+#if !defined (errno) && defined (HAVE_DECL_ERRNO) && !HAVE_DECL_ERRNO
+extern int errno;
+#endif
+
 /* Some of glibc's string inlines cause warnings.  Plus we'd rather
rely on (and therefore test) GCC's string builtins.  */
 #define 

[gcc r14-9359] analyzer: Fix up some -Wformat* warnings

2024-03-07 Thread Jakub Jelinek via Gcc-cvs
https://gcc.gnu.org/g:a242f69693d2fcac428cb82bf843882dee84fc81

commit r14-9359-ga242f69693d2fcac428cb82bf843882dee84fc81
Author: Jakub Jelinek 
Date:   Thu Mar 7 14:19:49 2024 +0100

analyzer: Fix up some -Wformat* warnings

I'm seeing warnings like
../../gcc/analyzer/access-diagram.cc: In member function ‘void 
ana::bit_size_expr::print(pretty_printer*) const’:
../../gcc/analyzer/access-diagram.cc:399:26: warning: unknown conversion 
type character ‘E’ in format [-Wformat=]
  399 | pp_printf (pp, _("%qE bytes"), bytes_expr);
  |  ^~~
when building stage2/stage3 gcc.  While such warnings would be
understandable when building stage1 because one could e.g. have some
older host compiler which doesn't understand some of the format specifiers,
the above seems to be because we have in pretty-print.h
 #ifdef GCC_DIAG_STYLE
 #define GCC_PPDIAG_STYLE GCC_DIAG_STYLE
 #else
 #define GCC_PPDIAG_STYLE __gcc_diag__
 #endif
and use GCC_PPDIAG_STYLE e.g. for pp_printf, and while
diagnostic-core.h has
 #ifndef GCC_DIAG_STYLE
 #define GCC_DIAG_STYLE __gcc_tdiag__
 #endif
(and similarly various FE headers include their own GCC_DIAG_STYLE)
when including pretty-print.h before diagnostic-core.h we end up
with __gcc_diag__ style rather than __gcc_tdiag__ style, which I think
is the right thing for the analyzer, because analyzer seems to use
default_tree_printer everywhere:
grep pp_format_decoder.*=.default_tree_printer analyzer/* | wc -l
57

The following patch fixes that by making sure diagnostic-core.h is included
before pretty-print.h.

2024-03-07  Jakub Jelinek  

* access-diagram.cc: Include diagnostic-core.h before including
diagnostic.h or diagnostic-path.h.
* sm-malloc.cc: Likewise.
* diagnostic-manager.cc: Likewise.
* call-summary.cc: Likewise.
* record-layout.cc: Likewise.

Diff:
---
 gcc/analyzer/access-diagram.cc | 1 +
 gcc/analyzer/call-summary.cc   | 1 +
 gcc/analyzer/diagnostic-manager.cc | 2 +-
 gcc/analyzer/record-layout.cc  | 1 +
 gcc/analyzer/sm-malloc.cc  | 1 +
 5 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gcc/analyzer/access-diagram.cc b/gcc/analyzer/access-diagram.cc
index 24d203f9325..2836308c019 100644
--- a/gcc/analyzer/access-diagram.cc
+++ b/gcc/analyzer/access-diagram.cc
@@ -30,6 +30,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "function.h"
 #include "basic-block.h"
 #include "gimple.h"
+#include "diagnostic-core.h"
 #include "diagnostic.h"
 #include "intl.h"
 #include "make-unique.h"
diff --git a/gcc/analyzer/call-summary.cc b/gcc/analyzer/call-summary.cc
index 8b8567a1528..a569bb94cec 100644
--- a/gcc/analyzer/call-summary.cc
+++ b/gcc/analyzer/call-summary.cc
@@ -23,6 +23,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "coretypes.h"
 #include "tree.h"
 #include "tree-dfa.h"
+#include "diagnostic-core.h"
 #include "diagnostic.h"
 #include "tree-diagnostic.h"
 #include "analyzer/analyzer.h"
diff --git a/gcc/analyzer/diagnostic-manager.cc 
b/gcc/analyzer/diagnostic-manager.cc
index 246d052100f..08d92f9780e 100644
--- a/gcc/analyzer/diagnostic-manager.cc
+++ b/gcc/analyzer/diagnostic-manager.cc
@@ -24,11 +24,11 @@ along with GCC; see the file COPYING3.  If not see
 #include "coretypes.h"
 #include "tree.h"
 #include "input.h"
+#include "diagnostic-core.h"
 #include "pretty-print.h"
 #include "gcc-rich-location.h"
 #include "gimple-pretty-print.h"
 #include "function.h"
-#include "diagnostic-core.h"
 #include "diagnostic-event-id.h"
 #include "diagnostic-path.h"
 #include "bitmap.h"
diff --git a/gcc/analyzer/record-layout.cc b/gcc/analyzer/record-layout.cc
index 62951474bb7..567dfd9809a 100644
--- a/gcc/analyzer/record-layout.cc
+++ b/gcc/analyzer/record-layout.cc
@@ -26,6 +26,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "function.h"
 #include "basic-block.h"
 #include "gimple.h"
+#include "diagnostic-core.h"
 #include "diagnostic.h"
 #include "tree-diagnostic.h"
 #include "analyzer/analyzer.h"
diff --git a/gcc/analyzer/sm-malloc.cc b/gcc/analyzer/sm-malloc.cc
index 2e0cf8a6887..a518816b2b8 100644
--- a/gcc/analyzer/sm-malloc.cc
+++ b/gcc/analyzer/sm-malloc.cc
@@ -29,6 +29,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "gimple.h"
 #include "options.h"
 #include "bitmap.h"
+#include "diagnostic-core.h"
 #include "diagnostic-path.h"
 #include "analyzer/analyzer.h"
 #include "diagnostic-event-id.h"


[gcc r14-9358] contrib: Update test_mklog to correspond to mklog

2024-03-07 Thread Filip Kastl via Gcc-cvs
https://gcc.gnu.org/g:0c1ff8951c2f5ff5b0699bbfa7523f690deac713

commit r14-9358-g0c1ff8951c2f5ff5b0699bbfa7523f690deac713
Author: Filip Kastl 
Date:   Thu Mar 7 13:23:49 2024 +0100

contrib: Update test_mklog to correspond to mklog

contrib/ChangeLog:

* test_mklog.py: "Moved to..." -> "Move to..."

Signed-off-by: Filip Kastl 

Diff:
---
 contrib/test_mklog.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/test_mklog.py b/contrib/test_mklog.py
index b6210738e55..80e159fcca4 100755
--- a/contrib/test_mklog.py
+++ b/contrib/test_mklog.py
@@ -400,7 +400,7 @@ rename to gcc/ipa-icf2.c
 EXPECTED8 = '''\
 gcc/ChangeLog:
 
-   * ipa-icf.c: Moved to...
+   * ipa-icf.c: Move to...
* ipa-icf2.c: ...here.
 
 '''


[gcc r14-9357] c++: Fix ICE diagnosing incomplete type of overloaded function set [PR98356]

2024-03-07 Thread Nathaniel Shead via Gcc-cvs
https://gcc.gnu.org/g:940586a63586941a9f2b973491afc8a15a96c98b

commit r14-9357-g940586a63586941a9f2b973491afc8a15a96c98b
Author: Nathaniel Shead 
Date:   Tue Mar 5 01:59:41 2024 +1100

c++: Fix ICE diagnosing incomplete type of overloaded function set [PR98356]

In the linked PR the result of 'get_first_fn' is a USING_DECL against
the template parameter, to be filled in on instantiation. But we don't
actually need to get the first set of the member functions: it's enough
to know that we have a (possibly overloaded) member function at all.

PR c++/98356

gcc/cp/ChangeLog:

* typeck2.cc (cxx_incomplete_type_diagnostic): Don't assume
'member' will be a FUNCTION_DECL (or something like it).

gcc/testsuite/ChangeLog:

* g++.dg/pr98356.C: New test.

Signed-off-by: Nathaniel Shead 

Diff:
---
 gcc/cp/typeck2.cc  | 11 +--
 gcc/testsuite/g++.dg/pr98356.C |  9 +
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/gcc/cp/typeck2.cc b/gcc/cp/typeck2.cc
index 9608bdccd8b..31198b2f9f5 100644
--- a/gcc/cp/typeck2.cc
+++ b/gcc/cp/typeck2.cc
@@ -350,16 +350,15 @@ cxx_incomplete_type_diagnostic (location_t loc, 
const_tree value,
 bad_member:
   {
tree member = TREE_OPERAND (value, 1);
-   if (is_overloaded_fn (member))
- member = get_first_fn (member);
-
-   if (DECL_FUNCTION_MEMBER_P (member)
-   && ! flag_ms_extensions)
+   if (is_overloaded_fn (member) && !flag_ms_extensions)
  {
gcc_rich_location richloc (loc);
/* If "member" has no arguments (other than "this"), then
   add a fix-it hint.  */
-   if (type_num_arguments (TREE_TYPE (member)) == 1)
+   member = MAYBE_BASELINK_FUNCTIONS (member);
+   if (TREE_CODE (member) == FUNCTION_DECL
+   && DECL_OBJECT_MEMBER_FUNCTION_P (member)
+   && type_num_arguments (TREE_TYPE (member)) == 1)
  richloc.add_fixit_insert_after ("()");
complained = emit_diagnostic (diag_kind, , 0,
 "invalid use of member function %qD "
diff --git a/gcc/testsuite/g++.dg/pr98356.C b/gcc/testsuite/g++.dg/pr98356.C
new file mode 100644
index 000..acea238593b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr98356.C
@@ -0,0 +1,9 @@
+// PR c++/98356
+// { dg-do compile { target c++11 } }
+
+template  class T> struct S {
+  using A = T;
+  using A::foo;
+  void foo ();
+  void bar () {foo.}  // { dg-error "invalid use of member function" }
+};


[gcc r14-9356] c++: Stream DECL_CONTEXT for template template parms [PR98881]

2024-03-07 Thread Nathaniel Shead via Gcc-cvs
https://gcc.gnu.org/g:2f8a3da8ea30066d2201f8148714a8e89da5

commit r14-9356-g2f8a3da8ea30066d2201f8148714a8e89da5
Author: Nathaniel Shead 
Date:   Tue Mar 5 15:17:09 2024 +1100

c++: Stream DECL_CONTEXT for template template parms [PR98881]

When streaming in a nested template-template parameter as in the
attached testcase, we end up reaching the containing template-template
parameter in 'tpl_parms_fini'. We should not set the DECL_CONTEXT to
this (nested) template-template parameter, as it should already be the
struct that the outer template-template parameter is declared on.

The precise logic for what DECL_CONTEXT should be for a template
template parameter in various situations seems rather obscure. Rather
than trying to determine the assumptions that need to hold, it seems
simpler to just always re-stream the DECL_CONTEXT as needed for now.

PR c++/98881

gcc/cp/ChangeLog:

* module.cc (trees_out::tpl_parms_fini): Stream out DECL_CONTEXT
for template template parameters.
(trees_in::tpl_parms_fini): Read it.

gcc/testsuite/ChangeLog:

* g++.dg/modules/tpl-tpl-parm-3.h: New test.
* g++.dg/modules/tpl-tpl-parm-3_a.H: New test.
* g++.dg/modules/tpl-tpl-parm-3_b.C: New test.
* g++.dg/modules/tpl-tpl-parm-3_c.C: New test.

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

Diff:
---
 gcc/cp/module.cc| 41 ++---
 gcc/testsuite/g++.dg/modules/tpl-tpl-parm-3.h   | 12 
 gcc/testsuite/g++.dg/modules/tpl-tpl-parm-3_a.H |  5 +++
 gcc/testsuite/g++.dg/modules/tpl-tpl-parm-3_b.C |  5 +++
 gcc/testsuite/g++.dg/modules/tpl-tpl-parm-3_c.C | 15 +
 5 files changed, 47 insertions(+), 31 deletions(-)

diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc
index 80b63a70a62..f7e8b357fc2 100644
--- a/gcc/cp/module.cc
+++ b/gcc/cp/module.cc
@@ -10126,23 +10126,12 @@ trees_out::tpl_parms_fini (tree tmpl, unsigned 
tpl_levels)
  tree dflt = TREE_PURPOSE (parm);
  tree_node (dflt);
 
- if (streaming_p ())
-   {
- tree decl = TREE_VALUE (parm);
- if (TREE_CODE (decl) == TEMPLATE_DECL)
-   {
- tree ctx = DECL_CONTEXT (decl);
- tree inner = DECL_TEMPLATE_RESULT (decl);
- tree tpi = (TREE_CODE (inner) == TYPE_DECL
- ? TEMPLATE_TYPE_PARM_INDEX (TREE_TYPE (decl))
- : DECL_INITIAL (inner));
- bool original = (TEMPLATE_PARM_LEVEL (tpi)
-  == TEMPLATE_PARM_ORIG_LEVEL (tpi));
- /* Original template template parms have a context
-of their owning template.  Reduced ones do not.  */
- gcc_checking_assert (original ? ctx == tmpl : !ctx);
-   }
-   }
+ /* Template template parameters need a context of their owning
+template. This is quite tricky to infer correctly on stream-in
+(see PR c++/98881) so we'll just provide it directly.  */
+ tree decl = TREE_VALUE (parm);
+ if (TREE_CODE (decl) == TEMPLATE_DECL)
+   tree_node (DECL_CONTEXT (decl));
}
 }
 }
@@ -10160,24 +10149,14 @@ trees_in::tpl_parms_fini (tree tmpl, unsigned 
tpl_levels)
{
  tree parm = TREE_VEC_ELT (vec, ix);
  tree dflt = tree_node ();
- if (get_overrun ())
-   return false;
  TREE_PURPOSE (parm) = dflt;
 
  tree decl = TREE_VALUE (parm);
  if (TREE_CODE (decl) == TEMPLATE_DECL)
-   {
- tree inner = DECL_TEMPLATE_RESULT (decl);
- tree tpi = (TREE_CODE (inner) == TYPE_DECL
- ? TEMPLATE_TYPE_PARM_INDEX (TREE_TYPE (decl))
- : DECL_INITIAL (inner));
- bool original = (TEMPLATE_PARM_LEVEL (tpi)
-  == TEMPLATE_PARM_ORIG_LEVEL (tpi));
- /* Original template template parms have a context
-of their owning template.  Reduced ones do not.  */
- if (original)
-   DECL_CONTEXT (decl) = tmpl;
-   }
+   DECL_CONTEXT (decl) = tree_node ();
+
+ if (get_overrun ())
+   return false;
}
 }
   return true;
diff --git a/gcc/testsuite/g++.dg/modules/tpl-tpl-parm-3.h 
b/gcc/testsuite/g++.dg/modules/tpl-tpl-parm-3.h
new file mode 100644
index 000..b0dcf353c23
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/tpl-tpl-parm-3.h
@@ -0,0 +1,12 @@
+// PR c++/98881
+
+template  struct X {};
+
+template typename TT>
+struct X> {
+  template typename UU>
+  void f (X>&);
+};
+
+template class TT> struct Y;
+template class UU> struct Y { };
diff --git 

gcc-wwwdocs branch master updated. f99d0f3a2c61ad6677170b9068d511c20ba1bfe1

2024-03-07 Thread Tobias Burnus 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  f99d0f3a2c61ad6677170b9068d511c20ba1bfe1 (commit)
  from  d8b8422fea1dc4cfb0411444544e12e7ed47cb38 (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 f99d0f3a2c61ad6677170b9068d511c20ba1bfe1
Author: Tobias Burnus 
Date:   Thu Mar 7 11:40:57 2024 +0100

projects/gomp/: Fix typo, mark an item as implemented in GCC 14

diff --git a/htdocs/projects/gomp/index.html b/htdocs/projects/gomp/index.html
index 8fdfb95a..b8f11508 100644
--- a/htdocs/projects/gomp/index.html
+++ b/htdocs/projects/gomp/index.html
@@ -708,7 +708,7 @@ than listed, depending on resolved corner cases and 
optimizations.
 
   
   
-.terators in target update motion clauses and map 
clauses
+Iterators in target update motion clauses and map 
clauses
 No
 
   
@@ -729,7 +729,7 @@ than listed, depending on resolved corner cases and 
optimizations.
   
   
 present argument to defaultmap clause
-No
+GCC14
 
   
   

---

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


hooks/post-receive
-- 
gcc-wwwdocs


[gcc r14-9355] bb-reorder: Fix -freorder-blocks-and-partition ICEs on aarch64 with asm goto [PR110079]

2024-03-07 Thread Jakub Jelinek via Gcc-cvs
https://gcc.gnu.org/g:b209d905f5ce1fa9d76ce634fd54245ff340960b

commit r14-9355-gb209d905f5ce1fa9d76ce634fd54245ff340960b
Author: Jakub Jelinek 
Date:   Thu Mar 7 10:02:49 2024 +0100

bb-reorder: Fix -freorder-blocks-and-partition ICEs on aarch64 with asm 
goto [PR110079]

The following testcase ICEs, because fix_crossing_unconditional_branches
thinks that asm goto is an unconditional jump and removes it, replacing it
with unconditional jump to one of the labels.
This doesn't happen on x86 because the function in question isn't invoked
there at all:
  /* If the architecture does not have unconditional branches that
 can span all of memory, convert crossing unconditional branches
 into indirect jumps.  Since adding an indirect jump also adds
 a new register usage, update the register usage information as
 well.  */
  if (!HAS_LONG_UNCOND_BRANCH)
fix_crossing_unconditional_branches ();
I think for the asm goto case, for the non-fallthru edge if any we should
handle it like any other fallthru (and fix_crossing_unconditional_branches
doesn't really deal with those, it only looks at explicit branches at the
end of bbs and we are in cfglayout mode at that point) and for the labels
we just pass the labels as immediates to the assembly and it is up to the
user to figure out how to store them/branch to them or whatever they want to
do.
So, the following patch fixes this by not treating asm goto as a simple
unconditional jump.

I really think that on the !HAS_LONG_UNCOND_BRANCH targets we have a bug
somewhere else, where outofcfglayout or whatever should actually create
those indirect jumps on the crossing edges instead of adding normal
unconditional jumps, I see e.g. in
__attribute__((cold)) int bar (char *);
__attribute__((hot)) int baz (char *);
void qux (int x) { if (__builtin_expect (!x, 1)) goto l1; bar (""); goto 
l1; l1: baz (""); }
void corge (int x) { if (__builtin_expect (!x, 0)) goto l1; baz (""); l2: 
return; l1: bar (""); goto l2; }
with -O2 -freorder-blocks-and-partition on aarch64 before/after this patch
just b .L? jumps which I believe are +-32MB, so if .text is larger than
32MB, it could fail to link, but this patch doesn't address that.

2024-03-07  Jakub Jelinek  

PR rtl-optimization/110079
* bb-reorder.cc (fix_crossing_unconditional_branches): Don't adjust
asm goto.

* gcc.dg/pr110079.c: New test.

Diff:
---
 gcc/bb-reorder.cc   |  3 ++-
 gcc/testsuite/gcc.dg/pr110079.c | 43 +
 2 files changed, 45 insertions(+), 1 deletion(-)

diff --git a/gcc/bb-reorder.cc b/gcc/bb-reorder.cc
index 3137f88a236..7998c0a148e 100644
--- a/gcc/bb-reorder.cc
+++ b/gcc/bb-reorder.cc
@@ -2266,7 +2266,8 @@ fix_crossing_unconditional_branches (void)
  /* Make sure the jump is not already an indirect or table jump.  */
 
  if (!computed_jump_p (last_insn)
- && !tablejump_p (last_insn, NULL, NULL))
+ && !tablejump_p (last_insn, NULL, NULL)
+ && asm_noperands (PATTERN (last_insn)) < 0)
{
  /* We have found a "crossing" unconditional branch.  Now
 we must convert it to an indirect jump.  First create
diff --git a/gcc/testsuite/gcc.dg/pr110079.c b/gcc/testsuite/gcc.dg/pr110079.c
new file mode 100644
index 000..1682f9c2344
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr110079.c
@@ -0,0 +1,43 @@
+/* PR rtl-optimization/110079 */
+/* { dg-do compile { target lra } } */
+/* { dg-options "-O2" } */
+/* { dg-additional-options "-freorder-blocks-and-partition" { target freorder 
} } */
+
+int a;
+__attribute__((cold)) int bar (char *);
+__attribute__((hot)) int baz (char *);
+
+void
+foo (void)
+{
+l1:
+  while (a)
+;
+  bar ("");
+  asm goto ("" : : : : l2);
+  asm ("");
+l2:
+  goto l1;
+}
+
+void
+qux (void)
+{
+  asm goto ("" : : : : l1);
+  bar ("");
+  goto l1;
+l1:
+  baz ("");
+}
+
+void
+corge (void)
+{
+  asm goto ("" : : : : l1);
+  baz ("");
+l2:
+  return;
+l1:
+  bar ("");
+  goto l2;
+}


[gcc r14-9354] expand: Fix UB in choose_mult_variant [PR105533]

2024-03-07 Thread Jakub Jelinek via Gcc-cvs
https://gcc.gnu.org/g:c655c8d8d845b36c59babb2413ce7aa3584dbeda

commit r14-9354-gc655c8d8d845b36c59babb2413ce7aa3584dbeda
Author: Jakub Jelinek 
Date:   Thu Mar 7 10:02:00 2024 +0100

expand: Fix UB in choose_mult_variant [PR105533]

As documented in the function comment, choose_mult_variant attempts to
compute costs of 3 different cases, val, -val and val - 1.
The -val case is actually only done if val fits into host int, so there
should be no overflow, but the val - 1 case is done unconditionally.
val is shwi (but inside of synth_mult already uhwi), so when val is
HOST_WIDE_INT_MIN, val - 1 invokes UB.  The following patch fixes that
by using val - HOST_WIDE_INT_1U, but I'm not really convinced it would
DTRT for > 64-bit modes, so I've guarded it as well.  Though, arch
would need to have really strange costs that something that could be
expressed as x << 63 would be better expressed as (x * 0x7fff) 
+ 1
In the long term, I think we should just rewrite
choose_mult_variant/synth_mult etc. to work on wide_int.

2024-03-07  Jakub Jelinek  

PR middle-end/105533
* expmed.cc (choose_mult_variant): Only try the val - 1 variant
if val is not HOST_WIDE_INT_MIN or if mode has exactly
HOST_BITS_PER_WIDE_INT precision.  Avoid triggering UB while 
computing
val - 1.

* gcc.dg/pr105533.c: New test.

Diff:
---
 gcc/expmed.cc   | 14 +-
 gcc/testsuite/gcc.dg/pr105533.c |  9 +
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/gcc/expmed.cc b/gcc/expmed.cc
index 5916d6ed1bc..4ec035e4843 100644
--- a/gcc/expmed.cc
+++ b/gcc/expmed.cc
@@ -3285,11 +3285,15 @@ choose_mult_variant (machine_mode mode, HOST_WIDE_INT 
val,
   limit.latency = mult_cost - op_cost;
 }
 
-  synth_mult (, val - 1, , mode);
-  alg2.cost.cost += op_cost;
-  alg2.cost.latency += op_cost;
-  if (CHEAPER_MULT_COST (, >cost))
-*alg = alg2, *variant = add_variant;
+  if (val != HOST_WIDE_INT_MIN
+  || GET_MODE_UNIT_PRECISION (mode) == HOST_BITS_PER_WIDE_INT)
+{
+  synth_mult (, val - HOST_WIDE_INT_1U, , mode);
+  alg2.cost.cost += op_cost;
+  alg2.cost.latency += op_cost;
+  if (CHEAPER_MULT_COST (, >cost))
+   *alg = alg2, *variant = add_variant;
+}
 
   return MULT_COST_LESS (>cost, mult_cost);
 }
diff --git a/gcc/testsuite/gcc.dg/pr105533.c b/gcc/testsuite/gcc.dg/pr105533.c
new file mode 100644
index 000..912685e33f6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr105533.c
@@ -0,0 +1,9 @@
+/* PR middle-end/105533 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+long long
+foo (long long x, long long y)
+{
+  return ((x < 0) & (y != 0)) * (-__LONG_LONG_MAX__ - 1);
+}


[gcc r14-9353] sccvn: Avoid UB in ao_ref_init_from_vn_reference [PR105533]

2024-03-07 Thread Jakub Jelinek via Gcc-cvs
https://gcc.gnu.org/g:e1bd0f293d8407d4e8149fbafd470612323dc938

commit r14-9353-ge1bd0f293d8407d4e8149fbafd470612323dc938
Author: Jakub Jelinek 
Date:   Thu Mar 7 10:01:08 2024 +0100

sccvn: Avoid UB in ao_ref_init_from_vn_reference [PR105533]

When compiling libgcc or on e.g.
int a[64];
int p;

void
foo (void)
{
  int s = 1;
  while (p)
{
  s -= 11;
  a[s] != 0;
}
}
sccvn invokes UB in the compiler as detected by ubsan:
../../gcc/poly-int.h:1089:5: runtime error: left shift of negative value -40
The problem is that we still use C++11..C++17 as the implementation language
and in those C++ versions shifting negative values left is UB (well defined
since C++20) and above in
   offset += op->off << LOG2_BITS_PER_UNIT;
op->off is poly_int64 with -40 value (in libgcc with -8).
I understand the offset_int << LOG2_BITS_PER_UNIT shifts but it is then well
defined during underlying implementation which is done on the uhwi limbs,
but for poly_int64 we use
offset += pop->off * BITS_PER_UNIT;
a few lines earlier and I think that is both more readable in what it
actually does and triggers UB only if there would be signed multiply
overflow.  In the end, the compiler will treat them the same at least at the
RTL level (at least, if not and they aren't the same cost, it should).

2024-03-07  Jakub Jelinek  

PR middle-end/105533
* tree-ssa-sccvn.cc (ao_ref_init_from_vn_reference) :
Multiple op->off by BITS_PER_UNIT instead of shifting it left by
LOG2_BITS_PER_UNIT.

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

diff --git a/gcc/tree-ssa-sccvn.cc b/gcc/tree-ssa-sccvn.cc
index 88d3b2498b9..93649895056 100644
--- a/gcc/tree-ssa-sccvn.cc
+++ b/gcc/tree-ssa-sccvn.cc
@@ -1221,7 +1221,7 @@ ao_ref_init_from_vn_reference (ao_ref *ref,
  if (maybe_eq (op->off, -1))
max_size = -1;
  else
-   offset += op->off << LOG2_BITS_PER_UNIT;
+   offset += op->off * BITS_PER_UNIT;
  break;
 
case REALPART_EXPR:


[gcc r14-9351] LoongArch: Use /lib instead of /lib64 as the library search path for MUSL.

2024-03-07 Thread LuluCheng via Gcc-cvs
https://gcc.gnu.org/g:2f7d4728dbfd976788f77b8f43d4dc3c718b71b7

commit r14-9351-g2f7d4728dbfd976788f77b8f43d4dc3c718b71b7
Author: Yang Yujie 
Date:   Wed Mar 6 09:19:59 2024 +0800

LoongArch: Use /lib instead of /lib64 as the library search path for MUSL.

gcc/ChangeLog:

* config.gcc: Add a case for loongarch*-*-linux-musl*.
* config/loongarch/linux.h: Disable the multilib-compatible
treatment for *musl* targets.
* config/loongarch/musl.h: New file.

Diff:
---
 gcc/config.gcc   |  3 +++
 gcc/config/loongarch/linux.h |  4 +++-
 gcc/config/loongarch/musl.h  | 23 +++
 3 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/gcc/config.gcc b/gcc/config.gcc
index a1480b72c46..624e0dae191 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -2538,6 +2538,9 @@ riscv*-*-freebsd*)
 
 loongarch*-*-linux*)
tm_file="elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h 
${tm_file}"
+   case ${target} in
+ *-linux-musl*) tm_file="${tm_file} loongarch/musl.h"
+   esac
tm_file="${tm_file} loongarch/gnu-user.h loongarch/linux.h 
loongarch/loongarch-driver.h"
extra_options="${extra_options} linux-android.opt"
tmake_file="${tmake_file} loongarch/t-multilib loongarch/t-linux"
diff --git a/gcc/config/loongarch/linux.h b/gcc/config/loongarch/linux.h
index 17d9f87537b..40d9ba6d405 100644
--- a/gcc/config/loongarch/linux.h
+++ b/gcc/config/loongarch/linux.h
@@ -21,7 +21,9 @@ along with GCC; see the file COPYING3.  If not see
  * This ensures that a compiler configured with --disable-multilib
  * can work in a multilib environment.  */
 
-#if defined(LA_DISABLE_MULTILIB) && defined(LA_DISABLE_MULTIARCH)
+#if !defined(LA_DEFAULT_TARGET_MUSL) \
+  && defined(LA_DISABLE_MULTILIB) \
+  && defined(LA_DISABLE_MULTIARCH)
 
   #if DEFAULT_ABI_BASE == ABI_BASE_LP64D
 #define ABI_LIBDIR "lib64"
diff --git a/gcc/config/loongarch/musl.h b/gcc/config/loongarch/musl.h
new file mode 100644
index 000..fa43bc86606
--- /dev/null
+++ b/gcc/config/loongarch/musl.h
@@ -0,0 +1,23 @@
+/* Definitions for MUSL C library support.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3.  If not see
+.  */
+
+
+#ifndef LA_DEFAULT_TARGET_MUSL
+#define LA_DEFAULT_TARGET_MUSL
+#endif


[gcc r14-9352] LoongArch: testsuite:Fix problems with incorrect results in vector test cases.

2024-03-07 Thread LuluCheng via Gcc-cvs
https://gcc.gnu.org/g:ae1b05641ccf1cd4739b0998ce61cda6e5b772dd

commit r14-9352-gae1b05641ccf1cd4739b0998ce61cda6e5b772dd
Author: chenxiaolong 
Date:   Wed Mar 6 16:54:06 2024 +0800

LoongArch: testsuite:Fix problems with incorrect results in vector test 
cases.

In simd_correctness_check.h, the role of the macro ASSERTEQ_64 is to check 
the
result of the passed vector values for the 64-bit data of each array 
element.
It turns out that it uses the abs() function to check only the lower 32 bits
of the data at a time, so it replaces abs() with the llabs() function.

However, the following two problems may occur after modification:

1.FAIL in lasx-xvfrint_s.c and lsx-vfrint_s.c
The reason for the error is because vector test cases that use __m{128,256} 
to
define vector types are composed of 32-bit primitive types, they should use
ASSERTEQ_32 instead of ASSERTEQ_64 to check for correctness.

2.FAIL in lasx-xvshuf_b.c and lsx-vshuf.c
The cause of the error is that the expected result of the function setting 
in
the test case is incorrect.

gcc/testsuite/ChangeLog:

* gcc.target/loongarch/vector/lasx/lasx-xvfrint_s.c: Replace
ASSERTEQ_64 with the macro ASSERTEQ_32.
* gcc.target/loongarch/vector/lasx/lasx-xvshuf_b.c: Modify the 
expected
test results of some functions according to the function of the 
vector
instruction.
* gcc.target/loongarch/vector/lsx/lsx-vfrint_s.c: Same
modification as lasx-xvfrint_s.c.
* gcc.target/loongarch/vector/lsx/lsx-vshuf.c: Same
modification as lasx-xvshuf_b.c.
* gcc.target/loongarch/vector/simd_correctness_check.h: Use the 
llabs()
function instead of abs() to check the correctness of the results.

Diff:
---
 .../loongarch/vector/lasx/lasx-xvfrint_s.c | 58 +++---
 .../loongarch/vector/lasx/lasx-xvshuf_b.c  | 14 +++---
 .../gcc.target/loongarch/vector/lsx/lsx-vfrint_s.c | 50 +--
 .../gcc.target/loongarch/vector/lsx/lsx-vshuf.c| 12 ++---
 .../loongarch/vector/simd_correctness_check.h  |  2 +-
 5 files changed, 68 insertions(+), 68 deletions(-)

diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lasx/lasx-xvfrint_s.c 
b/gcc/testsuite/gcc.target/loongarch/vector/lasx/lasx-xvfrint_s.c
index fbfe300eac4..4538528a67f 100644
--- a/gcc/testsuite/gcc.target/loongarch/vector/lasx/lasx-xvfrint_s.c
+++ b/gcc/testsuite/gcc.target/loongarch/vector/lasx/lasx-xvfrint_s.c
@@ -184,7 +184,7 @@ main ()
   *((int *)&__m256_result[1]) = 0x;
   *((int *)&__m256_result[0]) = 0x;
   __m256_out = __lasx_xvfrintrne_s (__m256_op0);
-  ASSERTEQ_64 (__LINE__, __m256_result, __m256_out);
+  ASSERTEQ_32 (__LINE__, __m256_result, __m256_out);
 
   *((int *)&__m256_op0[7]) = 0x;
   *((int *)&__m256_op0[6]) = 0x;
@@ -203,7 +203,7 @@ main ()
   *((int *)&__m256_result[1]) = 0x;
   *((int *)&__m256_result[0]) = 0x;
   __m256_out = __lasx_xvfrintrne_s (__m256_op0);
-  ASSERTEQ_64 (__LINE__, __m256_result, __m256_out);
+  ASSERTEQ_32 (__LINE__, __m256_result, __m256_out);
 
   *((int *)&__m256_op0[7]) = 0x;
   *((int *)&__m256_op0[6]) = 0x;
@@ -222,7 +222,7 @@ main ()
   *((int *)&__m256_result[1]) = 0x;
   *((int *)&__m256_result[0]) = 0x;
   __m256_out = __lasx_xvfrintrne_s (__m256_op0);
-  ASSERTEQ_64 (__LINE__, __m256_result, __m256_out);
+  ASSERTEQ_32 (__LINE__, __m256_result, __m256_out);
 
   *((int *)&__m256_op0[7]) = 0x01010101;
   *((int *)&__m256_op0[6]) = 0x01010101;
@@ -241,7 +241,7 @@ main ()
   *((int *)&__m256_result[1]) = 0x;
   *((int *)&__m256_result[0]) = 0x;
   __m256_out = __lasx_xvfrintrne_s (__m256_op0);
-  ASSERTEQ_64 (__LINE__, __m256_result, __m256_out);
+  ASSERTEQ_32 (__LINE__, __m256_result, __m256_out);
 
   *((int *)&__m256_op0[7]) = 0x;
   *((int *)&__m256_op0[6]) = 0x;
@@ -260,7 +260,7 @@ main ()
   *((int *)&__m256_result[1]) = 0x;
   *((int *)&__m256_result[0]) = 0x;
   __m256_out = __lasx_xvfrintrne_s (__m256_op0);
-  ASSERTEQ_64 (__LINE__, __m256_result, __m256_out);
+  ASSERTEQ_32 (__LINE__, __m256_result, __m256_out);
 
   *((int *)&__m256_op0[7]) = 0x;
   *((int *)&__m256_op0[6]) = 0x;
@@ -279,7 +279,7 @@ main ()
   *((int *)&__m256_result[1]) = 0x;
   *((int *)&__m256_result[0]) = 0x;
   __m256_out = __lasx_xvfrintrne_s (__m256_op0);
-  ASSERTEQ_64 (__LINE__, __m256_result, __m256_out);
+  ASSERTEQ_32 (__LINE__, __m256_result, __m256_out);
 
   *((int *)&__m256_op0[7]) = 0x;
   *((int *)&__m256_op0[6]) = 0x;
@@ -298,7 +298,7 @@ main ()
   *((int *)&__m256_result[1]) = 0x;
   *((int *)&__m256_result[0]) = 0x;
   __m256_out = __lasx_xvfrintrne_s (__m256_op0);
-  ASSERTEQ_64 (__LINE__, __m256_result, __m256_out);
+