[RFC][GCC, Multilib]Make GCC more easier for user to select and build extra libraries for ARM targets.

2011-09-11 Thread Terry Guo
Hello,

This patch intends to implement a convenient interface for user to customize
the final Multilibs according to their real requirements. There is no
intention to override the default Multilib set, instead it only build
"extra" libraries besides them. Specifically the extra Multilibs can be
selected by user through a new configure option
"--with-extra-multilibs=A-COMMA-SEPARATED-TARGET-LIST". For example if user
want to build extra library for cortex-m0, cortex-m3 and cortex-m4, the
configure option would be
"--with-extra-multilibs=armv6s-m,armv7-m,armv7e-m".

This patch has been in ARM/embedded-4_6-branch. Any comments for applying it
on trunk?

BR,
Terry

2011-09-08  Terry Guo  
 
* config.gcc: Support --with-extra-multilibs option for ARM EABI.
* configure.ac: Handle --with-extra-multilibs option.
* configure: Add help message and support for that option. 
* doc/install.texi: Document that option.
* config/arm/t-arm-elf (MULTILIB_OSDIRNAMES): Added to support
build extra multilibs with user-specified directory name.
* config/arm/t-armv6s-m: New fragment for building extra multilib
for
ARM armv6s-m architecture.
* config/arm/t-armv7-m: New fragment for building extra multilib for
ARM armv7-m architecture.
* config/arm/t-armv7e-m: New fragment for building extra multilib
for
ARM armv7e-m architecture.
* config/arm/t-thumb1: New fragment for building extra multilib for
ARM Thumb-1.
* config/arm/t-thumb2: New fragment for building extra multilib for
ARM Thumb-2.


Index: gcc/doc/install.texi
===
--- gcc/doc/install.texi(revision 178754)
+++ gcc/doc/install.texi(working copy)
@@ -1068,6 +1068,24 @@
 --with-multilib-list=sh4al,!mb/m4al
 @end smallexample
 
+@item --with-extra-multilibs=@var{list} @itemx 
+--without-extra-multilibs Specify what extra multilibs to build besides 
+the default library set.
+Currently only implemented for arm*-*-eabi.
+
+@var{list} is a comma separated list of ARM architecture names.
+Currently the available names are thumb1, thumb2, armv6s-m, armv7-m and 
+armv7e-m.
+
+If @option{--with-extra-multilibs} or @var{list} is not given, then no 
+extra multilibs will be built.
+
+Example: to configure a compiler for arm-none-eabi with additional 
+multilib support for thumb1, thumb2 and armv6s-m:
+@smallexample
+--target=arm-none-eabi --with-extra-multilibs=thumb1,thumb2,armv6s-m
+@end smallexample
+
 @item --with-endian=@var{endians}
 Specify what endians to use.
 Currently only implemented for sh*-*-*.
Index: gcc/configure
===
--- gcc/configure   (revision 178754)
+++ gcc/configure   (working copy)
@@ -1650,6 +1650,7 @@
   --with-pkgversion=PKG   Use PKG in the version string in place of "GCC"
   --with-bugurl=URL   Direct users to URL to report a bug
   --with-multilib-listSelect multilibs (SH only)
+  --with-extra-multilibs  Select extra multilibs (ARM only)
   --with-gnu-ld   assume the C compiler uses GNU ld default=no
   --with-libiconv-prefix[=DIR]  search for libiconv in DIR/include and
DIR/lib
   --without-libiconv-prefix don't search for libiconv in includedir and
libdir
@@ -7198,6 +7199,12 @@
   with_multilib_list=default
 fi
 
+# Check whether --with-extra-multilibs was given.
+if test "${with_extra_multilibs+set}" = set; then :
+  withval=$with_extra_multilibs; :
+else
+  with_extra_multilibs=default
+fi
 
 # -
 # Checks for other programs
Index: gcc/configure.ac
===
--- gcc/configure.ac(revision 178754)
+++ gcc/configure.ac(working copy)
@@ -790,6 +790,11 @@
 :,
 with_multilib_list=default)
 
+AC_ARG_WITH(extra-multilibs,
+[  --with-extra-multilibsSelect extra multilibs (ARM only)],
+:,
+with_extra_multilibs=default)
+
 # -
 # Checks for other programs
 # -
Index: gcc/config.gcc
===
--- gcc/config.gcc  (revision 178754)
+++ gcc/config.gcc  (working copy)
@@ -883,6 +883,32 @@
arm*-*-eabi*)
  tm_file="$tm_file newlib-stdint.h"
  tmake_file="${tmake_file} arm/t-bpabi"
+ arm_multilibs="${with_extra_multilibs}"
+ if test $arm_multilibs != "default"; then
+   arm_multilibs=`echo $arm_multilibs | sed -e 's/,/ /g'`
+   for arm_multilib in ${arm_multilibs}; do
+   case ${arm_multilib} in
+   thumb1)
+   tmake_file="${tmake_file} arm/t-thumb1"
+   ;;
+   thumb2)
+   tmake_file="${tmake_file} arm/t-thumb2"
+   ;;
+   armv6s-m)
+   tmake_file="

Re: [arm-embedded] Simply enable GCC to support -march=armv6s-m as GAS does.

2011-09-11 Thread Richard Earnshaw (home)

On 11 Sep 2011, at 03:10, "Terry Guo"  wrote:

> Hello,
> 
> This patch adds simple support of -march=armv6s-m which is already supported
> by GAS. With this patch, inline assembly code containing "SVC" instruction
> can be handled by option -march=armv6s-m. Otherwise one has to use option
> -mcpu=cortex-m0. Committed into ARM/embedded-4_6-branch.
> 
> BR,
> Terry
> 
> 2011-09-08  Terry Guo  
> 
>* config/arm/arm.c (all_architectures): Simple support for
>option -march=armv6s-m.
> 
> 

Ok.

R.

> Index: gcc/config/arm/arm.c
> ===
> --- gcc/config/arm/arm.c(revision 178753)
> +++ gcc/config/arm/arm.c(working copy)
> @@ -933,6 +933,7 @@
>   {"armv6zk", arm1176jzs, "6ZK", FL_CO_PROC | FL_FOR_ARCH6ZK,
> NULL},
>   {"armv6t2", arm1156t2s, "6T2", FL_CO_PROC | FL_FOR_ARCH6T2,
> NULL},
>   {"armv6-m", cortexm1,  "6M",
> FL_FOR_ARCH6M, NULL},
> +  {"armv6s-m", cortexm1,  "6M",
> FL_FOR_ARCH6M, NULL},
>   {"armv7",   cortexa8,  "7", FL_CO_PROC |
> FL_FOR_ARCH7, NULL},
>   {"armv7-a", cortexa8,  "7A", FL_CO_PROC |
> FL_FOR_ARCH7A, NULL},
>   {"armv7-r", cortexr4,  "7R", FL_CO_PROC |
> FL_FOR_ARCH7R, NULL},
> 
> 
> 




RE: [arm-embedded] Simply enable GCC to support -march=armv6s-m as GAS does.

2011-09-11 Thread Terry Guo
Hello Richard,

> 
> > Hello,
> >
> > This patch adds simple support of -march=armv6s-m which is already
> supported
> > by GAS. With this patch, inline assembly code containing "SVC"
> instruction
> > can be handled by option -march=armv6s-m. Otherwise one has to use
> option
> > -mcpu=cortex-m0. Committed into ARM/embedded-4_6-branch.
> >
> > BR,
> > Terry
> >
> > 2011-09-08  Terry Guo  
> >
> >* config/arm/arm.c (all_architectures): Simple support for
> >option -march=armv6s-m.
> >
> >
> 
> Ok.
> 
> R.

Can I apply this patch to trunk and GCC 4.6 branch?

BR,
Terry





Re: Add unwind information to mips epilogues

2011-09-11 Thread Richard Sandiford
Richard Sandiford  writes:
> I think I need to play around with it a bit before I understand enough
> to review.  I'll try to find time this weekend.

Does the attached patch look OK?  It should fix a couple of things.
First, on MIPS16, this code:

  /* Set TARGET to BASE + STEP1.  */
  target = base;
  if (step1 > 0)
{
  rtx adjust;

  /* Get an rtx for STEP1 that we can add to BASE.  */
  adjust = GEN_INT (step1);
  if (!SMALL_OPERAND (step1))
{
  mips_emit_move (MIPS_EPILOGUE_TEMP (Pmode), adjust);
  adjust = MIPS_EPILOGUE_TEMP (Pmode);
}

  /* Normal mode code can copy the result straight into $sp.  */
  if (!TARGET_MIPS16)
target = stack_pointer_rtx;

  emit_insn (gen_add3_insn (target, base, adjust));
}

adds STEP1 to the frame pointer, then:

  /* Copy TARGET into the stack pointer.  */
  if (target != stack_pointer_rtx)
mips_emit_move (stack_pointer_rtx, target);

moves it to the stack pointer.  So there's a window in which the frame
pointer would have been adjusted, but the CFA is still defined in terms
of the old frame pointer.  I think:

  emit_insn (gen_add3_insn (target, base, adjust));

always needs a DEF_CFA note for TARGET + STEP2.  For MIPS16, this will
redefine the CFA in terms of the new frame pointer, otherwise it will
define the CFA in terms of the stack pointer.  It's not necessary to
do this immediately for frame_pointer_needed && !TARGET_MIPS16, but we'd
eventually emit the same thing when restoring the frame pointer, so we
might as well do it here.

With that change, we can drop the DEF_CFA for:

  /* Copy TARGET into the stack pointer.  */
  if (target != stack_pointer_rtx)
mips_emit_move (stack_pointer_rtx, target);

and simply set it when restoring the frame pointer, just as for
non-MIPS16 code.

Second thing is that we never emitted .cfi_restores for interrupt
handlers that use the shadow register set (which don't need to
deallocate the stack).

I tested this with the other shrink-wrapping patches on mips64-linux-gnu
using --with-arch=mips64 (-mabi=32, -mabi=64, -mabi=n32 and -mips16/-mabi=32,
which tests SAVE and RESTORE).  The results were good apart from:

FAIL: gcc.c-torture/compile/iftrap-1.c  -O3 -g  (internal compiler error)
FAIL: gcc.c-torture/compile/iftrap-1.c  -O3 -g  (test for excess errors)

when testing with -mips16/-mabi=32.  Not sure if you've already
seen/mentioned this or not, but just in case: the ICE is coming from:

void f8(int p)
{
  if (p)
__builtin_trap();
  else
{
  bar();
  __builtin_trap();
}
}

