Re: Fix compute_reloc_for_constant
On 19 January 2014 03:12:56 Jan Hubicka hubi...@ucw.cz wrote: Hi, while comparing LTO and non-LTO builds I noticed that with LTO we produce a lot more vtables in datal.rel.ro rather than data.rel.ro.local This is because of partitioning promoting more symbols global. For RTL we make section decisions based on SYMBOL_REF_LOCAL_FLAG that is set based on decl_binds_local_p. For variables we use TREE_PUBLIC check that is overly conservative. Honza, Would you (or anybody else for that matter) mind looking into PR32219 while there? See http://gcc.gnu.org/ml/gcc-patches/2010-03/msg00665.html and other discussion of that bug on the ML last year. TIA, Bernhard Bootstrapped/regtested x86_64-linux, OK? * varasm.c (compute_reloc_for_constant): Use targetm.binds_local_p instead of TREE_PUBLIC to determine if reference will be local within given DSO or not. Index: varasm.c === --- varasm.c(revision 206684) +++ varasm.c(working copy) @@ -4060,7 +4060,7 @@ break; } - if (TREE_PUBLIC (tem)) + if (!targetm.binds_local_p (tem)) reloc |= 2; else reloc |= 1; Sent with AquaMail for Android http://www.aqua-mail.com
[PATCH] libgcc: use linker script for libgcc_s.so on xtensa
The xtensa port uses __xtensa_libgcc_window_spill in libgcc to implement __builtin_frame_address. This symbol is local/hidden in libgcc. This is not a problem when linking against static libgcc. But g++ defaults to -shared-libgcc, thus breaking link against C++ shared libraries that are using __builtin_frame_address as follows: ld: test: hidden symbol `__xtensa_libgcc_window_spill' in .../libgcc.a(lib2funcs.o) is referenced by DSO Make libgcc_s.so a linker script that links in unresolved symbols from the static libgcc, similar to the ARM and PowerPC ports. libgcc/ * config.host (tmake_file): add t-slibgcc-libgcc for xtensa*-*-linux*. --- libgcc/config.host | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libgcc/config.host b/libgcc/config.host index 75a17e3..178f6d9 100644 --- a/libgcc/config.host +++ b/libgcc/config.host @@ -1181,7 +1181,7 @@ xtensa*-*-elf*) extra_parts=$extra_parts crti.o crtn.o ;; xtensa*-*-linux*) - tmake_file=$tmake_file xtensa/t-xtensa xtensa/t-linux + tmake_file=$tmake_file xtensa/t-xtensa xtensa/t-linux t-slibgcc-libgcc md_unwind_header=xtensa/linux-unwind.h ;; am33_2.0-*-linux*) -- 1.8.5.2
Re: PATCH: PR target/59379: [4.9 Regression] gomp_init_num_threads is compiled into an infinite loop with --with-arch=corei7 --with-cpu=slm
On Sat, Jan 18, 2014 at 9:15 PM, H.J. Lu hjl.to...@gmail.com wrote: For LEA operation with SImode_address_operand, which zero-extends SImode to DImode, ix86_split_lea_for_addr turns (set (reg:DI) ...) into (set (reg:SI) ...) We need to do (set (reg:DI) (zero_extend:DI (reg:SI))) at the end. If the LEA operation is (set (reg:DI) (zero_extend:DI (reg:SI))) ree pass should remove these. However, we can just emit zero-extend insn at the end of sequence, and ree (which is located after post-reload split) should handle it: --cut here-- Index: config/i386/i386.md === --- config/i386/i386.md (revision 206753) +++ config/i386/i386.md (working copy) @@ -5428,12 +5428,17 @@ operands[0] = SET_DEST (pat); operands[1] = SET_SRC (pat); - /* Emit all operations in SImode for zero-extended addresses. Recall - that x86_64 inheretly zero-extends SImode operations to DImode. */ + /* Emit all operations in SImode for zero-extended addresses. */ if (SImode_address_operand (operands[1], VOIDmode)) mode = SImode; ix86_split_lea_for_addr (curr_insn, operands, mode); + + /* Zero-extend return register to DImode for zero-extended addresses. */ + if (mode != MODEmode) +emit_insn (gen_zero_extendsidi2 + (operands[0], gen_lowpart ((mode), operands[0]))); + DONE; } [(set_attr type lea) --cut here-- The patch was tested with a testcase from Comment #9 of the PR using -O --march=corei7 -mtune=slm, and resulting binary runs without problems. Uros.
[committed] Fix vect_intness in a few tests
One test tests for integer vectorisation so requires vect_int. Two others already had the dg-require-effective-target, but it was before the dg-do rather than after. Tested on mips64-linux-gnu, where it fixes the vect.exp failures. Applied as obvious. Thanks, Richard gcc/testsuite/ * gcc.dg/vect/pr57705.c: Require vect_int. * gcc.dg/vect/pr58508.c: Fix order of dg-require-effective-target line. * gcc.dg/vect/vect-alias-check.c: Likewise. Index: gcc/testsuite/gcc.dg/vect/pr57705.c === --- gcc/testsuite/gcc.dg/vect/pr57705.c 2014-01-19 09:52:07.761437971 + +++ gcc/testsuite/gcc.dg/vect/pr57705.c 2014-01-19 09:52:07.973439322 + @@ -1,4 +1,5 @@ /* { dg-do run } */ +/* { dg-require-effective-target vect_int } */ #include tree-vect.h Index: gcc/testsuite/gcc.dg/vect/pr58508.c === --- gcc/testsuite/gcc.dg/vect/pr58508.c 2014-01-19 09:52:07.776438067 + +++ gcc/testsuite/gcc.dg/vect/pr58508.c 2014-01-19 09:52:07.973439322 + @@ -1,5 +1,5 @@ -/* { dg-require-effective-target vect_int } */ /* { dg-do compile } */ +/* { dg-require-effective-target vect_int } */ /* The GCC vectorizer generates loop versioning for the following loop Index: gcc/testsuite/gcc.dg/vect/vect-alias-check.c === --- gcc/testsuite/gcc.dg/vect/vect-alias-check.c2014-01-19 09:52:07.776438067 + +++ gcc/testsuite/gcc.dg/vect/vect-alias-check.c2014-01-19 09:52:07.974439329 + @@ -1,5 +1,5 @@ -/* { dg-require-effective-target vect_int } */ /* { dg-do compile } */ +/* { dg-require-effective-target vect_int } */ /* { dg-additional-options --param=vect-max-version-for-alias-checks=2 } */ /* A test case showing four potential alias checks between a[i] and b[0], b[1],
Re: [Patch] Fix regex multiple consecutive quantifiers bug.
Hi, On 01/19/2014 06:52 AM, Tim Shen wrote: Regex like a** will throw an unexpected exception. Now fixed (but currently no optimizations on it). Booted and tested with -m64 and -m32 respectively. Ok. Please remove 2013 as copyright year for the tescase. I also think you can avoid the auxiliary includes. Thanks! Paolo.
Re: Fix compute_reloc_for_constant
On Sun, Jan 19, 2014 at 3:12 AM, Jan Hubicka hubi...@ucw.cz wrote: Hi, while comparing LTO and non-LTO builds I noticed that with LTO we produce a lot more vtables in datal.rel.ro rather than data.rel.ro.local This is because of partitioning promoting more symbols global. For RTL we make section decisions based on SYMBOL_REF_LOCAL_FLAG that is set based on decl_binds_local_p. For variables we use TREE_PUBLIC check that is overly conservative. Bootstrapped/regtested x86_64-linux, OK? Ok. Thanks, Richard. * varasm.c (compute_reloc_for_constant): Use targetm.binds_local_p instead of TREE_PUBLIC to determine if reference will be local within given DSO or not. Index: varasm.c === --- varasm.c(revision 206684) +++ varasm.c(working copy) @@ -4060,7 +4060,7 @@ break; } - if (TREE_PUBLIC (tem)) + if (!targetm.binds_local_p (tem)) reloc |= 2; else reloc |= 1;
Re: PATCH: PR target/59379: [4.9 Regression] gomp_init_num_threads is compiled into an infinite loop with --with-arch=corei7 --with-cpu=slm
On Sun, Jan 19, 2014 at 1:55 AM, Uros Bizjak ubiz...@gmail.com wrote: On Sat, Jan 18, 2014 at 9:15 PM, H.J. Lu hjl.to...@gmail.com wrote: For LEA operation with SImode_address_operand, which zero-extends SImode to DImode, ix86_split_lea_for_addr turns (set (reg:DI) ...) into (set (reg:SI) ...) We need to do (set (reg:DI) (zero_extend:DI (reg:SI))) at the end. If the LEA operation is (set (reg:DI) (zero_extend:DI (reg:SI))) ree pass should remove these. However, we can just emit zero-extend insn at the end of sequence, and ree (which is located after post-reload split) should handle it: --cut here-- Index: config/i386/i386.md === --- config/i386/i386.md (revision 206753) +++ config/i386/i386.md (working copy) @@ -5428,12 +5428,17 @@ operands[0] = SET_DEST (pat); operands[1] = SET_SRC (pat); - /* Emit all operations in SImode for zero-extended addresses. Recall - that x86_64 inheretly zero-extends SImode operations to DImode. */ + /* Emit all operations in SImode for zero-extended addresses. */ if (SImode_address_operand (operands[1], VOIDmode)) mode = SImode; ix86_split_lea_for_addr (curr_insn, operands, mode); + + /* Zero-extend return register to DImode for zero-extended addresses. */ + if (mode != MODEmode) +emit_insn (gen_zero_extendsidi2 + (operands[0], gen_lowpart ((mode), operands[0]))); + DONE; } [(set_attr type lea) --cut here-- The patch was tested with a testcase from Comment #9 of the PR using -O --march=corei7 -mtune=slm, and resulting binary runs without problems. Yes, the resulting GCC works correctly. However, we generate extra (set (reg:DI) (zero_extend:DI (reg:SI))) It is because we generate (set (reg:SI) (reg:SI) (set (reg:DI) (zero_extend:DI (reg:SI))) REE pass doesn't know (set (reg:SI) (reg:SI) has an implicit ZERO_EXTEND. Here is a testcase: ---foo.c--- extern __thread unsigned int __bid_IDEC_glbflags; typedef unsigned long long UINT64; typedef __attribute__ ((aligned(16))) struct { UINT64 w[2]; } UINT128; extern UINT64 __bid64_from_uint64 (UINT64); extern void __bid_round64_2_18 (int q, int x, UINT64 C, UINT64 * ptr_Cstar, int *delta_exp, int *ptr_is_midpoint_lt_even, int *ptr_is_midpoint_gt_even, int *ptr_is_inexact_lt_midpoint, int *ptr_is_inexact_gt_midpoint); extern void __bid_round128_19_38 (int q, int x, UINT128 C, UINT128 * ptr_Cstar, int *delta_exp, int *ptr_is_midpoint_lt_even, int *ptr_is_midpoint_gt_even, int *ptr_is_inexact_lt_midpoint, int *ptr_is_inexact_gt_midpoint); UINT64 __bid64_from_uint64 (UINT64 x) { UINT64 res; UINT128 x128, res128; unsigned int q, ind; int incr_exp = 0; int is_midpoint_lt_even = 0, is_midpoint_gt_even = 0; int is_inexact_lt_midpoint = 0, is_inexact_gt_midpoint = 0; if (x = 0x002386F26FC0ull) { if (x 0x0020ull) { res = 0x31c0ull | x; } else { res = 0x6c70ull | (x 0x0007ull); } } else { if (x 0x16345785d8aull) { q = 17; ind = 1; } else if (x 0xde0b6b3a764ull) { q = 18; ind = 2; } else if (x 0x8ac7230489e8ull) { q = 19; ind = 3; } else { q = 20; ind = 4; } if (q = 19) { __bid_round64_2_18 ( q, ind, x, res, incr_exp, is_midpoint_lt_even, is_midpoint_gt_even, is_inexact_lt_midpoint, is_inexact_gt_midpoint); } else { x128.w[1] = 0x0; x128.w[0] = x; __bid_round128_19_38 (q, ind, x128, res128, incr_exp, is_midpoint_lt_even, is_midpoint_gt_even, is_inexact_lt_midpoint, is_inexact_gt_midpoint); res = res128.w[0]; } if (incr_exp) ind++; if (is_inexact_lt_midpoint || is_inexact_gt_midpoint || is_midpoint_lt_even || is_midpoint_gt_even) *__bid_IDEC_glbflags |= 0x0020; if (res 0x0020ull) { res = (((UINT64) ind + 398) 53) | res; } else { res = 0x6000ull | (((UINT64) ind + 398) 51) | (res 0x0007ull); } } return(res);; } --- Compiling with -fPIC -O2, the differences between your patch and mine are --- bad.s 2014-01-19 06:10:28.006570325 -0800 +++ foo.s 2014-01-19 06:11:46.117754696 -0800 @@ -84,19 +84,18 @@ __bid64_from_uint64: movabsq $9007199254740991, %rax cmpq %rax, %rbx jbe .L23 - movl %ebp, %edx leaq 88(%rsp), %rsp .cfi_remember_state .cfi_def_cfa_offset 24 movabsq $2251799813685247, %rax - movl %edx, %edx + movl %ebp, %edx andq %rbx, %rax - movabsq $6917529027641081856, %rcx popq %rbx .cfi_def_cfa_offset 16 + movabsq $6917529027641081856, %rcx addq $398, %rdx - orq %rcx, %rax salq $51, %rdx + orq %rcx, %rax popq %rbp .cfi_def_cfa_offset 8 orq %rdx, %rax @@ -154,7 +153,6 @@ __bid64_from_uint64: leaq 88(%rsp), %rsp .cfi_remember_state .cfi_def_cfa_offset 24 - movl %eax, %eax addq $398, %rax salq $53, %rax orq %rbx, %rax My patch removes 2 extra (set
[Patch, libgfortran] PR59771, PR59774, and PR59836 Bugs in FORMATs Fw.0, Gw.0, and Gw.d
The attached patch fixes these bugs and adds the tests. See the PRs for = the rationale of the changes. Regression tested on x86_64-apple-darwin13 and powerpc-apple-darwin9. OK for trunk, 4.8.3, and 4.7.4 (after testing)? Regards, Dominique CL Description: Binary data patch-59774t Description: Binary data
Re: PATCH: PR target/59379: [4.9 Regression] gomp_init_num_threads is compiled into an infinite loop with --with-arch=corei7 --with-cpu=slm
On Sun, Jan 19, 2014 at 3:20 PM, H.J. Lu hjl.to...@gmail.com wrote: For LEA operation with SImode_address_operand, which zero-extends SImode to DImode, ix86_split_lea_for_addr turns (set (reg:DI) ...) into (set (reg:SI) ...) We need to do (set (reg:DI) (zero_extend:DI (reg:SI))) at the end. If the LEA operation is (set (reg:DI) (zero_extend:DI (reg:SI))) ree pass should remove these. However, we can just emit zero-extend insn at the end of sequence, and ree (which is located after post-reload split) should handle it: --cut here-- Index: config/i386/i386.md === --- config/i386/i386.md (revision 206753) +++ config/i386/i386.md (working copy) @@ -5428,12 +5428,17 @@ operands[0] = SET_DEST (pat); operands[1] = SET_SRC (pat); - /* Emit all operations in SImode for zero-extended addresses. Recall - that x86_64 inheretly zero-extends SImode operations to DImode. */ + /* Emit all operations in SImode for zero-extended addresses. */ if (SImode_address_operand (operands[1], VOIDmode)) mode = SImode; ix86_split_lea_for_addr (curr_insn, operands, mode); + + /* Zero-extend return register to DImode for zero-extended addresses. */ + if (mode != MODEmode) +emit_insn (gen_zero_extendsidi2 + (operands[0], gen_lowpart ((mode), operands[0]))); + DONE; } [(set_attr type lea) --cut here-- The patch was tested with a testcase from Comment #9 of the PR using -O --march=corei7 -mtune=slm, and resulting binary runs without problems. Yes, the resulting GCC works correctly. However, we generate extra (set (reg:DI) (zero_extend:DI (reg:SI))) It is because we generate (set (reg:SI) (reg:SI) (set (reg:DI) (zero_extend:DI (reg:SI))) REE pass doesn't know (set (reg:SI) (reg:SI) has an implicit ZERO_EXTEND. Here is a testcase: This is the correct sequence,and REE pass should be improved to handle this situation. Note, that the problem was that we assumed SImode operations (including move) have implicit DImode zero-extend, but in fact we haven't communicate this to the compiler in a proper way. So, I propose we go with my patch and file an enhancement PR for the REE pass. Uros.
Re: PATCH: PR target/59379: [4.9 Regression] gomp_init_num_threads is compiled into an infinite loop with --with-arch=corei7 --with-cpu=slm
On Sun, Jan 19, 2014 at 6:24 AM, Uros Bizjak ubiz...@gmail.com wrote: On Sun, Jan 19, 2014 at 3:20 PM, H.J. Lu hjl.to...@gmail.com wrote: For LEA operation with SImode_address_operand, which zero-extends SImode to DImode, ix86_split_lea_for_addr turns (set (reg:DI) ...) into (set (reg:SI) ...) We need to do (set (reg:DI) (zero_extend:DI (reg:SI))) at the end. If the LEA operation is (set (reg:DI) (zero_extend:DI (reg:SI))) ree pass should remove these. However, we can just emit zero-extend insn at the end of sequence, and ree (which is located after post-reload split) should handle it: --cut here-- Index: config/i386/i386.md === --- config/i386/i386.md (revision 206753) +++ config/i386/i386.md (working copy) @@ -5428,12 +5428,17 @@ operands[0] = SET_DEST (pat); operands[1] = SET_SRC (pat); - /* Emit all operations in SImode for zero-extended addresses. Recall - that x86_64 inheretly zero-extends SImode operations to DImode. */ + /* Emit all operations in SImode for zero-extended addresses. */ if (SImode_address_operand (operands[1], VOIDmode)) mode = SImode; ix86_split_lea_for_addr (curr_insn, operands, mode); + + /* Zero-extend return register to DImode for zero-extended addresses. */ + if (mode != MODEmode) +emit_insn (gen_zero_extendsidi2 + (operands[0], gen_lowpart ((mode), operands[0]))); + DONE; } [(set_attr type lea) --cut here-- The patch was tested with a testcase from Comment #9 of the PR using -O --march=corei7 -mtune=slm, and resulting binary runs without problems. Yes, the resulting GCC works correctly. However, we generate extra (set (reg:DI) (zero_extend:DI (reg:SI))) It is because we generate (set (reg:SI) (reg:SI) (set (reg:DI) (zero_extend:DI (reg:SI))) REE pass doesn't know (set (reg:SI) (reg:SI) has an implicit ZERO_EXTEND. Here is a testcase: This is the correct sequence,and REE pass should be improved to handle this situation. Note, that the problem was that we assumed SImode operations (including move) have implicit DImode zero-extend, but in fact we haven't communicate this to the compiler in a proper way. So, I propose we go with my patch and file an enhancement PR for the REE pass. That is fine with me. Please install it on all affected branches and close the PR. I will open a new PR for REE pass. Thanks. -- H.J.
Re: PATCH: PR target/59379: [4.9 Regression] gomp_init_num_threads is compiled into an infinite loop with --with-arch=corei7 --with-cpu=slm
On Sun, Jan 19, 2014 at 3:30 PM, H.J. Lu hjl.to...@gmail.com wrote: For LEA operation with SImode_address_operand, which zero-extends SImode to DImode, ix86_split_lea_for_addr turns (set (reg:DI) ...) into (set (reg:SI) ...) We need to do (set (reg:DI) (zero_extend:DI (reg:SI))) at the end. If the LEA operation is (set (reg:DI) (zero_extend:DI (reg:SI))) ree pass should remove these. However, we can just emit zero-extend insn at the end of sequence, and ree (which is located after post-reload split) should handle it: --cut here-- Index: config/i386/i386.md === --- config/i386/i386.md (revision 206753) +++ config/i386/i386.md (working copy) @@ -5428,12 +5428,17 @@ operands[0] = SET_DEST (pat); operands[1] = SET_SRC (pat); - /* Emit all operations in SImode for zero-extended addresses. Recall - that x86_64 inheretly zero-extends SImode operations to DImode. */ + /* Emit all operations in SImode for zero-extended addresses. */ if (SImode_address_operand (operands[1], VOIDmode)) mode = SImode; ix86_split_lea_for_addr (curr_insn, operands, mode); + + /* Zero-extend return register to DImode for zero-extended addresses. */ + if (mode != MODEmode) +emit_insn (gen_zero_extendsidi2 + (operands[0], gen_lowpart ((mode), operands[0]))); + DONE; } [(set_attr type lea) --cut here-- The patch was tested with a testcase from Comment #9 of the PR using -O --march=corei7 -mtune=slm, and resulting binary runs without problems. Yes, the resulting GCC works correctly. However, we generate extra (set (reg:DI) (zero_extend:DI (reg:SI))) It is because we generate (set (reg:SI) (reg:SI) (set (reg:DI) (zero_extend:DI (reg:SI))) REE pass doesn't know (set (reg:SI) (reg:SI) has an implicit ZERO_EXTEND. Here is a testcase: This is the correct sequence,and REE pass should be improved to handle this situation. Note, that the problem was that we assumed SImode operations (including move) have implicit DImode zero-extend, but in fact we haven't communicate this to the compiler in a proper way. So, I propose we go with my patch and file an enhancement PR for the REE pass. That is fine with me. Please install it on all affected branches and close the PR. I will open a new PR for REE pass. Installed with following ChangeLog: 2014-01-18 Uros Bizjak ubiz...@gmail.com H.J. Lu hongjiu...@intel.com PR target/59379 * config/i386/i386.md (*leamode): Zero-extend return register to DImode for zero-extended addresses. Bootstrapped and regression tested on x86_64-pc-linux-gnu, will backport in a couple of days. Uros.
[MIPS, committed] Add -ffat-lto-objects to pr54240.c
Add -ffat-lto-objects to pr54240.c to fix an UNRESOLVED on the scan-tree-dump. Tested on mips64-linux-gnu and applied. There's a similar failure for octeon2-pipe-1.c but I'm going to fix that in a different way. Thanks, Richard gcc/testsuite/ * gcc.target/mips/pr54240.c: Add -ffat-lto-objects. Index: gcc/testsuite/gcc.target/mips/pr54240.c === --- gcc/testsuite/gcc.target/mips/pr54240.c 2012-08-27 17:31:40.0 +0100 +++ gcc/testsuite/gcc.target/mips/pr54240.c 2014-01-19 10:22:21.167152052 + @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options -fdump-tree-phiopt-details isa=4 } */ +/* { dg-options -fdump-tree-phiopt-details -ffat-lto-objects isa=4 } */ /* { dg-skip-if code quality test { *-*-* } { -O0 -O1 } { } } */ typedef struct s {
[testsuite] Require -ffat-lto-objects for scan-rtl-dump*
We don't compile to RTL or machine instructions for lean LTO objects, so the scan-assembler tests force -ffat-lto-objects to be used instead. This patch extends that to scan-rtl-dump*. Tested on mips64-linux-gnu, where it fixes an UNRESOLVED on gcc.target/mips/octeon2-pipe-1.c. OK to install? Thanks, Richard gcc/testsuite/ * lib/target-supports.exp (force_conventional_output_for): New procedure. * lib/scanasm.exp (scan-assembler_required_options) (scan-assembler-not_required_options) (scan-assembler-times_required_options): Replace with force_conventional_output_fors. * lib/scanrtl.exp: Force conventional output for all rtl dump scans. * gcc.target/mips/octeon-pipe-1.c: Remove -ffat-lto-objects. Index: gcc/testsuite/lib/target-supports.exp === --- gcc/testsuite/lib/target-supports.exp 2014-01-19 10:17:01.078710840 + +++ gcc/testsuite/lib/target-supports.exp 2014-01-19 10:17:01.196711753 + @@ -5664,3 +5664,17 @@ proc check_effective_target_fenv_excepti } } -std=gnu99] } + +# Record that dg-final test TEST requires convential compilation. + +proc force_conventional_output_for { test } { +if { [info proc $test] == } { + perror $test does not exist + exit 1 +} +proc ${test}_required_options {} { + global gcc_force_conventional_output + return $gcc_force_conventional_output +} +} + Index: gcc/testsuite/lib/scanasm.exp === --- gcc/testsuite/lib/scanasm.exp 2014-01-19 10:17:01.076710824 + +++ gcc/testsuite/lib/scanasm.exp 2014-01-19 10:17:01.195711745 + @@ -82,10 +82,7 @@ proc scan-assembler { args } { dg-scan scan-assembler 1 $testcase $output_file $args } -proc scan-assembler_required_options { args } { -global gcc_force_conventional_output -return $gcc_force_conventional_output -} +force_conventional_output_for scan-assembler # Check that a pattern is not present in the .s file produced by the # compiler. See dg-scan for details. @@ -97,10 +94,7 @@ proc scan-assembler-not { args } { dg-scan scan-assembler-not 0 $testcase $output_file $args } -proc scan-assembler-not_required_options { args } { -global gcc_force_conventional_output -return $gcc_force_conventional_output -} +force_conventional_output_for scan-assembler-not # Return the scan for the assembly for hidden visibility. @@ -259,10 +253,7 @@ proc scan-assembler-times { args } { } } -proc scan-assembler-times_required_options { args } { -global gcc_force_conventional_output -return $gcc_force_conventional_output -} +force_conventional_output_for scan-assembler-times # Utility for scanning demangled compiler result, invoked via dg-final. # Call pass if pattern is present, otherwise fail. Index: gcc/testsuite/lib/scanrtl.exp === --- gcc/testsuite/lib/scanrtl.exp 2014-01-19 10:17:01.076710824 + +++ gcc/testsuite/lib/scanrtl.exp 2014-01-19 10:17:01.195711745 + @@ -42,6 +42,8 @@ proc scan-rtl-dump { args } { } } +force_conventional_output_for scan-rtl-dump + # Call pass if pattern is present given number of times, otherwise fail. # Argument 0 is the regexp to match # Argument 1 is number of times the regexp must be found @@ -66,6 +68,8 @@ proc scan-rtl-dump-times { args } { } } +force_conventional_output_for scan-rtl-dump-times + # Call pass if pattern is not present, otherwise fail. # # Argument 0 is the regexp to match @@ -90,6 +94,8 @@ proc scan-rtl-dump-not { args } { } } +force_conventional_output_for scan-rtl-dump-not + # Utility for scanning demangled compiler result, invoked via dg-final. # Call pass if pattern is present, otherwise fail. # @@ -115,6 +121,8 @@ proc scan-rtl-dump-dem { args } { } } +force_conventional_output_for scan-rtl-dump-dem + # Call pass if demangled pattern is not present, otherwise fail. # # Argument 0 is the regexp to match @@ -139,3 +147,5 @@ proc scan-rtl-dump-dem-not { args } { \[0-9\]\[0-9\]\[0-9\]r.[lindex $args 1] } } + +force_conventional_output_for scan-rtl-dump-dem-not Index: gcc/testsuite/gcc.target/mips/octeon-pipe-1.c === --- gcc/testsuite/gcc.target/mips/octeon-pipe-1.c 2014-01-19 10:17:01.076710824 + +++ gcc/testsuite/gcc.target/mips/octeon-pipe-1.c 2014-01-19 10:17:01.194711738 + @@ -1,6 +1,6 @@ /* Check that we use the octeon pipeline description. */ /* { dg-do compile } */ -/* { dg-options -march=octeon -fschedule-insns2 -fdump-rtl-sched2 -ffat-lto-objects } */ +/* { dg-options -march=octeon -fschedule-insns2 -fdump-rtl-sched2 } */ /* { dg-skip-if code quality test { *-*-* } { -O0 } { } } */ NOMIPS16 int f
PR 52125: Detecting which operands are used in an asm
The MIPS %hi and %lo relocation operators act as a pair on REL targets; you need to see the partnering %lo in order to calculate the addend for a %hi and detect carries properly. The assembler therefore complains if %hi is used without a corresponding %lo. The MIPS backend tries to remove unmatched %his in mips_reorg. The problem is that it can wrongly keep a %hi(foo) in cases like: asm ( : =m (foo)); where a LO_SUM MEM appears as an operand at the rtl level but where %lo(foo) doesn't appear in the assembly code. It's very hard without fully parsing an asm to know whether it will need the LO_SUM or not. E.g. the operand could appear in the asm string but could be protected by an .if or only be used in a comment. But it should be safe to assume that the LO_SUM in operand N isn't needed if %N or %letterN doesn't appear in the string, since AFAIK there's no other way for the asm to know which register contains the high part. Specifically, things like: asm (sw $0,foo : =m (foo)); work fine either way, since the %hi is implicit in the SW macro. I split out the routine to detect which operands are used since it seemed like it might be more generally useful. Tested on mips64-linux-gnu, where it fixes the gcc.dg/guality/pr36728-2.c failures for -mabi=32. OK for the target-independent bits? Thanks, Richard gcc/ PR target/52125 * rtl.h (get_referenced_operands): Declare. * recog.c (get_referenced_operands): New function. * config/mips/mips.c (mips_reorg_process_insns): Check which asm operands have been referenced when recording LO_SUM references. gcc/testsuite/ PR target/52125 * gcc.dg/pr48774.c: Remove skip for mips_rel. * gcc.target/mips/pr52125.c: New test. Index: gcc/rtl.h === --- gcc/rtl.h 2014-01-18 09:57:11.042577719 + +++ gcc/rtl.h 2014-01-19 11:01:36.970759960 + @@ -2169,6 +2169,7 @@ extern rtx extract_asm_operands (rtx); extern int asm_noperands (const_rtx); extern const char *decode_asm_operands (rtx, rtx *, rtx **, const char **, enum machine_mode *, location_t *); +extern void get_referenced_operands (const char *, bool *, unsigned int); extern enum reg_class reg_preferred_class (int); extern enum reg_class reg_alternate_class (int); Index: gcc/recog.c === --- gcc/recog.c 2014-01-02 22:16:05.816301145 + +++ gcc/recog.c 2014-01-19 11:01:00.097426240 + @@ -1620,6 +1620,50 @@ decode_asm_operands (rtx body, rtx *oper return ASM_OPERANDS_TEMPLATE (asmop); } +/* Parse inline assembly string STRING and determine which operands are + referenced by % markers. For the first NOPERANDS operands, set USED[I] + to true if operand I is referenced. + + This is intended to distinguish barrier-like asms such as: + + asm ( : =m (...)); + + from real references such as: + + asm (sw\t$0, %0 : =m (...)); */ + +void +get_referenced_operands (const char *string, bool *used, +unsigned int noperands) +{ + memset (used, 0, sizeof (bool) * noperands); + const char *p = string; + while (*p) +switch (*p) + { + case '%': + p += 1; + /* A letter followed by a digit indicates an operand number. */ + if (ISALPHA (p[0]) ISDIGIT (p[1])) + p += 1; + if (ISDIGIT (*p)) + { + char *endptr; + unsigned long opnum = strtoul (p, endptr, 10); + if (endptr != p opnum noperands) + used[opnum] = true; + p = endptr; + } + else + p += 1; + break; + + default: + p++; + break; + } +} + /* Check if an asm_operand matches its constraints. Return 0 if ok, = 0 if bad, 0 if inconclusive. */ Index: gcc/config/mips/mips.c === --- gcc/config/mips/mips.c 2014-01-18 09:57:11.628582243 + +++ gcc/config/mips/mips.c 2014-01-19 11:31:18.743731497 + @@ -16095,7 +16095,23 @@ mips_reorg_process_insns (void) for (insn = get_insns (); insn != 0; insn = NEXT_INSN (insn)) FOR_EACH_SUBINSN (subinsn, insn) if (USEFUL_INSN_P (subinsn)) - for_each_rtx (PATTERN (subinsn), mips_record_lo_sum, htab); + { + rtx body = PATTERN (insn); + int noperands = asm_noperands (body); + if (noperands = 0) + { + rtx *ops = XALLOCAVEC (rtx, noperands); + bool *used = XALLOCAVEC (bool, noperands); + const char *string = decode_asm_operands (body, ops, NULL, NULL, + NULL, NULL); + get_referenced_operands (string, used, noperands); + for (int i = 0; i noperands; ++i) + if (used[i]) + for_each_rtx (ops[i],
Re: Ping: [PATCH] Prevent crash when expand movstr fail when movstr pattern is defined
Jakub Jelinek ja...@redhat.com writes: On Sat, Jan 18, 2014 at 10:37:18AM +, Richard Sandiford wrote: Review ping for this patch. IMO it almost counts as obviously correct but just in case... Kito Cheng k...@0xlab.org writes: expand_movstr is work fine when we don't define movstr pattern or always expand it successfully, however it's will crash when if movstr expand fail since expand_insn expect always expand successfully (it's place a gcc_unreachable() when expand fail). this patch use maybe_expand_insn instead of expand_insn, check it done or not and just return NULL_RTX for generate a libcall if fail to expand movstr. 2014-01-11 Kito Cheng k...@0xlab.org * gcc/builtins.c (expand_movstr): Check movstr expand done or fail. Ok. Thanks. It doesn't look like Kito has commit access so I went ahead and applied it. Kito, thanks for the patch. Richard
[PATCH][RFC] Fix PR59860
The following patch fixes PR59860 by removing the only folding builtins.c does that can end up recursing to GIMPLE call stmt folding. It does that via strcat - strlen + strcpy folding and then folding the strlen gimple stmt via gimplify which then can use the SSA web to fold that to a constant and then the strcpy call to memcpy. This confuses the virtual operand updating code - not that it ends up creating wrong virtual SSA form but by bogously marking virtual operands for renaming through the operand scanner as the folding on the just gimplified sequence doesn't see any VOPs yet. Bootstrapped on x86_64-unknown-linux-gnu, testing reveals that I have to adjust gcc.c-torture/execute/builtins/strcat.c expectations and gcc.dg/strlenopt-* likely because of different input. I still think this patch is better than the second option, avoiding to call fold_stmt from the gimplifier in this case (either by a new ctx flag or looking at ctx-into_ssa). I also think that fixing this by scheduling update-ssa after objsz is wrong. Any opinions? Maybe any different preferences for branch / trunk? Long term all sophisticated call stmt foldings should move from GENERIC folding in builtins.c to GIMPLE folding in gimple-fold.c of course (retaining only constant folding in builtins.c for FEs use). And the gimplifier shouldn't fold itself. Thanks, Richard. 2014-01-17 Richard Biener rguent...@suse.de PR middle-end/59860 * builtins.c (fold_builtin_strcat): Remove case better handled by tree-ssa-strlen.c * gcc.dg/pr59860.c: New testcase. Index: gcc/builtins.c === *** gcc/builtins.c (revision 206714) --- gcc/builtins.c (working copy) *** fold_builtin_strcat (location_t loc ATTR *** 11749,11789 if (p *p == '\0') return dst; - if (optimize_insn_for_speed_p ()) - { - /* See if we can store by pieces into (dst + strlen(dst)). */ - tree newdst, call; - tree strlen_fn = builtin_decl_implicit (BUILT_IN_STRLEN); - tree strcpy_fn = builtin_decl_implicit (BUILT_IN_STRCPY); - - if (!strlen_fn || !strcpy_fn) - return NULL_TREE; - - /* If we don't have a movstr we don't want to emit an strcpy -call. We have to do that if the length of the source string -isn't computable (in that case we can use memcpy probably -later expanding to a sequence of mov instructions). If we -have movstr instructions we can emit strcpy calls. */ - if (!HAVE_movstr) - { - tree len = c_strlen (src, 1); - if (! len || TREE_SIDE_EFFECTS (len)) - return NULL_TREE; - } - - /* Stabilize the argument list. */ - dst = builtin_save_expr (dst); - - /* Create strlen (dst). */ - newdst = build_call_expr_loc (loc, strlen_fn, 1, dst); - /* Create (dst p+ strlen (dst)). */ - - newdst = fold_build_pointer_plus_loc (loc, dst, newdst); - newdst = builtin_save_expr (newdst); - - call = build_call_expr_loc (loc, strcpy_fn, 2, newdst, src); - return build2 (COMPOUND_EXPR, TREE_TYPE (dst), call, dst); - } return NULL_TREE; } } --- 11749,11754 Index: gcc/testsuite/gcc.dg/pr59860.c === *** gcc/testsuite/gcc.dg/pr59860.c (revision 0) --- gcc/testsuite/gcc.dg/pr59860.c (working copy) *** *** 0 --- 1,15 + /* { dg-do compile } */ + /* { dg-options -O } */ + + extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__gnu_inline__)) __attribute__ ((__artificial__)) char * __attribute__ ((__nothrow__ , __leaf__)) + strcat (char *__restrict __dest, const char *__restrict __src) + { + return __builtin___strcat_chk (__dest, __src, __builtin_object_size (__dest, 2 1)); + } + static char raw_decode; + void foo (char **argv, char *outfilename) + { + if (**argv == 'r') + raw_decode = 1; + strcat (outfilename, raw_decode ? .raw : .wav); + }
Re: [PATCH][RFC] Fix PR59860
On Sun, Jan 19, 2014 at 07:05:12PM +0100, Richard Biener wrote: The following patch fixes PR59860 by removing the only folding builtins.c does that can end up recursing to GIMPLE call stmt folding. It does that via strcat - strlen + strcpy folding and then folding the strlen gimple stmt via gimplify which then can use the SSA web to fold that to a constant and then the strcpy call to memcpy. This confuses the virtual operand updating code - not that it ends up creating wrong virtual SSA form but by bogously marking virtual operands for renaming through the operand scanner as the folding on the just gimplified sequence doesn't see any VOPs yet. Bootstrapped on x86_64-unknown-linux-gnu, testing reveals that I have to adjust gcc.c-torture/execute/builtins/strcat.c expectations and gcc.dg/strlenopt-* likely because of different input. I still think this patch is better than the second option, avoiding to call fold_stmt from the gimplifier in this case (either by a new ctx flag or looking at ctx-into_ssa). I also think that fixing this by scheduling update-ssa after objsz is wrong. Any opinions? Maybe any different preferences for branch / trunk? If you verify that strlen pass does the right thing here (I hope it does, but haven't verified), then I think this is the way for the trunk, not sure about the branch, I'd prefer there something less intrusive at this point, even if it is say just through setting some global flag that will disable the strcat folding at the problematic spot, or folds it on the tree before gimplification, or gimplifies operands and builds the call in gimple by hand for the strcat case. 2014-01-17 Richard Biener rguent...@suse.de PR middle-end/59860 * builtins.c (fold_builtin_strcat): Remove case better handled by tree-ssa-strlen.c Missing dot at the end ;) * gcc.dg/pr59860.c: New testcase. Jakub
[committed] Fix length of long non-pic millicode calls on PA
The attached change fixes a segmentation fault bootstrapping GCC on hppa2.0-hp-hpux11.11. The length of long non-pic millicode calls does not depend on TARGET_LONG_ABS_CALL. As a result, the length of long non-pic millicode calls was being overestimated. This broke the millicode call to $$sh_func_adrs. It has a couple of branches that branch past the call when a call isn't needed. Tested on hppa2.0w-hp-hpux11.11 and hppa-unknown-linux-gnu. Committed to active branches. Dave -- John David Anglin dave.ang...@bell.net 2014-01-19 John David Anglin dang...@gcc.gnu.org * config/pa/pa.c (pa_attr_length_millicode_call): Correct length of long non-pic millicode calls. Index: config/pa/pa.c === --- config/pa/pa.c (revision 206767) +++ config/pa/pa.c (working copy) @@ -7534,7 +7528,7 @@ if (!TARGET_LONG_CALLS distance MAX_PCREL17F_OFFSET) return 8; - if (TARGET_LONG_ABS_CALL !flag_pic) + if (!flag_pic) return 12; return 24;
[PATCH, testsuite]: g++.dg/pr49718.C: Add -mno-explicit-relocs for alpha*-*-* targets.
Hello! Alpha needs -mno-explicit-relocs to count number of function calls properly. 2014-01-19 Uros Bizjak ubiz...@gmail.com * g++.dg/pr49718.C: Add -mno-explicit-relocs for alpha*-*-* targets. Tested on alphaev6-pc-linux-gnu and committed to mainline SVN. Uros. Index: g++.dg/pr49718.C === --- g++.dg/pr49718.C(revision 206758) +++ g++.dg/pr49718.C(working copy) @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options -O2 -finstrument-functions } */ +/* { dg-additional-options -mno-explicit-relocs { target alpha*-*-* } } */ /* { dg-final { scan-assembler-times __cyg_profile_func_enter 1} } */ #define NOINSTR __attribute__((no_instrument_function))
[PING]Resolve pr44194-1.c failure by refining scan-rtl-dump-not pattern
On 10/01/14 11:28, Renlin Li wrote: Hi Eric, Thank you for your suggestion! I have made the adjustment and test it. Please check the new attachment. Regards, Renlin Li On 10/01/14 10:42, Eric Botcazou wrote: This patch will resolve testsuite/gcc.dg/pr44194-1.c failure observed in aarch64 target by refining the second scan-rtl-dump-not pattern. For aarch64 target, the following barrier is generated which will exactly match the current pattern insn \[^\n\]*set \\(mem. This is undesired. By adjusting the pattern, this scenario is excluded. (insn 29 28 30 (set (mem:BLK (scratch) [0 A8]) (unspec:BLK [ (reg/f:DI 31 sp) (reg/f:DI 29 x29) ] UNSPEC_PRLG_STK)) pr44194-1.c:10 704 {stack_tie} (nil)) Please use scratch instead of stack_tie as marker, it's more general. Hi, Any comments? Kind regards, Renlin Li
Re: [Patch, libgfortran] PR59771, PR59774, and PR59836 Bugs in FORMATs Fw.0, Gw.0, and Gw.d
On 01/19/2014 06:24 AM, Dominique d'Humières wrote: The attached patch fixes these bugs and adds the tests. See the PRs for = the rationale of the changes. Regression tested on x86_64-apple-darwin13 and powerpc-apple-darwin9. OK for trunk, 4.8.3, and 4.7.4 (after testing)? Regards, Dominique Yes OK, and I will commit for you. Thanks for the work. Jerry
Re: [Patch, libgfortran] PR59771, PR59774, and PR59836 Bugs in FORMATs Fw.0, Gw.0, and Gw.d
Yes OK, and I will commit for you. Thanks Jerry. While trying to back port the patch, I have found a leftover of my previous attempts: if (ft != FMT_F before == 0 w 0 d == 0 p == 0) should be if (ft != FMT_F w 0 d == 0 p == 0) The second change was needed for 4.7 (still one failure after it): if (nzero_real == d digits[0] = char) changed to if (digits[0] = char) I am attaching the updated patch. Dominique patch-59774t2 Description: Binary data
Re: experimental testsuite patch
So here is another patch proposal with the faulty debug assertion commented for the moment. 2014-01-20 François Dumont fdum...@gcc.gnu.org * scripts/create_testsuite_files: Add testsuite/experimental in the list of folders to introspect for tests. * include/experimental/string_view (basic_string_view::operator[]): Comment _GLIBCXX_DEBUG_ASSERT, incompatible with constexpr qualifier. (basic_string_view::front()): Likewise. (basic_string_view::back()): Likewise. * testsuite/experimental/string_view/element_access/wchar_t/2.cc: Merge dg-options directives into one. * testsuite/experimental/string_view/element_access/char/2.cc: Likewise. Remove invalid experimental namespace scope on string_view_type. Tested under Linux x86_64 normal, debug modes. Ok to commit ? François On 01/15/2014 06:43 PM, Jonathan Wakely wrote: On 15 January 2014 17:22, Paolo Carlini wrote: On 01/15/2014 06:17 PM, Jonathan Wakely wrote: I think we decided we want functions to be constexpr in debug mode if they are constexpr in normal mode. I think std::array has solved the same problem without losing the constexpr qualifier. Yes, I think the only complete solution we know of is that kind of strategy. But IMO it could wait, for the time being we could just comment out the checks and add comments about that (make sure first that the various make check* are clean as we are approaching the release of 4.9.0) Yes, that would be the safest option. The assertions are not essential. Index: include/experimental/string_view === --- include/experimental/string_view (revision 206782) +++ include/experimental/string_view (working copy) @@ -181,7 +181,8 @@ constexpr const _CharT operator[](size_type __pos) const { - _GLIBCXX_DEBUG_ASSERT(__pos = this-_M_len); + // TODO: Assert to restore in a way compatible with the constexpr. + // _GLIBCXX_DEBUG_ASSERT(__pos = this-_M_len); return *(this-_M_str + __pos); } @@ -200,14 +201,16 @@ constexpr const _CharT front() const { - _GLIBCXX_DEBUG_ASSERT(this-_M_len 0); + // TODO: Assert to restore in a way compatible with the constexpr. + // _GLIBCXX_DEBUG_ASSERT(this-_M_len 0); return *this-_M_str; } constexpr const _CharT back() const { - _GLIBCXX_DEBUG_ASSERT(this-_M_len 0); + // TODO: Assert to restore in a way compatible with the constexpr. + // _GLIBCXX_DEBUG_ASSERT(this-_M_len 0); return *(this-_M_str + this-_M_len - 1); } Index: scripts/create_testsuite_files === --- scripts/create_testsuite_files (revision 206782) +++ scripts/create_testsuite_files (working copy) @@ -32,7 +32,7 @@ # This is the ugly version of everything but the current directory. It's # what has to happen when find(1) doesn't support -mindepth, or -xtype. dlist=`echo [0-9][0-9]*` -dlist=$dlist abi backward ext performance tr1 tr2 decimal +dlist=$dlist abi backward ext performance tr1 tr2 decimal experimental find $dlist ( -type f -o -type l ) -name *.cc -print $tmp.01 find $dlist ( -type f -o -type l ) -name *.c -print $tmp.02 cat $tmp.01 $tmp.02 | sort $tmp.1 Index: testsuite/experimental/string_view/element_access/wchar_t/2.cc === --- testsuite/experimental/string_view/element_access/wchar_t/2.cc (revision 206782) +++ testsuite/experimental/string_view/element_access/wchar_t/2.cc (working copy) @@ -1,6 +1,5 @@ -// { dg-options -std=gnu++1y } // { dg-do run { xfail *-*-* } } -// { dg-options -O0 } +// { dg-options -std=gnu++1y -O0 } // { dg-require-debug-mode } // Copyright (C) 2013-2014 Free Software Foundation, Inc. Index: testsuite/experimental/string_view/element_access/char/2.cc === --- testsuite/experimental/string_view/element_access/char/2.cc (revision 206782) +++ testsuite/experimental/string_view/element_access/char/2.cc (working copy) @@ -1,6 +1,5 @@ -// { dg-options -std=gnu++1y } // { dg-do run { xfail *-*-* } } -// { dg-options -O0 } +// { dg-options -std=gnu++1y -O0 } // { dg-require-debug-mode } // Copyright (C) 2013-2014 Free Software Foundation, Inc. @@ -26,6 +25,6 @@ main() { typedef std::experimental::string_view string_view_type; - experimental::string_view_type s; + string_view_type s; s[0]; // abort }
Re: [Patch] Fix regex multiple consecutive quantifiers bug.
On Sun, Jan 19, 2014 at 5:01 AM, Paolo Carlini paolo.carl...@oracle.com wrote: Ok. Please remove 2013 as copyright year for the tescase. I also think you can avoid the auxiliary includes. Oops, fixed, including fixing incorrect file name :) Tested and committed. -- Regards, Tim Shen commit 5e36fe9d0d2dbbb2141016d1062bda4fb61fe8ec Author: tim timshe...@gmail.com Date: Sat Jan 18 23:35:09 2014 -0500 2014-01-19 Tim Shen timshe...@gmail.com * include/bits/regex_compiler.h (_Comipler::_M_quantifier()): Fix parse error of multiple consecutive quantifiers like a**. * include/bits/regex_compiler.tcc (_Comipler::_M_quantifier()): Likewise. * testsuite/28_regex/basic_regex/multiple_quantifiers.cc: New. diff --git a/libstdc++-v3/include/bits/regex_compiler.h b/libstdc++-v3/include/bits/regex_compiler.h index 216f8fb..fe2e5f1 100644 --- a/libstdc++-v3/include/bits/regex_compiler.h +++ b/libstdc++-v3/include/bits/regex_compiler.h @@ -83,7 +83,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION bool _M_assertion(); - void + bool _M_quantifier(); bool diff --git a/libstdc++-v3/include/bits/regex_compiler.tcc b/libstdc++-v3/include/bits/regex_compiler.tcc index 621e43f..128dac1 100644 --- a/libstdc++-v3/include/bits/regex_compiler.tcc +++ b/libstdc++-v3/include/bits/regex_compiler.tcc @@ -135,7 +135,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return true; if (this-_M_atom()) { - this-_M_quantifier(); + while (this-_M_quantifier()); return true; } return false; @@ -173,7 +173,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } templatetypename _TraitsT -void +bool _Compiler_TraitsT:: _M_quantifier() { @@ -276,6 +276,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } _M_stack.push(__e); } + else + return false; + return true; } #define __INSERT_REGEX_MATCHER(__func, args...)\ diff --git a/libstdc++-v3/testsuite/28_regex/basic_regex/multiple_quantifiers.cc b/libstdc++-v3/testsuite/28_regex/basic_regex/multiple_quantifiers.cc new file mode 100644 index 000..5670cbb --- /dev/null +++ b/libstdc++-v3/testsuite/28_regex/basic_regex/multiple_quantifiers.cc @@ -0,0 +1,33 @@ +// { dg-options -std=gnu++11 } + +// Copyright (C) 2014 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// http://www.gnu.org/licenses/. + +// 28.8 basic_regex +// Tests multiple consecutive quantifiers + +#include regex + +using namespace std; + +int +main() +{ + regex re1(a++); + regex re2((a+)+); + return 0; +}
Do not produce empty try-finally statements
Hi, when compiling: struct A { virtual int foo (void) {return 42;} }; int test (void) { struct A a, *b=a; return b-foo(); } We wind up the following useless EH: int test() () { int D.2235; int (*__vtbl_ptr_type) () * D.2236; int (*__vtbl_ptr_type) () D.2237; struct A a; struct A * b; try { A::A (a); b = a; D.2236 = b-_vptr.A; D.2237 = *D.2236; D.2235 = OBJ_TYPE_REF(D.2237;b-0) (b); return D.2235; } finally { a = {CLOBBER}; } } while ehcleanup gets rid of the try..finally code later, it happens only with optimizing compilation. With -O0 the EH gets all the way down to the binary that is rather embarassing. I believe this is a regression since CLOBBERs were introduced. Gimplifier already has logic to skip empty cleanups, the patch bellow just makes it to ignore clobbers. I checked that empty_body_p is used only in gomp lowering in very similar scenario, so I think it is safe to change them and we don't need to introduce new statement. On related note however, the ehcleanup pass itself is using nondebug_stmt to detect empty cleanups. Again I think it is bug. I wonder if we should not invent active_stmt (matching RTL's naming scheme) and revisit current uses of non-debug? Bootstrapped/regtested x86_64-linux, OK? * gimplify.c (gimplify_bind_expr, gimplify_expr): Use empty_body_p to detect no-op sequences. * gimple.c (empty_body_p): Ignore clobbers. * g++.dg/tree-ssa/ehcleanup-1.C: Update testcase so it is harder to optimize * g++.dg/tree-ssa/ehcleanup-2.C: New testcase. Index: gimplify.c === --- gimplify.c (revision 206684) +++ gimplify.c (working copy) @@ -1106,7 +1106,7 @@ } } - if (cleanup) + if (!empty_body_p (cleanup)) { gimple gs; gimple_seq new_body; @@ -7771,7 +7771,7 @@ gimplify_and_add (TREE_OPERAND (*expr_p, 0), eval); gimplify_and_add (TREE_OPERAND (*expr_p, 1), cleanup); /* Don't create bogus GIMPLE_TRY with empty cleanup. */ - if (gimple_seq_empty_p (cleanup)) + if (empty_body_p (cleanup)) { gimple_seq_add_seq (pre_p, eval); ret = GS_ALL_DONE; Index: gimple.c === --- gimple.c(revision 206684) +++ gimple.c(working copy) @@ -1264,6 +1264,7 @@ return true; for (i = gsi_start (body); !gsi_end_p (i); gsi_next (i)) if (!empty_stmt_p (gsi_stmt (i)) +!gimple_clobber_p (gsi_stmt (i)) !is_gimple_debug (gsi_stmt (i))) return false; Index: testsuite/g++.dg/tree-ssa/ehcleanup-1.C === --- testsuite/g++.dg/tree-ssa/ehcleanup-1.C (revision 206684) +++ testsuite/g++.dg/tree-ssa/ehcleanup-1.C (working copy) @@ -12,7 +12,8 @@ public: ~a () NOEXCEPT_FALSE { -if (0) +int t = 0; +if (t) can_throw (); } }; @@ -23,9 +24,9 @@ can_throw (); } // We ought to remove implicit cleanup, since destructor is empty. -// { dg-final { scan-tree-dump-times Empty EH handler 2 ehcleanup1 } } +// { dg-final { scan-tree-dump-times Empty EH handler 1 ehcleanup1 } } // // And as a result also contained control flow. -// { dg-final { scan-tree-dump-times Removing unreachable 6 ehcleanup1 } } +// { dg-final { scan-tree-dump-times Removing unreachable 2 ehcleanup1 } } // // { dg-final { cleanup-tree-dump ehcleanup1 } } Index: testsuite/g++.dg/tree-ssa/ehcleanup-2.C === --- testsuite/g++.dg/tree-ssa/ehcleanup-2.C (revision 0) +++ testsuite/g++.dg/tree-ssa/ehcleanup-2.C (revision 0) @@ -0,0 +1,12 @@ +// { dg-options -O0 -fdump-tree-gimple } + struct A + { +virtual int foo (void) {return 42;} + }; +int test (void) +{ + struct A a, *b=a; + return b-foo(); +} +// { dg-final { scan-tree-dump-not finally gimple } } +// { dg-final { cleanup-tree-dump gimple } }
RE: [PATCH][4.8] Backport strict-volatile-bitfields fixes to 4.8
Ping -Original Message- From: Joey Ye [mailto:joey...@arm.com] Sent: Thursday, January 16, 2014 16:28 To: gcc-patches@gcc.gnu.org Subject: [PATCH][4.8] Backport strict-volatile-bitfields fixes to 4.8 4.8 has a number of strict-volatile-bitfields issues that can be fixed by following patches. trunk@205899, 205898, 205897, 205896, 203003 Tested on x86_64 and arm without regression. OK to 4.8? 2013-09-28 Sandra Loosemore san...@codesourcery.com gcc/ * expr.h (extract_bit_field): Remove packedp parameter. * expmed.c (extract_fixed_bit_field): Remove packedp parameter from forward declaration. (store_split_bit_field): Remove packedp arg from calls to extract_fixed_bit_field. (extract_bit_field_1): Remove packedp parameter and packedp argument from recursive calls and calls to extract_fixed_bit_field. (extract_bit_field): Remove packedp parameter and corresponding arg to extract_bit_field_1. (extract_fixed_bit_field): Remove packedp parameter. Remove code to issue warnings. (extract_split_bit_field): Remove packedp arg from call to extract_fixed_bit_field. * expr.c (emit_group_load_1): Adjust calls to extract_bit_field. (copy_blkmode_from_reg): Likewise. (copy_blkmode_to_reg): Likewise. (read_complex_part): Likewise. (store_field): Likewise. (expand_expr_real_1): Likewise. * calls.c (store_unaligned_arguments_into_pseudos): Adjust call to extract_bit_field. * config/tilegx/tilegx.c (tilegx_expand_unaligned_load): Adjust call to extract_bit_field. * config/tilepro/tilepro.c (tilepro_expand_unaligned_load): Adjust call to extract_bit_field. * doc/invoke.texi (Code Gen Options): Remove mention of warnings and special packedp behavior from -fstrict-volatile-bitfields documentation. 2013-12-11 Bernd Edlinger bernd.edlin...@hotmail.de * expr.c (expand_assignment): Remove dependency on flag_strict_volatile_bitfields. Always set the memory access mode. (expand_expr_real_1): Likewise. 2013-12-11 Sandra Loosemore san...@codesourcery.com PR middle-end/23623 PR middle-end/48784 PR middle-end/56341 PR middle-end/56997 gcc/ * expmed.c (strict_volatile_bitfield_p): New function. (store_bit_field_1): Don't special-case strict volatile bitfields here. (store_bit_field): Handle strict volatile bitfields here instead. (store_fixed_bit_field): Don't special-case strict volatile bitfields here. (extract_bit_field_1): Don't special-case strict volatile bitfields here. (extract_bit_field): Handle strict volatile bitfields here instead. (extract_fixed_bit_field): Don't special-case strict volatile bitfields here. Simplify surrounding code to resemble that in store_fixed_bit_field. * doc/invoke.texi (Code Gen Options): Update -fstrict-volatile-bitfields description. gcc/testsuite/ * gcc.dg/pr23623.c: New test. * gcc.dg/pr48784-1.c: New test. * gcc.dg/pr48784-2.c: New test. * gcc.dg/pr56341-1.c: New test. * gcc.dg/pr56341-2.c: New test. * gcc.dg/pr56997-1.c: New test. * gcc.dg/pr56997-2.c: New test. * gcc.dg/pr56997-3.c: New test. 2013-12-11 Bernd Edlinger bernd.edlin...@hotmail.de Sandra Loosemore san...@codesourcery.com PR middle-end/23623 PR middle-end/48784 PR middle-end/56341 PR middle-end/56997 * expmed.c (strict_volatile_bitfield_p): Add bitregion_start and bitregion_end parameters. Test for compliance with C++ memory model. (store_bit_field): Adjust call to strict_volatile_bitfield_p. Add fallback logic for cases where -fstrict-volatile-bitfields is supposed to apply, but cannot. (extract_bit_field): Likewise. Use narrow_bit_field_mem and extract_fixed_bit_field_1 to do the extraction. (extract_fixed_bit_field): Revert to previous mode selection algorithm. Call extract_fixed_bit_field_1 to do the real work. (extract_fixed_bit_field_1): New function. testsuite: * gcc.dg/pr23623.c: Update to test interaction with C++ memory model. 2013-12-11 Bernd Edlinger bernd.edlin...@hotmail.de PR middle-end/59134 * expmed.c (store_bit_field): Use narrow_bit_field_mem and store_fixed_bit_field_1 for -fstrict-volatile-bitfields. (store_fixed_bit_field): Split up. Call store_fixed_bit_field_1 to do the real work. (store_fixed_bit_field_1): New function. (store_split_bit_field): Limit the unit size to the memory
Update MAINTAINERS (Re: Remove spam in GCC mailing list)
On Sun, 22 Dec 2013, Tae Wong wrote: It will be better if you have enabled the Launchpad account seotaewong40. This account has been suspended for renaming an answer title multiple times. The GCC team has nothing to do with Launchpad. There's also an ordering error on the GCC maintainer list: On the write after approval section, Xinliang David Li comes between H.J. Lu and Christophe Lyon: please fix the sort order so his name appears between Kriang Lerdsuwanakij and Jiangning Liu. Thanks for pointing this out. Fixed per the patch below. On the way I noticed (well, strictly speaking my editor did, and transparently so) that the MAINTAINERS file was ISO 8859, so I did the conversation to UTF-8 as well. It's 2014 after all. Gerald * MAINTAINERS: Convert to UTF-8. Properly sort Xinliang David Li's entry. Index: MAINTAINERS === --- MAINTAINERS (revision 206770) +++ MAINTAINERS (working copy) @@ -276,11 +276,11 @@ FortranErik Edelmann erik.edelm...@iki.fi FortranDaniel Franke franke.dan...@gmail.com FortranSteven G. Kargl s...@troutmask.apl.washington.edu -FortranThomas K?ig tkoe...@gcc.gnu.org +FortranThomas Königtkoe...@gcc.gnu.org FortranDaniel Kraftd...@domob.eu FortranToon Moene t...@moene.org FortranMikael Morinmikael.mo...@sfr.fr -FortranTobias Schl?er tobias.schlue...@physik.uni-muenchen.de +FortranTobias Schlüter tobias.schlue...@physik.uni-muenchen.de FortranPaul Thomas pa...@gcc.gnu.org FortranJanus Weil ja...@gcc.gnu.org gengtype/GTY Laurynas Biveinis laurynas.bivei...@gmail.com @@ -346,7 +346,7 @@ Stephane Carrezstcar...@nerim.fr Gabriel Charette gch...@google.com Chandra Chavva ccha...@redhat.com -Fabien Ch?efab...@gcc.gnu.org +Fabien Chêne fab...@gcc.gnu.org Bin Cheng bin.ch...@arm.com Harshit Chopra hars...@google.com William Cohen wco...@redhat.com @@ -353,7 +353,7 @@ Josh Connerjcon...@apple.com R. Kelley Cook kc...@gcc.gnu.org Christian Cornelssen cc...@cs.tu-berlin.de -Fran?is-Xavier Coudert fxcoud...@gcc.gnu.org +François-Xavier Coudertfxcoud...@gcc.gnu.org Cary Coutant ccout...@google.com Lawrence Crowl cr...@google.com Ian Dall i...@beware.dropbear.id.au @@ -361,7 +361,7 @@ Bud Davis jmda...@link.com Chris Demetriouc...@google.com Sameera Deshpande sameera.deshpa...@arm.com -Fran?is Dumont fdum...@gcc.gnu.org +François Dumontfdum...@gcc.gnu.org Benoit Dupont de Dinechin benoit.dupont-de-dinec...@st.com Michael Eager ea...@eagercon.com Bernd Edlinger bernd.edlin...@hotmail.de @@ -369,7 +369,7 @@ Mohan Embargnust...@thisiscool.com Revital Eres e...@il.ibm.com Marc Espie es...@cvs.openbsd.org -Rafael ?vila de Esp?dola espind...@google.com +Rafael Ávila de Espíndola espind...@google.com Ansgar Esztermann ans...@thphy.uni-duesseldorf.de Doug Evans d...@google.com Chris Fairles cfair...@gcc.gnu.org @@ -448,15 +448,15 @@ Marc Lehmann p...@goof.com James Lemkejwle...@codesourcery.com Kriang Lerdsuwanakij lerds...@users.sourceforge.net +Xinliang David Li davi...@google.com Jiangning Liu jiangning@arm.com Sa Liu sa...@de.ibm.com Ralph Loader r...@ihug.co.nz Gabor Loki l...@inf.u-szeged.hu Sandra Loosemore
RE: [GOMP4][PATCH] SIMD-enabled functions (formerly Elemental functions) for C++
Hi Jakub, I have fixed all the issues you have mentioned below. I am also attaching a fixed patch along with ChangeLog entries. I have also rebased the patch to the trunk revision r206786. Is this Ok to install? Thanks, Balaji V. Iyer. -Original Message- From: Jakub Jelinek [mailto:ja...@redhat.com] Sent: Friday, January 17, 2014 12:46 PM To: Iyer, Balaji V Cc: 'Aldy Hernandez (al...@redhat.com)'; 'gcc-patches@gcc.gnu.org' Subject: Re: [GOMP4][PATCH] SIMD-enabled functions (formerly Elemental functions) for C++ On Thu, Dec 19, 2013 at 06:12:29PM +, Iyer, Balaji V wrote: 2013-12-19 Balaji V. Iyer balaji.v.i...@intel.com * parser.c (cp_parser_direct_declarator): When Cilk Plus is enabled see if there is an attribute after function decl. If so, then parse them now. (cp_parser_late_return_type_opt): Handle parsing of Cilk Plus SIMD enabled function late parsing. (cp_parser_gnu_attribute_list): Parse all the tokens for the vector attribute for a SIMD-enabled function. (cp_parser_omp_all_clauses): Skip parsing to the end of pragma when the function is used by SIMD-enabled function (indicated by NULL pragma token). Added 3 new clauses: PRAGMA_CILK_CLAUSE_MASK, PRAGMA_CILK_CLAUSE_NOMASK and PRAGMA_CILK_CLAUSE_VECTORLENGTH (cp_parser_cilk_simd_vectorlength): Modified this function to handle vectorlength clause in SIMD-enabled function and #pragma SIMD's vectorlength clause. Added a new bool parameter to differentiate between the two. (cp_parser_cilk_simd_fn_vector_attrs): New function. (is_cilkplus_vector_p): Likewise. (cp_parser_late_parsing_elem_fn_info): Likewise. (cp_parser_omp_clause_name): Added a check for mask, nomask The comma should have been after . Fixed. + /* In here, we handle cases where attribute is used after +the function declaration. For example: +void func (int x) __attribute__((vector(..))); */ + if (flag_enable_cilkplus + cp_next_tokens_can_be_attribute_p (parser)) As you are just calling cp_parser_gnu_attributes_opt here and not ..._std_..., I'd say the above should be cp_next_tokens_can_be_gnu_attribute_p rather than cp_next_tokens_can_be_attribute_p. I think [[...]] attributes at this position are ignored, so no need to handle them, not sure about whether we allow e.g. combination of GNU and std attributes or vice versa. Fixed. + { + cp_parser_parse_tentatively (parser); + tree attr = cp_parser_gnu_attributes_opt (parser); + if (cp_lexer_next_token_is_not (parser-lexer, + CPP_SEMICOLON) + cp_lexer_next_token_is_not (parser-lexer, +CPP_OPEN_BRACE)) + cp_parser_abort_tentative_parse (parser); + else if (!cp_parser_parse_definitely (parser)) + ; + else + attrs = chainon (attr, attrs); + } late_return = (cp_parser_late_return_type_opt (parser, declarator, memfn ? cv_quals : -1)); @@ -17842,6 +17868,10 @@ cp_parser_late_return_type_opt (cp_parser* parser, cp_declarator *declarator, type = cp_parser_trailing_type_id (parser); } + if (cilk_simd_fn_vector_p) +declarator-std_attributes + = cp_parser_late_parsing_cilk_simd_fn_info (parser, +declarator-std_attributes); Please make sure declarator is aligned below parser. Fixed. + token-type = CPP_PRAGMA_EOL; + parser-lexer-next_token = token; + cp_lexer_consume_token (parser-lexer); + + struct cp_token_cache *cp = +cp_token_cache_new (v_token, cp_lexer_peek_token + (parser-lexer)); The = should already go on the next line. Fixed. +/* Handles the delayed parsing of the Cilk Plus SIMD-enabled function. + This function is modelled similar to the late parsing of omp declare + simd. */ + +static tree +cp_parser_late_parsing_cilk_simd_fn_info (cp_parser *parser, tree +attrs) { + struct cp_token_cache *ce; + cp_omp_declare_simd_data *info = parser-cilk_simd_fn_info; + int ii = 0; + + if (parser-omp_declare_simd != NULL) +{ + error (%#pragma omp declare simd% cannot be used in the same function + marked as a Cilk Plus SIMD-enabled function); + parser-cilk_simd_fn_info = NULL; This will leak parser-cilk_simd_fn_info memory. Please XDELETE it first. Fixed + return attrs; +} + if (!info-error_seen info-fndecl_seen) +{ +