From 6f223b1f2416e69031190c5b7dd731e325736f2d Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Tue, 17 Oct 2023 00:20:33 +0000 Subject: [PATCH 01/31] Daily bump. --- gcc/ChangeLog | 19 +++++++++++++++++++ gcc/DATESTAMP | 2 +- gcc/testsuite/ChangeLog | 17 +++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4aa86f0bbe90..f578e5fc5cde 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,22 @@ +2023-10-16 Kewen Lin + + Backported from master: + 2023-09-25 Kewen Lin + + PR target/111380 + * config/rs6000/rs6000.cc (rs6000_can_inline_p): Adopt + target_option_default_node when the callee has no option + attributes, also simplify the existing code accordingly. + +2023-10-16 Kewen Lin + + Backported from master: + 2023-09-25 Kewen Lin + + PR target/111366 + * config/rs6000/rs6000.cc (rs6000_update_ipa_fn_target_info): Skip + empty inline asm. + 2023-10-13 Andrew MacLeod PR tree-optimization/111622 diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 2638d56830af..a8fe11db53a8 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20231016 +20231017 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 40f762f83941..edee91c3364b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,20 @@ +2023-10-16 Kewen Lin + + Backported from master: + 2023-09-25 Kewen Lin + + PR target/111380 + * gcc.target/powerpc/pr111380-1.c: New test. + * gcc.target/powerpc/pr111380-2.c: New test. + +2023-10-16 Kewen Lin + + Backported from master: + 2023-09-25 Kewen Lin + + PR target/111366 + * g++.target/powerpc/pr111366.C: New test. + 2023-10-11 Andrew MacLeod PR tree-optimization/111694 From 27165633859bdf92589428213edfeccdb49b7d83 Mon Sep 17 00:00:00 2001 From: liuhongt Date: Wed, 5 Jul 2023 13:45:11 +0800 Subject: [PATCH 02/31] Disparage slightly for the alternative which move DFmode between SSE_REGS and GENERAL_REGS. For testcase void __cond_swap(double* __x, double* __y) { bool __r = (*__x < *__y); auto __tmp = __r ? *__x : *__y; *__y = __r ? *__y : *__x; *__x = __tmp; } GCC-14 with -O2 and -march=x86-64 options generates the following code: __cond_swap(double*, double*): movsd xmm1, QWORD PTR [rdi] movsd xmm0, QWORD PTR [rsi] comisd xmm0, xmm1 jbe .L2 movq rax, xmm1 movapd xmm1, xmm0 movq xmm0, rax .L2: movsd QWORD PTR [rsi], xmm1 movsd QWORD PTR [rdi], xmm0 ret rax is used to save and restore DFmode value. In RA both GENERAL_REGS and SSE_REGS cost zero since we didn't disparage the alternative in movdf_internal pattern, according to register allocation order, GENERAL_REGS is allocated. The patch add ? for alternative (r,v) and (v,r) just like we did for movsf/hf/bf_internal pattern, after that we get optimal RA. __cond_swap: .LFB0: .cfi_startproc movsd (%rdi), %xmm1 movsd (%rsi), %xmm0 comisd %xmm1, %xmm0 jbe .L2 movapd %xmm1, %xmm2 movapd %xmm0, %xmm1 movapd %xmm2, %xmm0 .L2: movsd %xmm1, (%rsi) movsd %xmm0, (%rdi) ret gcc/ChangeLog: PR target/110170 * config/i386/i386.md (movdf_internal): Disparage slightly for 2 alternatives (r,v) and (v,r) by adding constraint modifier '?'. gcc/testsuite/ChangeLog: * gcc.target/i386/pr110170-3.c: New test. (cherry picked from commit 37a231cc7594d12ba0822077018aad751a6fb94e) --- gcc/config/i386/i386.md | 4 ++-- gcc/testsuite/gcc.target/i386/pr110170-3.c | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr110170-3.c diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index bd678190782e..d6e25db9d014 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -3744,9 +3744,9 @@ ;; Possible store forwarding (partial memory) stall in alternatives 4, 6 and 7. (define_insn "*movdf_internal" [(set (match_operand:DF 0 "nonimmediate_operand" - "=Yf*f,m ,Yf*f,?r ,!o,?*r ,!o,!o,?r,?m,?r,?r,v,v,v,m,*x,*x,*x,m ,r ,v,r ,o ,r ,m") + "=Yf*f,m ,Yf*f,?r ,!o,?*r ,!o,!o,?r,?m,?r,?r,v,v,v,m,*x,*x,*x,m ,?r,?v,r ,o ,r ,m") (match_operand:DF 1 "general_operand" - "Yf*fm,Yf*f,G ,roF,r ,*roF,*r,F ,rm,rC,C ,F ,C,v,m,v,C ,*x,m ,*x,v,r ,roF,rF,rmF,rC"))] + "Yf*fm,Yf*f,G ,roF,r ,*roF,*r,F ,rm,rC,C ,F ,C,v,m,v,C ,*x,m ,*x, v, r,roF,rF,rmF,rC"))] "!(MEM_P (operands[0]) && MEM_P (operands[1])) && (lra_in_progress || reload_completed || !CONST_DOUBLE_P (operands[1]) diff --git a/gcc/testsuite/gcc.target/i386/pr110170-3.c b/gcc/testsuite/gcc.target/i386/pr110170-3.c new file mode 100644 index 000000000000..70daa89e9aae --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr110170-3.c @@ -0,0 +1,11 @@ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-options "-O2 -fno-if-conversion -fno-if-conversion2" } */ +/* { dg-final { scan-assembler-not {(?n)movq.*r} } } */ + +void __cond_swap(double* __x, double* __y) { + _Bool __r = (*__x < *__y); + double __tmp = __r ? *__x : *__y; + *__y = __r ? *__y : *__x; + *__x = __tmp; +} + From e889ba1c5edba0fdff2ab9ad9176485ca1ff0bc1 Mon Sep 17 00:00:00 2001 From: Georg-Johann Lay Date: Tue, 17 Oct 2023 11:36:52 +0200 Subject: [PATCH 03/31] LibF7: Implement fma / fmal. libgcc/config/avr/libf7/ * libf7.h (F7_SIZEOF): New macro. * libf7-asm.sx: Use F7_SIZEOF instead of magic number "10". (F7MOD_D_fma_, __fma): New module and function. (fma) [-mdouble=64]: Define as alias for __fma. (fmal) [-mlong-double=64]: Define as alias for __fma. * libf7-common.mk (F7_ASM_PARTS): Add D_fma. --- libgcc/config/avr/libf7/libf7-asm.sx | 69 +++++++++++++++++++++---- libgcc/config/avr/libf7/libf7-common.mk | 2 +- libgcc/config/avr/libf7/libf7.h | 1 + 3 files changed, 62 insertions(+), 10 deletions(-) diff --git a/libgcc/config/avr/libf7/libf7-asm.sx b/libgcc/config/avr/libf7/libf7-asm.sx index 8fbd66bd2902..5df167fe73cc 100644 --- a/libgcc/config/avr/libf7/libf7-asm.sx +++ b/libgcc/config/avr/libf7/libf7-asm.sx @@ -283,8 +283,8 @@ DEFUN copy cp XL, ZL cpc XH, ZH breq 9f - adiw XL, 10 - adiw ZL, 10 + adiw XL, F7_SIZEOF + adiw ZL, F7_SIZEOF set bld ZERO, 1 bld ZERO, 3 ; ZERO = 0b1010 = 10. @@ -312,8 +312,8 @@ DEFUN copy_P st X+, TMP dec ZERO brne .Loop - sbiw X, 10 - sbiw Z, 10 + sbiw X, F7_SIZEOF + sbiw Z, F7_SIZEOF ret ENDF copy_P #endif /* F7MOD_copy_P_ */ @@ -1328,6 +1328,58 @@ ENDF sqrt_approx #undef Carry +#ifdef F7MOD_D_fma_ +_DEFUN __fma + DALIAS fma + LALIAS fmal + +#define n_pushed 4 +#define n_frame (2 * F7_SIZEOF) + + do_prologue_saves n_pushed, n_frame + ;; Y = FramePointer + 1 + adiw Y, 1 + + ;; FP + 1 = (f7_t) arg1 + wmov r16, Y + ;; The double argument arg1 is already in R18[]. + XCALL F7_NAME (set_double_impl) + + ;; The double argument arg2 is in R10[]. Move it to R18[]. + wmov r18, r10 + wmov r20, r12 + wmov r22, r14 + ;; R16, R17 are clobbered. Fetch them from where prologue_saves put them. + ldd r24, Y + n_frame + 3 ; Saved R16 + ldd r25, Y + n_frame + 2 ; Saved R17 + ;; FP + 1 + 10 = (f7_t) arg2 + subi r16, lo8 (-F7_SIZEOF) + sbci r17, hi8 (-F7_SIZEOF) + XCALL F7_NAME (set_double_impl) + + wmov r24, Y ; &arg1 + wmov r22, r16 ; &arg2 + XCALL F7_NAME (Imul) ; arg1 *= arg2 + + ;; The 3rd double argument arg3 was passed on the stack. Move it to R18[], + ;; Don't use f7_set_pdouble() because that function is unused (for now). + .irp n, 0, 1, 2, 3, 4, 5, 6, 7 + ldd 18+\n, Y + n_frame + n_pushed + PC_SIZE + \n + .endr + XCALL F7_NAME (set_double_impl) + + wmov r24, Y ; &arg1 + wmov r22, r16 ; &arg2 + XCALL F7_NAME (Iadd) ; arg1 += arg2 + + wmov r24, Y ; &arg1 + XCALL F7_NAME (get_double) + + do_epilogue_restores n_pushed, n_frame +_ENDF __fma +#endif /* F7MOD_D_fma_ */ + + #ifdef F7MOD_D_fabs_ _DEFUN __fabs DALIAS fabs @@ -1493,7 +1545,7 @@ LABEL call_dx ; WHAT = R13 = 0 wmov r14, Z #define n_pushed 4 -#define n_frame 10 +#define n_frame F7_SIZEOF do_prologue_saves n_pushed, n_frame ;; Y = FramePointer + 1 @@ -1565,7 +1617,7 @@ LABEL call_xdd ret #define n_pushed 4 -#define n_frame 20 +#define n_frame (2 * F7_SIZEOF) call.2: do_prologue_saves n_pushed, n_frame @@ -1576,9 +1628,8 @@ call.2: ;; First double argument is already in R18[]. XCALL F7_NAME (set_double_impl) ;; FP + 11 = (f7_t) arg2 - wmov r16, Y - subi r16, lo8 (-10) - sbci r17, hi8 (-10) + subi r16, lo8 (-F7_SIZEOF) + sbci r17, hi8 (-F7_SIZEOF) ;; Move second double argument to R18[]. wmov r18, r10 wmov r20, r12 diff --git a/libgcc/config/avr/libf7/libf7-common.mk b/libgcc/config/avr/libf7/libf7-common.mk index e417715a7e52..d541b48ff3ca 100644 --- a/libgcc/config/avr/libf7/libf7-common.mk +++ b/libgcc/config/avr/libf7/libf7-common.mk @@ -22,7 +22,7 @@ F7_ASM_PARTS += addsub_mant_scaled store load F7_ASM_PARTS += to_integer to_unsigned clz normalize_with_carry normalize F7_ASM_PARTS += store_expo sqrt16 sqrt_approx div -F7_ASM_PARTS += D_class +F7_ASM_PARTS += D_class D_fma F7_ASM_PARTS += D_isnan D_isinf D_isfinite D_signbit D_copysign D_neg D_fabs F7_ASM_PARTS += call_dd call_ddd diff --git a/libgcc/config/avr/libf7/libf7.h b/libgcc/config/avr/libf7/libf7.h index 7236e611341d..d1169b18c999 100644 --- a/libgcc/config/avr/libf7/libf7.h +++ b/libgcc/config/avr/libf7/libf7.h @@ -29,6 +29,7 @@ #define F7_MANT_BYTES 7 #define F7_MANT_BITS (8 * F7_MANT_BYTES) +#define F7_SIZEOF (1 + F7_MANT_BYTES + 2) /* Using the following GCC features: -- Unnamed structs / unions (GNU-C) From c3ec767b08fc598f836427233efc0f47e17f425b Mon Sep 17 00:00:00 2001 From: Georg-Johann Lay Date: Tue, 17 Oct 2023 17:18:18 +0200 Subject: [PATCH 04/31] LibF7: Re-generate f7-renames.h to pick up white-space from f7renames.sh. libgcc/config/avr/libf7/ * f7-renames.h: Re-renerate. --- libgcc/config/avr/libf7/f7-renames.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libgcc/config/avr/libf7/f7-renames.h b/libgcc/config/avr/libf7/f7-renames.h index e4c0c0d8fc00..22370a1e699a 100644 --- a/libgcc/config/avr/libf7/f7-renames.h +++ b/libgcc/config/avr/libf7/f7-renames.h @@ -3,16 +3,16 @@ Generated by: f7renames.sh. Generated using: F7_PREFIX = __f7_ from t-libf7. - F7F, F7F_cst, F7F_asm from libf7-common.mk. - Included by: libf7.h. - Used by: libf7.c, libf7.h, libf7-asm.sx, f7-wraps.h. + F7F, F7F_cst, F7F_asm from libf7-common.mk. + Included by: libf7.h. + Used by: libf7.c, libf7.h, libf7-asm.sx, f7-wraps.h. */ #ifndef F7_RENAMES_H #define F7_RENAMES_H #define F7_(name) __f7_##name -#define F7P __f7_ +#define F7P __f7_ /* Renames for libf7.c, libf7.h. */ From 834ae88fe48a2477d187d05f8e57be06b18ca389 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 18 Oct 2023 00:21:03 +0000 Subject: [PATCH 05/31] Daily bump. --- gcc/ChangeLog | 10 ++++++++++ gcc/DATESTAMP | 2 +- gcc/testsuite/ChangeLog | 7 +++++++ libgcc/config/avr/libf7/ChangeLog | 13 +++++++++++++ 4 files changed, 31 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f578e5fc5cde..85b0df1dc3c6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2023-10-17 liuhongt + + Backported from master: + 2023-07-06 liuhongt + + PR target/110170 + * config/i386/i386.md (movdf_internal): Disparage slightly for + 2 alternatives (r,v) and (v,r) by adding constraint modifier + '?'. + 2023-10-16 Kewen Lin Backported from master: diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index a8fe11db53a8..304d62621454 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20231017 +20231018 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index edee91c3364b..d40eba04af64 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2023-10-17 liuhongt + + Backported from master: + 2023-07-06 liuhongt + + * gcc.target/i386/pr110170-3.c: New test. + 2023-10-16 Kewen Lin Backported from master: diff --git a/libgcc/config/avr/libf7/ChangeLog b/libgcc/config/avr/libf7/ChangeLog index e78b9cb88692..71c34d055b7d 100644 --- a/libgcc/config/avr/libf7/ChangeLog +++ b/libgcc/config/avr/libf7/ChangeLog @@ -1,3 +1,16 @@ +2023-10-17 Georg-Johann Lay + + * f7-renames.h: Re-renerate. + +2023-10-17 Georg-Johann Lay + + * libf7.h (F7_SIZEOF): New macro. + * libf7-asm.sx: Use F7_SIZEOF instead of magic number "10". + (F7MOD_D_fma_, __fma): New module and function. + (fma) [-mdouble=64]: Define as alias for __fma. + (fmal) [-mlong-double=64]: Define as alias for __fma. + * libf7-common.mk (F7_ASM_PARTS): Add D_fma. + 2023-10-12 Georg-Johann Lay * libf7.c (F7MOD_atan2_, f7_atan2): New module and function. From bdf4b6f9f2847b7abba5392e271e30f55541935e Mon Sep 17 00:00:00 2001 From: Gaius Mulley Date: Wed, 18 Oct 2023 03:09:29 +0100 Subject: [PATCH 06/31] PR modula2/111756: Re-building all-gcc after source changes fails to link When having modula-2 enabled in a development tree and there are any changes that trigger rebuilds in m2/ doing a 'make all-gcc' in the build directory might fail due to lack of dependency tracking. This patch introduces build dependencies into gcc/m2/Make-lang.in using -M* options. gcc/m2/ChangeLog: PR modula2/111756 * Make-lang.in (CM2DEP): New define conditionally set if ($(CXXDEPMODE),depmode=gcc3). (m2/gm2-gcc/%.o): Ensure $(@D)/$(DEPDIR) is created. Add $(CM2DEP) to the $(COMPILER) command and use $(POSTCOMPILE). (m2/gm2-gcc/m2configure.o): Ditto. (m2/gm2-lang.o): Ditto. (m2/m2pp.o): Ditto. (m2/gm2-gcc/rtegraph.o): Ditto. (m2/mc-boot/$(SRC_PREFIX)%.o): Ditto. (m2/mc-boot-ch/$(SRC_PREFIX)%.o): Ditto. (m2/mc-boot-ch/$(SRC_PREFIX)%.o): Ditto. (m2/mc-boot/main.o): Ditto. (mcflex.o): Ditto. (m2/gm2-libs-boot/M2RTS.o): Ditto. (m2/gm2-libs-boot/%.o): Ditto. (m2/gm2-libs-boot/%.o): Ditto. (m2/gm2-libs-boot/RTcodummy.o): Ditto. (m2/gm2-libs-boot/RTintdummy.o): Ditto. (m2/gm2-libs-boot/wrapc.o): Ditto. (m2/gm2-libs-boot/UnixArgs.o): Ditto. (m2/gm2-libs-boot/choosetemp.o): Ditto. (m2/gm2-libs-boot/errno.o): Ditto. (m2/gm2-libs-boot/dtoa.o): Ditto. (m2/gm2-libs-boot/ldtoa.o): Ditto. (m2/gm2-libs-boot/termios.o): Ditto. (m2/gm2-libs-boot/SysExceptions.o): Ditto. (m2/gm2-libs-boot/SysStorage.o): Ditto. (m2/gm2-compiler-boot/M2GCCDeclare.o): Ditto. (m2/gm2-compiler-boot/M2Error.o): Ditto. (m2/gm2-compiler-boot/%.o): Ditto. (m2/gm2-compiler-boot/%.o): Ditto. (m2/gm2-compiler-boot/m2flex.o): Ditto. (m2/gm2-compiler/m2flex.o): Ditto. (m2/gm2-libs/choosetemp.o): Ditto. (m2/boot-bin/mklink$(exeext)): Ditto. (m2/pge-boot/%.o): Ditto. (m2/pge-boot/%.o): Ditto. * README: Remove out of date info. * gm2-compiler/M2Quads.mod (BuildStringAdrParam): Correct procedure end name. * gm2-compiler/SymbolTable.mod (GetVarPointerCheck): Add default FALSE return value. Signed-off-by: Gaius Mulley --- gcc/m2/Make-lang.in | 214 +++++++++++++++++----------- gcc/m2/README | 21 --- gcc/m2/gm2-compiler/M2Quads.mod | 2 +- gcc/m2/gm2-compiler/SymbolTable.mod | 3 +- 4 files changed, 132 insertions(+), 108 deletions(-) diff --git a/gcc/m2/Make-lang.in b/gcc/m2/Make-lang.in index cf4f3c015115..0ae3e1839770 100644 --- a/gcc/m2/Make-lang.in +++ b/gcc/m2/Make-lang.in @@ -27,6 +27,13 @@ GM2_CROSS_NAME = `echo gm2|sed '$(program_transform_cross_name)'` M2_MAINTAINER = no +# CM2DEP must match the COMPILE and POSTCOMPILE defines in gcc/Make-lang.in +ifeq ($(CXXDEPMODE),depmode=gcc3) +CM2DEP=-MT $@ -MMD -MP -MF $(@D)/$(DEPDIR)/$(*F).TPo +else +CM2DEP= +endif + GM2_1 = ./gm2 -B./m2/stage1 -g -fm2-g GM2_FOR_TARGET = $(STAGE_CC_WRAPPER) ./gm2 -B./ -B$(build_tooldir)/bin/ -L$(objdir)/../ld $(TFLAGS) @@ -567,35 +574,40 @@ GCC_HEADER_DEPENDENCIES_FOR_M2 = $(BUILD-BOOT-H) $(TIMEVAR_H) m2/gm2config.h $(C $(generated_files) insn-attr-common.h m2/gm2-gcc/%.o: $(srcdir)/m2/gm2-gcc/%.cc $(GCC_HEADER_DEPENDENCIES_FOR_M2) - -test -d $(@D) || $(mkinstalldirs) $(@D) - $(COMPILER) -c -g $(ALL_COMPILERFLAGS) \ + -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) + $(COMPILER) $(CM2DEP) -c -g $(ALL_COMPILERFLAGS) \ $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) + $(POSTCOMPILE) m2/gm2-gcc/m2configure.o: $(srcdir)/m2/gm2-gcc/m2configure.cc \ $(SYSTEM_H) $(GCC_H) $(CONFIG_H) \ m2/gm2config.h $(TARGET_H) $(PLUGIN_HEADERS) \ $(generated_files) $(C_TREE_H) insn-attr-common.h - -test -d $(@D) || $(mkinstalldirs) $(@D) - $(COMPILER) $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ + -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) + $(COMPILER) $(CM2DEP) $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ $(DRIVER_DEFINES) \ -DLIBSUBDIR=\"$(libsubdir)\" \ -DPREFIX=\"$(prefix)\" \ -c $(srcdir)/m2/gm2-gcc/m2configure.cc $(OUTPUT_OPTION) + $(POSTCOMPILE) m2/gm2-lang.o: $(srcdir)/m2/gm2-lang.cc gt-m2-gm2-lang.h $(GCC_HEADER_DEPENDENCIES_FOR_M2) - $(COMPILER) -c -g $(GM2GCC) $(ALL_COMPILERFLAGS) \ + $(COMPILER) $(CM2DEP) -c -g $(GM2GCC) $(ALL_COMPILERFLAGS) \ -DLIBSUBDIR=\"$(libsubdir)\" \ $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) + $(POSTCOMPILE) m2/m2pp.o : $(srcdir)/m2/m2pp.cc $(GCC_HEADER_DEPENDENCIES_FOR_M2) - $(COMPILER) -c -g -DGM2 $(ALL_COMPILERFLAGS) \ + $(COMPILER) $(CM2DEP) -c -g -DGM2 $(ALL_COMPILERFLAGS) \ $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) + $(POSTCOMPILE) m2/gm2-gcc/rtegraph.o: $(srcdir)/m2/gm2-gcc/rtegraph.cc $(GCC_HEADER_DEPENDENCIES_FOR_M2) \ gt-m2-rtegraph.h - -test -d $(@D) || $(mkinstalldirs) $(@D) - $(COMPILER) -c -g $(GM2GCC) $(ALL_COMPILERFLAGS) \ + -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) + $(COMPILER) $(CM2DEP) -c -g $(GM2GCC) $(ALL_COMPILERFLAGS) \ $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) + $(POSTCOMPILE) m2/gm2-gcc/$(SRC_PREFIX)%.h: $(srcdir)/m2/gm2-gcc/%.def $(MCDEPS) -test -d $(@D) || $(mkinstalldirs) $(@D) @@ -1373,126 +1385,150 @@ m2/boot-bin/mc$(exeext): $(BUILD-MC-BOOT-O) $(BUILD-MC-INTERFACE-O) \ mcflex.o m2/gm2-libs-boot/RTcodummy.o -lm m2/mc-boot/$(SRC_PREFIX)%.o: m2/mc-boot/$(SRC_PREFIX)%.cc m2/gm2-libs/gm2-libs-host.h - -test -d $(@D) || $(mkinstalldirs) $(@D) - $(CXX) $(CXXFLAGS) -g -c -I. -I$(srcdir)/m2/mc-boot-ch -I$(srcdir)/m2/mc-boot -I$(srcdir)/../include -I$(srcdir) $(INCLUDES) $< -o $@ + -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) + $(CXX) $(CM2DEP) $(CXXFLAGS) $(GM2_PICFLAGS) -g -c -I. -I$(srcdir)/m2/mc-boot-ch -I$(srcdir)/m2/mc-boot -I$(srcdir)/../include -I$(srcdir) $(INCLUDES) $< -o $@ + $(POSTCOMPILE) m2/mc-boot-ch/$(SRC_PREFIX)%.o: m2/mc-boot-ch/$(SRC_PREFIX)%.c m2/gm2-libs/gm2-libs-host.h - -test -d $(@D) || $(mkinstalldirs) $(@D) - $(CXX) $(CXXFLAGS) -DHAVE_CONFIG_H -g -c -I. -Im2/gm2-libs -I$(srcdir)/../include -I$(srcdir) $(INCLUDES) -Im2/gm2-libs $< -o $@ + -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) + $(CXX) $(CM2DEP) $(CXXFLAGS) $(GM2_PICFLAGS) -DHAVE_CONFIG_H -g -c -I. -Im2/gm2-libs -I$(srcdir)/../include -I$(srcdir) $(INCLUDES) -Im2/gm2-libs $< -o $@ + $(POSTCOMPILE) m2/mc-boot-ch/$(SRC_PREFIX)%.o: m2/mc-boot-ch/$(SRC_PREFIX)%.cc m2/gm2-libs/gm2-libs-host.h -test -d $(@D) || $(mkinstalldirs) $(@D) $(CXX) $(CXXFLAGS) -DHAVE_CONFIG_H -g -c -I. -Im2/gm2-libs -I$(srcdir)/../include -I$(srcdir) $(INCLUDES) -Im2/gm2-libs $< -o $@ m2/mc-boot/main.o: $(M2LINK) $(srcdir)/m2/init/mcinit - -test -d $(@D) || $(mkinstalldirs) $(@D) + -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) unset CC ; $(M2LINK) -s --langc++ --exit --name m2/mc-boot/main.cc $(srcdir)/m2/init/mcinit - $(CXX) $(CXXFLAGS) -g -c -I. -I$(srcdir)/../include -I$(srcdir) $(INCLUDES) m2/mc-boot/main.cc -o $@ + $(CXX) $(CM2DEP) $(CXXFLAGS) $(GM2_PICFLAGS) -g -c -I. -I$(srcdir)/../include -I$(srcdir) $(INCLUDES) m2/mc-boot/main.cc -o $@ + $(POSTCOMPILE) mcflex.o: mcflex.c m2/gm2-libs/gm2-libs-host.h - $(CC) $(CFLAGS) -I$(srcdir)/m2/mc -g -c $< -o $@ # remember that mcReserved.h is copied into m2/mc + -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) + $(CC) $(CM2DEP) $(CFLAGS) $(GM2_PICFLAGS) -I$(srcdir)/m2/mc -g -c $< -o $@ # remember that mcReserved.h is copied into m2/mc + $(POSTCOMPILE) mcflex.c: $(srcdir)/m2/mc/mc.flex flex -t $< > $@ m2/gm2-libs-boot/M2RTS.o: $(srcdir)/m2/gm2-libs/M2RTS.mod $(MCDEPS) $(BUILD-BOOT-H) - -test -d $(@D) || $(mkinstalldirs) $(@D) + -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) $(MC) --suppress-noreturn -o=m2/gm2-libs-boot/M2RTS.c $(srcdir)/m2/gm2-libs/M2RTS.mod - $(COMPILER) -c -DIN_GCC $(CFLAGS) -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(MCINCLUDES) $(INCLUDES) m2/gm2-libs-boot/M2RTS.c -o $@ + $(COMPILER) $(CM2DEP) -c -DIN_GCC $(CFLAGS) $(GM2_PICFLAGS) -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(MCINCLUDES) $(INCLUDES) m2/gm2-libs-boot/M2RTS.c -o $@ + $(POSTCOMPILE) m2/gm2-libs-boot/%.o: $(srcdir)/m2/gm2-libs-boot/%.mod $(MCDEPS) $(BUILD-BOOT-H) - -test -d $(@D) || $(mkinstalldirs) $(@D) + -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) $(MC) -o=m2/gm2-libs-boot/$*.c $(srcdir)/m2/gm2-libs-boot/$*.mod - $(COMPILER) -c -DIN_GCC $(CFLAGS) $(MCINCLUDES) m2/gm2-libs-boot/$*.c -o $@ + $(COMPILER) $(CM2DEP) -c -DIN_GCC $(CFLAGS) $(GM2_PICFLAGS) $(MCINCLUDES) m2/gm2-libs-boot/$*.c -o $@ + $(POSTCOMPILE) m2/gm2-libs-boot/%.o: $(srcdir)/m2/gm2-libs/%.mod $(MCDEPS) $(BUILD-BOOT-H) - -test -d $(@D) || $(mkinstalldirs) $(@D) + -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) $(MC) -o=m2/gm2-libs-boot/$*.c $(srcdir)/m2/gm2-libs/$*.mod - $(COMPILER) -c -DIN_GCC $(CFLAGS) -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(MCINCLUDES) $(INCLUDES) m2/gm2-libs-boot/$*.c -o $@ + $(COMPILER) $(CM2DEP) -c -DIN_GCC $(CFLAGS) $(GM2_PICFLAGS) -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(MCINCLUDES) $(INCLUDES) m2/gm2-libs-boot/$*.c -o $@ + $(POSTCOMPILE) m2/gm2-libs-boot/$(SRC_PREFIX)%.h: $(srcdir)/m2/gm2-libs/%.def $(MCDEPS) -test -d $(@D) || $(mkinstalldirs) $(@D) $(MC) -o=$@ $(srcdir)/m2/gm2-libs/$*.def m2/gm2-libs-boot/RTcodummy.o: $(srcdir)/m2/gm2-libs-ch/RTcodummy.c m2/gm2-libs/gm2-libs-host.h - -test -d $(@D) || $(mkinstalldirs) $(@D) - $(CXX) -c -DIN_GCC $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ + -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) + $(CXX) $(CM2DEP) -c -DIN_GCC $(CFLAGS) $(GM2_PICFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ + $(POSTCOMPILE) m2/gm2-libs-boot/RTintdummy.o: $(srcdir)/m2/gm2-libs-ch/RTintdummy.c m2/gm2-libs/gm2-libs-host.h - -test -d $(@D) || $(mkinstalldirs) $(@D) - $(CXX) -c -DIN_GCC $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ + -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) + $(CXX) $(CM2DEP) -c -DIN_GCC $(CFLAGS) $(GM2_PICFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ + $(POSTCOMPILE) m2/gm2-libs-boot/wrapc.o: $(srcdir)/m2/gm2-libs-ch/wrapc.c m2/gm2-libs-boot/$(SRC_PREFIX)wrapc.h m2/gm2-libs/gm2-libs-host.h - -test -d $(@D) || $(mkinstalldirs) $(@D) - $(CXX) -c -DHAVE_CONFIG_H $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot -Im2/gm2-libs $(INCLUDES) $< -o $@ + -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) + $(CXX) $(CM2DEP) -c -DHAVE_CONFIG_H $(CFLAGS) $(GM2_PICFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot -Im2/gm2-libs $(INCLUDES) $< -o $@ + $(POSTCOMPILE) m2/gm2-libs-boot/UnixArgs.o: $(srcdir)/m2/gm2-libs-ch/UnixArgs.cc m2/gm2-libs-boot/$(SRC_PREFIX)UnixArgs.h m2/gm2-libs/gm2-libs-host.h - -test -d $(@D) || $(mkinstalldirs) $(@D) - $(CXX) -c -DIN_GCC $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ + -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) + $(CXX) $(CM2DEP) -c -DIN_GCC $(CFLAGS) $(GM2_PICFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ + $(POSTCOMPILE) m2/gm2-libs-boot/choosetemp.o: m2/gm2-libs-ch/choosetemp.c m2/gm2-libiberty/Gchoosetemp.h m2/gm2-libs/gm2-libs-host.h - -test -d $(@D) || $(mkinstalldirs) $(@D) - $(CXX) -c $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot -Im2/gm2-libiberty -I$(srcdir)/m2/gm2-libiberty/ $(INCLUDES) $< -o $@ + -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) + $(CXX) $(CM2DEP) -c $(CFLAGS) $(GM2_PICFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot -Im2/gm2-libiberty -I$(srcdir)/m2/gm2-libiberty/ $(INCLUDES) $< -o $@ + $(POSTCOMPILE) m2/gm2-libs-boot/errno.o: $(srcdir)/m2/gm2-libs-ch/errno.c m2/gm2-libs-boot/$(SRC_PREFIX)errno.h m2/gm2-libs/gm2-libs-host.h - -test -d $(@D) || $(mkinstalldirs) $(@D) - $(CXX) -c $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ + -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) + $(CXX) $(CM2DEP) -c $(CFLAGS) $(GM2_PICFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ + $(POSTCOMPILE) m2/gm2-libs-boot/dtoa.o: $(srcdir)/m2/gm2-libs-ch/dtoa.cc m2/gm2-libs/gm2-libs-host.h - -test -d $(@D) || $(mkinstalldirs) $(@D) - $(CXX) -c $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ + -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) + $(CXX) $(CM2DEP) -c $(CFLAGS) $(GM2_PICFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ + $(POSTCOMPILE) m2/gm2-libs-boot/ldtoa.o: $(srcdir)/m2/gm2-libs-ch/ldtoa.cc m2/gm2-libs/gm2-libs-host.h - -test -d $(@D) || $(mkinstalldirs) $(@D) - $(CXX) -c $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ + -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) + $(CXX) $(CM2DEP) -c $(CFLAGS) $(GM2_PICFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ + $(POSTCOMPILE) m2/gm2-libs-boot/termios.o: $(srcdir)/m2/gm2-libs-ch/termios.c $(BUILD-LIBS-BOOT-H) m2/gm2-libs/gm2-libs-host.h - -test -d $(@D) || $(mkinstalldirs) $(@D) - $(CXX) -c $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ + -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) + $(CXX) $(CM2DEP) -c $(CFLAGS) $(GM2_PICFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ + $(POSTCOMPILE) m2/gm2-libs-boot/SysExceptions.o: $(srcdir)/m2/gm2-libs-ch/SysExceptions.c \ m2/gm2-libs-boot/$(SRC_PREFIX)SysExceptions.h m2/gm2-libs/gm2-libs-host.h - -test -d $(@D) || $(mkinstalldirs) $(@D) - $(CXX) -c $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ + -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) + $(CXX) $(CM2DEP) -c $(CFLAGS) $(GM2_PICFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ + $(POSTCOMPILE) m2/gm2-libs-boot/SysStorage.o: $(srcdir)/m2/gm2-libs/SysStorage.mod $(MCDEPS) $(BUILD-BOOT-H) - -test -d $(@D) || $(mkinstalldirs) $(@D) + -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) $(MC) -o=m2/gm2-libs-boot/SysStorage.c $(srcdir)/m2/gm2-libs/SysStorage.mod - $(COMPILER) -DIN_GCC -c $(CFLAGS) \ - -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(MCINCLUDES) $(INCLUDES) \ - m2/gm2-libs-boot/SysStorage.c -o m2/gm2-libs-boot/SysStorage.o + $(COMPILER) $(CM2DEP) -DIN_GCC -c $(CFLAGS) $(GM2_PICFLAGS) \ + -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(MCINCLUDES) $(INCLUDES) \ + m2/gm2-libs-boot/SysStorage.c -o m2/gm2-libs-boot/SysStorage.o + $(POSTCOMPILE) m2/gm2-compiler-boot/M2GCCDeclare.o: $(srcdir)/m2/gm2-compiler/M2GCCDeclare.mod $(MCDEPS) $(BUILD-BOOT-H) - -test -d $(@D) || $(mkinstalldirs) $(@D) + -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) $(MC) --extended-opaque -o=m2/gm2-compiler-boot/M2GCCDeclare.c $< - $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(GM2GCC) \ - -I. -I$(srcdir)/../include -I$(srcdir) \ - -I. -Im2/gm2-libs-boot -Im2/gm2-compiler-boot \ - -I$(srcdir)/m2/gm2-libiberty $(MCINCLUDES) $(INCLUDES) m2/gm2-compiler-boot/M2GCCDeclare.c -o $@ + $(COMPILER) $(CM2DEP) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(GM2GCC) \ + -I. -I$(srcdir)/../include -I$(srcdir) \ + -I. -Im2/gm2-libs-boot -Im2/gm2-compiler-boot \ + -I$(srcdir)/m2/gm2-libiberty $(MCINCLUDES) $(INCLUDES) m2/gm2-compiler-boot/M2GCCDeclare.c -o $@ + $(POSTCOMPILE) m2/gm2-compiler-boot/M2Error.o: $(srcdir)/m2/gm2-compiler/M2Error.mod $(MCDEPS) $(BUILD-BOOT-H) - -test -d $(@D) || $(mkinstalldirs) $(@D) + -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) $(MC) --extended-opaque -o=m2/gm2-compiler-boot/M2Error.c $< - $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(GM2GCC) \ - -I. -I$(srcdir)/../include -I$(srcdir) \ - -I. -Im2/gm2-libs-boot -Im2/gm2-compiler-boot \ - -I$(srcdir)/m2/gm2-libiberty $(MCINCLUDES) $(INCLUDES) m2/gm2-compiler-boot/M2Error.c -o $@ + $(COMPILER) $(CM2DEP) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(GM2GCC) \ + -I. -I$(srcdir)/../include -I$(srcdir) \ + -I. -Im2/gm2-libs-boot -Im2/gm2-compiler-boot \ + -I$(srcdir)/m2/gm2-libiberty $(MCINCLUDES) $(INCLUDES) m2/gm2-compiler-boot/M2Error.c -o $@ + $(POSTCOMPILE) m2/gm2-compiler-boot/%.o: $(srcdir)/m2/gm2-compiler/%.mod $(BUILD-BOOT-H) $(MCDEPS) $(BUILD-BOOT-H) - -test -d $(@D) || $(mkinstalldirs) $(@D) + -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) $(MC) -o=m2/gm2-compiler-boot/$*.c $(srcdir)/m2/gm2-compiler/$*.mod - $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(GM2GCC) \ - -I. -I$(srcdir)/../include -I$(srcdir) \ - -I. -Im2/gm2-libs-boot -Im2/gm2-compiler-boot -Im2/gm2-libiberty \ - -I$(srcdir)/m2/gm2-libiberty $(MCINCLUDES) $(INCLUDES) m2/gm2-compiler-boot/$*.c -o $@ + + $(COMPILER) $(CM2DEP) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(GM2GCC) \ + -I. -I$(srcdir)/../include -I$(srcdir) \ + -I. -Im2/gm2-libs-boot -Im2/gm2-compiler-boot -Im2/gm2-libiberty \ + -I$(srcdir)/m2/gm2-libiberty $(MCINCLUDES) $(INCLUDES) m2/gm2-compiler-boot/$*.c -o $@ + $(POSTCOMPILE) m2/gm2-compiler-boot/%.o: m2/gm2-compiler-boot/%.mod $(MCDEPS) $(BUILD-BOOT-H) - -test -d $(@D) || $(mkinstalldirs) $(@D) + -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) $(MC) -o=m2/gm2-compiler-boot/$*.c m2/gm2-compiler-boot/$*.mod - $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(GM2GCC) \ - -I. -I$(srcdir)/../include -I$(srcdir) \ - -I. -Im2/gm2-libs-boot -Im2/gm2-compiler-boot \ - -I$(srcdir)/m2/gm2-libiberty $(MCINCLUDES) $(INCLUDES) m2/gm2-compiler-boot/$*.c -o $@ + $(COMPILER) $(CM2DEP) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(GM2GCC) \ + -I. -I$(srcdir)/../include -I$(srcdir) \ + -I. -Im2/gm2-libs-boot -Im2/gm2-compiler-boot \ + -I$(srcdir)/m2/gm2-libiberty $(MCINCLUDES) $(INCLUDES) m2/gm2-compiler-boot/$*.c -o $@ + $(POSTCOMPILE) m2/gm2-compiler-boot/$(SRC_PREFIX)%.h: $(srcdir)/m2/gm2-compiler/%.def $(MCDEPS) -test -d $(@D) || $(mkinstalldirs) $(@D) @@ -1501,10 +1537,11 @@ m2/gm2-compiler-boot/$(SRC_PREFIX)%.h: $(srcdir)/m2/gm2-compiler/%.def $(MCDEPS) m2/gm2-compiler-boot/m2flex.o: m2/gm2-compiler/m2flex.c $(BUILD-BOOT-H) $(TIMEVAR_H) \ $(BUILD-LIBS-BOOT-H) m2/gm2-compiler-boot/$(SRC_PREFIX)NameKey.h \ $(CONFIG_H) m2/gm2config.h $(TARGET_H) $(PLUGIN_HEADERS) - -test -d $(@D) || $(mkinstalldirs) $(@D) - $(COMPILER) -c -g $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ + -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) + $(COMPILER) $(CM2DEP) -c -g $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ $(GM2GCC) $(INCLUDES) -I$(srcdir)/m2 \ -Im2 -Im2/gm2-compiler-boot -Im2/gm2-libs-boot $< -o $@ + $(POSTCOMPILE) m2/gm2-compiler/m2flex.c: $(srcdir)/m2/m2.flex $(TIMEVAR_H) insn-attr-common.h -test -d $(@D) || $(mkinstalldirs) $(@D) @@ -1521,23 +1558,24 @@ m2/gm2-compiler/%.o: $(srcdir)/m2/gm2-compiler/%.mod $(GM2_1) $(GM2_FLAGS) -c -I$(srcdir)/m2/gm2-compiler -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-gcc -I$(srcdir)/m2/gm2-libiberty $< -o $@ m2/gm2-compiler/m2flex.o: m2/gm2-compiler/m2flex.c m2/gm2-libs/gm2-libs-host.h $(TIMEVAR_H) - -test -d $(@D) || $(mkinstalldirs) $(@D) - $(COMPILER) -c -g $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ - $(GM2GCC) -Im2/gm2-compiler-boot -Im2/gm2-libs-boot $< -o $@ + -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) + $(COMPILER) $(CM2DEP) -c -g $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ + $(GM2GCC) -Im2/gm2-compiler-boot -Im2/gm2-libs-boot $< -o $@ + $(POSTCOMPILE) m2/gm2-compiler/%.o: m2/gm2-compiler/%.mod -test -d $(@D) || $(mkinstalldirs) $(@D) $(GM2_1) $(GM2_FLAGS) -c -I$(srcdir)/m2/gm2-compiler -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-gcc -I$(srcdir)/m2/gm2-libiberty $< -o $@ m2/gm2-libs-iso/%.o: $(srcdir)/m2/gm2-libs-iso/%.c m2/gm2-libs/gm2-libs-host.h - -test -d $(@D) || $(mkinstalldirs) $(@D) - $(CXX) -DBUILD_GM2_LIBS_TARGET -DBUILD_GM2_LIBS -c $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ + -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) + $(CXX) $(CM2DEP) -DBUILD_GM2_LIBS_TARGET -DBUILD_GM2_LIBS -c $(CFLAGS) $(GM2_PICFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ + $(POSTCOMPILE) m2/gm2-libs-iso/%.o: $(srcdir)/m2/gm2-libs-iso/%.mod -test -d $(@D) || $(mkinstalldirs) $(@D) $(GM2_1) $(GM2_ISO_FLAGS) -c -B./ -Im2/gm2-libs-iso:$(srcdir)/m2/gm2-libs-iso -I$(srcdir)/m2/gm2-libs $< -o $@ - # We build the cc1gm2$(exeext) from the boot stage and then proceed to build it # again using itself. @@ -1632,16 +1670,19 @@ m2/gm2-libs/%.o: $(srcdir)/m2/gm2-libs/%.mod $(MCDEPS) $(BUILD-BOOT-H) $(GM2_1) -c $(GM2_FLAGS) -Im2/gm2-libs -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-libs-iso $< -o $@ m2/gm2-libs/%.o: $(srcdir)/m2/gm2-libs-ch/%.c m2/gm2-libs/gm2-libs-host.h - -test -d $(@D) || $(mkinstalldirs) $(@D) - $(CXX) -DBUILD_GM2_LIBS -c $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ + -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) + $(CXX) $(CM2DEP) -DBUILD_GM2_LIBS -c $(CFLAGS) $(GM2_PICFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ + $(POSTCOMPILE) m2/gm2-libs/%.o: $(srcdir)/m2/gm2-libs-ch/%.cc m2/gm2-libs/gm2-libs-host.h - -test -d $(@D) || $(mkinstalldirs) $(@D) - $(CXX) -c $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ + -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) + $(CXX) $(CM2DEP) -c $(CFLAGS) $(GM2_PICFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@ + $(POSTCOMPILE) m2/gm2-libs/choosetemp.o: m2/gm2-libs-ch/choosetemp.c m2/gm2-libiberty/Gchoosetemp.h m2/gm2-libs/gm2-libs-host.h - -test -d $(@D) || $(mkinstalldirs) $(@D) - $(CXX) -c $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot -Im2/gm2-libiberty -I$(srcdir)/m2/gm2-libiberty/ $(INCLUDES) $< -o $@ + -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) + $(CXX) $(CM2DEP) -c $(CFLAGS) $(GM2_PICFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot -Im2/gm2-libiberty -I$(srcdir)/m2/gm2-libiberty/ $(INCLUDES) $< -o $@ + $(POSTCOMPILE) m2/gm2-libs-boot/libgm2.a: m2/boot-bin/mc$(exeext) $(BUILD-LIBS-BOOT) -test -d $(@D) || $(mkinstalldirs) $(@D) @@ -1660,8 +1701,9 @@ m2/gm2-compiler-boot/gm2.a: m2/boot-bin/mc$(exeext) m2/boot-bin/mklink$(exeext) m2/gm2-compiler-boot/gm2.a: m2/boot-bin/mc$(exeext) m2/boot-bin/mklink$(exeext): $(srcdir)/m2/tools-src/mklink.c - -test -d $(@D) || $(mkinstalldirs) $(@D) - $(CXX) $(CFLAGS) -I$(srcdir)/m2 -Im2/gm2-libs-boot -Im2/gm2-compiler-boot -I$(srcdir)/m2/mc-boot-ch $(INCLUDES) $< -o $@ + -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) + $(CXX) $(CM2DEP) $(CFLAGS) $(LDFLAGS) -I$(srcdir)/m2 -Im2/gm2-libs-boot -Im2/gm2-compiler-boot -I$(srcdir)/m2/mc-boot-ch $(INCLUDES) $< -o $@ + $(POSTCOMPILE) m2/gm2-compiler-boot/$(SRC_PREFIX)%.h: $(srcdir)/m2/gm2-compiler-boot/%.def $(MCDEPS) -test -d $(@D) || $(mkinstalldirs) $(@D) @@ -1740,12 +1782,14 @@ ifeq ($(M2_MAINTAINER),yes) include m2/Make-maintainer else m2/pge-boot/%.o: m2/pge-boot/%.c m2/gm2-libs/gm2-libs-host.h m2/gm2config.h - -test -d $(@D) || $(mkinstalldirs) $(@D) - $(CXX) $(CFLAGS) $(INCLUDES) -I$(srcdir)/m2/pge-boot -Im2/gm2-libs -g -c $< -o $@ + -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) + $(CXX) $(CM2DEP) $(CFLAGS) $(GM2_PICFLAGS) $(INCLUDES) -I$(srcdir)/m2/pge-boot -Im2/gm2-libs -g -c $< -o $@ + $(POSTCOMPILE) m2/pge-boot/%.o: m2/pge-boot/%.cc m2/gm2-libs/gm2-libs-host.h m2/gm2config.h - -test -d $(@D) || $(mkinstalldirs) $(@D) - $(CXX) $(CXXFLAGS) $(INCLUDES) -I$(srcdir)/m2/pge-boot -Im2/gm2-libs -g -c $< -o $@ + -test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR) + $(CXX) $(CM2DEP) $(CXXFLAGS) $(GM2_PICFLAGS) $(INCLUDES) -I$(srcdir)/m2/pge-boot -Im2/gm2-libs -g -c $< -o $@ + $(POSTCOMPILE) $(PGE): $(BUILD-PGE-O) +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ $(BUILD-PGE-O) -lm diff --git a/gcc/m2/README b/gcc/m2/README index 9de9e4fbf548..9cb87724d318 100644 --- a/gcc/m2/README +++ b/gcc/m2/README @@ -1,25 +1,4 @@ -Building GNU Modula-2 -===================== - -Please see the GCC documentation (gcc.texi) and section -(Installing GCC). - -Regression testing GM2 -====================== - - cd host-build ; make check-m2 - -runs all regression tests. - -Stress testing GM2 -================== - - cd host-build/gcc ; make gm2.paranoid - -builds gm2 using itself and then compiles each module with both -versions of gm2 comparing the emitted assembler code. - Contributing to GNU Modula-2 ============================ diff --git a/gcc/m2/gm2-compiler/M2Quads.mod b/gcc/m2/gm2-compiler/M2Quads.mod index 9d4616ae6e64..7b5cd083b71a 100644 --- a/gcc/m2/gm2-compiler/M2Quads.mod +++ b/gcc/m2/gm2-compiler/M2Quads.mod @@ -2593,7 +2593,7 @@ BEGIN PushTtok (m2strnul, tok) ; PushT (1) ; BuildAdrFunction -END BuildAdrFunction ; +END BuildStringAdrParam ; (* diff --git a/gcc/m2/gm2-compiler/SymbolTable.mod b/gcc/m2/gm2-compiler/SymbolTable.mod index 891b29985b8b..85025e15bc0b 100644 --- a/gcc/m2/gm2-compiler/SymbolTable.mod +++ b/gcc/m2/gm2-compiler/SymbolTable.mod @@ -6713,7 +6713,8 @@ BEGIN WITH pSym^.Var DO RETURN( IsPointerCheck ) END - END + END ; + RETURN FALSE END GetVarPointerCheck ; From f5e56c5857cc6b704446c3666213468d25f6dcb2 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Wed, 18 Oct 2023 18:44:57 +0100 Subject: [PATCH 07/31] lra: Avoid unfolded plus-0 While backporting another patch to an earlier release, I hit a situation in which lra_eliminate_regs_1 would eliminate an address to: (plus (reg:P R) (const_int 0)) This address compared not-equal to plain: (reg:P R) which caused an ICE in a later peephole2. (The ICE showed up in gfortran.fortran-torture/compile/pr80464.f90 on the branch but seems to be latent on trunk.) These unfolded PLUSes shouldn't occur in the insn stream, and later code in the same function tried to avoid them. gcc/ PR target/111528 * lra-eliminations.cc (lra_eliminate_regs_1): Use simplify_gen_binary rather than gen_rtx_PLUS. (cherry picked from commit 10d59b802a7db9ae908291fb20627c1493cfa26c) --- gcc/lra-eliminations.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/lra-eliminations.cc b/gcc/lra-eliminations.cc index 422063666690..c627dc5db6b7 100644 --- a/gcc/lra-eliminations.cc +++ b/gcc/lra-eliminations.cc @@ -397,8 +397,8 @@ lra_eliminate_regs_1 (rtx_insn *insn, rtx x, machine_mode mem_mode, rtx to = subst_p ? ep->to_rtx : ep->from_rtx; if (! update_p && ! full_p) - return gen_rtx_PLUS (Pmode, to, XEXP (x, 1)); - + return simplify_gen_binary (PLUS, Pmode, to, XEXP (x, 1)); + if (maybe_ne (update_sp_offset, 0)) offset = ep->to_rtx == stack_pointer_rtx ? update_sp_offset : 0; else From 05f87b3275fc0e4d19b3d97e3d9339affb79134d Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 19 Oct 2023 00:21:56 +0000 Subject: [PATCH 08/31] Daily bump. --- gcc/ChangeLog | 9 +++++++++ gcc/DATESTAMP | 2 +- gcc/m2/ChangeLog | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 85b0df1dc3c6..576474e789f4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2023-10-18 Richard Sandiford + + Backported from master: + 2023-09-07 Richard Sandiford + + PR target/111528 + * lra-eliminations.cc (lra_eliminate_regs_1): Use simplify_gen_binary + rather than gen_rtx_PLUS. + 2023-10-17 liuhongt Backported from master: diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 304d62621454..1e71ea70cb34 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20231018 +20231019 diff --git a/gcc/m2/ChangeLog b/gcc/m2/ChangeLog index ea2d97cf5bcc..1fa98922af34 100644 --- a/gcc/m2/ChangeLog +++ b/gcc/m2/ChangeLog @@ -1,3 +1,49 @@ +2023-10-18 Gaius Mulley + + PR modula2/111756 + * Make-lang.in (CM2DEP): New define conditionally set if + ($(CXXDEPMODE),depmode=gcc3). + (m2/gm2-gcc/%.o): Ensure $(@D)/$(DEPDIR) is created. + Add $(CM2DEP) to the $(COMPILER) command and use $(POSTCOMPILE). + (m2/gm2-gcc/m2configure.o): Ditto. + (m2/gm2-lang.o): Ditto. + (m2/m2pp.o): Ditto. + (m2/gm2-gcc/rtegraph.o): Ditto. + (m2/mc-boot/$(SRC_PREFIX)%.o): Ditto. + (m2/mc-boot-ch/$(SRC_PREFIX)%.o): Ditto. + (m2/mc-boot-ch/$(SRC_PREFIX)%.o): Ditto. + (m2/mc-boot/main.o): Ditto. + (mcflex.o): Ditto. + (m2/gm2-libs-boot/M2RTS.o): Ditto. + (m2/gm2-libs-boot/%.o): Ditto. + (m2/gm2-libs-boot/%.o): Ditto. + (m2/gm2-libs-boot/RTcodummy.o): Ditto. + (m2/gm2-libs-boot/RTintdummy.o): Ditto. + (m2/gm2-libs-boot/wrapc.o): Ditto. + (m2/gm2-libs-boot/UnixArgs.o): Ditto. + (m2/gm2-libs-boot/choosetemp.o): Ditto. + (m2/gm2-libs-boot/errno.o): Ditto. + (m2/gm2-libs-boot/dtoa.o): Ditto. + (m2/gm2-libs-boot/ldtoa.o): Ditto. + (m2/gm2-libs-boot/termios.o): Ditto. + (m2/gm2-libs-boot/SysExceptions.o): Ditto. + (m2/gm2-libs-boot/SysStorage.o): Ditto. + (m2/gm2-compiler-boot/M2GCCDeclare.o): Ditto. + (m2/gm2-compiler-boot/M2Error.o): Ditto. + (m2/gm2-compiler-boot/%.o): Ditto. + (m2/gm2-compiler-boot/%.o): Ditto. + (m2/gm2-compiler-boot/m2flex.o): Ditto. + (m2/gm2-compiler/m2flex.o): Ditto. + (m2/gm2-libs/choosetemp.o): Ditto. + (m2/boot-bin/mklink$(exeext)): Ditto. + (m2/pge-boot/%.o): Ditto. + (m2/pge-boot/%.o): Ditto. + * README: Remove out of date info. + * gm2-compiler/M2Quads.mod (BuildStringAdrParam): Correct + procedure end name. + * gm2-compiler/SymbolTable.mod (GetVarPointerCheck): Add + default FALSE return value. + 2023-09-26 Gaius Mulley Backported from master: From 8d7250fa7d61892a27c59f53b025581e33477311 Mon Sep 17 00:00:00 2001 From: Georg-Johann Lay Date: Wed, 18 Oct 2023 18:59:17 +0200 Subject: [PATCH 09/31] LibF7: Implement mul_mant for devices without MUL instruction. libgcc/config/avr/libf7/ * libf7-asm.sx (mul_mant): Implement for devices without MUL. * asm-defs.h (wmov) [!HAVE_MUL]: Fix regno computation. * t-libf7 (F7_ASM_FLAGS): Add -g0. --- libgcc/config/avr/libf7/asm-defs.h | 6 +- libgcc/config/avr/libf7/libf7-asm.sx | 94 ++++++++++++++++++++++++++++ libgcc/config/avr/libf7/t-libf7 | 2 +- 3 files changed, 98 insertions(+), 4 deletions(-) diff --git a/libgcc/config/avr/libf7/asm-defs.h b/libgcc/config/avr/libf7/asm-defs.h index 4cfd3e61cbb8..a50260a162f2 100644 --- a/libgcc/config/avr/libf7/asm-defs.h +++ b/libgcc/config/avr/libf7/asm-defs.h @@ -134,14 +134,14 @@ ..regno = 0 .irp reg, \ - X, x, XL, xl, Xl, xL, x, x \ + X, x, XL, xl, Xl, xL, x, x, \ Y, y, YL, yl, Yl, yL, y, y, \ Z, z, ZL, zl, Zl, zL, z, z .ifc \reg,\dst - ..dst = (..regno / 8) + 26 + ..dst = 2 * (..regno / 8) + 26 .endif .ifc \reg,\src - ..src = (..regno / 8) + 26 + ..src = 2 * (..regno / 8) + 26 .endif ..regno = ..regno + 1 .endr diff --git a/libgcc/config/avr/libf7/libf7-asm.sx b/libgcc/config/avr/libf7/libf7-asm.sx index 5df167fe73cc..4505764c1263 100644 --- a/libgcc/config/avr/libf7/libf7-asm.sx +++ b/libgcc/config/avr/libf7/libf7-asm.sx @@ -1067,6 +1067,100 @@ DEFUN mul_mant ENDF mul_mant #endif /* F7MOD_mul_mant_ && MUL */ +#if defined F7MOD_mul_mant_ && ! defined (__AVR_HAVE_MUL__) + #define AA TMP + #define A0 13 + #define A1 A0+1 + #define A2 A0+2 + #define A3 A0+3 + #define A4 A0+4 + #define A5 r26 + #define A6 r27 + #define BB ZERO + #define Bits r29 + #define Bytes r28 + +DEFUN mul_mant + do_prologue_saves 7 + bst r18, 0 ; T = 1: Don't round. + ;; Save result address for later. + push r25 + push r24 + ;; Load 1st operand mantissa. + wmov r30, r22 + clr AA + LDD A0, Z+0+Off + LDD A1, Z+1+Off + LDD A2, Z+2+Off + LDD A3, Z+3+Off + LDD A4, Z+4+Off + LDD A5, Z+5+Off + LDD A6, Z+6+Off + ;; Let Z point one past .mant of the 2nd input operand. + wmov r30, r20 + adiw r30, Expo + + ;; Clear the result mantissa. + .global __clr_8 + XCALL __clr_8 + + ;; Loop over the bytes of B's mantissa from highest to lowest. + ;; "+1" because we jump into the loop. + ldi Bytes, 1 + F7_MANT_BYTES + + ;; Divide one operand by 2 so that the result mantissa won't overflow. + ;; This is accounted for by "Carry = 1" below. + ldi Bits, 1 + rjmp .Loop_entry + +.Loop_bytes: + ld BB, -Z + ;; Loop over the bits of B's mantissa from highest to lowest. + ldi Bits, 8 +.Loop_bits: + lsl BB + brcc .Lnext_bit + + ADD CA, AA + adc C0, A0 + adc C1, A1 + adc C2, A2 + adc C3, A3 + adc C4, A4 + adc C5, A5 + adc C6, A6 + +.Lnext_bit: +.Loop_entry: + LSR A6 + ror A5 + ror A4 + ror A3 + ror A2 + ror A1 + ror A0 + ror AA + + dec Bits + brne .Loop_bits + + dec Bytes + brne .Loop_bytes + + ;; Finally... + + pop ZL + pop ZH + + ;; The result has to be left-shifted by one (multiplied by 2) in order + ;; to undo the division by 2 of the 1st operand. + ldi Carry, 1 + F7call normalize.maybe_round.store_with_flags + + do_epilogue_restores 7 +ENDF mul_mant +#endif /* F7MOD_mul_mant_ && ! MUL */ + #if defined (F7MOD_div_) diff --git a/libgcc/config/avr/libf7/t-libf7 b/libgcc/config/avr/libf7/t-libf7 index 30aa280d11e3..f17e67e8523a 100644 --- a/libgcc/config/avr/libf7/t-libf7 +++ b/libgcc/config/avr/libf7/t-libf7 @@ -86,7 +86,7 @@ F7_C_FLAGS += $(F7_FLAGS) \ -fno-tree-loop-optimize \ -fno-tree-loop-im -fno-move-loop-invariants -F7_ASM_FLAGS += $(F7_FLAGS) +F7_ASM_FLAGS += $(F7_FLAGS) -g0 $(patsubst %, f7_c_%.o, $(CALL_PROLOGUES)) \ : F7_C_FLAGS += -mcall-prologues From 7a1de35f9cdc13098375baa277496147be271dd3 Mon Sep 17 00:00:00 2001 From: Lewis Hyatt Date: Wed, 18 Oct 2023 12:37:08 -0400 Subject: [PATCH 10/31] c++: Make -Wunknown-pragmas controllable by #pragma GCC diagnostic [PR89038] As noted on the PR, commit r13-1544, the fix for PR53431, did not handle the specific case of -Wunknown-pragmas, because that warning is issued during preprocessing, but not by libcpp directly (it comes from the cb_def_pragma callback). Address that by handling this pragma in addition to libcpp pragmas during the early pragma handler. gcc/c-family/ChangeLog: PR c++/89038 * c-pragma.cc (handle_pragma_diagnostic_impl): Handle -Wunknown-pragmas during early processing. gcc/testsuite/ChangeLog: PR c++/89038 * c-c++-common/cpp/Wunknown-pragmas-1.c: New test. --- gcc/c-family/c-pragma.cc | 3 ++- gcc/testsuite/c-c++-common/cpp/Wunknown-pragmas-1.c | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/c-c++-common/cpp/Wunknown-pragmas-1.c diff --git a/gcc/c-family/c-pragma.cc b/gcc/c-family/c-pragma.cc index 0d2b333cebbe..d660ff1d922a 100644 --- a/gcc/c-family/c-pragma.cc +++ b/gcc/c-family/c-pragma.cc @@ -1006,7 +1006,8 @@ handle_pragma_diagnostic_impl () /* option_string + 1 to skip the initial '-' */ unsigned int option_index = find_opt (data.option_str + 1, lang_mask); - if (early && !c_option_is_from_cpp_diagnostics (option_index)) + if (early && !(c_option_is_from_cpp_diagnostics (option_index) + || option_index == OPT_Wunknown_pragmas)) return; if (option_index == OPT_SPECIAL_unknown) diff --git a/gcc/testsuite/c-c++-common/cpp/Wunknown-pragmas-1.c b/gcc/testsuite/c-c++-common/cpp/Wunknown-pragmas-1.c new file mode 100644 index 000000000000..fb58739e2bce --- /dev/null +++ b/gcc/testsuite/c-c++-common/cpp/Wunknown-pragmas-1.c @@ -0,0 +1,13 @@ +/* PR c++/89038 */ +/* { dg-additional-options "-Wunknown-pragmas" } */ + +#pragma oops /* { dg-warning "-:-Wunknown-pragmas" } */ +#pragma GGC diagnostic push /* { dg-warning "-:-Wunknown-pragmas" } */ +#pragma GCC diagnostics push /* { dg-warning "-:-Wunknown-pragmas" } */ + +/* Test we can disable the warnings. */ +#pragma GCC diagnostic ignored "-Wunknown-pragmas" + +#pragma oops /* { dg-bogus "-:-Wunknown-pragmas" } */ +#pragma GGC diagnostic push /* { dg-bogus "-:-Wunknown-pragmas" } */ +#pragma GCC diagnostics push /* { dg-bogus "-:-Wunknown-pragmas" } */ From 7c70e811538cd0cc6c67823ca8d8dd161d152662 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 20 Oct 2023 00:20:24 +0000 Subject: [PATCH 11/31] Daily bump. --- gcc/DATESTAMP | 2 +- gcc/c-family/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ libgcc/config/avr/libf7/ChangeLog | 6 ++++++ 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 1e71ea70cb34..5402eeba5fc7 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20231019 +20231020 diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 8c4ec45d7f6b..3b109265dd8a 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,9 @@ +2023-10-19 Lewis Hyatt + + PR c++/89038 + * c-pragma.cc (handle_pragma_diagnostic_impl): Handle + -Wunknown-pragmas during early processing. + 2023-07-27 Release Manager * GCC 13.2.0 released. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d40eba04af64..ab29fdb671c3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2023-10-19 Lewis Hyatt + + PR c++/89038 + * c-c++-common/cpp/Wunknown-pragmas-1.c: New test. + 2023-10-17 liuhongt Backported from master: diff --git a/libgcc/config/avr/libf7/ChangeLog b/libgcc/config/avr/libf7/ChangeLog index 71c34d055b7d..8a1bba80127a 100644 --- a/libgcc/config/avr/libf7/ChangeLog +++ b/libgcc/config/avr/libf7/ChangeLog @@ -1,3 +1,9 @@ +2023-10-19 Georg-Johann Lay + + * libf7-asm.sx (mul_mant): Implement for devices without MUL. + * asm-defs.h (wmov) [!HAVE_MUL]: Fix regno computation. + * t-libf7 (F7_ASM_FLAGS): Add -g0. + 2023-10-17 Georg-Johann Lay * f7-renames.h: Re-renerate. From 3ce4e99303d01d348229cca22bf8d3dd63004e01 Mon Sep 17 00:00:00 2001 From: Oleg Endo Date: Fri, 20 Oct 2023 18:48:34 +0900 Subject: [PATCH 12/31] SH: Fix PR 101177 Fix accidentally inverted comparison. gcc/ChangeLog: PR target/101177 * config/sh/sh.md (unnamed split pattern): Fix comparison of find_regno_note result. --- gcc/config/sh/sh.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md index 76e7774cef31..93374c65bfe1 100644 --- a/gcc/config/sh/sh.md +++ b/gcc/config/sh/sh.md @@ -842,7 +842,7 @@ if (SUBREG_P (reg)) reg = SUBREG_REG (reg); gcc_assert (REG_P (reg)); - if (find_regno_note (curr_insn, REG_DEAD, REGNO (reg)) != NULL_RTX) + if (find_regno_note (curr_insn, REG_DEAD, REGNO (reg)) == NULL_RTX) FAIL; /* FIXME: Maybe also search the predecessor basic blocks to catch From 4f93c6027fb09c94ca8dc7fe13f92a3b9205b68a Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Thu, 19 Oct 2023 16:32:10 -0400 Subject: [PATCH 13/31] c-family: char8_t and aliasing in C vs C++ [PR111884] In the PR, Joseph says that in C char8_t is not a distinct type. So we should behave as if it can alias anything, like ordinary char. In C, unsigned_char_type_node == char8_type_node, so with this patch we return 0 instead of -1. And the following comment says: /* The C standard guarantees that any object may be accessed via an lvalue that has narrow character type (except char8_t). */ if (t == char_type_node || t == signed_char_type_node || t == unsigned_char_type_node) return 0; Which appears to be wrong, so I'm adjusting that as well. PR c/111884 gcc/c-family/ChangeLog: * c-common.cc (c_common_get_alias_set): Return -1 for char8_t only in C++. gcc/testsuite/ChangeLog: * c-c++-common/alias-1.c: New test. (cherry picked from commit 281699fbff6262766674ab13087d37db751cd40a) --- gcc/c-family/c-common.cc | 7 ++++--- gcc/testsuite/c-c++-common/alias-1.c | 23 +++++++++++++++++++++++ 2 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/c-c++-common/alias-1.c diff --git a/gcc/c-family/c-common.cc b/gcc/c-family/c-common.cc index 2b4c82facf7f..aae397ed755c 100644 --- a/gcc/c-family/c-common.cc +++ b/gcc/c-family/c-common.cc @@ -3806,12 +3806,13 @@ c_common_get_alias_set (tree t) if (!TYPE_P (t)) return -1; - /* Unlike char, char8_t doesn't alias. */ - if (flag_char8_t && t == char8_type_node) + /* Unlike char, char8_t doesn't alias in C++. (In C, char8_t is not + a distinct type.) */ + if (flag_char8_t && t == char8_type_node && c_dialect_cxx ()) return -1; /* The C standard guarantees that any object may be accessed via an - lvalue that has narrow character type (except char8_t). */ + lvalue that has narrow character type. */ if (t == char_type_node || t == signed_char_type_node || t == unsigned_char_type_node) diff --git a/gcc/testsuite/c-c++-common/alias-1.c b/gcc/testsuite/c-c++-common/alias-1.c new file mode 100644 index 000000000000..d72fec47f760 --- /dev/null +++ b/gcc/testsuite/c-c++-common/alias-1.c @@ -0,0 +1,23 @@ +/* PR c/111884 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -Wall" } */ +/* { dg-additional-options "-std=c++20" { target c++ } } */ +/* { dg-additional-options "-std=c2x" { target c } } */ + +int f(int i) +{ + int f = 1; + return i[(unsigned char *)&f]; +} + +int g(int i) +{ + int f = 1; + return i[(signed char *)&f]; +} + +int h(int i) +{ + int f = 1; + return i[(char *)&f]; +} From 0d015a557ee7a173a908df69da1aecdf3973637a Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 21 Oct 2023 00:21:04 +0000 Subject: [PATCH 14/31] Daily bump. --- gcc/ChangeLog | 6 ++++++ gcc/DATESTAMP | 2 +- gcc/c-family/ChangeLog | 9 +++++++++ gcc/testsuite/ChangeLog | 8 ++++++++ 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 576474e789f4..51835db381b6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2023-10-20 Oleg Endo + + PR target/101177 + * config/sh/sh.md (unnamed split pattern): Fix comparison of + find_regno_note result. + 2023-10-18 Richard Sandiford Backported from master: diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 5402eeba5fc7..dc31a4d01d13 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20231020 +20231021 diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 3b109265dd8a..2d92bf206794 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,12 @@ +2023-10-20 Marek Polacek + + Backported from master: + 2023-10-20 Marek Polacek + + PR c/111884 + * c-common.cc (c_common_get_alias_set): Return -1 for char8_t only + in C++. + 2023-10-19 Lewis Hyatt PR c++/89038 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ab29fdb671c3..d92a27144c04 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2023-10-20 Marek Polacek + + Backported from master: + 2023-10-20 Marek Polacek + + PR c/111884 + * c-c++-common/alias-1.c: New test. + 2023-10-19 Lewis Hyatt PR c++/89038 From f9dd32562f537ac80a1473ed36d4d937209b9af4 Mon Sep 17 00:00:00 2001 From: Nathaniel Shead Date: Fri, 29 Sep 2023 10:30:41 +0100 Subject: [PATCH 15/31] libstdc++: Ensure active union member is correctly set This patch ensures that the union members for std::string and std::variant are always properly set when a change occurs. libstdc++-v3/ChangeLog: * include/bits/basic_string.h: (basic_string(basic_string&&)): Activate _M_local_buf when needed. (basic_string(basic_string&&, const _Alloc&)): Likewise. * include/bits/basic_string.tcc: (basic_string::swap): Likewise. * include/std/variant: (__detail::__variant::__construct_n): New. (__detail::__variant::__emplace): Use __construct_n. Signed-off-by: Nathaniel Shead (cherry picked from commit 28adad7a32ed92a3c0906b38411c4ed686bbacc5) --- libstdc++-v3/include/bits/basic_string.h | 6 ++-- libstdc++-v3/include/bits/basic_string.tcc | 4 +++ libstdc++-v3/include/std/variant | 32 ++++++++++++++++++++-- 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h index 870b4728928a..11b62af8fb20 100644 --- a/libstdc++-v3/include/bits/basic_string.h +++ b/libstdc++-v3/include/bits/basic_string.h @@ -669,6 +669,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 { if (__str._M_is_local()) { + (void)_M_use_local_data(); traits_type::copy(_M_local_buf, __str._M_local_buf, __str.length() + 1); } @@ -682,7 +683,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 // basic_stringbuf relies on writing into unallocated capacity so // we mess up the contents if we put a '\0' in the string. _M_length(__str.length()); - __str._M_data(__str._M_local_data()); + __str._M_data(__str._M_use_local_data()); __str._M_set_length(0); } @@ -708,6 +709,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 { if (__str._M_is_local()) { + (void)_M_use_local_data(); traits_type::copy(_M_local_buf, __str._M_local_buf, __str.length() + 1); _M_length(__str.length()); @@ -719,7 +721,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 _M_data(__str._M_data()); _M_length(__str.length()); _M_capacity(__str._M_allocated_capacity); - __str._M_data(__str._M_local_buf); + __str._M_data(__str._M_use_local_data()); __str._M_set_length(0); } else diff --git a/libstdc++-v3/include/bits/basic_string.tcc b/libstdc++-v3/include/bits/basic_string.tcc index d8a279fc9edb..3495a69df6b2 100644 --- a/libstdc++-v3/include/bits/basic_string.tcc +++ b/libstdc++-v3/include/bits/basic_string.tcc @@ -79,6 +79,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } else if (__s.length()) { + (void)_M_use_local_data(); traits_type::copy(_M_local_buf, __s._M_local_buf, __s.length() + 1); _M_length(__s.length()); @@ -87,6 +88,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } else if (length()) { + (void)__s._M_use_local_data(); traits_type::copy(__s._M_local_buf, _M_local_buf, length() + 1); __s._M_length(length()); @@ -97,6 +99,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION else { const size_type __tmp_capacity = __s._M_allocated_capacity; + (void)__s._M_use_local_data(); traits_type::copy(__s._M_local_buf, _M_local_buf, length() + 1); _M_data(__s._M_data()); @@ -108,6 +111,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION const size_type __tmp_capacity = _M_allocated_capacity; if (__s._M_is_local()) { + (void)_M_use_local_data(); traits_type::copy(_M_local_buf, __s._M_local_buf, __s.length() + 1); __s._M_data(_M_data()); diff --git a/libstdc++-v3/include/std/variant b/libstdc++-v3/include/std/variant index 5155124522f2..90e86b7c61bf 100644 --- a/libstdc++-v3/include/std/variant +++ b/libstdc++-v3/include/std/variant @@ -320,6 +320,33 @@ namespace __variant __get(_Variant&& __v) noexcept { return __variant::__get_n<_Np>(std::forward<_Variant>(__v)._M_u); } + // Gets the _Uninitialized to construct into for __u. + template + constexpr decltype(auto) + __construct_n(_Union& __u) noexcept + { + if constexpr (_Np == 0) + return &__u._M_first; + else if constexpr (_Np == 1) + { + std::_Construct(&__u._M_rest); + return &__u._M_rest._M_first; + } + else if constexpr (_Np == 2) + { + std::_Construct(&__u._M_rest); + std::_Construct(&__u._M_rest._M_rest); + return &__u._M_rest._M_rest._M_first; + } + else + { + std::_Construct(&__u._M_rest); + std::_Construct(&__u._M_rest._M_rest); + std::_Construct(&__u._M_rest._M_rest._M_rest); + return __variant::__construct_n<_Np - 3>(__u._M_rest._M_rest._M_rest); + } + } + template struct _Traits { @@ -536,8 +563,9 @@ namespace __variant __emplace(_Variant_storage<_Triv, _Types...>& __v, _Args&&... __args) { __v._M_reset(); - auto* __addr = std::__addressof(__variant::__get_n<_Np>(__v._M_u)); - std::_Construct(__addr, std::forward<_Args>(__args)...); + auto* __addr = __variant::__construct_n<_Np>(__v._M_u); + std::_Construct(__addr, in_place_index<0>, + std::forward<_Args>(__args)...); // Construction didn't throw, so can set the new index now: __v._M_index = _Np; } From af3b4459e4fbc1adaf17716164ea8d0872a7a73e Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Tue, 3 Oct 2023 17:35:38 +0100 Subject: [PATCH 16/31] libstdc++: Fix formatting of filesystem directory iterators Fix indentation. libstdc++-v3/ChangeLog: * include/bits/fs_dir.h (operator==(default_sentinel_t)): Fix indentation. (cherry picked from commit 77209d43f1f38f153863a1845b64542cca79c2cb) --- libstdc++-v3/include/bits/fs_dir.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libstdc++-v3/include/bits/fs_dir.h b/libstdc++-v3/include/bits/fs_dir.h index 9dd0f896e468..3b0a493dc3fd 100644 --- a/libstdc++-v3/include/bits/fs_dir.h +++ b/libstdc++-v3/include/bits/fs_dir.h @@ -449,10 +449,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 } #if __cplusplus >= 202002L - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 3719. Directory iterators should be usable with default sentinel - bool operator==(default_sentinel_t) const noexcept - { return !_M_dir; } + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 3719. Directory iterators should be usable with default sentinel + bool operator==(default_sentinel_t) const noexcept + { return !_M_dir; } #endif #if __cpp_impl_three_way_comparison < 201907L @@ -565,10 +565,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 } #if __cplusplus >= 202002L - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 3719. Directory iterators should be usable with default sentinel - bool operator==(default_sentinel_t) const noexcept - { return !_M_dirs; } + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 3719. Directory iterators should be usable with default sentinel + bool operator==(default_sentinel_t) const noexcept + { return !_M_dirs; } #endif #if __cpp_impl_three_way_comparison < 201907L From 59047d969f1e1a6c224ae3f5f9bd69a9445cdad0 Mon Sep 17 00:00:00 2001 From: Benjamin Brock Date: Fri, 20 Oct 2023 18:07:50 +0100 Subject: [PATCH 17/31] libstdc++: Workaround for LLVM-61763 in This patch adds a small workaround that avoids declaring constrained friends when compiling with Clang, instead making some members public. MSVC's standard library has implemented a similar workaround. Signed-off-by: Benjamin Brock libstdc++-v3/ChangeLog: * include/std/ranges (zip_view, adjacent_view): Implement workaround for LLVM-61763. (cherry picked from commit be34a8b538c0f04b11a428bd1a9340eb19dec13f) --- libstdc++-v3/include/std/ranges | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libstdc++-v3/include/std/ranges b/libstdc++-v3/include/std/ranges index c4d4d85bf909..421197584873 100644 --- a/libstdc++-v3/include/std/ranges +++ b/libstdc++-v3/include/std/ranges @@ -4535,6 +4535,9 @@ namespace views::__adaptor class zip_view<_Vs...>::_Iterator : public __detail::__zip_view_iter_cat<_Const, _Vs...> { +#ifdef __clang__ // LLVM-61763 workaround + public: +#endif __detail::__tuple_or_pair_t>...> _M_current; constexpr explicit @@ -4555,11 +4558,13 @@ namespace views::__adaptor return input_iterator_tag{}; } +#ifndef __clang__ // LLVM-61763 workaround template requires (view<_Ws> && ...) && (sizeof...(_Ws) > 0) && is_object_v<_Fp> && regular_invocable<_Fp&, range_reference_t<_Ws>...> && std::__detail::__can_reference...>> friend class zip_transform_view; +#endif public: // iterator_category defined in __zip_view_iter_cat @@ -5230,6 +5235,9 @@ namespace views::__adaptor template class adjacent_view<_Vp, _Nm>::_Iterator { +#ifdef __clang__ // LLVM-61763 workaround + public: +#endif using _Base = __detail::__maybe_const_t<_Const, _Vp>; array, _Nm> _M_current = array, _Nm>(); @@ -5270,12 +5278,14 @@ namespace views::__adaptor friend class adjacent_view; +#ifndef __clang__ // LLVM-61763 workaround template requires view<_Wp> && (_Mm > 0) && is_object_v<_Fp> && regular_invocable<__detail::__unarize<_Fp&, _Mm>, range_reference_t<_Wp>> && std::__detail::__can_reference, range_reference_t<_Wp>>> friend class adjacent_transform_view; +#endif public: using iterator_category = input_iterator_tag; From c83907b9fad802a5c38ed4ca75d9415b8f57f619 Mon Sep 17 00:00:00 2001 From: Harald Anlauf Date: Mon, 16 Oct 2023 21:02:20 +0200 Subject: [PATCH 18/31] Fortran: out of bounds access with nested implied-do IO [PR111837] gcc/fortran/ChangeLog: PR fortran/111837 * frontend-passes.cc (traverse_io_block): Dependency check of loop nest shall be triangular, not banded. gcc/testsuite/ChangeLog: PR fortran/111837 * gfortran.dg/implied_do_io_8.f90: New test. (cherry picked from commit 5ac63ec5da2e93226457bea4dbb3a4f78d5d82c2) --- gcc/fortran/frontend-passes.cc | 2 +- gcc/testsuite/gfortran.dg/implied_do_io_8.f90 | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/implied_do_io_8.f90 diff --git a/gcc/fortran/frontend-passes.cc b/gcc/fortran/frontend-passes.cc index 904289820232..85ebca56a69f 100644 --- a/gcc/fortran/frontend-passes.cc +++ b/gcc/fortran/frontend-passes.cc @@ -1326,7 +1326,7 @@ traverse_io_block (gfc_code *code, bool *has_reached, gfc_code *prev) if (iters[i]) { gfc_expr *var = iters[i]->var; - for (int j = i - 1; j < i; j++) + for (int j = 0; j < i; j++) { if (iters[j] && (var_in_expr (var, iters[j]->start) diff --git a/gcc/testsuite/gfortran.dg/implied_do_io_8.f90 b/gcc/testsuite/gfortran.dg/implied_do_io_8.f90 new file mode 100644 index 000000000000..c66a0f6fde66 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/implied_do_io_8.f90 @@ -0,0 +1,18 @@ +! { dg-do run } +! { dg-additional-options "-fcheck=bounds" } +! PR fortran/111837 - out of bounds access with front-end optimization + +program implied_do_bug + implicit none + integer :: i,j,k + real :: arr(1,1,1) + integer :: ni(1) + ni(1) = 1 + arr = 1 + write(*,*) (((arr(i,j,k), i=1,ni(k)), k=1,1), j=1,1) + write(*,*) (((arr(i,j,k), i=1,ni(k)), j=1,1), k=1,1) + write(*,*) (((arr(k,i,j), i=1,ni(k)), k=1,1), j=1,1) + write(*,*) (((arr(k,i,j), i=1,ni(k)), j=1,1), k=1,1) + write(*,*) (((arr(j,k,i), i=1,ni(k)), k=1,1), j=1,1) + write(*,*) (((arr(j,k,i), i=1,ni(k)), j=1,1), k=1,1) +end From db1eba7f3aa803e335f683a842f5f2cb02488fce Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sun, 22 Oct 2023 00:20:27 +0000 Subject: [PATCH 19/31] Daily bump. --- gcc/DATESTAMP | 2 +- gcc/fortran/ChangeLog | 9 +++++++++ gcc/testsuite/ChangeLog | 8 ++++++++ libstdc++-v3/ChangeLog | 28 ++++++++++++++++++++++++++++ 4 files changed, 46 insertions(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index dc31a4d01d13..244ba0395067 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20231021 +20231022 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index e88bb3d78e20..db29631a5144 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,12 @@ +2023-10-21 Harald Anlauf + + Backported from master: + 2023-10-17 Harald Anlauf + + PR fortran/111837 + * frontend-passes.cc (traverse_io_block): Dependency check of loop + nest shall be triangular, not banded. + 2023-10-04 Paul Thomas Backported from master: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d92a27144c04..374e08c989be 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2023-10-21 Harald Anlauf + + Backported from master: + 2023-10-17 Harald Anlauf + + PR fortran/111837 + * gfortran.dg/implied_do_io_8.f90: New test. + 2023-10-20 Marek Polacek Backported from master: diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index b9283607c0c5..ed1fd4b2140c 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,31 @@ +2023-10-21 Benjamin Brock + + Backported from master: + 2023-10-21 Benjamin Brock + + * include/std/ranges (zip_view, adjacent_view): Implement + workaround for LLVM-61763. + +2023-10-21 Jonathan Wakely + + Backported from master: + 2023-10-21 Jonathan Wakely + + * include/bits/fs_dir.h (operator==(default_sentinel_t)): Fix + indentation. + +2023-10-21 Nathaniel Shead + + Backported from master: + 2023-09-29 Nathaniel Shead + + * include/bits/basic_string.h: (basic_string(basic_string&&)): + Activate _M_local_buf when needed. + (basic_string(basic_string&&, const _Alloc&)): Likewise. + * include/bits/basic_string.tcc: (basic_string::swap): Likewise. + * include/std/variant: (__detail::__variant::__construct_n): New. + (__detail::__variant::__emplace): Use __construct_n. + 2023-10-02 Tim Song Backported from master: From 262b9200eff93e2c57ffb567a8b4ce2ae7489237 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Mon, 23 Oct 2023 00:21:10 +0000 Subject: [PATCH 20/31] Daily bump. --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 244ba0395067..909fbcdf47eb 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20231022 +20231023 From 3ae7f45ea0d9caa54ebd5dc19caf94fa002e7ee2 Mon Sep 17 00:00:00 2001 From: Kewen Lin Date: Thu, 12 Oct 2023 00:05:03 -0500 Subject: [PATCH 21/31] rs6000: Make 32 bit stack_protect support prefixed insn [PR111367] As PR111367 shows, with prefixed insn supported, some of checkings consider it's able to leverage prefixed insn for stack protect related load/store, but since we don't actually change the emitted assembly for 32 bit, it can cause the assembler error as exposed. Mike's commit r10-4547-gce6a6c007e5a98 has already handled the 64 bit case (DImode), this patch is to treat the 32 bit case (SImode) by making use of mode iterator P and ptrload attribute iterator, also fixes the constraints to match the emitted operand formats. PR target/111367 gcc/ChangeLog: * config/rs6000/rs6000.md (stack_protect_setsi): Support prefixed instruction emission and incorporate to stack_protect_set. (stack_protect_setdi): Rename to ... (stack_protect_set): ... this, adjust constraint. (stack_protect_testsi): Support prefixed instruction emission and incorporate to stack_protect_test. (stack_protect_testdi): Rename to ... (stack_protect_test): ... this, adjust constraint. gcc/testsuite/ChangeLog: * g++.target/powerpc/pr111367.C: New test. (cherry picked from commit 530babc2058be5f2b06b1541384e7b730c368b93) --- gcc/config/rs6000/rs6000.md | 73 ++++++++------------- gcc/testsuite/g++.target/powerpc/pr111367.C | 22 +++++++ 2 files changed, 49 insertions(+), 46 deletions(-) create mode 100644 gcc/testsuite/g++.target/powerpc/pr111367.C diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index b323d4132715..b54767867ef8 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -12354,33 +12354,26 @@ DONE; }) -(define_insn "stack_protect_setsi" - [(set (match_operand:SI 0 "memory_operand" "=m") - (unspec:SI [(match_operand:SI 1 "memory_operand" "m")] UNSPEC_SP_SET)) - (set (match_scratch:SI 2 "=&r") (const_int 0))] - "TARGET_32BIT" - "lwz%U1%X1 %2,%1\;stw%U0%X0 %2,%0\;li %2,0" - [(set_attr "type" "three") - (set_attr "length" "12")]) - ;; We can't use the prefixed attribute here because there are two memory ;; instructions. We can't split the insn due to the fact that this operation ;; needs to be done in one piece. -(define_insn "stack_protect_setdi" - [(set (match_operand:DI 0 "memory_operand" "=Y") - (unspec:DI [(match_operand:DI 1 "memory_operand" "Y")] UNSPEC_SP_SET)) - (set (match_scratch:DI 2 "=&r") (const_int 0))] - "TARGET_64BIT" +(define_insn "stack_protect_set" + [(set (match_operand:P 0 "memory_operand" "=YZ") + (unspec:P [(match_operand:P 1 "memory_operand" "YZ")] UNSPEC_SP_SET)) + (set (match_scratch:P 2 "=&r") (const_int 0))] + "" { - if (prefixed_memory (operands[1], DImode)) - output_asm_insn ("pld %2,%1", operands); + if (prefixed_memory (operands[1], mode)) + /* Prefixed load only supports D-form but no update and X-form. */ + output_asm_insn ("p %2,%1", operands); else - output_asm_insn ("ld%U1%X1 %2,%1", operands); + output_asm_insn ("%U1%X1 %2,%1", operands); - if (prefixed_memory (operands[0], DImode)) - output_asm_insn ("pstd %2,%0", operands); + if (prefixed_memory (operands[0], mode)) + /* Prefixed store only supports D-form but no update and X-form. */ + output_asm_insn ("pst %2,%0", operands); else - output_asm_insn ("std%U0%X0 %2,%0", operands); + output_asm_insn ("st%U0%X0 %2,%0", operands); return "li %2,0"; } @@ -12426,45 +12419,33 @@ DONE; }) -(define_insn "stack_protect_testsi" - [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y") - (unspec:CCEQ [(match_operand:SI 1 "memory_operand" "m,m") - (match_operand:SI 2 "memory_operand" "m,m")] - UNSPEC_SP_TEST)) - (set (match_scratch:SI 4 "=r,r") (const_int 0)) - (clobber (match_scratch:SI 3 "=&r,&r"))] - "TARGET_32BIT" - "@ - lwz%U1%X1 %3,%1\;lwz%U2%X2 %4,%2\;xor. %3,%3,%4\;li %4,0 - lwz%U1%X1 %3,%1\;lwz%U2%X2 %4,%2\;cmplw %0,%3,%4\;li %3,0\;li %4,0" - [(set_attr "length" "16,20")]) - ;; We can't use the prefixed attribute here because there are two memory ;; instructions. We can't split the insn due to the fact that this operation ;; needs to be done in one piece. -(define_insn "stack_protect_testdi" +(define_insn "stack_protect_test" [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y") - (unspec:CCEQ [(match_operand:DI 1 "memory_operand" "Y,Y") - (match_operand:DI 2 "memory_operand" "Y,Y")] + (unspec:CCEQ [(match_operand:P 1 "memory_operand" "YZ,YZ") + (match_operand:P 2 "memory_operand" "YZ,YZ")] UNSPEC_SP_TEST)) - (set (match_scratch:DI 4 "=r,r") (const_int 0)) - (clobber (match_scratch:DI 3 "=&r,&r"))] - "TARGET_64BIT" + (set (match_scratch:P 4 "=r,r") (const_int 0)) + (clobber (match_scratch:P 3 "=&r,&r"))] + "" { - if (prefixed_memory (operands[1], DImode)) - output_asm_insn ("pld %3,%1", operands); + if (prefixed_memory (operands[1], mode)) + /* Prefixed load only supports D-form but no update and X-form. */ + output_asm_insn ("p %3,%1", operands); else - output_asm_insn ("ld%U1%X1 %3,%1", operands); + output_asm_insn ("%U1%X1 %3,%1", operands); - if (prefixed_memory (operands[2], DImode)) - output_asm_insn ("pld %4,%2", operands); + if (prefixed_memory (operands[2], mode)) + output_asm_insn ("p %4,%2", operands); else - output_asm_insn ("ld%U2%X2 %4,%2", operands); + output_asm_insn ("%U2%X2 %4,%2", operands); if (which_alternative == 0) output_asm_insn ("xor. %3,%3,%4", operands); else - output_asm_insn ("cmpld %0,%3,%4\;li %3,0", operands); + output_asm_insn ("cmpl %0,%3,%4\;li %3,0", operands); return "li %4,0"; } diff --git a/gcc/testsuite/g++.target/powerpc/pr111367.C b/gcc/testsuite/g++.target/powerpc/pr111367.C new file mode 100644 index 000000000000..8f9d4415672d --- /dev/null +++ b/gcc/testsuite/g++.target/powerpc/pr111367.C @@ -0,0 +1,22 @@ +/* { dg-do assemble } */ +/* { dg-require-effective-target power10_ok } */ +/* { dg-options "-mdejagnu-cpu=power10 -fstack-protector-strong" } */ + +/* Verify object file can be generated successfully. */ + +struct SortAscending +{ +}; + +typedef unsigned long long size_t; + +void VQSort (long long *, size_t, SortAscending); + +void +BenchAllColdSort () +{ + typedef long long T; + constexpr size_t kSize = 10 * 1000; + alignas (16) T items[kSize]; + VQSort (items, kSize, SortAscending ()); +} From 4e1320e4af413b7126f3b998096f60f8b7d5cb32 Mon Sep 17 00:00:00 2001 From: Oleg Endo Date: Mon, 23 Oct 2023 22:08:37 +0900 Subject: [PATCH 22/31] SH: Fix PR 111001 gcc/ChangeLog: PR target/111001 * config/sh/sh_treg_combine.cc (sh_treg_combine::record_set_of_reg): Skip over nop move insns. --- gcc/config/sh/sh_treg_combine.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gcc/config/sh/sh_treg_combine.cc b/gcc/config/sh/sh_treg_combine.cc index 9f6a89fa71fb..9b35960c8c2b 100644 --- a/gcc/config/sh/sh_treg_combine.cc +++ b/gcc/config/sh/sh_treg_combine.cc @@ -729,7 +729,14 @@ sh_treg_combine::record_set_of_reg (rtx reg, rtx_insn *start_insn, } else if (REG_P (new_entry.cstore.set_src ())) { - // If it's a reg-reg copy follow the copied reg. + // If it's a reg-reg copy follow the copied reg, but ignore + // nop copies of the reg onto itself. + if (REGNO (new_entry.cstore.set_src ()) == REGNO (reg)) + { + i = prev_nonnote_nondebug_insn_bb (i); + continue; + } + new_entry.cstore_reg_reg_copies.push_back (new_entry.cstore); reg = new_entry.cstore.set_src (); i = new_entry.cstore.insn; From 25306f0590686bd8ba3f041d94c78bc744d92dd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Dumont?= Date: Wed, 18 Oct 2023 19:35:32 +0200 Subject: [PATCH 23/31] libstdc++: [_Hashtable] Do not reuse untrusted cached hash code On merge, reuse a merged node's possibly cached hash code only if we are on the same type of hash and this hash is stateless. Usage of function pointers or std::function as hash functor will prevent reusing cached hash code. libstdc++-v3/ChangeLog * include/bits/hashtable_policy.h (_Hash_code_base::_M_hash_code(const _Hash&, const _Hash_node_value<>&)): Remove. (_Hash_code_base::_M_hash_code<_H2>(const _H2&, const _Hash_node_value<>&)): Remove. * include/bits/hashtable.h (_M_src_hash_code<_H2>(const _H2&, const key_type&, const __node_value_type&)): New. (_M_merge_unique<>, _M_merge_multi<>): Use latter. * testsuite/23_containers/unordered_map/modifiers/merge.cc (test04, test05, test06): New test cases. --- libstdc++-v3/include/bits/hashtable.h | 19 +- libstdc++-v3/include/bits/hashtable_policy.h | 13 -- .../unordered_map/modifiers/merge.cc | 178 +++++++++++++++++- 3 files changed, 190 insertions(+), 20 deletions(-) diff --git a/libstdc++-v3/include/bits/hashtable.h b/libstdc++-v3/include/bits/hashtable.h index d2ff15320fc8..dd3e655866ac 100644 --- a/libstdc++-v3/include/bits/hashtable.h +++ b/libstdc++-v3/include/bits/hashtable.h @@ -1066,6 +1066,20 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return { __n, this->_M_node_allocator() }; } + // Only use the possibly cached node's hash code if its hash function + // _H2 matches _Hash and is stateless. Otherwise recompute it using _Hash. + template + __hash_code + _M_src_hash_code(const _H2&, const key_type& __k, + const __node_value_type& __src_n) const + { + if constexpr (std::is_same_v<_H2, _Hash>) + if constexpr (std::is_empty_v<_Hash>) + return this->_M_hash_code(__src_n); + + return this->_M_hash_code(__k); + } + public: // Extract a node. node_type @@ -1103,7 +1117,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION auto __pos = __i++; const key_type& __k = _ExtractKey{}(*__pos); __hash_code __code - = this->_M_hash_code(__src.hash_function(), *__pos._M_cur); + = _M_src_hash_code(__src.hash_function(), __k, *__pos._M_cur); size_type __bkt = _M_bucket_index(__code); if (_M_find_node(__bkt, __k, __code) == nullptr) { @@ -1131,8 +1145,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION for (auto __i = __src.cbegin(), __end = __src.cend(); __i != __end;) { auto __pos = __i++; + const key_type& __k = _ExtractKey{}(*__pos); __hash_code __code - = this->_M_hash_code(__src.hash_function(), *__pos._M_cur); + = _M_src_hash_code(__src.hash_function(), __k, *__pos._M_cur); auto __nh = __src.extract(__pos); __hint = _M_insert_multi_node(__hint, __code, __nh._M_ptr)._M_cur; __nh._M_ptr = nullptr; diff --git a/libstdc++-v3/include/bits/hashtable_policy.h b/libstdc++-v3/include/bits/hashtable_policy.h index 2f79394d89ec..2528dbe21091 100644 --- a/libstdc++-v3/include/bits/hashtable_policy.h +++ b/libstdc++-v3/include/bits/hashtable_policy.h @@ -1319,19 +1319,6 @@ namespace __detail return _M_hash()(__k); } - __hash_code - _M_hash_code(const _Hash&, - const _Hash_node_value<_Value, true>& __n) const - { return __n._M_hash_code; } - - // Compute hash code using _Hash as __n _M_hash_code, if present, was - // computed using _H2. - template - __hash_code - _M_hash_code(const _H2&, - const _Hash_node_value<_Value, __cache_hash_code>& __n) const - { return _M_hash_code(_ExtractKey{}(__n._M_v())); } - __hash_code _M_hash_code(const _Hash_node_value<_Value, false>& __n) const { return _M_hash_code(_ExtractKey{}(__n._M_v())); } diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/modifiers/merge.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/modifiers/merge.cc index b140ce452aab..c051b58137a4 100644 --- a/libstdc++-v3/testsuite/23_containers/unordered_map/modifiers/merge.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_map/modifiers/merge.cc @@ -17,15 +17,29 @@ // { dg-do run { target c++17 } } +#include +#include #include #include #include using test_type = std::unordered_map; -struct hash { - auto operator()(int i) const noexcept { return ~std::hash()(i); } -}; +template + struct xhash + { + auto operator()(const T& i) const noexcept + { return ~std::hash()(i); } + }; + + +namespace std +{ + template + struct __is_fast_hash> : __is_fast_hash> + { }; +} + struct equal : std::equal_to<> { }; template @@ -64,7 +78,7 @@ test02() { const test_type c0{ {1, 10}, {2, 20}, {3, 30} }; test_type c1 = c0; - std::unordered_map c2( c0.begin(), c0.end() ); + std::unordered_map, equal> c2( c0.begin(), c0.end() ); c1.merge(c2); VERIFY( c1 == c0 ); @@ -89,7 +103,7 @@ test03() { const test_type c0{ {1, 10}, {2, 20}, {3, 30} }; test_type c1 = c0; - std::unordered_multimap c2( c0.begin(), c0.end() ); + std::unordered_multimap, equal> c2( c0.begin(), c0.end() ); c1.merge(c2); VERIFY( c1 == c0 ); VERIFY( equal_elements(c2, c0) ); @@ -125,10 +139,164 @@ test03() VERIFY( c2.empty() ); } +void +test04() +{ + const std::unordered_map c0 + { {"one", 10}, {"two", 20}, {"three", 30} }; + + std::unordered_map c1 = c0; + std::unordered_multimap c2( c0.begin(), c0.end() ); + c1.merge(c2); + VERIFY( c1 == c0 ); + VERIFY( equal_elements(c2, c0) ); + + c1.clear(); + c1.merge(c2); + VERIFY( c1 == c0 ); + VERIFY( c2.empty() ); + + c2.merge(c1); + VERIFY( c1.empty() ); + VERIFY( equal_elements(c2, c0) ); + + c1 = c0; + c2.merge(c1); + VERIFY( c1.empty() ); + VERIFY( c2.size() == (2 * c0.size()) ); + VERIFY( c2.count("one") == 2 ); + VERIFY( c2.count("two") == 2 ); + VERIFY( c2.count("three") == 2 ); + + c1.merge(c2); + VERIFY( c1 == c0 ); + VERIFY( equal_elements(c2, c0) ); + + c1.merge(std::move(c2)); + VERIFY( c1 == c0 ); + VERIFY( equal_elements(c2, c0) ); + + c1.clear(); + c1.merge(std::move(c2)); + VERIFY( c1 == c0 ); + VERIFY( c2.empty() ); +} + +void +test05() +{ + const std::unordered_map c0 + { {"one", 10}, {"two", 20}, {"three", 30} }; + + std::unordered_map c1 = c0; + std::unordered_multimap, equal> c2( c0.begin(), c0.end() ); + c1.merge(c2); + VERIFY( c1 == c0 ); + VERIFY( equal_elements(c2, c0) ); + + c1.clear(); + c1.merge(c2); + VERIFY( c1 == c0 ); + VERIFY( c2.empty() ); + + c2.merge(c1); + VERIFY( c1.empty() ); + VERIFY( equal_elements(c2, c0) ); + + c1 = c0; + c2.merge(c1); + VERIFY( c1.empty() ); + VERIFY( c2.size() == (2 * c0.size()) ); + VERIFY( c2.count("one") == 2 ); + VERIFY( c2.count("two") == 2 ); + VERIFY( c2.count("three") == 2 ); + + c1.merge(c2); + VERIFY( c1 == c0 ); + VERIFY( equal_elements(c2, c0) ); + + c1.merge(std::move(c2)); + VERIFY( c1 == c0 ); + VERIFY( equal_elements(c2, c0) ); + + c1.clear(); + c1.merge(std::move(c2)); + VERIFY( c1 == c0 ); + VERIFY( c2.empty() ); +} + +template + using hash_f = + std::function; + +std::size_t +hash_func(const std::string& str) +{ return std::hash{}(str); } + +std::size_t +xhash_func(const std::string& str) +{ return xhash{}(str); } + +namespace std +{ + template + struct __is_fast_hash> : __is_fast_hash> + { }; +} + +void +test06() +{ + const std::unordered_map, equal> + c0({ {"one", 10}, {"two", 20}, {"three", 30} }, 3, &hash_func); + + std::unordered_map, equal> + c1(3, &hash_func); + c1 = c0; + std::unordered_multimap, equal> + c2(c0.begin(), c0.end(), 3, &xhash_func); + c1.merge(c2); + VERIFY( c1 == c0 ); + VERIFY( equal_elements(c2, c0) ); + + c1.clear(); + c1.merge(c2); + VERIFY( c1 == c0 ); + VERIFY( c2.empty() ); + + c2.merge(c1); + VERIFY( c1.empty() ); + VERIFY( equal_elements(c2, c0) ); + + c1 = c0; + c2.merge(c1); + VERIFY( c1.empty() ); + VERIFY( c2.size() == (2 * c0.size()) ); + VERIFY( c2.count("one") == 2 ); + VERIFY( c2.count("two") == 2 ); + VERIFY( c2.count("three") == 2 ); + + c1.merge(c2); + VERIFY( c1 == c0 ); + VERIFY( equal_elements(c2, c0) ); + + c1.merge(std::move(c2)); + VERIFY( c1 == c0 ); + VERIFY( equal_elements(c2, c0) ); + + c1.clear(); + c1.merge(std::move(c2)); + VERIFY( c1 == c0 ); + VERIFY( c2.empty() ); +} + int main() { test01(); test02(); test03(); + test04(); + test05(); + test06(); } From 9481a1f7d5ad989588ee7444e5add8161c3cb1ea Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Tue, 24 Oct 2023 00:25:42 +0000 Subject: [PATCH 24/31] Daily bump. --- gcc/ChangeLog | 21 +++++++++++++++++++++ gcc/DATESTAMP | 2 +- gcc/testsuite/ChangeLog | 8 ++++++++ libstdc++-v3/ChangeLog | 11 +++++++++++ 4 files changed, 41 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 51835db381b6..87d9fc3b4562 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,24 @@ +2023-10-23 Oleg Endo + + PR target/111001 + * config/sh/sh_treg_combine.cc (sh_treg_combine::record_set_of_reg): + Skip over nop move insns. + +2023-10-23 Kewen Lin + + Backported from master: + 2023-10-12 Kewen Lin + + PR target/111367 + * config/rs6000/rs6000.md (stack_protect_setsi): Support prefixed + instruction emission and incorporate to stack_protect_set. + (stack_protect_setdi): Rename to ... + (stack_protect_set): ... this, adjust constraint. + (stack_protect_testsi): Support prefixed instruction emission and + incorporate to stack_protect_test. + (stack_protect_testdi): Rename to ... + (stack_protect_test): ... this, adjust constraint. + 2023-10-20 Oleg Endo PR target/101177 diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 909fbcdf47eb..2b20a22545d4 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20231023 +20231024 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 374e08c989be..746acf78a611 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2023-10-23 Kewen Lin + + Backported from master: + 2023-10-12 Kewen Lin + + PR target/111367 + * g++.target/powerpc/pr111367.C: New test. + 2023-10-21 Harald Anlauf Backported from master: diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index ed1fd4b2140c..579deb61424c 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,14 @@ +2023-10-23 François Dumont + + * include/bits/hashtable_policy.h + (_Hash_code_base::_M_hash_code(const _Hash&, const _Hash_node_value<>&)): Remove. + (_Hash_code_base::_M_hash_code<_H2>(const _H2&, const _Hash_node_value<>&)): Remove. + * include/bits/hashtable.h + (_M_src_hash_code<_H2>(const _H2&, const key_type&, const __node_value_type&)): New. + (_M_merge_unique<>, _M_merge_multi<>): Use latter. + * testsuite/23_containers/unordered_map/modifiers/merge.cc + (test04, test05, test06): New test cases. + 2023-10-21 Benjamin Brock Backported from master: From 3235289bc7e092abde361668851e07850ccccfb2 Mon Sep 17 00:00:00 2001 From: Mark Harmstone Date: Tue, 24 Oct 2023 09:04:25 +0200 Subject: [PATCH 25/31] Remove obsolete debugging formats from names list * opts.cc (debug_type_names): Remove stabs and xcoff. (df_set_names): Adjust. (cherry picked from commit 724badcadf889b5798321620aeed16b61e91fe72) --- gcc/opts.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/opts.cc b/gcc/opts.cc index fb2e5388ab19..e0ba89ffe516 100644 --- a/gcc/opts.cc +++ b/gcc/opts.cc @@ -49,7 +49,7 @@ static void set_Wstrict_aliasing (struct gcc_options *opts, int onoff); const char *const debug_type_names[] = { - "none", "stabs", "dwarf-2", "xcoff", "vms", "ctf", "btf" + "none", "dwarf-2", "vms", "ctf", "btf" }; /* Bitmasks of fundamental debug info formats indexed by enum @@ -64,7 +64,7 @@ static uint32_t debug_type_masks[] = /* Names of the set of debug formats requested by user. Updated and accessed via debug_set_names. */ -static char df_set_names[sizeof "none stabs dwarf-2 xcoff vms ctf btf"]; +static char df_set_names[sizeof "none dwarf-2 vms ctf btf"]; /* Get enum debug_info_type of the specified debug format, for error messages. Can be used only for individual debug format types. */ From 544e75b06c9de089535099e89c9706452b40d1f3 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 25 Oct 2023 00:24:37 +0000 Subject: [PATCH 26/31] Daily bump. --- gcc/ChangeLog | 8 ++++++++ gcc/DATESTAMP | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 87d9fc3b4562..861f45a2a2c8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2023-10-24 Mark Harmstone + + Backported from master: + 2023-10-24 Mark Harmstone + + * opts.cc (debug_type_names): Remove stabs and xcoff. + (df_set_names): Adjust. + 2023-10-23 Oleg Endo PR target/111001 diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 2b20a22545d4..399b940984eb 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20231024 +20231025 From c79e015fff919e01504537bddf26baef1e2bd803 Mon Sep 17 00:00:00 2001 From: "Paul M. Bendixen" Date: Fri, 21 Jul 2023 23:35:25 +0200 Subject: [PATCH 27/31] libstdc++: Include cstdarg in freestanding P1642 includes cstdarg in the full headers to include. This commit includes it along with cstdalign and cstdbool that were left out when updating in an earlier commit. libstdc++/Changelog * include/Makefile.am: Move cstdarg, cstdalign and cstdbool to freestanding. * include/Makefile.in: Regenerate. Signed-off-by: Paul M. Bendixen (cherry picked from commit c1eee808a93a94a18cffef59432e3422ed4e9b27) --- libstdc++-v3/include/Makefile.am | 6 +++--- libstdc++-v3/include/Makefile.in | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am index a880e8ee2275..2a42ac044367 100644 --- a/libstdc++-v3/include/Makefile.am +++ b/libstdc++-v3/include/Makefile.am @@ -849,6 +849,9 @@ c_base_builddir = . c_base_freestanding = \ ${c_base_srcdir}/cfloat \ ${c_base_srcdir}/climits \ + ${c_base_srcdir}/cstdalign \ + ${c_base_srcdir}/cstdarg \ + ${c_base_srcdir}/cstdbool \ ${c_base_srcdir}/cstddef \ ${c_base_srcdir}/cstdint \ ${c_base_srcdir}/cstdlib @@ -869,9 +872,6 @@ c_base_headers = \ ${c_base_srcdir}/cmath \ ${c_base_srcdir}/csetjmp \ ${c_base_srcdir}/csignal \ - ${c_base_srcdir}/cstdalign \ - ${c_base_srcdir}/cstdarg \ - ${c_base_srcdir}/cstdbool \ ${c_base_srcdir}/cstdio \ ${c_base_srcdir}/cstring \ ${c_base_srcdir}/ctgmath \ diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in index 0ff875b280be..bdbf015e5442 100644 --- a/libstdc++-v3/include/Makefile.in +++ b/libstdc++-v3/include/Makefile.in @@ -1194,6 +1194,9 @@ c_base_builddir = . c_base_freestanding = \ ${c_base_srcdir}/cfloat \ ${c_base_srcdir}/climits \ + ${c_base_srcdir}/cstdalign \ + ${c_base_srcdir}/cstdarg \ + ${c_base_srcdir}/cstdbool \ ${c_base_srcdir}/cstddef \ ${c_base_srcdir}/cstdint \ ${c_base_srcdir}/cstdlib @@ -1212,9 +1215,6 @@ c_base_freestanding = \ @GLIBCXX_HOSTED_TRUE@ ${c_base_srcdir}/cmath \ @GLIBCXX_HOSTED_TRUE@ ${c_base_srcdir}/csetjmp \ @GLIBCXX_HOSTED_TRUE@ ${c_base_srcdir}/csignal \ -@GLIBCXX_HOSTED_TRUE@ ${c_base_srcdir}/cstdalign \ -@GLIBCXX_HOSTED_TRUE@ ${c_base_srcdir}/cstdarg \ -@GLIBCXX_HOSTED_TRUE@ ${c_base_srcdir}/cstdbool \ @GLIBCXX_HOSTED_TRUE@ ${c_base_srcdir}/cstdio \ @GLIBCXX_HOSTED_TRUE@ ${c_base_srcdir}/cstring \ @GLIBCXX_HOSTED_TRUE@ ${c_base_srcdir}/ctgmath \ From 13ad7b1603f31b65e181780a29ada3f9a331bf8f Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Tue, 24 Oct 2023 16:56:30 +0100 Subject: [PATCH 28/31] libstdc++: Build libstdc++_libbacktrace.a as PIC [PR111936] In order for std::stacktrace to be used in a shared library, the libbacktrace symbols need to be built with -fPIC. Add the libtool -prefer-pic flag to the commands in src/libbacktrace/Makefile so that the archive contains PIC objects. libstdc++-v3/ChangeLog: PR libstdc++/111936 * src/libbacktrace/Makefile.am: Add -prefer-pic to libtool compile commands. * src/libbacktrace/Makefile.in: Regenerate. (cherry picked from commit f32c1e1e96ffef6512ce025942b51f3967a3e7f2) --- libstdc++-v3/src/libbacktrace/Makefile.am | 8 ++++++-- libstdc++-v3/src/libbacktrace/Makefile.in | 7 ++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/libstdc++-v3/src/libbacktrace/Makefile.am b/libstdc++-v3/src/libbacktrace/Makefile.am index 9abf9dd64a1a..998c059418eb 100644 --- a/libstdc++-v3/src/libbacktrace/Makefile.am +++ b/libstdc++-v3/src/libbacktrace/Makefile.am @@ -48,9 +48,13 @@ WARN_FLAGS = -W -Wall -Wwrite-strings -Wmissing-format-attribute \ -Wcast-qual -Werror C_WARN_FLAGS = $(WARN_FLAGS) -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wno-unused-but-set-variable CXX_WARN_FLAGS = $(WARN_FLAGS) -Wno-unused-parameter -AM_CFLAGS = $(C_WARN_FLAGS) +AM_CFLAGS = \ + $(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \ + $(C_WARN_FLAGS) AM_CFLAGS += $(EXTRA_CFLAGS) -AM_CXXFLAGS = $(CXX_WARN_FLAGS) -fno-rtti -fno-exceptions +AM_CXXFLAGS = \ + $(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \ + $(CXX_WARN_FLAGS) -fno-rtti -fno-exceptions AM_CXXFLAGS += $(EXTRA_CXXFLAGS) obj_prefix = std_stacktrace diff --git a/libstdc++-v3/src/libbacktrace/Makefile.in b/libstdc++-v3/src/libbacktrace/Makefile.in index 1c1242d88278..b5cce3741df3 100644 --- a/libstdc++-v3/src/libbacktrace/Makefile.in +++ b/libstdc++-v3/src/libbacktrace/Makefile.in @@ -498,9 +498,10 @@ libstdc___libbacktrace_la_CPPFLAGS = \ C_WARN_FLAGS = $(WARN_FLAGS) -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wno-unused-but-set-variable CXX_WARN_FLAGS = $(WARN_FLAGS) -Wno-unused-parameter -AM_CFLAGS = $(C_WARN_FLAGS) $(EXTRA_CFLAGS) -AM_CXXFLAGS = $(CXX_WARN_FLAGS) -fno-rtti -fno-exceptions \ - $(EXTRA_CXXFLAGS) +AM_CFLAGS = $(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \ + $(C_WARN_FLAGS) $(EXTRA_CFLAGS) +AM_CXXFLAGS = $(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \ + $(CXX_WARN_FLAGS) -fno-rtti -fno-exceptions $(EXTRA_CXXFLAGS) obj_prefix = std_stacktrace # Each FILE.c in SOURCES will be compiled to SHORTNAME-FILE.o From b5201aee2964df9b8c9ffbeb9390ad240b8114eb Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 26 Oct 2023 00:20:46 +0000 Subject: [PATCH 29/31] Daily bump. --- gcc/DATESTAMP | 2 +- libstdc++-v3/ChangeLog | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 399b940984eb..8cc3c140cdf8 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20231025 +20231026 diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 579deb61424c..400a36a04ed8 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,22 @@ +2023-10-25 Jonathan Wakely + + Backported from master: + 2023-10-25 Jonathan Wakely + + PR libstdc++/111936 + * src/libbacktrace/Makefile.am: Add -prefer-pic to libtool + compile commands. + * src/libbacktrace/Makefile.in: Regenerate. + +2023-10-25 Paul M. Bendixen + + Backported from master: + 2023-10-24 Paul M. Bendixen + + * include/Makefile.am: Move cstdarg, cstdalign and cstdbool to + freestanding. + * include/Makefile.in: Regenerate. + 2023-10-23 François Dumont * include/bits/hashtable_policy.h From 3e422483f18682dad0e5d61cd0efb97deee077b7 Mon Sep 17 00:00:00 2001 From: chenxiaolong Date: Tue, 24 Oct 2023 14:40:14 +0800 Subject: [PATCH 30/31] LoongArch: Implement __builtin_thread_pointer for TLS. gcc/ChangeLog: * config/loongarch/loongarch.md (get_thread_pointer):Adds the instruction template corresponding to the __builtin_thread_pointer function. * doc/extend.texi:Add the __builtin_thread_pointer function support description to the documentation. gcc/testsuite/ChangeLog: * gcc.target/loongarch/builtin_thread_pointer.c: New test. (cherry picked from commit 1b30ef7cea773e0af527dbf821e0be42b6a264f8) --- gcc/config/loongarch/loongarch.md | 7 +++++++ gcc/doc/extend.texi | 5 +++++ .../gcc.target/loongarch/builtin_thread_pointer.c | 10 ++++++++++ 3 files changed, 22 insertions(+) create mode 100644 gcc/testsuite/gcc.target/loongarch/builtin_thread_pointer.c diff --git a/gcc/config/loongarch/loongarch.md b/gcc/config/loongarch/loongarch.md index 43c3578b6db4..830eaaea90e4 100644 --- a/gcc/config/loongarch/loongarch.md +++ b/gcc/config/loongarch/loongarch.md @@ -110,6 +110,7 @@ (define_constants [(RETURN_ADDR_REGNUM 1) + (TP_REGNUM 2) (T0_REGNUM 12) (T1_REGNUM 13) (S0_REGNUM 23) @@ -3446,6 +3447,12 @@ [(set_attr "length" "0") (set_attr "type" "ghost")]) +;; Named pattern for expanding thread pointer reference. +(define_expand "get_thread_pointer" + [(set (match_operand:P 0 "register_operand" "=r") + (reg:P TP_REGNUM))] + "HAVE_AS_TLS" + {}) (define_split [(match_operand 0 "small_data_pattern")] diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 7a3b5454724a..12c5ca507ed5 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -16332,6 +16332,11 @@ function you need to include @code{larchintrin.h}. void __break (imm0_32767) @end smallexample +Returns the value that is currently set in the @samp{tp} register. +@smallexample + void * __builtin_thread_pointer (void) +@end smallexample + @node MIPS DSP Built-in Functions @subsection MIPS DSP Built-in Functions diff --git a/gcc/testsuite/gcc.target/loongarch/builtin_thread_pointer.c b/gcc/testsuite/gcc.target/loongarch/builtin_thread_pointer.c new file mode 100644 index 000000000000..541e3b143bd2 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/builtin_thread_pointer.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target tls_native } */ +/* { dg-options "-O2" } */ +/* { dg-final { scan-assembler "or\t\\\$r4,\\\$r2,\\\$r0" } } */ + +void * +get_tp () +{ + return __builtin_thread_pointer (); +} From 319e887bdddfb8b9244f9310a54c1f08b7e8f0e8 Mon Sep 17 00:00:00 2001 From: Lulu Cheng Date: Mon, 23 Oct 2023 09:07:32 +0800 Subject: [PATCH 31/31] LoongArch: Define macro CLEAR_INSN_CACHE. LoongArch's microstructure ensures cache consistency by hardware. Due to out-of-order execution, "ibar" is required to ensure the visibility of the store (invalidated icache) executed by this CPU before "ibar" (to the instance). "ibar" will not invalidate the icache, so the start and end parameters are not Affect "ibar" performance. gcc/ChangeLog: * config/loongarch/loongarch.h (CLEAR_INSN_CACHE): New definition. (cherry picked from commit 5697ed0327f23d2e2ec4f7beec3b3d02f463173c) --- gcc/config/loongarch/loongarch.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gcc/config/loongarch/loongarch.h b/gcc/config/loongarch/loongarch.h index f81678756465..f0db67f8c7b8 100644 --- a/gcc/config/loongarch/loongarch.h +++ b/gcc/config/loongarch/loongarch.h @@ -1157,3 +1157,8 @@ struct GTY (()) machine_function (TARGET_HARD_FLOAT_ABI ? (TARGET_DOUBLE_FLOAT_ABI ? 8 : 4) : 0) #define FUNCTION_VALUE_REGNO_P(N) ((N) == GP_RETURN || (N) == FP_RETURN) + +/* LoongArch maintains ICache/DCache coherency by hardware, + we just need "ibar" to avoid instruction hazard here. */ +#undef CLEAR_INSN_CACHE +#define CLEAR_INSN_CACHE(beg, end) __builtin_loongarch_ibar (0)