When generating prologues and epilogues, there are still two trap
instructions (each with only fake edges to the exit block, since
the trap is unconditional).  We decide to shrink-wrap the "else",
meaning that the two traps have different CFAs.  Then the cfg cleanups
in csa notice that we have two basic blocks that end in traps,
and decides to redirect the "then" branch to the end of the "else".
That's correct execution-wise, but it means we have two incoming edges
with different CFAs.

Richard


gcc/
2011-09-11  Bernd Schmidt  
Richard Sandiford  

* config/mips/mips.c (mips_epilogue): New structure.
(mips16e_save_restore_reg): Queue REG_CFA_RESTORE notes when
restoring registers.
(mips_epilogue_emit_cfa_restores): New function.
(mips_epilogue_set_cfa): Likewise.
(mips_restore_reg): Queue REG_CFA_RESTORE notes.  When restoring
the current CFA register from the stack, redefine the CFA in terms
of the stack pointer.
(mips_expand_epilogue): Set up mips_epilogue.  Attach CFA information
to the epilogue instructions.

gcc/testsuite/
* gcc.target/mips/mips.exp (mips_option_groups): Add debug options.
* gcc.target/mips/interrupt_handler-2.c: New test.
* gcc.target/mips/interrupt_handler-3.c: Likewise.

Index: gcc/config/mips/mips.c
===
--- gcc/config/mips/mips.c  2011-09-10 09:30:00.0 +0100
+++ gcc/config/mips/mips.c  2011-09-11 09:07:47.0 +0100
@@ -501,6 +501,21 @@ const char *current_function_file = "";
 int mips_dbx_regno[FIRST_PSEUDO_REGISTER];
 int mips_dwarf_regno[FIRST_PSEUDO_REGISTER];
 
+/* Information about the current function's epilogue, used only while
+   expanding it.  */
+static struct {
+  /* A list of queued REG_CFA_RESTORE notes.  */
+  rtx cfa_restores;
+
+  /* The CFA is currently defined as CFA_REG + CFA_OFFSET.  */
+  rtx cfa_reg;
+  HOST_WIDE_INT cfa_offset;
+
+  /* The offset of the CFA from the stack pointer while restoring
+ registers.  */
+  HOST_WIDE_INT cfa_restore_sp_offset;
+} mips_epilogue;
+
 /* The nesting depth of the PRINT_OPERAND '%(', '%<' and '%[' constructs.  */
 struct mips_asm_switch mips_noreorder = { "reorder", 0 };
 struct mips_asm_switch mips_nomacro = { "macro", 0 };
@@ -8377,7 +8392,11 @@ mips16e_save_restor

Re: [RFC][GCC, Multilib]Make GCC more easier for user to select and build extra libraries for ARM targets.

2011-09-11 Thread Joseph S. Myers
On Sun, 11 Sep 2011, Terry Guo wrote:

> This patch intends to implement a convenient interface for user to customize
> the final Multilibs according to their real requirements. There is no
> intention to override the default Multilib set, instead it only build
> "extra" libraries besides them. Specifically the extra Multilibs can be
> selected by user through a new configure option
> "--with-extra-multilibs=A-COMMA-SEPARATED-TARGET-LIST". For example if user
> want to build extra library for cortex-m0, cortex-m3 and cortex-m4, the
> configure option would be
> "--with-extra-multilibs=armv6s-m,armv7-m,armv7e-m".

This seems very similar to the --with-multilib-list option for SH and 
x86_64.  I think you should use the same name and share the same 
implementation as far as possible - certainly, you need to explain how 
what you have done compares to that option and justify differences.  If 
the difference is whether the multilibs add to or replace the default 
list, maybe allow "default," to appear in the argument to 
--with-multilib-list to indicate that the default list is added to rather 
than replaced.

> +@item --with-extra-multilibs=@var{list} @itemx 
> +--without-extra-multilibs Specify what extra multilibs to build besides 

You have @itemx on the wrong line here.

> Index: gcc/config/arm/t-armv7e-m
> ===
> --- gcc/config/arm/t-armv7e-m (revision 0)
> +++ gcc/config/arm/t-armv7e-m (revision 0)
> @@ -0,0 +1,16 @@
> +#Build below library for ARM armv7e-m architecture.
> +#  armv7e-m/ -mthumb -march=armv7e-m
> +
> +MULTILIB_OPTIONS  += march=armv7e-m
> +
> +MULTILIB_DIRNAMES += armv7e-m
> +
> +MULTILIB_EXCEPTIONS   += march=armv7e-m*
> +MULTILIB_EXCEPTIONS   += marm*/march=armv7e-m*
> +MULTILIB_EXCEPTIONS   += mfloat-abi=hard/march=armv7e-m*
> +MULTILIB_EXCEPTIONS   += mthumb/mfloat-abi=hard/march=armv7e-m*
> +MULTILIB_EXCEPTIONS   += m*/march=armv7e-m/march*
> +
> +MULTILIB_MATCHES  += march?armv7e-m=mcpu?cortex-m4
> +
> +MULTILIB_OSDIRNAMES   += mthumb/march.armv7e-m=!armv7e-m

I don't think having such massive manually maintained files for each 
architecture is sustainable.  Note that when the SH configure option was 
enhanced

2009-04-17  Andrew Stubbs  

it *removed* a load of such files.

m68k/t-mlibs uses awk to process .def files to work out appropriate 
multilib settings in different cases.  That seems a much more sustainable 
way of producing these settings than entering them all manually.

-- 
Joseph S. Myers
jos...@codesourcery.com


RE: [arm-embedded] Simply enable GCC to support -march=armv6s-m as GAS does.

2011-09-11 Thread Joseph S. Myers
On Sun, 11 Sep 2011, Terry Guo wrote:

> > > 2011-09-08  Terry Guo  
> > >
> > >* config/arm/arm.c (all_architectures): Simple support for
> > >option -march=armv6s-m.
> > >
> > >
> > 
> > Ok.
> > 
> > R.
> 
> Can I apply this patch to trunk and GCC 4.6 branch?

It won't apply to trunk; you'll need to patch arm-arches.def and 
regenerate the generated file arm-tables.opt.

-- 
Joseph S. Myers
jos...@codesourcery.com


RE: [arm-embedded] Simply enable GCC to support -march=armv6s-m as GAS does.

2011-09-11 Thread Joseph S. Myers
On Sun, 11 Sep 2011, Terry Guo wrote:

> > It won't apply to trunk; you'll need to patch arm-arches.def and
> > regenerate the generated file arm-tables.opt.
> 
> Thanks for your help and I will do that. What else do you think I should 
> do besides that?

I have no other comments on this patch.

-- 
Joseph S. Myers
jos...@codesourcery.com


Re: [Patch, Fortran, OOP] PR 47978: Invalid INTENT in overriding TBP not detected

