[gcc r15-9233] cobol, driver: Remove platform-specific options [PR119414].

2025-04-06 Thread Iain D Sandoe via Gcc-cvs
https://gcc.gnu.org/g:54932496a8b36a3991f7e533cc3a47ae41148b3e

commit r15-9233-g54932496a8b36a3991f7e533cc3a47ae41148b3e
Author: Iain Sandoe 
Date:   Mon Mar 24 09:12:47 2025 +

cobol, driver: Remove platform-specific options [PR119414].

As discussed in the PR, the options had been added during development
to handle specific cases, they are no longer needed (and if they should
become necessary, we will need to guard them such that individual
platforms get the correct handling).

PR cobol/119414

gcc/cobol/ChangeLog:

* gcobolspec.cc (append_rdynamic,
append_allow_multiple_definition, append_fpic): Remove.
(lang_specific_driver): Remove platform-specific command
line option handling.

Signed-off-by: Iain Sandoe 

Diff:
---
 gcc/cobol/gcobolspec.cc | 90 ++---
 1 file changed, 3 insertions(+), 87 deletions(-)

diff --git a/gcc/cobol/gcobolspec.cc b/gcc/cobol/gcobolspec.cc
index 083223115ad4..4df9f8dc37e9 100644
--- a/gcc/cobol/gcobolspec.cc
+++ b/gcc/cobol/gcobolspec.cc
@@ -126,41 +126,6 @@ add_arg_lib(const char *library, bool force_static 
ATTRIBUTE_UNUSED)
 #endif
   }
 
