[PATCH] [ADA] Make install-gnatlib use the correct ranlib for cross-builds
Hi, there is a minor glitch in the make install for TARGET!=HOST cross-builds, which affects only Ada AFAICT. That is "make install" tries to use the wrong ranlib command here: cd rts; for file in *.a;do \ /usr/bin/install -c -m 644 $file /home/ed/gnu/arm-linux-gnueabihf-linux64/lib/gcc/arm-linux-gnueabihf/9.0.0/adalib; \ arm-linux-gnueabihf-ranlib /home/ed/gnu/arm-linux-gnueabihf-linux64/lib/gcc/arm-linux-gnueabihf/9.0.0/adalib/$file; \ done /bin/bash: line 2: arm-linux-gnueabihf-ranlib: command not found /bin/bash: line 2: arm-linux-gnueabihf-ranlib: command not found /bin/bash: line 2: arm-linux-gnueabihf-ranlib: command not found /bin/bash: line 2: arm-linux-gnueabihf-ranlib: command not found /bin/bash: line 2: arm-linux-gnueabihf-ranlib: command not found gcc-interface/Makefile:527: recipe for target 'install-gnatlib' failed make[4]: [install-gnatlib] Error 127 (ignored) true The installed toolchain is nevertheless fully operational, but... This small correction fixes this glitch. Boot-strapped and reg-tested on x86_64-pc-linux-gnu and arm-linux-gnueabihf cross. Is it OK for trunk? Thanks Bernd. patch-ada-install.diff Description: patch-ada-install.diff
Re: [PATCH] [ADA] Make install-gnatlib use the correct ranlib for cross-builds
> there is a minor glitch in the make install for TARGET!=HOST cross-builds, > which affects only Ada AFAICT. > > That is "make install" tries to use the wrong ranlib command here: > > cd rts; for file in *.a;do \ >/usr/bin/install -c -m 644 $file > /home/ed/gnu/arm-linux-gnueabihf-linux64/lib/gcc/arm-linux-gnueabihf/9.0.0/adalib; > \ >arm-linux-gnueabihf-ranlib > /home/ed/gnu/arm-linux-gnueabihf-linux64/lib/gcc/arm-linux-gnueabihf/9.0.0/adalib/$file; > \ > done > /bin/bash: line 2: arm-linux-gnueabihf-ranlib: command not found > /bin/bash: line 2: arm-linux-gnueabihf-ranlib: command not found > /bin/bash: line 2: arm-linux-gnueabihf-ranlib: command not found > /bin/bash: line 2: arm-linux-gnueabihf-ranlib: command not found > /bin/bash: line 2: arm-linux-gnueabihf-ranlib: command not found > gcc-interface/Makefile:527: recipe for target 'install-gnatlib' failed > make[4]: [install-gnatlib] Error 127 (ignored) > true > > > The installed toolchain is nevertheless fully operational, but... > > This small correction fixes this glitch. > > Boot-strapped and reg-tested on x86_64-pc-linux-gnu and arm-linux-gnueabihf > cross. > Is it OK for trunk? Ok, thanks. Arno
Re: [RFC PATCH] diagnose built-in declarations without prototype (PR 83656)
Hi Martin, really nice work. Just one minor nit: >--- a/gcc/doc/invoke.texi >+++ b/gcc/doc/invoke.texi >@@ -6568,8 +6568,13 @@ attributes. > @item -Wno-builtin-declaration-mismatch > @opindex Wno-builtin-declaration-mismatch > @opindex Wbuiltin-declaration-mismatch >-Warn if a built-in function is declared with the wrong signature or >-as non-function. >+Warn if a built-in function is declared with the wrong signature or >+as non-function. Also warn when a built-in function that takes arguments >+is declared without a prototype, and for calls to built-in functions >+declared ithout a prototype made with the wrong number of arguments or s/ithout/without/ Bernd.
[PATCH] Bump libgnat to 9.
Hi. Quite obvious change where I bumped version to 9. Ready for trunk? Thanks, Martin gcc/ada/ChangeLog: 2018-06-30 Martin Liska * gnatvsn.ads: Bump Library_Version to 9. --- gcc/ada/gnatvsn.ads | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/ada/gnatvsn.ads b/gcc/ada/gnatvsn.ads index 5a7b56ce7de..a55243d4eca 100644 --- a/gcc/ada/gnatvsn.ads +++ b/gcc/ada/gnatvsn.ads @@ -38,7 +38,7 @@ package Gnatvsn is -- Static string identifying this version, that can be used as an argument -- to e.g. pragma Ident. - Library_Version : constant String := "8"; + Library_Version : constant String := "9"; -- Library version. It needs to be updated whenever the major version -- number is changed. --
Re: [Patch, fortran] PR45305 - Array-valued calls to elementals are not simplified
On 06/27/2018 06:48 AM, Paul Richard Thomas wrote: I posted a patch for this on the PR in August 2010. Dominique pointed out that it caused repeated error messages in some testcases; eg. arithmetic_overflow_1.f90 As it happens, that seems to have crept in at some time even without the patch for this PR. Nevertheless, I have modified the patch slightly to prevent any more escalation. Apart from this, the patch is very straightforward. Bootstraps and regtests on FC28/x86_64 - OK for trunk and? Paul Well this goes way back. OK for trunk. If you want to backport to 7 and 8, your choice. Jerry
Re: [PATCH] Bump libgnat to 9.
On 06/30/2018 07:52 AM, Martin Liška wrote: > Hi. > > Quite obvious change where I bumped version to 9. > > Ready for trunk? > Thanks, > Martin > > gcc/ada/ChangeLog: > > 2018-06-30 Martin Liska > > * gnatvsn.ads: Bump Library_Version to 9. OK jeff
Re: [Patch, fortran] PR45305 - Array-valued calls to elementals are not simplified
Ok, thanks. I think that I will stick to trunk, since we do not seem to have been overwhelmed with demand to fix this! Regards Paul On Sat, 30 Jun 2018 at 15:37, Jerry DeLisle wrote: > > On 06/27/2018 06:48 AM, Paul Richard Thomas wrote: > > I posted a patch for this on the PR in August 2010. Dominique pointed > > out that it caused repeated error messages in some testcases; eg. > > arithmetic_overflow_1.f90 > > > > As it happens, that seems to have crept in at some time even without > > the patch for this PR. Nevertheless, I have modified the patch > > slightly to prevent any more escalation. Apart from this, the patch is > > very straightforward. > > > > Bootstraps and regtests on FC28/x86_64 - OK for trunk and? > > > > Paul > > > > Well this goes way back. OK for trunk. If you want to backport to 7 and > 8, your choice. > > Jerry -- "If you can't explain it simply, you don't understand it well enough" - Albert Einstein
[Patch, fortran] PR86242 [6/7/8/9 Regression] [OOP] ICE for derived type with allocatable component and proc-ptr component
This patch is 'obvious' and I will commit to trunk tomorrow night if there are no objections. The other branches will follow next week. Bootstrapped and regtested on FC28/x86_64. Cheers Paul 2018-06-30 Paul Thomas PR fortran/82969 PR fortran/86242 * trans-array.c (structure_alloc_comps): Do not explicitly copy procedure pointer components. 2018-06-30 Paul Thomas PR fortran/82969 PR fortran/86242 * gfortran.dg/proc_ptr_50.f90: New test. Index: gcc/fortran/trans-array.c === *** gcc/fortran/trans-array.c (revision 261974) --- gcc/fortran/trans-array.c (working copy) *** structure_alloc_comps (gfc_symbol * der_ *** 8842,8848 break; case COPY_ALLOC_COMP: ! if (c->attr.pointer) continue; /* We need source and destination components. */ --- 8842,8848 break; case COPY_ALLOC_COMP: ! if (c->attr.pointer || c->attr.proc_pointer) continue; /* We need source and destination components. */ Index: gcc/testsuite/gfortran.dg/proc_ptr_50.f90 === *** gcc/testsuite/gfortran.dg/proc_ptr_50.f90 (nonexistent) --- gcc/testsuite/gfortran.dg/proc_ptr_50.f90 (working copy) *** *** 0 --- 1,68 + ! { dg-do compile } + ! + ! Test the fix for PR86242, in which the procedure pointer in 'tester' + ! was being copied as if it were an allocatable class component. + ! + ! Contributed by + ! + module test + +implicit none + +private +public :: tester + +type :: wrapper + integer(4) :: n +end type wrapper + +type :: output + real(8) :: dummy +end type output + +type :: tester + class(wrapper), allocatable :: wrap + procedure(proc1), pointer :: ptr => null() +end type tester + +abstract interface + function proc1(self) result(uc) + import :: tester, output + class(tester), intent(in) :: self + class(output), allocatable :: uc + end function proc1 +end interface + + end module test + + ! Comment #2 from Janus Weil + module test1 + +implicit none + +type :: output +end type + +type :: tester + integer, allocatable :: wrap + procedure(proc1), pointer, nopass :: ptr +end type + +interface ! Originally abstract + function proc1() result(uc) + import :: output + class(output), allocatable :: uc ! Works if a pointer + end function +end interface + + ! PR82969 from Gerhard Steinmetz +type t + real, allocatable :: x(:) + procedure(f), nopass, pointer :: g +end type + contains +function f() result(z) + class(t), allocatable :: z +end + + end module test1
[PATCH] Remove -Wabi from libstdc++ build options
Hi, the -Wabi option prints a warning as follows: cc1plus: warning: -Wabi won't warn about anything [-Wabi] cc1plus: note: -Wabi warns about differences from the most up-to-date ABI, which is also used by default cc1plus: note: use e.g. -Wabi=11 to warn about changes from GCC 7 This happens many times while building libstdc++, and as the warning explains, it is good for nothing, so this patch removes it. Bootstrapped and reg-tested on x86_64-pc-linux-gnu. Is it OK for trunk? Thanks Bernd. 2018-06-30 Bernd Edlinger * acinclude.m4 (WARN_FLAGS): Remove -Wabi. * configure: Regenerated. Index: libstdc++-v3/acinclude.m4 === --- libstdc++-v3/acinclude.m4 (revision 262271) +++ libstdc++-v3/acinclude.m4 (working copy) @@ -733,7 +733,7 @@ # OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc AC_SUBST(OPTIMIZE_CXXFLAGS) - WARN_FLAGS='-Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi' + WARN_FLAGS='-Wall -Wextra -Wwrite-strings -Wcast-qual' AC_SUBST(WARN_FLAGS) ]) Index: libstdc++-v3/configure === --- libstdc++-v3/configure (revision 262271) +++ libstdc++-v3/configure (working copy) @@ -81846,7 +81846,7 @@ # OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc - WARN_FLAGS='-Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi' + WARN_FLAGS='-Wall -Wextra -Wwrite-strings -Wcast-qual'
[PATCH] RISC-V: Add patterns to convert AND mask to two shifts.
This fixes a problem reported by Bruce Hoult on the RISC-V isa-dev mailing list. Given a testcase with two shifts, gcc canonicalizes to an AND with a mask, and then we get 3 instructions at the end when we should have two. This adds combiner patterns to convert AND mask back to two shifts when that is beneficial. I added 3 testcases to verify the optimization. This was tested with riscv64-linux native, and riscv32-elf cross. There were no regressions. Committed. Jim gcc/ * config/riscv/predicates.md (p2m1_shift_operand): New. (high_mask_shift_operand): New. * config/riscv/riscv.md (lshrsi3_zero_extend_3+1): New combiner pattern using p2m1_shift_operand. (lshsi3_zero_extend_3+2): New combiner pattern using high_mask_shift_operand. gcc/testsuite/ * gcc.target/riscv/shift-shift-1.c: New. * gcc.target/riscv/shift-shift-2.c: New. * gcc.target/riscv/shift-shift-3.c: New. --- gcc/config/riscv/predicates.md| 20 gcc/config/riscv/riscv.md | 32 +++ .../gcc.target/riscv/shift-shift-1.c | 17 ++ .../gcc.target/riscv/shift-shift-2.c | 29 + .../gcc.target/riscv/shift-shift-3.c | 18 +++ 5 files changed, 116 insertions(+) create mode 100644 gcc/testsuite/gcc.target/riscv/shift-shift-1.c create mode 100644 gcc/testsuite/gcc.target/riscv/shift-shift-2.c create mode 100644 gcc/testsuite/gcc.target/riscv/shift-shift-3.c diff --git a/gcc/config/riscv/predicates.md b/gcc/config/riscv/predicates.md index a2799d4cb98..cffc831bbc7 100644 --- a/gcc/config/riscv/predicates.md +++ b/gcc/config/riscv/predicates.md @@ -71,6 +71,26 @@ return !LUI_OPERAND (INTVAL (op)) && !SMALL_OPERAND (INTVAL (op)); }) +(define_predicate "p2m1_shift_operand" + (match_code "const_int") +{ + int val = exact_log2 (INTVAL (op) + 1); + if (val < 12) +return false; + return true; + }) + +(define_predicate "high_mask_shift_operand" + (match_code "const_int") +{ + int val1 = clz_hwi (~ INTVAL (op)); + int val0 = ctz_hwi (INTVAL (op)); + if ((val0 + val1 == BITS_PER_WORD) + && val0 > 31 && val0 < 64) +return true; + return false; +}) + (define_predicate "move_operand" (match_operand 0 "general_operand") { diff --git a/gcc/config/riscv/riscv.md b/gcc/config/riscv/riscv.md index a5940dcc425..7b411f0538e 100644 --- a/gcc/config/riscv/riscv.md +++ b/gcc/config/riscv/riscv.md @@ -1711,6 +1711,38 @@ [(set_attr "type" "shift") (set_attr "mode" "SI")]) +;; Handle AND with 2^N-1 for N from 12 to XLEN. This can be split into +;; two logical shifts. Otherwise it requires 3 instructions: lui, +;; xor/addi/srli, and. +(define_split + [(set (match_operand:GPR 0 "register_operand") + (and:GPR (match_operand:GPR 1 "register_operand") +(match_operand:GPR 2 "p2m1_shift_operand")))] + "" + [(set (match_dup 0) + (ashift:GPR (match_dup 1) (match_dup 2))) + (set (match_dup 0) + (lshiftrt:GPR (match_dup 0) (match_dup 2)))] +{ + operands[2] = GEN_INT (BITS_PER_WORD +- exact_log2 (INTVAL (operands[2]) + 1)); +}) + +;; Handle AND with 0xF...F0...0 where there are 32 to 63 zeros. This can be +;; split into two shifts. Otherwise it requires 3 instructions: li, sll, and. +(define_split + [(set (match_operand:DI 0 "register_operand") + (and:DI (match_operand:DI 1 "register_operand") + (match_operand:DI 2 "high_mask_shift_operand")))] + "TARGET_64BIT" + [(set (match_dup 0) + (lshiftrt:DI (match_dup 1) (match_dup 2))) + (set (match_dup 0) + (ashift:DI (match_dup 0) (match_dup 2)))] +{ + operands[2] = GEN_INT (ctz_hwi (INTVAL (operands[2]))); +}) + ;; ;; ;; diff --git a/gcc/testsuite/gcc.target/riscv/shift-shift-1.c b/gcc/testsuite/gcc.target/riscv/shift-shift-1.c new file mode 100644 index 000..a5343a31b14 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/shift-shift-1.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gc -mabi=ilp32 -O" } */ + +/* Test for lshrsi3_zero_extend_3+1 pattern that uses p2m1_shift_operand. */ +unsigned int +sub1 (unsigned int i) +{ + return (i << 1) >> 1; +} + +unsigned int +sub2 (unsigned int i) +{ + return (i << 20) >> 20; +} +/* { dg-final { scan-assembler-times "slli" 2 } } */ +/* { dg-final { scan-assembler-times "srli" 2 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/shift-shift-2.c b/gcc/testsuite/gcc.target/riscv/shift-shift-2.c new file mode 100644 index 000..3f07e7776e7 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/shift-shift-2.c @@ -0,0 +1,29 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gc -mabi=lp64 -O" } */ + +/* Test for lshrsi3_zero_extend_3+1 pattern that uses p2m1_shift_operand. */ +unsigned int +sub1 (unsigned int i) +{ + return (i << 1) >> 1; +} + +unsigned int +sub2 (unsigned int i)