2011-09-11 Thread Janus Weil
Update: Here is an extended version of the patch, which adds a few
additional checks:
 * a simple check for the array shape (not complete yet, but fixing at
least comment #0 of PR 35831)
 * a check for the string length, as recently implemented for
character results (PR49638)
 * furthermore it checks more of the attributes listed in 12.3.2 (I
did not add test cases for those, and I would argue that we don't
really need a test case for every single attribute)

The patch still regtests cleanly. Ok for trunk? Or should I rather
commit the simple version first?

Cheers,
Janus


2011-09-11  Janus Weil  

PR fortran/35831
PR fortran/47978
* interface.c (check_dummy_characteristics): New function to check the
characteristics of dummy arguments.
(gfc_compare_interfaces,gfc_check_typebound_override): Call it here.


2011-09-11  Janus Weil  

PR fortran/35831
PR fortran/47978
* gfortran.dg/dynamic_dispatch_5.f03: Fix invalid test case.
* gfortran.dg/typebound_proc_6.f03: Changed wording in error message.
* gfortran.dg/proc_decl_26.f90: New.
* gfortran.dg/typebound_override_2.f90: New.



2011/9/9 Janus Weil :
> Hi all,
>
> here is another small patch for an accepts-invalid OOP problem: When
> overriding a type-bound procedure, we need to check that the intents
> of the formal args agree (or more general: their 'characteristics', as
> defined in chapter 12.3.2 of the F08 standard). For now I'm only
> checking type+rank as well as the INTENT and OPTIONAL attributes, but
> I added a FIXME for more comprehensive checking (which could be added
> in a follow-up patch).
>
> On the technical side of things, I'm adding a new function
> 'check_dummy_characteristics', which is called in two places:
>  * gfc_compare_interfaces and
>  * gfc_check_typebound_override.
>
> A slight subtlety is given by the fact that for the PASS argument, the
> type of the argument does not have to agree when overriding.
>
> The improved checking also caught an invalid test case in the
> testsuite (dynamic_dispatch_5), for another one the error message
> changed slightly (typebound_proc_6).
>
> Regtested on x86_64-unknown-linux-gnu. Ok for trunk?
>
> Cheers,
> Janus
>
>
> 2011-09-09  Janus Weil  
>
>        PR fortran/47978
>        * interface.c (check_dummy_characteristics): New function to check the
>        characteristics of dummy arguments.
>        (gfc_compare_interfaces,gfc_check_typebound_override): Call it here.
>
>
> 2011-09-09  Janus Weil  
>
>        PR fortran/47978
>        * gfortran.dg/dynamic_dispatch_5.f03: Fix invalid test case.
>        * gfortran.dg/typebound_proc_6.f03: Changed wording in error message.
>        * gfortran.dg/typebound_override_1.f90: New.
>
Index: gcc/testsuite/gfortran.dg/dynamic_dispatch_5.f03
===
--- gcc/testsuite/gfortran.dg/dynamic_dispatch_5.f03	(revision 178757)
+++ gcc/testsuite/gfortran.dg/dynamic_dispatch_5.f03	(working copy)
@@ -56,7 +56,7 @@ module s_base_mat_mod
 contains 
   subroutine s_scals(d,a,info) 
 implicit none 
-class(s_base_sparse_mat), intent(in) :: a
+class(s_base_sparse_mat), intent(inout) :: a
 real(spk_), intent(in)  :: d
 integer, intent(out):: info
 
@@ -73,7 +73,7 @@ contains
 
   subroutine s_scal(d,a,info) 
 implicit none 
-class(s_base_sparse_mat), intent(in) :: a
+class(s_base_sparse_mat), intent(inout) :: a
 real(spk_), intent(in)  :: d(:)
 integer, intent(out):: info
 
Index: gcc/testsuite/gfortran.dg/typebound_proc_6.f03
===
--- gcc/testsuite/gfortran.dg/typebound_proc_6.f03	(revision 178757)
+++ gcc/testsuite/gfortran.dg/typebound_proc_6.f03	(working copy)
@@ -89,7 +89,7 @@ MODULE testmod
 ! For corresponding dummy arguments.
 PROCEDURE, PASS :: corresp1 => proc_tmeint ! Ok.
 PROCEDURE, PASS :: corresp2 => proc_tmeintx ! { dg-error "should be named 'a'" }
-PROCEDURE, PASS :: corresp3 => proc_tmereal ! { dg-error "Types mismatch for dummy argument 'a'" }
+PROCEDURE, PASS :: corresp3 => proc_tmereal ! { dg-error "Type/rank mismatch in argument 'a'" }
 
   END TYPE t
 
Index: gcc/fortran/interface.c
===
--- gcc/fortran/interface.c	(revision 178757)
+++ gcc/fortran/interface.c	(working copy)
@@ -977,6 +977,113 @@ generic_correspondence (gfc_formal_arglist *f1, gf
 }
 
 
+/* Check if the characteristics of two dummy arguments match,
+   cf. F08:12.3.2.  */
+
+static gfc_try
+check_dummy_characteristics (gfc_symbol *s1, gfc_symbol *s2,
+			 bool type_must_agree, char *errmsg, int err_len)
+{
+  /* Check type and rank.  */
+  if (type_must_agree && !compare_type_rank (s2, s1))
+{
+  if (errmsg != NULL)
+	snprintf (errmsg, err_len, "Type/rank mismatch in argument '%s'",
+		  s1->name);
+  return

[wwwdocs] Minor tweak to release branch status descriptions

2011-09-11 Thread Gerald Pfeifer
Hi there,

I'd like to make the change below which helps with lower resolution
systems (or non-maximized web browsers) or larger font sizes.

Practically I think everyone would understand the new version is the
same as the old, and the official status links usually are more explicit,
but still -- any objections from the RMs?

Gerald

Index: index.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/index.html,v
retrieving revision 1.812
diff -u -r1.812 index.html
--- index.html  10 Sep 2011 21:09:18 -  1.812
+++ index.html  11 Sep 2011 01:16:54 -
@@ -119,7 +119,7 @@
   
   http://gcc.gnu.org/ml/gcc/2011-08/msg00320.html";>2011-08-17
   
-  (regression fixes and docs only).
+  (regression fixes and docs).
   
   
   
   http://gcc.gnu.org/ml/gcc/2011-04/msg00412.html";>2011-04-29
   
-  (regression fixes and docs only).
+  (regression fixes and docs).
   
   
   
   http://gcc.gnu.org/ml/gcc/2011-04/msg00270.html";>2011-04-18
   
-  (regression fixes and docs only).
+  (regression fixes and docs).
   
   
   

Re: [arm-embedded] Simply enable GCC to support -march=armv6s-m as GAS does.

2011-09-11 Thread Richard Earnshaw (home)

On 11 Sep 2011, at 09:37, "Terry Guo"  wrote:

> Hello Richard,
> 
>> 
>>> Hello,
>>> 
>>> This patch adds simple support of -march=armv6s-m which is already
>> supported
>>> by GAS. With this patch, inline assembly code containing "SVC"
>> instruction
>>> can be handled by option -march=armv6s-m. Otherwise one has to use
>> option
>>> -mcpu=cortex-m0. Committed into ARM/embedded-4_6-branch.
>>> 
>>> BR,
>>> Terry
>>> 
>>> 2011-09-08  Terry Guo  
>>> 
>>>   * config/arm/arm.c (all_architectures): Simple support for
>>>   option -march=armv6s-m.
>>> 
>>> 
>> 
>> Ok.
>> 
>> R.
> 
> Can I apply this patch to trunk and GCC 4.6 branch?

Yes, once you've done as Joseph suggests.

R.
> 
> BR,
> Terry
> 
> 
> 
> 




[wwwdocs] Adjust highlight style, and make headers darker

2011-09-11 Thread Gerald Pfeifer
This is in preparation of something I'm doing "for" Nicola, but
it is useful in and by itself so I went ahead and applied it.

Gerald

Index: gcc.css
===
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc.css,v
retrieving revision 1.21
diff -u -r1.21 gcc.css
--- gcc.css 11 Sep 2011 02:07:30 -  1.21
+++ gcc.css 11 Sep 2011 12:47:01 -
@@ -9,10 +9,10 @@
 a:visited { color: #003399; text-decoration: none; }
 a:hover   { color: darkorange; text-decoration: none; }
 
-h1{ color: gray; text-align:center; }
-h2{ color: gray; }
+h1{ color: darkslategray; text-align:center; }
+h2{ color: darkslategray; }
 
-.highlight{ color: gray; }
+.highlight{ color: darkslategray; font-weight:bold; }
 
 dl.news  { margin-top:0; }
 dl.news dt   { font-weight:bold; }



Re: [patch, fortran] Fix PR 50327, regression in DO WHILE

2011-09-11 Thread Tobias Burnus

Thomas Koenig wrote:

the attached patch fixes the PR by transforming

  DO WHILE (condition)
...
  END DO

into the equvialent

  DO WHILE(.true.)
IF (.not. condition) exit
...
  END DO

before applying common function elimination.


Which matches what the current code in trans*.c already does (cf. dump 
in the PR).



OK for trunk?


OK. Thanks for the patch!

Tobias


2011-09-10  Thomas Koenig 

PR fortran/50327
* frontend-passes.c (dummy_expr_callback):  New function.
(convert_do_while):  New function.
(optimize_namespace):  Call code walker to convert do while 
loops.


2011-09-10  Thomas Koenig 

PR fortran/50327
* gfortran.dg/do_while_1.f90:  New test.




Re: [Patch, Fortran, OOP] PR 47978: Invalid INTENT in overriding TBP not detected

2011-09-11 Thread Tobias Burnus

Janus Weil wrote:

Update: Here is an extended version of the patch, which adds a few
additional checks:

The patch still regtests cleanly. Ok for trunk?



+  switch (compval)
+  {

...

+   default:
+ gfc_internal_error ("check_dummy_characteristics: Unexpected result "
+ "%i of gfc_dep_compare_expr", compval);
+ break;
+  }
+}


I think we really should move to enum.


+ gfc_error (strcat (err, " of '%s' at %L with respect to the "
+"overridden procedure"), proc->name,&where);
  return FAILURE;


That's extremely unfriendly to translators; additionally, using
  ("%s of '%s' ...", err, ...
you could avoid calling strcat. That way one also avoids problems like 
exceeding the length of err.


How about something like
  "Argument mismatch for the overridden procedure '%s' at %L: %s"
which is easier to translate - and might be also easier to understand 
for a user.


Otherwise, the patch looks OK.

Tobias


[MIPS, committed] Use match_test for .md attributes

2011-09-11 Thread Richard Sandiford
As per the subject.  Tested on mips64-linux-gnu and mipsisa32-elf
and applied.

Richard


gcc/
* config/mips/mips.md: Use match_test rather than eq/ne symbol_ref
throughout file.
* config/mips/sb1.md: Likewise.
* config/mips/predicates.md: Replace (match_test "!...")
with (not (match_test "..."))
* config/mips/constraints.md: Likewise.

Index: gcc/config/mips/mips.md
===
--- gcc/config/mips/mips.md 2011-09-11 18:17:07.0 +0100
+++ gcc/config/mips/mips.md 2011-09-11 18:17:33.0 +0100
@@ -210,11 +210,11 @@ (define_attr "mode" "unknown,none,QI,HI,
 ;; True if the main data type is twice the size of a word.
 (define_attr "dword_mode" "no,yes"
   (cond [(and (eq_attr "mode" "DI,DF")
- (eq (symbol_ref "TARGET_64BIT") (const_int 0)))
+ (not (match_test "TARGET_64BIT")))
 (const_string "yes")
 
 (and (eq_attr "mode" "TI,TF")
- (ne (symbol_ref "TARGET_64BIT") (const_int 0)))
+ (match_test "TARGET_64BIT"))
 (const_string "yes")]
(const_string "no")))
 
@@ -384,7 +384,7 @@ (define_attr "sync_release_barrier" "yes
 ;; Length of instruction in bytes.
 (define_attr "length" ""
(cond [(and (eq_attr "extended_mips16" "yes")
-  (ne (symbol_ref "TARGET_MIPS16") (const_int 0)))
+  (match_test "TARGET_MIPS16"))
  (const_int 8)
 
  ;; Direct branch instructions have a range of [-0x2,0x1fffc],
@@ -423,7 +423,7 @@ (define_attr "length" ""
   (const_int 4)
 
 ;; The non-PIC case: branch, first delay slot, and J.
-(ne (symbol_ref "TARGET_ABSOLUTE_JUMPS") (const_int 0))
+(match_test "TARGET_ABSOLUTE_JUMPS")
   (const_int 12)]
 
 ;; Use MAX_PIC_BRANCH_LENGTH as a (gross) overestimate.
@@ -439,7 +439,7 @@ (define_attr "length" ""
  (const_int 0)
 
  (eq_attr "got" "load")
- (if_then_else (ne (symbol_ref "TARGET_MIPS16") (const_int 0))
+ (if_then_else (match_test "TARGET_MIPS16")
(const_int 8)
(const_int 4))
  (eq_attr "got" "xgot_high")
@@ -456,7 +456,7 @@ (define_attr "length" ""
  ;; SHIFT_SHIFTs are decomposed into two separate instructions.
  ;; They are extended instructions on MIPS16 targets.
  (eq_attr "move_type" "shift_shift")
- (if_then_else (ne (symbol_ref "TARGET_MIPS16") (const_int 0))
+ (if_then_else (match_test "TARGET_MIPS16")
(const_int 16)
(const_int 8))
 
@@ -479,7 +479,7 @@ (define_attr "length" ""
  (eq_attr "move_type" "load,fpload")
  (symbol_ref "mips_load_store_insns (operands[1], insn) * 4")
  (eq_attr "move_type" "store,fpstore")
- (cond [(eq (symbol_ref "TARGET_FIX_24K") (const_int 0))
+ (cond [(not (match_test "TARGET_FIX_24K"))
 (symbol_ref "mips_load_store_insns (operands[0], insn) * 4")]
 (symbol_ref "mips_load_store_insns (operands[0], insn) * 4 + 
4"))
 
@@ -500,7 +500,7 @@ (define_attr "length" ""
  ;; instruction.  The assembler does this for us, so account for
  ;; the worst-case length here.
  (and (eq_attr "type" "imadd")
-  (ne (symbol_ref "TARGET_FIX_VR4120") (const_int 0)))
+  (match_test "TARGET_FIX_VR4120"))
  (const_int 8)
 
  ;; VR4120 errata MD(4): if there are consecutive dmult instructions,
@@ -508,7 +508,7 @@ (define_attr "length" ""
  ;; around this by inserting a nop after the first dmult.
  (and (eq_attr "type" "imul,imul3")
   (and (eq_attr "mode" "DI")
-   (ne (symbol_ref "TARGET_FIX_VR4120") (const_int 0
+   (match_test "TARGET_FIX_VR4120")))
  (const_int 8)
 
  (eq_attr "type" "idiv,idiv3")
@@ -528,24 +528,24 @@ (define_enum_attr "cpu" "processor"
 ;; write to HI or LO.
 (define_attr "hazard" "none,delay,hilo"
   (cond [(and (eq_attr "type" "load,fpload,fpidxload")
- (ne (symbol_ref "ISA_HAS_LOAD_DELAY") (const_int 0)))
+ (match_test "ISA_HAS_LOAD_DELAY"))
 (const_string "delay")
 
 (and (eq_attr "type" "mfc,mtc")
- (ne (symbol_ref "ISA_HAS_XFER_DELAY") (const_int 0)))
+ (match_test "ISA_HAS_XFER_DELAY"))
 (const_string "delay")
 
 (and (eq_attr "type" "fcmp")
- (ne (symbol_ref "ISA_HAS_FCMP_DELAY") (const_int 0)))
+ (match_test "ISA_HAS_FCMP_DELAY"))
 (const_string "delay")
 
 ;; The r4000 multiplication patterns include an mflo instruction.
 (and (eq_attr "type" "imul")
- (ne (symbol_ref "TARGET_FIX_R4000") (const_int 0)))
+ (match_test "TARGET_FIX_R4000"))
 (const_string "hilo")
 
 

[CRIS, committed] Use match_test for .md attributes

2011-09-11 Thread Richard Sandiford
As per the subject.  Tested by making sure there were no differences
in the assembly output for the C and C++ testsuites for cris-elf.
Applied as preapproved (thanks H-P).

Richard


gcc/
* config/cris/cris.md: Use match_test rather than eq/ne symbol_ref
throughout file.

Index: gcc/config/cris/cris.md
===
--- gcc/config/cris/cris.md 2011-09-03 10:05:49.0 +0100
+++ gcc/config/cris/cris.md 2011-09-11 18:21:13.0 +0100
@@ -191,10 +191,8 @@ (define_delay (eq_attr "slottable" "has_
 
 (define_delay (eq_attr "slottable" "has_call_slot")
   [(and (eq_attr "slottable" "yes")
-   (ior (eq (symbol_ref "RTX_FRAME_RELATED_P (insn)")
-(const_int 0))
-(eq (symbol_ref "flag_exceptions")
-(const_int 0
+   (ior (not (match_test "RTX_FRAME_RELATED_P (insn)"))
+(not (match_test "flag_exceptions"
(nil) (nil)])
 
 ;; The insn in the return insn slot must not be the
@@ -204,8 +202,7 @@ (define_delay (eq_attr "slottable" "has_
 ;; naked RETURN in middle-end.
 (define_delay (eq_attr "slottable" "has_return_slot")
   [(and (eq_attr "slottable" "yes")
-   (eq (symbol_ref "dead_or_set_regno_p (insn, CRIS_SRP_REGNUM)")
-   (const_int 0)))
+   (not (match_test "dead_or_set_regno_p (insn, CRIS_SRP_REGNUM)")))
(nil) (nil)])
 
 
@@ -2578,7 +2575,7 @@ (define_insn "mul3"
   "TARGET_HAS_MUL_INSNS"
   "%!mul %2,%0"
   [(set (attr "slottable")
-   (if_then_else (ne (symbol_ref "TARGET_MUL_BUG") (const_int 0))
+   (if_then_else (match_test "TARGET_MUL_BUG")
  (const_string "no")
  (const_string "yes")))
;; For umuls.[bwd] it's just N unusable here, but let's be safe.
@@ -2601,7 +2598,7 @@ (define_insn "mulsi3"
   "TARGET_HAS_MUL_INSNS"
   "%!muls.d %2,%0"
   [(set (attr "slottable")
-   (if_then_else (ne (symbol_ref "TARGET_MUL_BUG") (const_int 0))
+   (if_then_else (match_test "TARGET_MUL_BUG")
  (const_string "no")
  (const_string "yes")))
;; Just N unusable here, but let's be safe.
@@ -3493,9 +3490,7 @@ (define_insn "*return_expanded"
 }
   [(set (attr "slottable")
(if_then_else
-(ne (symbol_ref
- "(cris_return_address_on_stack_for_return ())")
-(const_int 0))
+(match_test "cris_return_address_on_stack_for_return ()")
 (const_string "no")
 (const_string "has_return_slot")))])
 


[Ada] Housekeeping work in gigi (33/n)

2011-09-11 Thread Eric Botcazou
This cleans up a bit the handling of MODIFY_EXPR in gigi.

Tested on i586-suse-linux, applied on the mainline.


2011-09-11  Eric Botcazou  

* gcc-interface/trans.c (build_return_expr): Use void_type_node for
MODIFY_EXPR.
* gcc-interface/utils2.c (build_binary_op) : Assert that
the result type is null if ENABLE_CHECKING.  Set operation_type at the
end unconditionally if not set in the previous cases.
Use build2 and void_type_node for MODIFY_EXPR.
(build_allocator): Use NULL_TREE for MODIFY_EXPR.


-- 
Eric Botcazou
Index: gcc-interface/utils2.c
===
--- gcc-interface/utils2.c	(revision 178757)
+++ gcc-interface/utils2.c	(working copy)
@@ -518,8 +518,9 @@ nonbinary_modular_operation (enum tree_c
 
 /* Make a binary operation of kind OP_CODE.  RESULT_TYPE is the type
desired for the result.  Usually the operation is to be performed
-   in that type.  For MODIFY_EXPR and ARRAY_REF, RESULT_TYPE may be 0
-   in which case the type to be used will be derived from the operands.
+   in that type.  For INIT_EXPR and MODIFY_EXPR, RESULT_TYPE must be
+   NULL_TREE.  For ARRAY_REF, RESULT_TYPE may be NULL_TREE, in which
+   case the type to be used will be derived from the operands.
 
This function is very much unlike the ones for C and C++ since we
have already done any type conversion and matching required.  All we
@@ -557,6 +558,9 @@ build_binary_op (enum tree_code op_code,
 {
 case INIT_EXPR:
 case MODIFY_EXPR:
+#ifdef ENABLE_CHECKING
+  gcc_assert (result_type == NULL_TREE);
+#endif
   /* If there were integral or pointer conversions on the LHS, remove
 	 them; we'll be putting them back below if needed.  Likewise for
 	 conversions between array and record types, except for justified
@@ -633,7 +637,7 @@ build_binary_op (enum tree_code op_code,
 	operation_type = best_type;
 
   /* Otherwise use the LHS type.  */
-  else if (!operation_type)
+  else
 	operation_type = left_type;
 
   /* Ensure everything on the LHS is valid.  If we have a field reference,
@@ -955,6 +959,8 @@ build_binary_op (enum tree_code op_code,
   else if (op_code == ARRAY_REF || op_code == ARRAY_RANGE_REF)
 result = fold (build4 (op_code, operation_type, left_operand,
 			   right_operand, NULL_TREE, NULL_TREE));
+  else if (op_code == INIT_EXPR || op_code == MODIFY_EXPR)
+result = build2 (op_code, void_type_node, left_operand, right_operand);
   else
 result
   = fold_build2 (op_code, operation_type, left_operand, right_operand);
@@ -2114,7 +2120,7 @@ build_allocator (tree type, tree init, t
 	(result_type,
 	 build2 (COMPOUND_EXPR, storage_ptr_type,
 		 build_binary_op
-		 (MODIFY_EXPR, storage_type,
+		 (MODIFY_EXPR, NULL_TREE,
 		  build_unary_op (INDIRECT_REF, NULL_TREE,
   convert (storage_ptr_type, storage)),
 		  gnat_build_constructor (storage_type, v)),
@@ -2124,7 +2130,7 @@ build_allocator (tree type, tree init, t
 	return build2
 	  (COMPOUND_EXPR, result_type,
 	   build_binary_op
-	   (MODIFY_EXPR, template_type,
+	   (MODIFY_EXPR, NULL_TREE,
 	build_component_ref
 	(build_unary_op (INDIRECT_REF, NULL_TREE,
 			 convert (storage_ptr_type, storage)),
Index: gcc-interface/trans.c
===
--- gcc-interface/trans.c	(revision 178757)
+++ gcc-interface/trans.c	(working copy)
@@ -2482,7 +2482,7 @@ build_return_expr (tree ret_obj, tree re
   if (operation_type != TREE_TYPE (ret_val))
 	ret_val = convert (operation_type, ret_val);
 
-  result_expr = build2 (MODIFY_EXPR, operation_type, ret_obj, ret_val);
+  result_expr = build2 (MODIFY_EXPR, void_type_node, ret_obj, ret_val);
 }
   else
 result_expr = ret_obj;


[Ada] Housekeeping work in gigi (34/n)

2011-09-11 Thread Eric Botcazou
This cleans up a bit the handling of CALL_EXPR in gigi.

Tested on i586-suse-linux, applied on the mainline.


2011-09-11  Eric Botcazou  

* gcc-interface/gigi.h (build_call_0_expr): Delete.
(build_call_1_expr): Likewise.
(build_call_2_expr): Likewise.
(build_call_n_expr): New prototype.
* gcc-interface/decl.c (gnat_to_gnu_entity): Use build_call_n_expr.
* gcc-interface/trans.c (establish_gnat_vms_condition_handler): Ditto.
(Handled_Sequence_Of_Statements_to_gnu): Likewise.
(Exception_Handler_to_gnu_zcx): Likewise.
(gnat_to_gnu): Likewise.
(build_binary_op_trapv): Likewise.
* gcc-interface/utils2.c (build_call_0_expr): Delete.
(build_call_1_expr): Likewise.
(build_call_2_expr): Likewise.
(build_call_n_expr): New function.
(build_call_raise): Use build_call_n_expr.
(build_call_raise_range): Likewise.
(build_call_raise_column): Likewise.
(build_call_alloc_dealloc_proc): Likewise.
(maybe_wrap_malloc): Likewise.
(maybe_wrap_free): Likewise.


-- 
Eric Botcazou
Index: gcc-interface/decl.c
===
--- gcc-interface/decl.c	(revision 178757)
+++ gcc-interface/decl.c	(working copy)
@@ -1492,8 +1492,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entit
 		|| (flag_stack_check == GENERIC_STACK_CHECK
 		&& compare_tree_int (DECL_SIZE_UNIT (gnu_decl),
 	 STACK_CHECK_MAX_VAR_SIZE) > 0)))
-	  add_stmt_with_node (build_call_1_expr
-			  (update_setjmp_buf_decl,
+	  add_stmt_with_node (build_call_n_expr
+			  (update_setjmp_buf_decl, 1,
 			   build_unary_op (ADDR_EXPR, NULL_TREE,
 	   get_block_jmpbuf_decl ())),
 			  gnat_entity);
Index: gcc-interface/utils2.c
===
--- gcc-interface/utils2.c	(revision 178761)
+++ gcc-interface/utils2.c	(working copy)
@@ -1409,43 +1409,22 @@ build_compound_expr (tree result_type, t
   return result;
 }
 
-/* Build a CALL_EXPR to call FUNDECL with one argument, ARG.  Return
-   the CALL_EXPR.  */
+/* Conveniently construct a function call expression.  FNDECL names the
+   function to be called, N is the number of arguments, and the "..."
+   parameters are the argument expressions.  Unlike build_call_expr
+   this doesn't fold the call, hence it will always return a CALL_EXPR.  */
 
 tree
-build_call_1_expr (tree fundecl, tree arg)
+build_call_n_expr (tree fndecl, int n, ...)
 {
-  tree call = build_call_nary (TREE_TYPE (TREE_TYPE (fundecl)),
-			   build_unary_op (ADDR_EXPR, NULL_TREE, fundecl),
-			   1, arg);
-  TREE_SIDE_EFFECTS (call) = 1;
-  return call;
-}
-
-/* Build a CALL_EXPR to call FUNDECL with two arguments, ARG1 & ARG2.  Return
-   the CALL_EXPR.  */
-
-tree
-build_call_2_expr (tree fundecl, tree arg1, tree arg2)
-{
-  tree call = build_call_nary (TREE_TYPE (TREE_TYPE (fundecl)),
-			   build_unary_op (ADDR_EXPR, NULL_TREE, fundecl),
-			   2, arg1, arg2);
-  TREE_SIDE_EFFECTS (call) = 1;
-  return call;
-}
-
-/* Likewise to call FUNDECL with no arguments.  */
-
-tree
-build_call_0_expr (tree fundecl)
-{
-  /* We rely on build_call_nary to compute TREE_SIDE_EFFECTS.  This makes
- it possible to propagate DECL_IS_PURE on parameterless functions.  */
-  tree call = build_call_nary (TREE_TYPE (TREE_TYPE (fundecl)),
-			   build_unary_op (ADDR_EXPR, NULL_TREE, fundecl),
-			   0);
-  return call;
+  va_list ap;
+  tree fntype = TREE_TYPE (fndecl);
+  tree fn = build1 (ADDR_EXPR, build_pointer_type (fntype), fndecl);
+
+  va_start (ap, n);
+  fn = build_call_valist (TREE_TYPE (fntype), fn, n, ap);
+  va_end (ap);
+  return fn;
 }
 
 /* Call a function that raises an exception and pass the line number and file
@@ -1483,7 +1462,7 @@ build_call_raise (int msg, Node_Id gnat_
 	  tree gnu_exception_entity
 	= gnat_to_gnu_entity (Get_RT_Exception_Entity (msg), NULL_TREE, 0);
 	  tree gnu_call
-	= build_call_1_expr (gnu_local_raise,
+	= build_call_n_expr (gnu_local_raise, 1,
  build_unary_op (ADDR_EXPR, NULL_TREE,
 		 gnu_exception_entity));
 
@@ -1513,7 +1492,7 @@ build_call_raise (int msg, Node_Id gnat_
 	   build_index_type (size_int (len)));
 
   return
-build_call_2_expr (fndecl,
+build_call_n_expr (fndecl, 2,
 		   build1 (ADDR_EXPR,
 			   build_pointer_type (unsigned_char_type_node),
 			   filename),
@@ -1528,7 +1507,6 @@ tree
 build_call_raise_range (int msg, Node_Id gnat_node,
 			tree index, tree first, tree last)
 {
-  tree call;
   tree fndecl = gnat_raise_decls_ext[msg];
   tree filename;
   int line_number, column_number;
@@ -1561,19 +1539,16 @@ build_call_raise_range (int msg, Node_Id
   TREE_TYPE (filename) = build_array_type (unsigned_char_type_node,
 	   build_index_type (size_int (len)));
 
-  call = build_call_nary (TREE_TYPE (TREE_TYPE (fndecl)),
-			  build_unary_op (ADDR_EXPR, NULL_T

[Ada] Housekeeping work in gigi (35/n)

2011-09-11 Thread Eric Botcazou
Tested on i586-suse-linux, applied on the mainline.


2011-09-11  Eric Botcazou  

* gcc-interface/trans.c (call_to_gnu): Use local variable.  Make sure
this is a real formal parameter before testing whether it is by ref.


-- 
Eric Botcazou
Index: gcc-interface/trans.c
===
--- gcc-interface/trans.c	(revision 178762)
+++ gcc-interface/trans.c	(working copy)
@@ -2943,6 +2943,8 @@ call_to_gnu (Node_Id gnat_node, tree *gn
   tree gnu_formal = present_gnu_tree (gnat_formal)
 			? get_gnu_tree (gnat_formal) : NULL_TREE;
   tree gnu_formal_type = gnat_to_gnu_type (Etype (gnat_formal));
+  const bool is_true_formal_parm
+	= gnu_formal && TREE_CODE (gnu_formal) == PARM_DECL;
   /* In the Out or In Out case, we must suppress conversions that yield
 	 an lvalue but can nevertheless cause the creation of a temporary,
 	 because we need the real object in this case, either to pass its
@@ -2951,7 +2953,7 @@ call_to_gnu (Node_Id gnat_node, tree *gn
 	 We do it in the In case too, except for an unchecked conversion
 	 because it alone can cause the actual to be misaligned and the
 	 addressability test is applied to the real object.  */
-  bool suppress_type_conversion
+  const bool suppress_type_conversion
 	= ((Nkind (gnat_actual) == N_Unchecked_Type_Conversion
 	&& Ekind (gnat_formal) != E_In_Parameter)
 	   || (Nkind (gnat_actual) == N_Type_Conversion
@@ -2972,11 +2974,10 @@ call_to_gnu (Node_Id gnat_node, tree *gn
   /* If we are passing a non-addressable parameter by reference, pass the
 	 address of a copy.  In the Out or In Out case, set up to copy back
 	 out after the call.  */
-  if (gnu_formal
+  if (is_true_formal_parm
 	  && (DECL_BY_REF_P (gnu_formal)
-	  || (TREE_CODE (gnu_formal) == PARM_DECL
-		  && (DECL_BY_COMPONENT_PTR_P (gnu_formal)
-		  || (DECL_BY_DESCRIPTOR_P (gnu_formal)
+	  || DECL_BY_COMPONENT_PTR_P (gnu_formal)
+	  || DECL_BY_DESCRIPTOR_P (gnu_formal))
 	  && (gnu_name_type = gnat_to_gnu_type (Etype (gnat_name)))
 	  && !addressable_p (gnu_name, gnu_name_type))
 	{
@@ -3118,9 +3119,7 @@ call_to_gnu (Node_Id gnat_node, tree *gn
   /* If we have not saved a GCC object for the formal, it means it is an
 	 Out parameter not passed by reference and that need not be copied in.
 	 Otherwise, first see if the parameter is passed by reference.  */
-  if (gnu_formal
-	  && TREE_CODE (gnu_formal) == PARM_DECL
-	  && DECL_BY_REF_P (gnu_formal))
+  if (is_true_formal_parm && DECL_BY_REF_P (gnu_formal))
 	{
 	  if (Ekind (gnat_formal) != E_In_Parameter)
 	{
@@ -3171,9 +3170,7 @@ call_to_gnu (Node_Id gnat_node, tree *gn
 
 	  gnu_actual = build_unary_op (ADDR_EXPR, gnu_formal_type, gnu_actual);
 	}
-  else if (gnu_formal
-	   && TREE_CODE (gnu_formal) == PARM_DECL
-	   && DECL_BY_COMPONENT_PTR_P (gnu_formal))
+  else if (is_true_formal_parm && DECL_BY_COMPONENT_PTR_P (gnu_formal))
 	{
 	  gnu_formal_type = TREE_TYPE (gnu_formal);
 	  gnu_actual = maybe_implicit_deref (gnu_actual);
@@ -3193,9 +3190,7 @@ call_to_gnu (Node_Id gnat_node, tree *gn
 	 but this is the most likely to work in all cases.  */
 	  gnu_actual = build_unary_op (ADDR_EXPR, gnu_formal_type, gnu_actual);
 	}
-  else if (gnu_formal
-	   && TREE_CODE (gnu_formal) == PARM_DECL
-	   && DECL_BY_DESCRIPTOR_P (gnu_formal))
+  else if (is_true_formal_parm && DECL_BY_DESCRIPTOR_P (gnu_formal))
 	{
 	  gnu_actual = convert (gnu_formal_type, gnu_actual);
 
@@ -3218,7 +3213,7 @@ call_to_gnu (Node_Id gnat_node, tree *gn
 	  if (Ekind (gnat_formal) != E_In_Parameter)
 	gnu_name_list = tree_cons (NULL_TREE, gnu_name, gnu_name_list);
 
-	  if (!(gnu_formal && TREE_CODE (gnu_formal) == PARM_DECL))
+	  if (!is_true_formal_parm)
 	{
 	  /* Make sure side-effects are evaluated before the call.  */
 	  if (TREE_SIDE_EFFECTS (gnu_name))


[Ada] Fix ICE on unchecked conversion from atomic record type

2011-09-11 Thread Eric Botcazou
This is a regression present on the mainline and 4.6 branch.

Tested on i586-suse-linux, applied on the mainline and 4.6 branch.


2011-09-11  Eric Botcazou  

* gcc-interface/decl.c (maybe_pad_type): Do not try to change the form
of an addressable type.
* gcc-interface/trans.c (gnat_gimplify_expr) : New.
Deal with those cases for which creating a temporary is mandatory.


2011-09-11  Eric Botcazou  

* gnat.dg/atomic5.ad[sb]: New test.


-- 
Eric Botcazou
Index: gcc-interface/decl.c
===
--- gcc-interface/decl.c	(revision 178762)
+++ gcc-interface/decl.c	(working copy)
@@ -6521,6 +6521,7 @@ maybe_pad_type (tree type, tree size, un
   if (align != 0
   && TREE_CODE (type) == RECORD_TYPE
   && TYPE_MODE (type) == BLKmode
+  && !TREE_ADDRESSABLE (type)
   && TREE_CODE (orig_size) == INTEGER_CST
   && !TREE_OVERFLOW (orig_size)
   && compare_tree_int (orig_size, MAX_FIXED_MODE_SIZE) <= 0
Index: gcc-interface/trans.c
===
--- gcc-interface/trans.c	(revision 178763)
+++ gcc-interface/trans.c	(working copy)
@@ -6446,6 +6446,28 @@ gnat_gimplify_expr (tree *expr_p, gimple
 
   return GS_UNHANDLED;
 
+case VIEW_CONVERT_EXPR:
+  op = TREE_OPERAND (expr, 0);
+
+  /* If we are view-converting a CONSTRUCTOR or a call from an aggregate
+	 type to a scalar one, explicitly create the local temporary.  That's
+	 required if the type is passed by reference.  */
+  if ((TREE_CODE (op) == CONSTRUCTOR || TREE_CODE (op) == CALL_EXPR)
+	  && AGGREGATE_TYPE_P (TREE_TYPE (op))
+	  && !AGGREGATE_TYPE_P (TREE_TYPE (expr)))
+	{
+	  tree mod, new_var = create_tmp_var_raw (TREE_TYPE (op), "C");
+	  gimple_add_tmp_var (new_var);
+
+	  mod = build2 (INIT_EXPR, TREE_TYPE (new_var), new_var, op);
+	  gimplify_and_add (mod, pre_p);
+
+	  TREE_OPERAND (expr, 0) = new_var;
+	  return GS_OK;
+	}
+
+  return GS_UNHANDLED;
+
 case DECL_EXPR:
   op = DECL_EXPR_DECL (expr);
 
package body Atomic5 is

  function Create return R is
  begin
return (A => 0, B => 1, C => 2, D => 4);
  end;

  procedure Proc1 is
I : Unsigned_32;
  begin
I := Conv(Create);
  end;

  procedure Proc2 is
I : Unsigned_32;
  begin
I := Conv(R'(A => 0, B => 1, C => 2, D => 4));
  end;

end Atomic5;
-- { dg-do compile }

with Unchecked_Conversion;

package Atomic5 is

  type Byte is mod 2 ** 8;
  for Byte'Size use 8;

  type Unsigned_32 is mod 2 ** 32;
  for Unsigned_32'Size use 32;

  type R is record
A,B,C,D : Byte;
  end record;
  for R'Alignment use 4;
  pragma Atomic (R);

  function Conv is new Unchecked_Conversion (R, Unsigned_32);

  procedure Proc1;

  procedure Proc2;

end Atomic5;


[Ada] Fix segfault on conditional expression with type String

2011-09-11 Thread Eric Botcazou
Because of some quite complex expressions with variable size that outsmart the 
unsharing mechanism.  Fixed by being smarter earlier.

Tested on i586-suse-linux, applied on the mainline.


2011-09-11  Eric Botcazou  

* gcc-interface/utils.c (maybe_unconstrained_array): In the reference
to unconstrained array case, deal with each branch of a COND_EXPR.
* gcc-interface/utils2.c (build_allocator): Deal with each branch of
a COND_EXPR in the initializer, if present.


2011-09-11  Eric Botcazou  

* gnat.dg/cond_expr2.ad[sb]: New test.


-- 
Eric Botcazou
-- { dg-do compile }
-- { dg-options "-gnat12" }

package body Cond_Expr2 is

  function F (X : integer) return String is
  begin
return (if X > 0 then "positive" else "negative");
  end;

end Cond_Expr2;
package Cond_Expr2 is

  function F (X : integer) return String;

end Cond_Expr2;
Index: gcc-interface/utils.c
===
--- gcc-interface/utils.c	(revision 178757)
+++ gcc-interface/utils.c	(working copy)
@@ -4241,22 +4241,44 @@ tree
 maybe_unconstrained_array (tree exp)
 {
   enum tree_code code = TREE_CODE (exp);
-  tree new_exp;
 
   switch (TREE_CODE (TREE_TYPE (exp)))
 {
 case UNCONSTRAINED_ARRAY_TYPE:
   if (code == UNCONSTRAINED_ARRAY_REF)
 	{
-	  new_exp = TREE_OPERAND (exp, 0);
-	  new_exp
-	= build_unary_op (INDIRECT_REF, NULL_TREE,
-			  build_component_ref (new_exp, NULL_TREE,
-		   TYPE_FIELDS
-		   (TREE_TYPE (new_exp)),
-		   false));
-	  TREE_READONLY (new_exp) = TREE_READONLY (exp);
-	  return new_exp;
+	  const bool read_only = TREE_READONLY (exp);
+	  exp = TREE_OPERAND (exp, 0);
+	  if (TREE_CODE (exp) == COND_EXPR)
+	{
+	  tree op1
+		= build_unary_op (INDIRECT_REF, NULL_TREE,
+  build_component_ref (TREE_OPERAND (exp, 1),
+		   NULL_TREE,
+		   TYPE_FIELDS
+		   (TREE_TYPE (exp)),
+		   false));
+	  tree op2
+		= build_unary_op (INDIRECT_REF, NULL_TREE,
+  build_component_ref (TREE_OPERAND (exp, 2),
+		   NULL_TREE,
+		   TYPE_FIELDS
+		   (TREE_TYPE (exp)),
+		   false));
+
+	  exp = build3 (COND_EXPR,
+			TREE_TYPE (TREE_TYPE (TYPE_FIELDS
+	  (TREE_TYPE (exp,
+			TREE_OPERAND (exp, 0), op1, op2);
+	}
+	  else
+	exp = build_unary_op (INDIRECT_REF, NULL_TREE,
+  build_component_ref (exp, NULL_TREE,
+		   TYPE_FIELDS
+		   (TREE_TYPE (exp)),
+		   false));
+	  TREE_READONLY (exp) = read_only;
+	  return exp;
 	}
 
   else if (code == NULL_EXPR)
@@ -4270,7 +4292,8 @@ maybe_unconstrained_array (tree exp)
 	 it contains a template.  */
   if (TYPE_PADDING_P (TREE_TYPE (exp)))
 	{
-	  new_exp = convert (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (exp))), exp);
+	  tree new_exp
+	= convert (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (exp))), exp);
 	  if (TREE_CODE (TREE_TYPE (new_exp)) == RECORD_TYPE
 	  && TYPE_CONTAINS_TEMPLATE_P (TREE_TYPE (new_exp)))
 	return
Index: gcc-interface/utils2.c
===
--- gcc-interface/utils2.c	(revision 178762)
+++ gcc-interface/utils2.c	(working copy)
@@ -2046,6 +2046,16 @@ build_allocator (tree type, tree init, t
   if (init && TREE_CODE (init) == NULL_EXPR)
 return build1 (NULL_EXPR, result_type, TREE_OPERAND (init, 0));
 
+  /* If the initializer, if present, is a COND_EXPR, deal with each branch.  */
+  else if (init && TREE_CODE (init) == COND_EXPR)
+return build3 (COND_EXPR, result_type, TREE_OPERAND (init, 0),
+		   build_allocator (type, TREE_OPERAND (init, 1), result_type,
+gnat_proc, gnat_pool, gnat_node,
+ignore_init_type),
+		   build_allocator (type, TREE_OPERAND (init, 2), result_type,
+gnat_proc, gnat_pool, gnat_node,
+ignore_init_type));
+
   /* If RESULT_TYPE is a fat or thin pointer, set SIZE to be the sum of the
  sizes of the object and its template.  Allocate the whole thing and
  fill in the parts that are known.  */


[Patch] Finish function using absolute value not #define value

2011-09-11 Thread Iyer, Balaji V
Hi H. J,
Here is the fixed patch, with corrected email subject and changelog:

Thanks,

Balaji V. Iyer.

cp/ChangeLog

2011-09-09  Balaji V. Iyer  

   * decl2.c (finish_objects): Replaced parameter '0' inside
finish_function  with SF_PRE_PARSED.
(finish_static_storage_duration_function): Likewise.
* decl.c (end_cleanup_fn): Likewise.
* method.c (synthesize_method): Likewise.
* optimize.c (maybe_clone_body): Likewise.
* pt.c (instantiate_decl): Likewise.
* parser.c (cp_parser_function_definition_after_declarator): Replaced 
'0', '1', 
 and '2' in finish_function  parameters with SF_DEFAULT, SF_PRE_PARSED 
and 
 SF_INCLASS_INLINE, respectively.
(cp_parser_lambda_body): Replaced parameter '2' inside
finish_function  with SF_INCLASS_INLINE.
* semantics.c (maybe_add_lambda_conv_op): Likewise.

Here is the objcp/ChangeLog

2011-09-09  Balaji V. Iyer  

* objcp-decl.c (objcp_finish_function): Replaced parameter '0' inside
finish_function  with SF_PRE_PARSED 





-Original Message-
From: H.J. Lu [mailto:hjl.to...@gmail.com] 
Sent: Friday, September 09, 2011 11:14 AM
To: Iyer, Balaji V
Cc: Tobias Burnus; gcc-patches@gcc.gnu.org
Subject: Re: [Patch] Finish function using absolute value not #define value

On Fri, Sep 9, 2011 at 7:48 AM, Iyer, Balaji V  wrote:
> Hello Everyone,
>        Here are the fixes to the patches as mentioned by H. J. . I am not 
> attaching the patch, just cut and pasting it.

Cut/paste may not work if other people have to apply the patch for you.

> Thanks,
>
> Balaji V. Iyer.
>
> Here is the cp/ChangeLog
>
> 2011-09-09  Balaji V. Iyer  
>
>        * decl2.c (finish_objects): Replaced finish_function (0) with
>        finish_function (SF_PRE_PARSED).
>        (finish_static_storage_duration_function): Likewise.
>        * decl.c (end_cleanup_fn): Likewise.
>        * method.c (synthesize_method): Likewise.
>        * optimize.c (maybe_clone_body): Likewise.
>        * pt.c (instantiate_decl): Likewise.
>        * parser.c (cp_parser_function_definition_after_declarator): 
> Replaced
>        finish_function ((ctor_initializer_p ? 1 : 0) | (inline_p ? 2 : 
> 0))
>        with finish_function ((ctor_initializer_p ? SF_PRE_PARSED : 
> SF_DEFAULT)
>        | (inline_p ? SF_INCLASS_INLINE : SF_DEFAULT)).
>        * parser.c (cp_parser_lambda_body): Replaced finish_function 
> (2) with
>        finish_function (SF_INCLASS_INLINE).
>        * semantics.c (maybe_add_lambda_conv_op): Likewise.
>
> Here is the objcp/ChangeLog
>
> 2011-09-09  Balaji V. Iyer  
>
>        * objcp-decl.c (objcp_finish_function): Replaced 
> finish_function (0)
>        with finish_function (SF_DEFAULT).
>

Your ChangeLog can just say "Use SF_DEFAULT, SF_PRE_PARSED and 
SF_INCLASS_INLINE."


--
H.J.
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index eed4535..b92f13b 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -6540,7 +6540,7 @@ start_cleanup_fn (void)
 static void
 end_cleanup_fn (void)
 {
-  expand_or_defer_fn (finish_function (0));
+  expand_or_defer_fn (finish_function (SF_DEFAULT));
 
   pop_from_top_level ();
 }
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index f05b0f8..5b3bcc0 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -2775,7 +2775,7 @@ finish_objects (int method_type, int initp, tree body)
 
   /* Finish up.  */
   finish_compound_stmt (body);
-  fn = finish_function (0);
+  fn = finish_function (SF_DEFAULT);
 
   if (method_type == 'I')
 {
@@ -2917,7 +2917,7 @@ finish_static_storage_duration_function (tree body)
 {
   /* Close out the function.  */
   finish_compound_stmt (body);
-  expand_or_defer_fn (finish_function (0));
+  expand_or_defer_fn (finish_function (SF_DEFAULT));
 }
 
 /* Return the information about the indicated PRIORITY level.  If no
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index 5b24f8f..97213f1 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -767,7 +767,7 @@ synthesize_method (tree fndecl)
 }
 
   finish_function_body (stmt);
-  expand_or_defer_fn (finish_function (0));
+  expand_or_defer_fn (finish_function (SF_DEFAULT));
 
   input_location = save_input_location;
 
diff --git a/gcc/cp/optimize.c b/gcc/cp/optimize.c
index 6a06988..2e1c7b6 100644
--- a/gcc/cp/optimize.c
+++ b/gcc/cp/optimize.c
@@ -415,7 +415,7 @@ maybe_clone_body (tree fn)
   cp_function_chain->can_throw = !TREE_NOTHROW (fn);
 
   /* Now, expand this function into RTL, if appropriate.  */
-  finish_function (0);
+  finish_function (SF_DEFAULT);
   BLOCK_ABSTRACT_ORIGIN (DECL_INITIAL (clone)) = DECL_INITIAL (fn);
   if (alias)
{
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 7d766d1..3fc6c75 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -7904,7 +7904,7 @@ cp_parser_lambda_body (cp_parser* parser, tree 
lambda_expr)
 finish_lambda_scope ();
 
 /* Finish the function and generate code for it if necessary.  */
-

Re: [Patch, Fortran, OOP] PR 47978: Invalid INTENT in overriding TBP not detected

2011-09-11 Thread Janus Weil
Hi Tobias,

>> Update: Here is an extended version of the patch, which adds a few
>> additional checks:
>>
>> The patch still regtests cleanly. Ok for trunk?
>
>> +      switch (compval)
>> +      {
>
> ...
>>
>> +       default:
>> +         gfc_internal_error ("check_dummy_characteristics: Unexpected
>> result "
>> +                             "%i of gfc_dep_compare_expr", compval);
>> +         break;
>> +      }
>> +    }
>
> I think we really should move to enum.

Agreed. However, I'm afraid this is not completely trivial. I'll open
a PR for it.


>> +         gfc_error (strcat (err, " of '%s' at %L with respect to the "
>> +                            "overridden procedure"), proc->name,&where);
>>          return FAILURE;
>
> That's extremely unfriendly to translators; additionally, using
>  ("%s of '%s' ...", err, ...
> you could avoid calling strcat. That way one also avoids problems like
> exceeding the length of err.
>
> How about something like
>  "Argument mismatch for the overridden procedure '%s' at %L: %s"
> which is easier to translate - and might be also easier to understand for a
> user.

Good point. I'm not sure why I invented this ugly strcat hack. Now I
changed the error message to what you suggested, except that it should
say "the overriding procedure".


> Otherwise, the patch looks OK.

Thanks a look for the review. Committed as r178767.

Cheers,
Janus


Re: [Patch, Fortran, OOP] PR 47978: Invalid INTENT in overriding TBP not detected

2011-09-11 Thread Janus Weil
>>> +      switch (compval)
>>> +      {
>>
>> ...
>>>
>>> +       default:
>>> +         gfc_internal_error ("check_dummy_characteristics: Unexpected
>>> result "
>>> +                             "%i of gfc_dep_compare_expr", compval);
>>> +         break;
>>> +      }
>>> +    }
>>
>> I think we really should move to enum.
>
> Agreed. However, I'm afraid this is not completely trivial. I'll open
> a PR for it.

This is now PR50360.

Cheers,
Janus


[wwwdocs] Document recent (and less recent) SPARC changes

2011-09-11 Thread Eric Botcazou
This documents the recent changes made to the SPARC port, as well as an old one 
made for GCC 4.3 but that wasn't documented at the time.

OK to install?

-- 
Eric Botcazou
Index: htdocs/gcc-4.3/changes.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.3/changes.html,v
retrieving revision 1.124
diff -u -r1.124 changes.html
--- htdocs/gcc-4.3/changes.html	27 Jun 2011 11:00:44 -	1.124
+++ htdocs/gcc-4.3/changes.html	11 Sep 2011 21:18:30 -
@@ -922,6 +922,12 @@
 
  
 
+SPARC
+  
+Support for the Sun UltraSPARC T2 (Niagara 2) processor has been
+added.
+  
+
 Xtensa
   
 Stack unwinding for exception handling now uses by default a
Index: htdocs/gcc-4.7/changes.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.7/changes.html,v
retrieving revision 1.27
diff -u -r1.27 changes.html
--- htdocs/gcc-4.7/changes.html	6 Sep 2011 11:32:30 -	1.27
+++ htdocs/gcc-4.7/changes.html	11 Sep 2011 21:18:30 -
@@ -292,6 +292,19 @@
 
 MIPS
 
+SPARC
+  
+The option -mflat has been reinstated.  When it is
+specified, the compiler will generate code for a single register
+window model.  This is essentially a new implementation and the
+associated debugger support has been added to GDB 7.4 and later.
+Support for the options -mtune=native and
+-mcpu=native has been added on selected native platforms
+(GNU/Linux and Solaris).
+Support for the Sun UltraSPARC T3 (Niagara 3) processor has been
+added.
+  
+
 picochip
 
 ARM


Re: [patch, arm] Fix PR target/50305 (arm_legitimize_reload_address problem)

2011-09-11 Thread Michael Hope
On Sat, Sep 10, 2011 at 5:04 AM, Ulrich Weigand  wrote:
> Hello,
>
> the problem in PR 50305 turned out to be caused by the ARM back-end
> LEGITIMIZE_RELOAD_ADDRESS implementation.

Interesting the fault goes away with -mfpu=neon, perhaps due to the DI
mode operations getting pushed out into NEON registers.  You might
want to be explicit about the FPU in dg-options.

-- Michael


Re: [wwwdocs] Document recent (and less recent) SPARC changes

2011-09-11 Thread Gerald Pfeifer
On Sun, 11 Sep 2011, Eric Botcazou wrote:
> This documents the recent changes made to the SPARC port, as well as an 
> old one made for GCC 4.3 but that wasn't documented at the time.
> 
> OK to install?

Lovely.

(Well, to live up to my reviewer's reputation :-) and provide a
nanonit, perhaps omit "and later"?)

Gerald


Re: [1/4] SMS: remove register undo list

2011-09-11 Thread Ayal Zaks
Resending; didn't seem to go through.

-- Forwarded message --
From: Ayal Zaks 
Date: 2011/9/11
Subject: gcc-patches@gcc.gnu.org
To: Richard Sandiford ‫richard.sandif...@linaro.org‬


 Richard Sandiford  wrote on 30/08/2011
02:58:22 PM:

> From: Richard Sandiford 

> To: gcc-patches@gcc.gnu.org

> Cc: Ayal Zaks/Haifa/IBM@IBMIL

> Date: 30/08/2011 02:58 PM

> Subject: [1/4] SMS: remove register undo list

>
> This patch removes the (unused) undo_replace_buff_elem list.
> Verges on the obvious, but still.

Sure, this is fine.

Thanks for the clean-up,

Ayal.

>
> Patch 3 splits the generation of moves into two: one function to record
> what needs to happen, and another function to actually do it. It's then
> easy to bail out if we decide that we don't want the moves.
>
> Richard
>
>
> gcc/
> * modulo-sched.c (undo_replace_buff_elem): Delete.
> (generate_reg_moves): Don't build and return an undo list.
> (free_undo_replace_buff): Delete.
> (sms_schedule): Adjust call to generate_reg_moves.
> Don't call free_undo_replace_buff.
>
> Index: gcc/modulo-sched.c
> ===
> --- gcc/modulo-sched.c 2011-08-24 12:38:37.171362916 +0100
> +++ gcc/modulo-sched.c 2011-08-24 12:56:17.754942951 +0100
> @@ -165,17 +165,6 @@ struct partial_schedule
> int stage_count; /* The stage count of the partial schedule. */
> };
>
> -/* We use this to record all the register replacements we do in
> - the kernel so we can undo SMS if it is not profitable. */
> -struct undo_replace_buff_elem
> -{
> - rtx insn;
> - rtx orig_reg;
> - rtx new_reg;
> - struct undo_replace_buff_elem *next;
> -};
> -
> -
>
> static partial_schedule_ptr create_partial_schedule (int ii, ddg_ptr, int 
> history);
> static void free_partial_schedule (partial_schedule_ptr);
> @@ -456,13 +445,12 @@ print_node_sched_params (FILE *file, int
> nreg_moves = --- + 1 - { dependence.
> ii { 1 if not.
> */
> -static struct undo_replace_buff_elem *
> +static void
> generate_reg_moves (partial_schedule_ptr ps, bool rescan)
> {
> ddg_ptr g = ps->g;
> int ii = ps->ii;
> int i;
> - struct undo_replace_buff_elem *reg_move_replaces = NULL;
>
> for (i = 0; i < g->num_nodes; i++)
> {
> @@ -543,22 +531,6 @@ generate_reg_moves (partial_schedule_ptr
>
> EXECUTE_IF_SET_IN_SBITMAP (uses_of_defs[i_reg_move], 0, i_use, sbi)
> {
> - struct undo_replace_buff_elem *rep;
> -
> - rep = (struct undo_replace_buff_elem *)
> - xcalloc (1, sizeof (struct undo_replace_buff_elem));
> - rep->insn = g->nodes[i_use].insn;
> - rep->orig_reg = old_reg;
> - rep->new_reg = new_reg;
> -
> - if (! reg_move_replaces)
> - reg_move_replaces = rep;
> - else
> - {
> - rep->next = reg_move_replaces;
> - reg_move_replaces = rep;
> - }
> -
> replace_rtx (g->nodes[i_use].insn, old_reg, new_reg);
> if (rescan)
> df_insn_rescan (g->nodes[i_use].insn);
> @@ -568,21 +540,6 @@ generate_reg_moves (partial_schedule_ptr
> }
> sbitmap_vector_free (uses_of_defs);
> }
> - return reg_move_replaces;
> -}
> -
> -/* Free memory allocated for the undo buffer. */
> -static void
> -free_undo_replace_buff (struct undo_replace_buff_elem *reg_move_replaces)
> -{
> -
> - while (reg_move_replaces)
> - {
> - struct undo_replace_buff_elem *rep = reg_move_replaces;
> -
> - reg_move_replaces = reg_move_replaces->next;
> - free (rep);
> - }
> }
>
> /* Update the sched_params (time, row and stage) for node U using the II,
> @@ -1472,8 +1429,6 @@ sms_schedule (void)
> }
> else
> {
> - struct undo_replace_buff_elem *reg_move_replaces;
> -
> if (!opt_sc_p)
> {
> /* Rotate the partial schedule to have the branch in row ii-1. */
> @@ -1523,13 +1478,11 @@ sms_schedule (void)
> /* The life-info is not valid any more. */
> df_set_bb_dirty (g->bb);
>
> - reg_move_replaces = generate_reg_moves (ps, true);
> + generate_reg_moves (ps, true);
> if (dump_file)
> print_node_sched_params (dump_file, g->num_nodes, g);
> /* Generate prolog and epilog. */
> generate_prolog_epilog (ps, loop, count_reg, count_init);
> -
> - free_undo_replace_buff (reg_move_replaces);
> }
>
> free_partial_schedule (ps);


Re: [PATCH, SMS] Minor misc. fixes

2011-09-11 Thread Ayal Zaks
Copying the lists..

‎-- Forwarded message --‎
From: Ayal Zaks ‎‎
Date: 2011/9/11
Subject: Re: [PATCH, SMS] Minor misc. fixes
To: Revital Eres ‫revital.e...@linaro.org‬


2011/9/8 Revital Eres 
>
> Hello,
>
> The attached patch contains minor fixes.
>
> Currently testing and bootstrap on ppc64-redhat-linux enabling SMS on
> loops with SC 1.
>
> OK for mainline once testing completes?


OK.
While we're at it, an alternative would be to have
remove_node_from_ps() assert its own (parameters and) return value.
That is, replace "if (c) return false" by "assert (!c)" and have it
return void if successful. There's not much you can do if it returns
false. That would check its other invocation too.

Ayal.


>
> Thanks,
> Revital
>
>
> Changelog
>
>        * modulo-sched.c (optimize_sc): Call remove_node_from_ps outside
>        of gcc_assert.
>        (sms_schedule): Add print info.


[wwwdocs] Revamp the news section on our title page

2011-09-11 Thread Gerald Pfeifer
Nicola suggested that I have a look a couple of months ago, and add
short, catchy titles.  Indeed focusing so much on the date as we've
had for, what, the last decade?, can be improved upon which this
patch does.

Gerald

Index: gcc.css
===
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc.css,v
retrieving revision 1.22
diff -u -r1.22 gcc.css
--- gcc.css 11 Sep 2011 14:00:47 -  1.22
+++ gcc.css 12 Sep 2011 00:02:45 -
@@ -15,8 +15,10 @@
 .highlight{ color: darkslategray; font-weight:bold; }
 
 dl.news  { margin-top:0; }
-dl.news dt   { font-weight:bold; }
-dl.news dd   { margin-left:3ex; }
+dl.news dt   { color:darkslategrey; font-weight:bold; margin-top:0.3em; }
+dl.news dd   { margin-left:3ex; margin-top:0.1em; margin-bottom:0.1em; }
+dl.news .date { color:darkslategrey; margin-left:0.1ex; }
 
 dl.status{ margin-top:0; }
 dl.status .version { font-weight:bold; }
Index: index.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/index.html,v
retrieving revision 1.812
diff -u -r1.812 index.html
--- index.html  10 Sep 2011 21:09:18 -  1.812
+++ index.html  12 Sep 2011 00:02:45 -
@@ -53,39 +53,46 @@
 
 
 
-August 2, 2011
+OpenMP v3.1
+[2011-08-02]
 An implementation of the http://www.openmp.org/mp-documents/OpenMP3.1.pdf";>OpenMP v3.1
 parallel programming interface for C, C++ and Fortran has been added.
 Code was contributed by Jakub Jelinek of Red Hat, Inc. and
 Tobias Burnus.
 
-July 15, 2011
+TI C6X processor support
+[2011-07-15]
 A port for the TI C6X family of processors has been contributed by
 CodeSourcery.
 
-June 27, 2011
-GCC 4.3.6 has been released.
+GCC 4.3.6 released
+[2011-06-27]
+
+
+GCC 4.6.1 released
+[2011-06-27]
+
+
+GCC 4.5.3 released
+[2011-04-28]
+
 
-June 27, 2011
-GCC 4.6.1 has been released.
+GCC 4.4.6 released
+[2011-04-16]
 
-April 28, 2011
-GCC 4.5.3 has been released.
-
-April 16, 2011
-GCC 4.4.6 has been released.
-
-April 4, 2011
+GCC at Google Summer of Code
+[2011-04-04]
 GCC has been accepted to
 http://socghop.appspot.com/gsoc/org/google/gsoc2011/gcc";>Google's
 Summer of Code 2011.
 We are currently accepting student applications.
 
-March 25, 2011
-GCC 4.6.0 has been released.
+GCC 4.6.0 released
+[2011-03-25]
 
-January 11, 2011
+Objective-C enhanced significantly
+[2011-01-11]
 GCC 4.6 will support many new
   Objective-C features, such as declared and synthesized properties, dot
   syntax, fast enumeration, optional protocol methods, method/protocol/class


[PATCH] Fix PR50343

2011-09-11 Thread Richard Guenther

This fixes PR50343.

Committed as obvious.

Richard.

2011-09-12  Richard Guenther  

PR tree-optimization/50343
* tree-vect-patterns.c (vect_recog_dot_prod_pattern): Check
that the reduction is over an SSA name before checking its
definition.

Index: gcc/tree-vect-patterns.c
===
--- gcc/tree-vect-patterns.c(revision 178725)
+++ gcc/tree-vect-patterns.c(working copy)
@@ -256,6 +256,8 @@ vect_recog_dot_prod_pattern (VEC (gimple
  we know that oprnd1 is the reduction variable (defined by a loop-header
  phi), and oprnd0 is an ssa-name defined by a stmt in the loop body.
  Left to check that oprnd0 is defined by a (widen_)mult_expr  */
+  if (TREE_CODE (oprnd0) != SSA_NAME)
+return NULL;
 
   prod_type = half_type;
   stmt = SSA_NAME_DEF_STMT (oprnd0);


Re: Vector shuffling

2011-09-11 Thread Richard Guenther
On Fri, Sep 9, 2011 at 5:51 PM, Artem Shinkarov
 wrote:
> Hi, sorry for the delay, I had a lot of other stuff to do.
>
> In the attachment there is a new patch that fixes all the issues
> pointed by Joseph and almost all the issues pointed by Richard. The
> issues that are not fixed are explained further.
>
> Artem.
>
>>+      if (TREE_CODE (vect) == VECTOR_CST)
>>+        {
>>+            unsigned i;
>>+            tree vals = TREE_VECTOR_CST_ELTS (vect);
>>+            for (i = 0; vals; vals = TREE_CHAIN (vals), ++i)
>>+              if (i == index)
>>
>>operand_equal_p
>
> Sorry, I didn't get this comment. It looks fine to me without any changes.

Error on my side, the code is ok.

>>+  if (need_asgn)
>>+    {
>>+      TREE_ADDRESSABLE (tmpvec) = 1;
>>
>>this should be at the point we call create_tmp_var.
>
> Here we are talking about writing this line two times several lines
> upper. I would like to leave it just to avoid code duplication.

Well, it's just that they are supposed to be occuring in pairs only,
so it would make the code more understandable.  So please do the duplication.

>>Index: gcc/passes.c
>>===>
>>--- gcc/passes.c        (revision 178354)
>>+++ gcc/passes.c        (working copy)
>>@@ -1354,7 +1354,6 @@ init_optimization_passes (void)
>>         NEXT_PASS (pass_vectorize);
>>           {
>>             struct opt_pass **p = &pass_vectorize.pass.sub;
>>-             NEXT_PASS (pass_lower_vector_ssa);
>>             NEXT_PASS (pass_dce_loop);
>>           }
>>          NEXT_PASS (pass_predcom);
>>@@ -1366,6 +1365,7 @@ init_optimization_passes (void)
>>         NEXT_PASS (pass_lim);
>>         NEXT_PASS (pass_tree_loop_done);
>>       }
>>+      NEXT_PASS (pass_lower_vector_ssa);
>>
>>This change should not be neccesary.
>
> Without this change the vector lowering with -Ox does not execute the
> pass at all. So the overall idea is to make sure that if we have -Ox
> we make lowering only once and as late as possible.
>
> But maybe I am just missing something.

Ah, I thought we had already converted the -O0 pass to work like the
complex lowering at -O0 (which uses a property).  So hm, I guess the
change is ok as well.

I'm on vacation for the next two weeks, conditional on the x86 approval
I'll take care of committing the patch after I return.

Richard.

>
>
> Thanks,
> Artem.
>
> P.S. X86 PEOPLE, WHERE ARE YOU? :)
>


Re: [Patch,AVR]: Fix PR 43746

2011-09-11 Thread Denis Chertykov
2011/9/8 Georg-Johann Lay :
> This patch adds support for named progmem sections.
>
> The problem with the current implementation is that all progmem stuff is put
> into .progmem.data and thus no -gc-sections will have effect or constant
> merging cannot merge constants/strings in progmem.
>
> This patch avoids the hard coded .progmem.data section attribute in
> avr_insert_attributes.  Instead, it uses avr_asm_named_section and
> avr_asm_select_section to choose the right section resp. to add the correct
> section prefix for progmem data.
>
> Tested without regressions.
>
> Initially I intended to add a -fprogmem-sections command line option that 
> works
> similar but independent to -fdata-section.  That way data sections could be
> used and strings in progmem merged.  However, I did not find a straight 
> forward
> way without cluttering avr BE with lots of code from varasm.c.  Thus, for now,
> there is no -fprogmem-sections, i.e. progmem-sections are in sync with
> data-sections.
>
> Ok to install?


Please, commit.

Denis.