Re: [ada, build] host/target configuration
Thomas Schwinge tho...@codesourcery.com writes: diff --git gcc/ada/gcc-interface/Makefile.in gcc/ada/gcc-interface/Makefile.in index eeb8c7f..c07722b 100644 --- gcc/ada/gcc-interface/Makefile.in +++ gcc/ada/gcc-interface/Makefile.in @@ -151,12 +151,15 @@ GCC_CFLAGS = $(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS) program_transform_name = objdir = . -target_alias=@target_alias@ target=@target@ +target_cpu=@target_cpu@ +target_vendor=@target_vendor@ +target_os=@target_os@ +host_cpu=@host_cpu@ +host_vendor=@host_vendor@ +host_os=@host_os@ xmake_file = @xmake_file@ tmake_file = @tmake_file@ -host_canonical=@host@ -target_cpu_default=@target_cpu_default@ This is wrong, you are reintroducing PR ada/39172. Installed as obvious. Andreas. PR ada/39172 * gcc-interface/Makefile.in (target_cpu_default): Revert 2013-10-11 change. Index: gcc/ada/gcc-interface/Makefile.in === --- gcc/ada/gcc-interface/Makefile.in (revision 208604) +++ gcc/ada/gcc-interface/Makefile.in (working copy) @@ -159,6 +159,7 @@ host_cpu=@host_cpu@ host_vendor=@host_vendor@ host_os=@host_os@ +target_cpu_default = @target_cpu_default@ xmake_file = @xmake_file@ tmake_file = @tmake_file@ #version=`sed -e 's/.*\\([^ \]*\)[ \].*/\1/' $(srcdir)/version.c` -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 And now for something completely different.
New Swedish PO file for 'gcc' (version 4.9-b20140202)
Hello, gentle maintainer. This is a message from the Translation Project robot. A revised PO file for textual domain 'gcc' has been submitted by the Swedish team of translators. The file is available at: http://translationproject.org/latest/gcc/sv.po (This file, 'gcc-4.9-b20140202.sv.po', has just now been sent to you in a separate email.) All other PO files for your package are available in: http://translationproject.org/latest/gcc/ Please consider including all of these in your next release, whether official or a pretest. Whenever you have a new distribution with a new version number ready, containing a newer POT file, please send the URL of that distribution tarball to the address below. The tarball may be just a pretest or a snapshot, it does not even have to compile. It is just used by the translators when they need some extra translation context. The following HTML page has been updated: http://translationproject.org/domain/gcc.html If any question arises, please contact the translation coordinator. Thank you for all your work, The Translation Project robot, in the name of your translation coordinator. coordina...@translationproject.org
Re: [ada, build] host/target configuration
Hi! On Sun, 16 Mar 2014 09:32:33 +0100, Andreas Schwab sch...@linux-m68k.org wrote: Thomas Schwinge tho...@codesourcery.com writes: http://news.gmane.org/find-root.php?message_id=%3C930D868B-5772-4F33-BB28-B878D40ED165%40adacore.com%3E was the final version of the patch, after Olivier had taken it over from me. --- gcc/ada/gcc-interface/Makefile.in +++ gcc/ada/gcc-interface/Makefile.in @@ -151,12 +151,15 @@ GCC_CFLAGS = $(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS) program_transform_name = objdir = . -target_alias=@target_alias@ target=@target@ +target_cpu=@target_cpu@ +target_vendor=@target_vendor@ +target_os=@target_os@ +host_cpu=@host_cpu@ +host_vendor=@host_vendor@ +host_os=@host_os@ xmake_file = @xmake_file@ tmake_file = @tmake_file@ -host_canonical=@host@ -target_cpu_default=@target_cpu_default@ This is wrong, you are reintroducing PR ada/39172. Installed as obvious. Sorry for that. PR ada/39172 * gcc-interface/Makefile.in (target_cpu_default): Revert 2013-10-11 change. --- gcc/ada/gcc-interface/Makefile.in (revision 208604) +++ gcc/ada/gcc-interface/Makefile.in (working copy) @@ -159,6 +159,7 @@ host_cpu=@host_cpu@ host_vendor=@host_vendor@ host_os=@host_os@ +target_cpu_default = @target_cpu_default@ It is not obvious to me (and neither was to Olivier as well as the patch reviewers, as it seems) where the gcc/ada/gcc-interface/ code is using this variable. Is there a way for this to be made more explicit, so in the future it won't get removed as unused, again? Grüße, Thomas pgpgoejdmNe1A.pgp Description: PGP signature
Re: [ada, build] host/target configuration
Thomas Schwinge tho...@codesourcery.com writes: It is not obvious to me (and neither was to Olivier as well as the patch reviewers, as it seems) where the gcc/ada/gcc-interface/ code is using this variable. Is there a way for this to be made more explicit, so in the future it won't get removed as unused, again? git grep? Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 And now for something completely different.
[patch, fortran] Fix for PR 60522
Hello world, the attached patch fixes PR 60522, a regresseion where temporary variables were incorrectly introduced in a BLOCK within a WHERE statement. Regression-tested on x86_64-unknown-linux-gnu. OK for trunk and the other open branches? Thomas 2014-04-16 Thomas Koenig tkoe...@gcc.gnu.org PR fortran/60522 * frontend-passes.c (top level): New variables where_level and where_code. (optimize_code): Set where_code if we are within a WHERE statment. (cfe_code): Likewise. (create_var): Use where_code if within a WHERE statement. (optimize_namespace): Set where_level. (gfc_code_walker): Keep track of where_level. 2014-04-16 Thomas Koenig tkoe...@gcc.gnu.org PR fortran/60522 * gfortran.dg/where_4.f90: New test case. ! { dg-do compile } ! PR 60522 - this used to ICE. ! Original test case Roger Ferrer Ibanez subroutine foo(a, b) implicit none integer, dimension(:), intent(inout) :: a integer, dimension(:), intent(in) :: b where (b(:) 0) where (b(:) 100) a(lbound(a, 1):ubound(a, 1)) = b(lbound(b, 1):ubound(b, 1)) * b(lbound(b, 1):ubound(b, 1)) - 100 elsewhere a(lbound(a, 1):ubound(a, 1)) = b(lbound(b, 1):ubound(b, 1)) * b(lbound(b, 1):ubound(b, 1)) end where elsewhere a(lbound(a, 1):ubound(a, 1)) = - b(lbound(b, 1):ubound(b, 1)) * b(lbound(b, 1):ubound(b, 1)) end where end subroutine foo Index: frontend-passes.c === --- frontend-passes.c (Revision 208592) +++ frontend-passes.c (Arbeitskopie) @@ -84,6 +84,12 @@ static int iterator_level; static gfc_code **doloop_list; static int doloop_size, doloop_level; +/* Keep track of whether we are within a WHERE + statement. */ + +static int where_level; +static gfc_code **where_code; + /* Vector of gfc_expr * to keep track of DO loops. */ struct my_struct *evec; @@ -139,6 +145,18 @@ optimize_code (gfc_code **c, int *walk_subtrees AT inserted_block = NULL; changed_statement = NULL; + + /* Keep track where to put a block around a WHERE statement. + TODO: We can do the same thing for FORALL. */ + + if (where_level == 0) +{ + if ((*c)-op == EXEC_WHERE) + where_code = c; + else + where_code = NULL; +} + if (op == EXEC_ASSIGN) optimize_assignment (*c); return 0; @@ -442,34 +460,40 @@ create_var (gfc_expr * e) gfc_expr *result; gfc_code *n; gfc_namespace *ns; + gfc_code **cc; int i; + if (where_level 0) +cc = where_code; + else +cc = current_code; + /* If the block hasn't already been created, do so. */ if (inserted_block == NULL) { inserted_block = XCNEW (gfc_code); inserted_block-op = EXEC_BLOCK; - inserted_block-loc = (*current_code)-loc; + inserted_block-loc = (*cc)-loc; ns = gfc_build_block_ns (current_ns); inserted_block-ext.block.ns = ns; inserted_block-ext.block.assoc = NULL; - ns-code = *current_code; + ns-code = *cc; /* If the statement has a label, make sure it is transferred to the newly created block. */ - if ((*current_code)-here) + if ((*cc)-here) { inserted_block-here = (*current_code)-here; - (*current_code)-here = NULL; + (*cc)-here = NULL; } - inserted_block-next = (*current_code)-next; + inserted_block-next = (*cc)-next; changed_statement = (inserted_block-ext.block.ns-code); - (*current_code)-next = NULL; + (*cc)-next = NULL; /* Insert the BLOCK at the right position. */ - *current_code = inserted_block; + *cc = inserted_block; ns-parent = current_ns; } else @@ -633,6 +657,18 @@ cfe_code (gfc_code **c, int *walk_subtrees ATTRIBU current_code = c; inserted_block = NULL; changed_statement = NULL; + + /* Keep track where to put a block around a WHERE statement. + TODO: We can do the same thing for FORALL. */ + + if (where_level == 0) +{ + if ((*c)-op == EXEC_WHERE) + where_code = c; + else + where_code = NULL; +} + return 0; } @@ -798,6 +834,7 @@ optimize_namespace (gfc_namespace *ns) forall_level = 0; iterator_level = 0; in_omp_workshare = false; + where_level = 0; gfc_code_walker (ns-code, convert_do_while, dummy_expr_callback, NULL); gfc_code_walker (ns-code, convert_elseif, dummy_expr_callback, NULL); @@ -1980,6 +2017,10 @@ gfc_code_walker (gfc_code **c, walk_code_fn_t code break; } + case EXEC_WHERE: + where_level ++; + break; + case EXEC_OPEN: WALK_SUBEXPR (co-ext.open-unit); WALK_SUBEXPR (co-ext.open-file); @@ -2144,6 +2185,9 @@ gfc_code_walker (gfc_code **c, walk_code_fn_t code if (co-op == EXEC_DO) doloop_level --; + if (co- op == EXEC_WHERE) + where_level --; + in_omp_workshare = saved_in_omp_workshare; } }
Re: [ada, build] host/target configuration
Hi! On Sun, 16 Mar 2014 11:30:06 +0100, Andreas Schwab sch...@linux-m68k.org wrote: Thomas Schwinge tho...@codesourcery.com writes: It is not obvious to me (and neither was to Olivier as well as the patch reviewers, as it seems) where the gcc/ada/gcc-interface/ code is using this variable. Is there a way for this to be made more explicit, so in the future it won't get removed as unused, again? git grep? $ git grep target_cpu_default -- gcc/ada/gcc-interface/ gcc/ada/gcc-interface/Makefile.in:target_cpu_default = @target_cpu_default@ Grüße, Thomas pgpuBPALm_u03.pgp Description: PGP signature
Re: [ada, build] host/target configuration
Thomas Schwinge tho...@codesourcery.com writes: Hi! On Sun, 16 Mar 2014 11:30:06 +0100, Andreas Schwab sch...@linux-m68k.org wrote: Thomas Schwinge tho...@codesourcery.com writes: It is not obvious to me (and neither was to Olivier as well as the patch reviewers, as it seems) where the gcc/ada/gcc-interface/ code is using this variable. Is there a way for this to be made more explicit, so in the future it won't get removed as unused, again? git grep? $ git grep target_cpu_default -- gcc/ada/gcc-interface/ gcc/ada/gcc-interface/Makefile.in:target_cpu_default = @target_cpu_default@ Did I say anything about ignoring everything but Ada Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 And now for something completely different.
[PATCH][AARCH64]Amend AArch64 frame layout comment.
Hi all, This is a simple patch to update the AArch64 frame layout comment in the source code. frame_pointer should point above the local_variables section as we define FRAME_GROWS_DOWNWARD = 1. Is this Okay for stage-4? Regards, Renlin Li gcc/ChangeLog: 2014-03-16 Renlin Li renlin...@arm.com * config/aarch64/aarch64.c: Correct the comments about aarch64 stack layout. diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 901ad3d..fe96a28 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -1994,18 +1994,21 @@ aarch64_save_or_restore_callee_save_registers (HOST_WIDE_INT offset, | callee-allocated save area | | for register varargs | | | - +---+ - | | - | local variables | - | | +---+ -- frame_pointer_rtx | | - | callee-saved registers | + | local variables | | | - +---+ - | LR' | - +---+ - | FP' | + +---+ + | padding0 | \ + +---+ | + | | | + | | | + | callee-saved registers | | frame.saved_regs_size + | | | + +---+ | + | LR' | | + +---+ | + | FP' | / P +---+ -- hard_frame_pointer_rtx | dynamic allocation | +---+
Re: [ada, build] host/target configuration
Hi! On Sun, 16 Mar 2014 12:09:59 +0100, Andreas Schwab sch...@linux-m68k.org wrote: Thomas Schwinge tho...@codesourcery.com writes: On Sun, 16 Mar 2014 11:30:06 +0100, Andreas Schwab sch...@linux-m68k.org wrote: Thomas Schwinge tho...@codesourcery.com writes: It is not obvious to me (and neither was to Olivier as well as the patch reviewers, as it seems) where the gcc/ada/gcc-interface/ code is using this variable. Is there a way for this to be made more explicit, so in the future it won't get removed as unused, again? git grep? $ git grep target_cpu_default -- gcc/ada/gcc-interface/ gcc/ada/gcc-interface/Makefile.in:target_cpu_default = @target_cpu_default@ Did I say anything about ignoring everything but Ada No, you did not, but I had said: »not obvious [...] where the gcc/ada/gcc-interface/ code is using [target_cpu_default]«. So, it seems the issue here is that all variables that may used by $(tmake_file)/$(xmake_file) files (which are included from gcc/ada/gcc-interface/Makefile.in; tmake_file/xmake_file set in gcc/config.gcc) must be available -- which is not ovious, and thus fragile. Grüße, Thomas pgpawYP3wE0DA.pgp Description: PGP signature
[PATCH v2] SPARC: Clarify -mapp-regs option
gcc/ChangeLog 2014-03-16 Sebastian Huber sebastian.hu...@embedded-brains.de * doc/invoke.texi (mapp-regs): Clarify. --- gcc/doc/invoke.texi | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 24bd76e..485867d 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -20817,7 +20817,10 @@ These @samp{-m} options are supported on the SPARC: @opindex mapp-regs Specify @option{-mapp-regs} to generate output using the global registers 2 through 4, which the SPARC SVR4 ABI reserves for applications. This -is the default. +is the default. Like the global register 1 each global register 2 through 4 is +then treated as an allocable register that is clobbered by function calls. +They may be allocated for temporaries or variables that do not live across a +call. To be fully SVR4 ABI-compliant at the cost of some performance loss, specify @option{-mno-app-regs}. You should compile libraries and system -- 1.8.1.4
[PATCH][AARCH64]combine ubfiz and orr with bfi when certain condition meets.
Hi all, Thank you for your suggestions, Richard. I have updated the patch accordingly. This is an optimization patch which will combine ubfiz and orr insns with a single bfi when certain conditions meet. tmp = (x m) | ( (y n) lsb) can be presented using and tmp, x, m bfi tmp, y, #lsb, #width if ((n+1) == 2^width) (m n lsb) == 0. A small test case is also added to verify it. Is this Okay for stage-1? Kind regards, Renlin Li gcc/ChangeLog: 2014-03-14 Renlin Li renlin...@arm.com * config/aarch64/aarch64.md (*combine_bfi2GPI:modeSHORT:mode, *combine_bfi3mode): New. gcc/testsuite: 2014-03-14 Renlin Li renlin...@arm.com * gcc.target/aarch64/combine_and_orr_1.c: New.diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index 99a6ac8..6c2798b 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -3115,6 +3115,53 @@ [(set_attr type bfm)] ) +(define_insn_and_split *combine_bfi2GPI:modeSHORT:mode + [(set (match_operand:GPI 0 register_operand =r) +(ior:GPI (and:GPI (ashift:GPI (match_operand:GPI 1 register_operand r) + (match_operand 2 const_int_operand n)) + (match_operand 3 const_int_operand n)) + (zero_extend:GPI (match_operand:SHORT 4 register_operand 0] + exact_log2 ((INTVAL (operands[3]) INTVAL (operands[2])) + 1) = 0 +SHORT:sizen = INTVAL (operands[2]) + # + reload_completed + [(set (match_dup 0) +(zero_extend:GPI (match_dup 4))) + (set (zero_extract:GPI (match_dup 0) + (match_dup 3) + (match_dup 2)) + (match_dup 1))] + { + int tmp = (INTVAL (operands[3]) INTVAL (operands[2])) + 1; + operands[3] = GEN_INT (exact_log2 (tmp)); + } + [(set_attr type multiple)] +) + +(define_insn_and_split *combine_bfi3mode + [(set (match_operand:GPI 0 register_operand =r) +(ior:GPI (and:GPI (match_operand:GPI 1 register_operand 0) + (match_operand 2 aarch64_logical_immediate n)) + (and:GPI (ashift:GPI (match_operand:GPI 3 register_operand r) + (match_operand 4 const_int_operand n)) + (match_operand 5 const_int_operand n] + exact_log2 ((INTVAL (operands[5]) INTVAL (operands[4])) + 1) = 0 +(INTVAL (operands[2]) INTVAL (operands[5])) == 0 + # + reload_completed + [(set (match_dup 0) +(and:GPI (match_dup 1) (match_dup 2))) + (set (zero_extract:GPI (match_dup 0) + (match_dup 5) + (match_dup 4)) + (match_dup 3))] + { + int tmp = (INTVAL (operands[5]) INTVAL (operands[4])) + 1; + operands[5] = GEN_INT (exact_log2 (tmp)); + } + [(set_attr type multiple)] +) + (define_insn *extr_insv_lower_regmode [(set (zero_extract:GPI (match_operand:GPI 0 register_operand +r) (match_operand 1 const_int_operand n) diff --git a/gcc/testsuite/gcc.target/aarch64/combine_and_orr_1.c b/gcc/testsuite/gcc.target/aarch64/combine_and_orr_1.c new file mode 100644 index 000..b2c0194 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/combine_and_orr_1.c @@ -0,0 +1,51 @@ +/* { dg-do run } */ +/* { dg-options -save-temps -O2 } */ + +extern void abort (void); + +unsigned int __attribute__ ((noinline)) +foo1 (unsigned int major, unsigned int minor) +{ + unsigned int tmp = (minor 0xff) | ((major 0xfff) 8); + return tmp; +} + +unsigned int __attribute__ ((noinline)) +foo2 (unsigned int major, unsigned int minor) +{ + unsigned int tmp = (minor 0x1f) | ((major 0xfff) 8); + return tmp; +} + +int +main (void) +{ + unsigned int major[10] = {1947662, 484254, 193508, 4219233, 2211215, + 3998162, 4240676, 1034099, 54412, 3195572}; + unsigned int minor[10] = {1027568, 21481, 2746675, 3121857, 2471080, + 3158801, 237587, 813307, 4073168, 1503494}; + + unsigned int result1[10] = {528112, 237289, 255027, 90561, 888744, + 119313, 336915, 488443, 298192, 177158}; + unsigned int result2[10] = {527888, 237065, 254995, 90369, 888584, + 119313, 336915, 488219, 298000, 177158}; + + unsigned int index = 0; + unsigned result = 0; + for (index; index 10; ++index) +{ + + result = foo1 (major[index], minor[index]); + if (result != result1[index]) + abort (); + + result = foo2 (major[index], minor[index]); + if (result != result2[index]) + abort (); +} + + return 0; +} + +/* { dg-final { scan-assembler-times bfi\tw\[0-9\]+, w\[0-9\]+, 8|5, 12 2 } } */ +/* { dg-final { cleanup-saved-temps } } */
Re: [ada, build] host/target configuration
Thomas Schwinge tho...@codesourcery.com writes: No, you did not, but I had said: »not obvious [...] where the gcc/ada/gcc-interface/ code is using [target_cpu_default]«. Why do you think this directory is called gcc-interface??? Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 And now for something completely different.
Re: Try to catch up _GLIBCXX_RESOLVE_LIB_DEFECTS comments and documentation.
On 15 March 2014 14:46, Ed Smith-Rowland wrote: I'm resending this because I forgot to dupe to gcc-patches and I'd like one thread. This should be pure commentary and documentation. I hope I got all these. I grepped for DR and added _GLIBCXX_RESOLVE_LIB_DEFECTS where it seemed needed. I did not add in cases where DR mentions were more commentary. Then I added the new _GLIBCXX_RESOLVE_LIB_DEFECTS to the xml intro page. OK? Can anyone think of one I left out? In many of these cases I'd actually prefer to remove the comment mentioning a DR, rather than add the RESOLVE_LIB_DEFECTS marker. For example: DR 1204: this says we don't need to check for self-move-assignment. It applies to every move assignment operator in the library. It is not a defect against C++03, and the resolution is part of the final C++11 standard, so I don't think we should document that we implement it. DR 1261: another one with C++11 status, meaning it was included in the C++11 standard, and this one also isn't relevant to C++03, so of course we implement it, and we shouldn't even mention it in comments or docs. DR 675, DR 776: these aren't relevant to C++03, and are part of C++11 (since the CD1 draft) So I think adding RESOLVE_LIB_DEFECTS is the wrong thing to do, I'd rather not touch them. Personally I'm in favour of completely remove any mention of DRs that are fixes to C++0x drafts, not post-C++11 fixes, but that might be more controversial.
[build]-PING - Re: [Build, Driver] Add -lcilkrts for -fcilkplus
PING for the build part; Joseph has already approved the driver part. Tobias Burnus wrote: When using Cilk Plus (-fcilkplus), it makes sense to automatically link the run-time library (-lcilkrts). This patch mimics libgomp by adding a .spec file; I am not 100% sure whether the .spec file is needed, but the pthread tests in libgomp imply that it makes sense. (libgomp also checks for -lrt for the high-performance timers, a check which is not required for libcilkrts.) Bootstrapped on x86-64-gnu-linux. OK for the trunk? Tobias
Re: Try to catch up _GLIBCXX_RESOLVE_LIB_DEFECTS comments and documentation.
On 03/16/2014 08:43 AM, Jonathan Wakely wrote: On 15 March 2014 14:46, Ed Smith-Rowland wrote: I'm resending this because I forgot to dupe to gcc-patches and I'd like one thread. This should be pure commentary and documentation. I hope I got all these. I grepped for DR and added _GLIBCXX_RESOLVE_LIB_DEFECTS where it seemed needed. I did not add in cases where DR mentions were more commentary. Then I added the new _GLIBCXX_RESOLVE_LIB_DEFECTS to the xml intro page. OK? Can anyone think of one I left out? In many of these cases I'd actually prefer to remove the comment mentioning a DR, rather than add the RESOLVE_LIB_DEFECTS marker. For example: DR 1204: this says we don't need to check for self-move-assignment. It applies to every move assignment operator in the library. It is not a defect against C++03, and the resolution is part of the final C++11 standard, so I don't think we should document that we implement it. DR 1261: another one with C++11 status, meaning it was included in the C++11 standard, and this one also isn't relevant to C++03, so of course we implement it, and we shouldn't even mention it in comments or docs. DR 675, DR 776: these aren't relevant to C++03, and are part of C++11 (since the CD1 draft) So I think adding RESOLVE_LIB_DEFECTS is the wrong thing to do, I'd rather not touch them. Personally I'm in favour of completely remove any mention of DRs that are fixes to C++0x drafts, not post-C++11 fixes, but that might be more controversial. OK, thinking further on it I actually agree with not mentioning DRs on a partially baked standard. We advertise that support for new standards is experimental. This whole thing is less of a deal now that the standard is moving so quickly and problems are easily incorporated into the next standard. I'll put something new out tonight or tomorrow.
[Patch, Fortran] PRs 60283/60543: Fix two wrong-code bugs related for implicit pure
This patch fixes two issues, where gfortran claims that a function is implicit pure, but it is not. That will cause a wrong-code optimization in the middle end. First problem, cf. PR60543, is that implicit pure was not set to 0 for calls to impure intrinsic subroutines. (BTW: There are no impure intrinsic functions.) Example: module m contains REAL(8) FUNCTION random() CALL RANDOM_NUMBER(random) END FUNCTION random end module m The second problem pops up if one adds a BLOCK ... END BLOCK around the random_number call after applying the patch of the PR, which just does: gfc_current_ns-proc_name-attr.implicit_pure = 0. The problem is that one sets only the implicit_pure of the block to 0 and not of the function. That's the reason that the patch became much longer and that I added gfc_unset_implicit_pure as new function. Thus, the suspicion I had when reviewing the OpenACC patches turned out to be founded. Cf. PR60283. Build and regtested on x86-64-gnu-linux. OK for the trunk and for the 4.7 and 4.8 branches? Note: I failed to create a test case. Tobias 2014-03-16 Tobias Burnus bur...@net-b.de PR fortran/60543 PR fortran/60283 * gfortran.h (gfc_unset_implicit_pure): New prototype. * resolve.c (gfc_unset_implicit_pure): New. (resolve_structure_cons, resolve_function, pure_subroutine): Use it. * decl.c (match_old_style_init, gfc_match_data, match_pointer_init, variable_decl): Ditto. * expr.c (gfc_check_pointer_assign): Ditto. * intrinsic.c (gfc_intrinsic_sub_interface): Ditto. * io.c (match_vtag, gfc_match_open, gfc_match_close, match_filepos, gfc_match_inquire, gfc_match_print, gfc_match_wait): Ditto. * match.c (gfc_match_critical, gfc_match_stopcode, lock_unlock_statement, sync_statement, gfc_match_allocate, gfc_match_deallocate): Ditto. * parse.c (decode_omp_directive): Ditto. * symbol.c (gfc_add_save): Ditto. 2014-03-16 Tobias Burnus bur...@net-b.de PR fortran/60543 PR fortran/60283 * gfortran.dg/implicit_pure_4.f90: New. diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index c7f5eed..11cded1 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -510,9 +510,7 @@ match_old_style_init (const char *name) free (newdata); return MATCH_ERROR; } - - if (gfc_implicit_pure (NULL)) -gfc_current_ns-proc_name-attr.implicit_pure = 0; + gfc_unset_implicit_pure (gfc_current_ns-proc_name); /* Mark the variable as having appeared in a data statement. */ if (!gfc_add_data (sym-attr, sym-name, sym-declared_at)) @@ -571,9 +569,7 @@ gfc_match_data (void) gfc_error (DATA statement at %C is not allowed in a PURE procedure); return MATCH_ERROR; } - - if (gfc_implicit_pure (NULL)) -gfc_current_ns-proc_name-attr.implicit_pure = 0; + gfc_unset_implicit_pure (gfc_current_ns-proc_name); return MATCH_YES; @@ -1739,6 +1735,7 @@ match_pointer_init (gfc_expr **init, int procptr) a PURE procedure); return MATCH_ERROR; } + gfc_unset_implicit_pure (gfc_current_ns-proc_name); /* Match NULL() initialization. */ m = gfc_match_null (init); @@ -2046,6 +2043,10 @@ variable_decl (int elem) m = MATCH_ERROR; } + if (current_attr.flavor != FL_PARAMETER + gfc_state_stack-state != COMP_DERIVED) + gfc_unset_implicit_pure (gfc_current_ns-proc_name); + if (m != MATCH_YES) goto cleanup; } diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index fe92c53..f677204 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -3704,8 +3704,7 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_expr *rvalue) } if (is_implicit_pure gfc_impure_variable (rvalue-symtree-n.sym)) -gfc_current_ns-proc_name-attr.implicit_pure = 0; - +gfc_unset_implicit_pure (gfc_current_ns-proc_name); if (gfc_has_vector_index (rvalue)) { diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h index cd2a913..14c202d 100644 --- a/gcc/fortran/gfortran.h +++ b/gcc/fortran/gfortran.h @@ -2837,6 +2837,7 @@ void gfc_resolve_blocks (gfc_code *, gfc_namespace *); int gfc_impure_variable (gfc_symbol *); int gfc_pure (gfc_symbol *); int gfc_implicit_pure (gfc_symbol *); +void gfc_unset_implicit_pure (gfc_symbol *); int gfc_elemental (gfc_symbol *); bool gfc_resolve_iterator (gfc_iterator *, bool, bool); bool find_forall_index (gfc_expr *, gfc_symbol *, int); diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c index 3db000b..19d4620 100644 --- a/gcc/fortran/intrinsic.c +++ b/gcc/fortran/intrinsic.c @@ -4404,13 +4404,16 @@ gfc_intrinsic_sub_interface (gfc_code *c, int error_flag) return MATCH_ERROR; } - if (gfc_pure (NULL) !isym-pure) + if (!isym-pure gfc_pure (NULL)) { gfc_error (Subroutine call to intrinsic '%s' at %L is not PURE, name, c-loc); return MATCH_ERROR; } + if (!isym-pure) +gfc_unset_implicit_pure (NULL); + c-resolved_sym-attr.noreturn = isym-noreturn; return
Re: [PATCH 1/4] [GOMP4] [Fortran] OpenACC 1.0+ support in fortran front-end
Ilmir Usmanov wrote: Committed as r208541. Thanks. Can you or Thomas apply the following patch after my patch* has been committed to the trunk and the branch has been updated? Please mention PR fortran/60283 in the ChangeLog. * http://gcc.gnu.org/ml/gcc-patches/2014-03/msg00782.html Tobias --- a/gcc/fortran/parse.c +++ b/gcc/fortran/parse.c @@ -550,8 +550,7 @@ decode_oacc_directive (void) return ST_NONE; } - if (gfc_implicit_pure (NULL)) -gfc_current_ns-proc_name-attr.implicit_pure = 0; + gfc_unset_implicit_pure (NULL); old_locus = gfc_current_locus;
Re: [PATCH 1/4] [GOMP4] [Fortran] OpenACC 1.0+ support in fortran front-end
Hi! On Sun, 16 Mar 2014 20:23:48 +0100, Tobias Burnus bur...@net-b.de wrote: Can you or Thomas apply the following patch after my patch* has been committed to the trunk and the branch has been updated? Please mention PR fortran/60283 in the ChangeLog. * http://gcc.gnu.org/ml/gcc-patches/2014-03/msg00782.html Thanks; I've put it onto my merge tasks list. Grüße, Thomas pgpzgLDTYerRJ.pgp Description: PGP signature
[PATCH] Fix PR c++/60390
PR c++/60390 * parser.c (cp_parser_member_declaration): Don't allow finish_fully_implicit_template to consider friend declarations to be class member templates. (synthesize_implicit_template_parm): Handling winding back through class scope to the class being defined in order to inject a template argument list. PR c++/60390 * g++.dg/cpp1y/pr60390.C: New testcase. --- gcc/cp/parser.c | 49 +--- gcc/testsuite/g++.dg/cpp1y/pr60390.C | 26 +++ 2 files changed, 66 insertions(+), 9 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp1y/pr60390.C diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index a01f204..e0ccec0 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -20521,8 +20521,13 @@ cp_parser_member_declaration (cp_parser* parser) decl = grokfield (declarator, decl_specifiers, initializer, /*init_const_expr_p=*/true, asm_specification, attributes); - if (parser-fully_implicit_function_template_p) - decl = finish_fully_implicit_template (parser, decl); + if (parser-fully_implicit_function_template_p) + { + if (friend_p) + finish_fully_implicit_template (parser, 0); + else + decl = finish_fully_implicit_template (parser, decl); + } } cp_finalize_omp_declare_simd (parser, decl); @@ -31976,13 +31981,39 @@ synthesize_implicit_template_parm (cp_parser *parser) parent_scope = scope; scope = scope-level_chain; } - if (current_class_type !LAMBDA_TYPE_P (current_class_type) - parser-num_classes_being_defined == 0) - while (scope-kind == sk_class) - { - parent_scope = scope; - scope = scope-level_chain; - } + if (current_class_type !LAMBDA_TYPE_P (current_class_type)) + { + /* If not defining a class, then any class scope is a scope level in +an out-of-line member definition. In this case simply wind back +beyond the first such scope to inject the template argument list. +Otherwise wind back to the class being defined. The latter can +occur in class member friend declarations such as: + + class A { +void foo (auto); + }; + class B { +friend void A::foo (auto); + }; + + The template argument list synthesized for the friend declaration + must be injected between in the scope of 'B', just beyond the scope + of 'A' introduced by 'A::'. */ + + if (parser-num_classes_being_defined == 0) + while (scope-kind == sk_class) + { + parent_scope = scope; + scope = scope-level_chain; + } + else + while (scope-kind == sk_class + !TYPE_BEING_DEFINED (scope-this_entity)) + { + parent_scope = scope; + scope = scope-level_chain; + } + } current_binding_level = scope; diff --git a/gcc/testsuite/g++.dg/cpp1y/pr60390.C b/gcc/testsuite/g++.dg/cpp1y/pr60390.C new file mode 100644 index 000..5cd5539 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/pr60390.C @@ -0,0 +1,26 @@ +// PR c++/60390 +// { dg-do compile { target c++1y } } +// { dg-options } + +struct A +{ + void foo (auto); +}; + +class B +{ + int m; + friend void A::foo (auto); +}; + +void A::foo (auto i) +{ + B b; + b.m = i; +} + +int main () +{ + A a; + a.foo (7); +} -- 1.9.0
Re: [patch, fortran] Fix for PR 60522
Le 16/03/2014 11:41, Thomas Koenig a écrit : Hello world, the attached patch fixes PR 60522, a regresseion where temporary variables were incorrectly introduced in a BLOCK within a WHERE statement. Regression-tested on x86_64-unknown-linux-gnu. OK for trunk and the other open branches? I have a testcase that I'm pretty sure you won't like. ;-) I outputs with -ffrontend-optimize: 0 0 260 442 696 and without: 0 0 1468820231260 Mikael program foo implicit none integer, parameter :: n = 5 integer :: i integer, dimension(n) :: a integer, dimension(n) :: b = (/ (i + 2, i=1,size(b)) /) integer, dimension(n) :: c = (/ (i*i, i=1,size(c)) /) integer, dimension(n) :: d d = 0 a = b where(c b) a = c d = bar(a) + bar(a) end where print *, d contains pure function bar(x) integer, dimension(n), intent(in) :: x integer, dimension(n) :: bar bar = x * x * x + 5 end function bar end program foo
[patch, libgfortran] PR46800 Handle CTRL-D correctly with STDIN
Hi all. The problem here was that when reading a value from STDIN and the user just entered an empty entry (LF), we would end up getting nested into a second read (via next_char) and the user would have to press CTRL-D twice to get out of the read. (The correct behavior is to only hit CTRL-D once which sends us the EOF. This was caused by a call to eat_separator right after we did the initial read. The eat_separator function then tries to read again and we get a condition of waiting for user input on that read. The patch eliminates this call to eat_separator. This requires explicitly checking for the comma and end-of-line conditions which are also done in eat_separator. Regression tested on x86-64-gnu. No test case can be done since it require terminal input to read. OK for trunk? Regards, Jerry 2014-03-16 Jerry DeLisle jvdeli...@gcc.gnu PR libfortran/58324 * io/list_read.c (list_formatted_read_scalar): Do not use eat_separator. Explicitly set the comma and end-of-line flags. Check for END condition from finish_separator. Index: list_read.c === --- list_read.c (revision 208591) +++ list_read.c (working copy) @@ -1923,17 +1923,31 @@ list_formatted_read_scalar (st_parameter_dt *dtp, } if (is_separator (c)) { - /* Found a null value. */ - eat_separator (dtp); + /* Found a null value. Do not use eat_separator here otherwise + we will do an extra read from stdin. */ dtp-u.p.repeat_count = 0; - /* eat_separator sets this flag if the separator was a comma. */ - if (dtp-u.p.comma_flag) - goto cleanup; + /* Set comma_flag. */ + if ((c == ';' + dtp-u.p.current_unit-decimal_status == DECIMAL_COMMA) + || + (c == ',' + dtp-u.p.current_unit-decimal_status == DECIMAL_POINT)) + { + dtp-u.p.comma_flag = 1; + goto cleanup; + } - /* eat_separator sets this flag if the separator was a \n or \r. */ - if (dtp-u.p.at_eol) - finish_separator (dtp); + /* Set end-of-line flag. */ + if (c == '\n' || c == '\r') + { + dtp-u.p.at_eol = 1; + if (finish_separator (dtp) == LIBERROR_END) + { + err = LIBERROR_END; + goto cleanup; + } + } else goto cleanup; }
Re: libgo patch committed: Compile math library with -ffp-contract=off
Michael Hudson-Doyle michael.hud...@linaro.org writes: Ian Lance Taylor i...@google.com writes: On Thu, Mar 13, 2014 at 6:27 PM, Michael Hudson-Doyle michael.hud...@linaro.org wrote: Ian Lance Taylor i...@google.com writes: The bug report http://golang.org/issue/7074 shows that math.Log2(1) produces the wrong result on Aarch64, because the Go math package is compiled to use a fused multiply-add instruction. This patch to the libgo configure script will use -ffp-contract=off when compiling the math package on processors other than x86. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu, not that that tests much. Committed to mainline. Thanks for this! If you are willing to go into battle enough to argue that libgcc should also be compiled with -ffp-contract=off (I did not have the stomach for that fight) then we'll be down to 1 check-go failure on aarch64 (which is peano -- due to the absence of split/copyable stacks and should probably xfail). Hmmm, what is it that fails with libgcc? Is there a bug report for it? https://code.google.com/p/go/issues/detail?id=7066 and then http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59714 I wanted to propose a version using Kahan's algorithm for the determinant as described in http://hal-ens-lyon.archives-ouvertes.fr/docs/00/78/57/86/PDF/Jeannerod_Louvet_Muller_final.pdf but I haven't gotten around to it... I got bored / distracted and hacked up this: diff --git a/libgo/runtime/go-cdiv.c b/libgo/runtime/go-cdiv.c index 0a81e45..b96576a 100644 --- a/libgo/runtime/go-cdiv.c +++ b/libgo/runtime/go-cdiv.c @@ -13,6 +13,8 @@ the the whole number is Inf, but an operation involving NaN ought to result in NaN, not Inf. */ +#include math.h + __complex float __go_complex64_div (__complex float a, __complex float b) { @@ -29,6 +31,48 @@ __go_complex64_div (__complex float a, __complex float b) return a / b; } +#ifdef FP_FAST_FMA + +// This implements what is sometimes called Kahan's compensated algorithm for +// 2 by 2 determinants. It returns a*b + c*d to a high degree of precision +// but depends on a fused-multiply add operation that rounds once. +// +// The obvious algorithm has problems when a*b and c*d nearly cancel, but the +// trick is the calculation of 'e': a*b = w + e is exact when the operands +// are considered as real numbers. So if c*d nearly cancels out w, e restores +// the result to accuracy. +double +Kahan(double a, double b, double c, double d) +{ + double w, e, f; + w = b * a; + e = fma(b, a, -w); + f = fma(d, c, w); + return f + e; +} + +__complex double +__go_complex128_div (__complex double a, __complex double b) +{ + double r, i, denom; + if (__builtin_expect (b == 0+0i, 0)) +{ + if (!__builtin_isinf (__real__ a) + !__builtin_isinf (__imag__ a) + (__builtin_isnan (__real__ a) || __builtin_isnan (__imag__ a))) + { + /* Pass 1 to nan to match math/bits.go. */ + return __builtin_nan(1) + __builtin_nan(1)*1i; + } +} + r = Kahan(__real__ a, __real__ b, __imag__ a, __imag__ b); + i = Kahan(__imag__ a, __real__ b, - __real__ a, __imag__ b); + denom = (__real__ b)*(__real__ b) + (__imag__ b)*(__imag__ b); + return r/denom + i*1.0i/denom; +} + +#else + __complex double __go_complex128_div (__complex double a, __complex double b) { @@ -44,3 +88,5 @@ __go_complex128_div (__complex double a, __complex double b) } return a / b; } + +#endif it would be better to do this in libgcc of course but I think that's awkward because libgcc can't link to libm and so on... It's probably a little slower than the libgcc version (although this is straight line code) but I don't really care about that :-) Cheers, mwh
[PATCH,GCC/Thumb1] Correctly reset the variable after_arm_reorg for Thumb1 target
Hi, I am working on another patch and found this per-function variable isn't correctly reset for Thumb1 target. Currently no ICE will be triggered because we don't call function arm_split_constants for Thumb1 target. This patch intends to define this variable in machine_function struct in arm.h. In this way, the variable will be correctly reset and ready for being used for Thumb1 target in future. Tested with gcc regression test for Thumb1 target cortex-m0. No new regressions. Is it ok to trunk? BR, Terry 2014-03-17 Terry Guo terry@arm.com * config/arm/arm.h (machine_function): Define variable after_arm_reorg here. * config/arm/arm.c (after_arm_reorg): Remove the definition. (arm_split_constant): Update the way to access variable after_arm_reorg. (arm_reorg): Ditto. (arm_output_function_epilogue): Remove the reset of after_arm_reorg.diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index 7ca47a7..982ed48 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -1543,6 +1543,9 @@ typedef struct GTY(()) machine_function rtx thumb1_cc_op1; /* Also record the CC mode that is supported. */ enum machine_mode thumb1_cc_mode; + /* Set to 1 after arm_reorg has started. Reset to 0 at the start of + the next function. */ + int after_arm_reorg; } machine_function; #endif diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index a68ed8d..a6ea45b 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -880,10 +880,6 @@ enum machine_mode output_memory_reference_mode; /* The register number to be used for the PIC offset register. */ unsigned arm_pic_register = INVALID_REGNUM; -/* Set to 1 after arm_reorg has started. Reset to start at the start of - the next function. */ -static int after_arm_reorg = 0; - enum arm_pcs arm_pcs_default; /* For an explanation of these variables, see final_prescan_insn below. */ @@ -3372,7 +3368,7 @@ arm_split_constant (enum rtx_code code, enum machine_mode mode, rtx insn, Ref: gcc -O1 -mcpu=strongarm gcc.c-torture/compile/980506-2.c */ - if (!after_arm_reorg + if (!cfun-machine-after_arm_reorg !cond (arm_gen_constant (code, mode, NULL_RTX, val, target, source, 1, 0) @@ -17132,7 +17128,7 @@ arm_reorg (void) /* From now on we must synthesize any constants that we can't handle directly. This can happen if the RTL gets split during final instruction generation. */ - after_arm_reorg = 1; + cfun-machine-after_arm_reorg = 1; /* Free the minipool memory. */ obstack_free (minipool_obstack, minipool_startobj); @@ -19281,9 +19277,6 @@ arm_output_function_epilogue (FILE *file ATTRIBUTE_UNUSED, || (cfun-machine-return_used_this_function != 0) || offsets-saved_regs == offsets-outgoing_args || frame_pointer_needed); - - /* Reset the ARM-specific per-function variables. */ - after_arm_reorg = 0; } }
[PATCH, GCC/THUMB1] New define_insn_and_split pattern to enable optimizing out certain unnecessary uxtb instruction
Hi The existing test case gcc.target/arm/unsigned-extend-1.c fails for Thumb1 target like cortex-m0 because the thumb1_addsi3_addgeu insn pattern isn't friendly to gcc combine pass. Before combine pass, we have such insn for this test case: (insn 10 9 12 2 (set (reg:SI 118) (plus:SI (plus:SI (reg:SI 120) (reg:SI 120)) (geu:SI (reg:SI 119) (reg:SI 117 When the operand (reg:SI 120) is zero and operand (reg:SI 119) is constant 9, combine pass will turn this insn into: (insn 10 9 12 2 (set (reg:SI 118) (leu:SI (reg:SI 116) (const_int 9 Unfortunately this new insn doesn't match any existing patterns, this causes combine pass to undo all attempts and results in sub-optimal code. The attached patch intends to legitimize the new insn. Tested with gcc regression test and no new regression. Is it OK to trunk? BR, Terry 2014-03-17 Terry Guo terry@arm.com * config/arm/arm.md (cstoresi_leu_thumb1): New define_insn_and_split pattern. (cstoresi4): Use above new pattern. diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md index 2ddda02..905a5b8 100644 --- a/gcc/config/arm/arm.md +++ b/gcc/config/arm/arm.md @@ -8755,18 +8755,14 @@ case LEU: op3 = force_reg (SImode, operands[3]); - scratch = force_reg (SImode, const0_rtx); - emit_insn (gen_thumb1_addsi3_addgeu (operands[0], scratch, scratch, - op3, operands[2])); + emit_insn (gen_cstoresi_leu_thumb1 (operands[0], operands[2], op3)); break; case GEU: op3 = operands[3]; if (!thumb1_cmp_operand (op3, SImode)) op3 = force_reg (SImode, op3); - scratch = force_reg (SImode, const0_rtx); - emit_insn (gen_thumb1_addsi3_addgeu (operands[0], scratch, scratch, - operands[2], op3)); + emit_insn (gen_cstoresi_leu_thumb1 (operands[0], op3, operands[2])); break; case LTU: @@ -8909,6 +8905,34 @@ (set_attr type multiple)] ) +(define_insn_and_split cstoresi_leu_thumb1 + [(set (match_operand:SI 0 s_register_operand =l) + (leu:SI (match_operand:SI 1 s_register_operand l) + (match_operand:SI 2 thumb1_cmp_operand lI)))] + TARGET_THUMB1 + # + TARGET_THUMB1 + [(set (match_dup 3) (const_int 0)) + (set (match_dup 0) + (plus:SI (plus:SI (match_dup 3) + (match_dup 3)) +(geu:SI (match_dup 4) +(match_dup 1] + +operands[3] = gen_reg_rtx (SImode); + +if (CONST_INT_P (operands[2])) + { +operands[4] = gen_reg_rtx (SImode); +emit_move_insn (operands[4], operands[2]); + } +else + operands[4] = operands[2]; + + [(set_attr length 4) + (set_attr type multiple)] +) + ;; Conditional move insns