-static void
-append_rdynamic()
-  {
-  // This is a bit ham-handed, but I was in a hurry.
-  struct cl_decoded_option decoded = {};
-  decoded.opt_index = OPT_rdynamic;
-  decoded.orig_option_with_args_text = "-rdynamic";
-  decoded.canonical_option[0] = "-rdynamic";
-  decoded.canonical_option_num_elements = 1;
-  decoded.value = 1;
-  append_arg(decoded);
-  return;
-  }
-
-static void
-append_allow_multiple_definition()
-  {
-  append_option (OPT_Wl_, "--allow-multiple-definition", 1);
-  return;
-  }
-
-static void
-append_fpic()
-  {
-  // This is a bit ham-handed, but I was in a hurry.
-  struct cl_decoded_option decoded = {};
-  decoded.opt_index = OPT_rdynamic;
-  decoded.orig_option_with_args_text = "-fPIC";
-  decoded.canonical_option[0] = "-fPIC";
-  decoded.canonical_option_num_elements = 1;
-  decoded.value = 1;
-  append_arg(decoded);
-  return;
-  }
-
 void
 lang_specific_driver (struct cl_decoded_option **in_decoded_options,
   unsigned int *in_decoded_options_count,
@@ -188,8 +153,6 @@ lang_specific_driver (struct cl_decoded_option 
**in_decoded_options,
 
   bool saw_OPT_c = false;
   bool saw_OPT_shared = false;
-  bool saw_OPT_pic = false;
-  bool saw_OPT_PIC = false;
 
   bool verbose = false;
 
@@ -197,9 +160,6 @@ lang_specific_driver (struct cl_decoded_option 
**in_decoded_options,
 
   bool need_libdl   = (DL_LIBRARY[0] != '\0');
   bool need_libstdc = (STDCPP_LIBRARY[0] != '\0');
-  // bool need_libquadmath = (QUADMATH_LIBRARY[0] != '\0');
-  bool need_rdynamic= true;
-  bool need_allow_multiple_definition = true;
 
   // Separate flags for a couple of static libraries
   bool static_libgcobol  = false;
@@ -290,36 +250,10 @@ lang_specific_driver (struct cl_decoded_option 
**in_decoded_options,
 saw_OPT_shared = true;
 break;
 
-  case OPT_fpic:
-saw_OPT_pic = true;
-break;
-
-  case OPT_fPIC:
-saw_OPT_PIC = true;
-break;
-
-  case OPT_c:
-// With this option, no libraries need be loaded
+   case OPT_c:
+// Note -c specially.
 saw_OPT_c = true;
-need_libgcobol   = false;
-need_libdl   = false;
-need_libstdc = false;
-// need_libquadmath = false;
-need_rdynamic= false;
-break;
-
-  case OPT_rdynamic:
-need_rdynamic  = false;
-break;
-
-  case OPT_Wl_:
-if( strstr(decoded_options[i].orig_option_with_args_text,
-"--allow-multiple-definitions") )
-  {
-  need_allow_multiple_definition = false;
-  }
-break;
-
+// FALLTHROUGH
   case OPT_nostdlib:
   case OPT_nodefaultlibs:
   case OPT_r:
@@ -330,8 +264,6 @@ lang_specific_driver (struct cl_decoded_option 
**in_decoded_options,
 need_libgcobol   = false;
 need_libdl   = false;
 need_libstdc = false;
-// need_libquadmath = false;
-need_rdynamic= false;
 break;
 
   case OPT_static_libgcobol:
@@ -449,7 +381,6 @@ lang_specific_driver (struct cl_decoded_option 
**in_decoded_options,
 need_libgcobol   = false;
 need_libdl   = false;
 need_libstdc = false;
-// need_libquadmath = false;
 }
 
   /* Second pass through arglist, transforming arguments as appropriate.  */
@@ -588,21 +519,6 @@ lang_specific_driver (struct cl_decoded_option 
**in_decoded_options,
 add_arg_lib(STDCPP_LIBRARY, static_in_general);
 }
 
-  if( saw_OPT_shared && !saw_OPT_pic && !saw_OPT_PIC )
-{
-append_fpic();
-}
-
-  if( need_rdynamic )
-{
-append_rdynamic();
-}
-
-  if( need_allow_multiple_definition && (n_infiles || n_outfiles) )
-{
-append_allow_

[gcc r15-9234] testsuite, cobol: Avoid adding duplicate libs.

2025-04-06 Thread Iain D Sandoe via Gcc-cvs
https://gcc.gnu.org/g:24f79780148613ea8539209c30ec6e102b007ee6

commit r15-9234-g24f79780148613ea8539209c30ec6e102b007ee6
Author: Iain Sandoe 
Date:   Mon Mar 31 13:54:37 2025 +0100

testsuite, cobol: Avoid adding duplicate libs.

The discovered paths already include the multilib and so there is
no need to add an extra library to COBOL_UNDER_TEST.  Doing so makes
a duplicate, which causes test fails on Darwin, where the linker warns
when duplicate libraries are provided on the link line.

gcc/testsuite/ChangeLog:

* lib/cobol.exp: Simplify the setting of COBOL_UNDER_TEST.

Signed-off-by: Iain Sandoe 

Diff:
---
 gcc/testsuite/lib/cobol.exp | 15 ++-
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/gcc/testsuite/lib/cobol.exp b/gcc/testsuite/lib/cobol.exp
index a0eeb4e64e9a..8ea91e3dcfac 100644
--- a/gcc/testsuite/lib/cobol.exp
+++ b/gcc/testsuite/lib/cobol.exp
@@ -163,7 +163,6 @@ proc cobol_init { args } {
 global gcc_warning_prefix
 global gcc_error_prefix
 global TEST_ALWAYS_FLAGS
-global cobol_init_set_COBOL_UNDER_TEST
 
 # We set LC_ALL and LANG to C so that we get the same error messages as 
expected.
 setenv LC_ALL C
@@ -179,24 +178,14 @@ proc cobol_init { args } {
   setenv LANG C.ASCII
 }
 
-# COBOL_UNDER_TEST as set below contains $specpath, which depends on
-# the used multilib config. Thus, its value may need to be reset;
-# that's tracked via gfortran_init_set_COBOL_UNDER_TEST.
-if { ![info exists COBOL_UNDER_TEST]
-|| [info exists cobol_init_set_COBOL_UNDER_TEST] } then {
+if ![info exists COBOL_UNDER_TEST] then {
if [info exists TOOL_EXECUTABLE] {
set COBOL_UNDER_TEST $TOOL_EXECUTABLE
} else {
if { [is_remote host] || ! [info exists TESTING_IN_BUILD_TREE] } {
set COBOL_UNDER_TEST [transform gcobol]
} else {
-   if [info exists TOOL_OPTIONS] {
-   set specpath [get_multilibs ${TOOL_OPTIONS}]
-   } else {
-   set specpath [get_multilibs]
-   }
-   set cobol_init_set_COBOL_UNDER_TEST 1
-   set COBOL_UNDER_TEST [findfile $base_dir/../../gcobol 
"$base_dir/../../gcobol -B$base_dir/../../ -B$specpath/libgcobol/.libs" 
[findfile $base_dir/gcobol "$base_dir/gcobol -B$base_dir/" [transform gcobol]]]
+   set COBOL_UNDER_TEST [findfile $base_dir/../../gcobol 
"$base_dir/../../gcobol -B$base_dir/../../" [findfile $base_dir/gcobol 
"$base_dir/gcobol -B$base_dir/" [transform gcobol]]]
}
}
 }


[gcc r15-9235] AVRrc: Support 8-bit and 16-bit fixed-point arith in libgcc.

2025-04-06 Thread Georg-Johann Lay via Gcc-cvs
https://gcc.gnu.org/g:939fa28d265d4707ad717fcff0c46329b6dc39c2

commit r15-9235-g939fa28d265d4707ad717fcff0c46329b6dc39c2
Author: Georg-Johann Lay 
Date:   Sun Apr 6 16:44:21 2025 +0200

AVRrc: Support 8-bit and 16-bit fixed-point arith in libgcc.

With some minor changes, 8-bit and 16-bit fixed-point operations
can be supported on the reduced core.

libgcc/
* config/avr/t-avr (LIB1ASMFUNCS): Add (and remove from
FUNCS_notiny): _mulhisi3, _umulhisi3, _mulqq3, _mulhq3, _muluhq3,
_mulha3, _muluha3 _muluha3_round, _usmuluha3, _ssmulha3,
_divqq3, _udivuqq3, _divqq_helper, _divhq3, _udivuhq3.
_divha3 _udivuha3, _ssneg_2, _ssabs_1, _ssabs_2,
_mask1, _ret, _roundqq3 _rounduqq3,
_round_s2, _round_u2, _round_2_const, _addmask_2.
* config/avr/lib1funcs.S (__umulhisi3, __mulhisi3): Make
work on AVRrc.
* config/avr/lib1funcs-fixed.S: Build 8-bit and 16-bit functions
on AVRrc, too.

Diff:
---
 libgcc/config/avr/lib1funcs-fixed.S | 66 -
 libgcc/config/avr/lib1funcs.S   | 41 ++-
 libgcc/config/avr/t-avr | 32 +-
 3 files changed, 106 insertions(+), 33 deletions(-)

diff --git a/libgcc/config/avr/lib1funcs-fixed.S 
b/libgcc/config/avr/lib1funcs-fixed.S
index 278ee1b4a5dd..4115589b5707 100644
--- a/libgcc/config/avr/lib1funcs-fixed.S
+++ b/libgcc/config/avr/lib1funcs-fixed.S
@@ -31,14 +31,6 @@
 ;; Fixed point library routines for AVR
 ;;
 
-#if defined __AVR_TINY__
-#define __zero_reg__ r17
-#define __tmp_reg__ r16
-#else  

-#define __zero_reg__ r1
-#define __tmp_reg__ r0
-#endif
-
 .section .text.libgcc.fixed, "ax", @progbits
 
 #ifndef __AVR_TINY__
@@ -251,6 +243,7 @@ DEFUN __fractsfusa
 ENDF __fractsfusa
 #endif  /* L_fractsfusa */
 
+#endif /* ! AVR_TINY */
 
 ;; For multiplication the functions here are called directly from
 ;; avr-fixed.md instead of using the standard libcall mechanisms.
@@ -295,8 +288,14 @@ DEFUN   __mulhq3
 rol r25
 brvs1f
 ;; Round
+#ifndef __AVR_TINY__
 sbrcr23, 7
 adiwr24, 1
+#else
+lsl r23
+adc r24, __zero_reg__
+adc r25, __zero_reg__
+#endif /* AVR_TINY? */
 ret
 1:  ;; Overflow.  TR 18037 requires  (-1)^2  not to overflow
 ldi r24, lo8 (0x7fff)
@@ -315,8 +314,14 @@ ENDF __mulhq3
 DEFUN   __muluhq3
 XCALL   __umulhisi3
 ;; Round
+#ifndef __AVR_TINY__
 sbrcr23, 7
 adiwr24, 1
+#else
+lsl r23
+adc r24, __zero_reg__
+adc r25, __zero_reg__
+#endif /* AVR_TINY? */
 ret
 ENDF __muluhq3
 #endif  /* L_muluhq3 */
@@ -361,8 +366,14 @@ DEFUN   __muluha3_round
 mov r25, r24
 mov r24, r23
 ;; Round
+#ifndef __AVR_TINY__
 sbrcr22, 7
 adiwr24, 1
+#else
+lsl r22
+adc r24, __zero_reg__
+adc r25, __zero_reg__
+#endif /* AVR_TINY? */
 ret
 ENDF __muluha3_round
 #endif  /* L_muluha3_round */
@@ -372,6 +383,8 @@ ENDF __muluha3_round
 Fixed  Multiplication  16.16 x 16.16
 ***/
 
+#ifndef __AVR_TINY__
+
 ;; Bits outside the result (below LSB), used in the signed version
 #define GUARD __tmp_reg__
 
@@ -679,6 +692,8 @@ ENDF __mulusa3_round
 
 #undef GUARD
 
+#endif /* ! AVR_TINY */
+
 /***
 Fixed  unsigned saturated Multiplication  8.8 x 8.8
 ***/
@@ -762,8 +777,14 @@ DEFUN __ssmulha3
 ;; SS =  0  -->  0x7fff
 ldi C3, 0x7f
 ldi C2, 0xff
+#ifndef __AVR_TINY__
 sbrcSS, 7
 adiwC2, 1
+#else
+lsl SS
+adc C2, __zero_reg__
+adc C3, __zero_reg__
+#endif /* AVR_TINY? */
 ret
 ENDF  __ssmulha3
 #endif /* L_ssmulha3 */
@@ -778,6 +799,8 @@ ENDF  __ssmulha3
 Fixed  unsigned saturated Multiplication  16.16 x 16.16
 ***/
 
+#ifndef __AVR_TINY__
+
 #define C0  18
 #define C1  C0+1
 #define C2  C0+2
@@ -883,6 +906,8 @@ ENDF  __ssmulsa3
 #undef C7
 #undef SS
 
+#endif /* ! AVR_TINY */
+
 /***
   Fractional Division 8 / 8
 ***/
@@ -962,8 +987,8 @@ ENDF __divqq_helper
 
 #if defined (L_divhq3)
 DEFUN   __divhq3
-mov r0, r_divdH
-eor r0, r_divH
+mov __tmp_reg__, r_divdH
+eor __tmp_reg__, r_divH
 sbrsr_divH, 7
 rjmp1f
 NEG2r_divL
@@ -1027,8 +1052,8 @@ ENDF __udivuha3_common
 ***/
 #if defined (L_divha3)
 DEFUN   __divha3
-mov   

[gcc r15-9236] Doc: Further clarify support for _Bool type

2025-04-06 Thread Sandra Loosemore via Gcc-cvs
https://gcc.gnu.org/g:b39d5fad621c25812fb764e3a8808bab3f2fe774

commit r15-9236-gb39d5fad621c25812fb764e3a8808bab3f2fe774
Author: Sandra Loosemore 
Date:   Sun Apr 6 16:03:48 2025 +

Doc: Further clarify support for _Bool type

gcc/ChangeLog
* doc/extend.texi (Boolean Type): Further clarify support for
_Bool in C23 and C++.

Diff:
---
 gcc/doc/extend.texi | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 16ad83fc510c..ae3357f83bff 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -13814,7 +13814,13 @@ The C99 standard added @code{_Bool} as a C language 
keyword naming the
 boolean type.  As an extension, GNU C also recognizes @code{_Bool} in
 C90 mode as well as with @option{-std=c99} and later.
 
-GNU C++ does not support the @code{_Bool} keyword.
+C23 added @code{bool} as the preferred name of the boolean type, but
+@code{_Bool} also remains a standard keyword in the language and is
+supported as such by GCC with @option{-std=c23}.
+
+GNU C++ does not support @code{_Bool} as a keyword, but including
+@code{} defines it as a macro in terms of standard C++'s
+@code{bool} type.
 
 @node Variadic Macros
 @subsection Macros with a Variable Number of Arguments.