Re: Unordered container insertion hints

2013-06-23 Thread Jonathan Wakely
On 19 June 2013 20:56, François Dumont wrote:
> Still no chance to have a look ?

I'll try to finish reviewing it today, thanks for the reminder.


[ping] [patch 4/5] fix bugs with -fstrict-volatile-bitfields and packed structures

2013-06-23 Thread Sandra Loosemore

On 06/16/2013 01:08 PM, Sandra Loosemore wrote:

This part of the patch series fixes problems with bad code being emitted
for unaligned bitfield accesses, as reported in PRs 48784, 56341, and
56997.  A secondary goal of this patch was making the bitfield store and
extract code follow similar logic, at least for the parts relating to
-fstrict-volatile-bitfield handling.


Is it possible to get this part of the patch series reviewed?  Except 
for the documentation change, it is independent of the controversy 
surrounding part 3 regarding whether the target ABI or C/C++ standard 
should take precedence when they conflict, and is independent of any 
further patches to change the default -fstrict-volatile-bitfields 
setting.  If the rest of the patch is approved, I'll take care to fix up 
invoke.texi to accurately reflect the behavior of the approved patches 
before checking anything in.


http://gcc.gnu.org/ml/gcc-patches/2013-06/msg00911.html

-Sandra




[C++ Patch] PR 57682

2013-06-23 Thread Paolo Carlini

Hi,

in this C++11 reject valid parsing issue, in a function-try-block we reject:

try
: f { func }  { } (1)

and we normally accept the C++98:

try
: f ( func )  { } (2)

Considering cp_parser_save_member_function_body, I think that a neat 
solution would be simply consuming first any 'try' keyword and then 
proceeding as usual. What is happening now is that, later on, the closed 
curly brace in 'f{ func }' is confused with the closed curly brace of 
(2) and things wrong when the former is not followed by 'catch'.


Tested x86_64-linux.

Thanks,
Paolo.

/
/cp
2013-06-23  Paolo Carlini  

PR c++/57682
* parser.c (cp_parser_save_member_function_body): Handle correctly
curly braces in function-try-block mem-initializers.

/testsuite
2013-06-23  Paolo Carlini  

PR c++/57682
* g++.dg/cpp0x/initlist72.C: New.
Index: cp/parser.c
===
--- cp/parser.c (revision 200350)
+++ cp/parser.c (working copy)
@@ -22797,6 +22797,9 @@ cp_parser_save_member_function_body (cp_parser* pa
   /* Save away the tokens that make up the body of the
  function.  */
   first = parser->lexer->next_token;
+  /* Handle function try blocks.  */
+  if (cp_lexer_next_token_is_keyword (parser->lexer, RID_TRY))
+cp_lexer_consume_token (parser->lexer);
   /* We can have braced-init-list mem-initializers before the fn body.  */
   if (cp_lexer_next_token_is (parser->lexer, CPP_COLON))
 {
Index: testsuite/g++.dg/cpp0x/initlist72.C
===
--- testsuite/g++.dg/cpp0x/initlist72.C (revision 0)
+++ testsuite/g++.dg/cpp0x/initlist72.C (working copy)
@@ -0,0 +1,13 @@
+// PR c++/57682
+// { dg-do compile { target c++11 } }
+
+struct Class
+{
+  Class (int func)
+  try
+  : f { func }  { }
+  catch ( ... ) { }
+
+private:
+  int f;
+};


[committed] Fix -mlzcnt (PR target/57688)

2013-06-23 Thread Jakub Jelinek
On Fri, May 17, 2013 at 09:00:21PM -0700, Sriraman Tallam wrote:
> --- common/config/i386/i386-common.c  (revision 198950)
> +++ common/config/i386/i386-common.c  (working copy)
> @@ -438,6 +440,18 @@ ix86_handle_option (struct gcc_options *opts,
>   }
>return true;
>  
> +case OPT_mlzcnt:
> +  if (value)
> + {
> +   opts->x_ix86_isa_flags |= OPTION_MASK_ISA_LZCNT_SET;
> +   opts->x_ix86_isa_flags_explicit |= OPTION_MASK_ISA_LZCNT_SET;
> + }
> +  else
> + {
> +   opts->x_ix86_isa_flags &= ~OPTION_MASK_ISA_LZCNT_UNSET;
> +   opts->x_ix86_isa_flags_explicit |= OPTION_MASK_ISA_LZCNT_UNSET;
> + }
> +
>  case OPT_mtbm:
>if (value)
>   {

This change broke PR target/57688, because the -mlzcnt case falls thru
into the -mtbm case, so if you have -mlzcnt, but not -mtbm, it will enable
-mtbm anyway.

Fixed thusly, committed as obvious.

2013-06-23  Jakub Jelinek  

PR target/57688
* common/config/i386/i386-common.c (ix86_handle_option): For OPT_mlzcnt
add missing return true.

--- gcc/common/config/i386/i386-common.c.jj 2013-06-23 20:43:34.0 
+0200
+++ gcc/common/config/i386/i386-common.c2013-06-23 21:00:17.056390879 
+0200
@@ -451,6 +451,7 @@ ix86_handle_option (struct gcc_options *
  opts->x_ix86_isa_flags &= ~OPTION_MASK_ISA_LZCNT_UNSET;
  opts->x_ix86_isa_flags_explicit |= OPTION_MASK_ISA_LZCNT_UNSET;
}
+  return true;
 
 case OPT_mtbm:
   if (value)


Jakub


Re: [PATCH] Basic support for MIPS r5900

2013-06-23 Thread Jürgen Urban
Hello Richard,

> >> Does it still work with those changes, as below?  If so, I'll check it in.
> >
> > I tested it. It is still working. So the patch is OK, please check it in.
>
> OK, I've applied this and the config.gcc patch.

Thanks.

In the native PS2SDK (i.e. no Linux) I detected that there are undefined 
references to `__fixtfsi', `__floatsitf', `__subtf3', `__multf3', 
`__extenddftf2', `__lttf2' and `__gttf2'. These are the functions for handling 
"long double".
There is a fix needed for this in libgcc. I attached 2 patches to this e-mail. 
There should be only one of the patches used to fix this.
The first one fixes the problem for all mips systems. The second one fixes this 
only for r5900. I think it is a general problem. I assume the undefined 
references could appear on all mips64 systems which are not Linux. So the first 
patch should be applied.
Checking for "ac_cv_sizeof_long_double" should work on all mips systems, but I 
don't know why the check was only in the mips*-linux part of the file 
libgcc/config.host.

Best regards
JürgenIndex: libgcc/config.host
===
--- libgcc/config.host	(Revision 200155)
+++ libgcc/config.host	(Arbeitskopie)
@@ -136,6 +136,9 @@
 mips*-*-*)
 	cpu_type=mips
 	tmake_file=mips/t-mips
+	if test "${ac_cv_sizeof_long_double}" = 16; then
+		tmake_file="${tmake_file} mips/t-tpbit"
+	fi
 	;;
 powerpc*-*-*)
 	cpu_type=rs6000
@@ -751,9 +754,6 @@
 			;;
 	esac
 	md_unwind_header=mips/linux-unwind.h
-	if test "${ac_cv_sizeof_long_double}" = 16; then
-		tmake_file="${tmake_file} mips/t-tpbit"
-	fi
 	;;
 mips*-sde-elf*)
 	tmake_file="$tmake_file mips/t-crtstuff mips/t-mips16"
Index: libgcc/config.host
===
--- libgcc/config.host	(Revision 200155)
+++ libgcc/config.host	(Arbeitskopie)
@@ -798,6 +798,9 @@
 mips64r5900-*-elf* | mips64r5900el-*-elf*)
 	tmake_file="$tmake_file mips/t-elf mips/t-crtstuff"
 	extra_parts="$extra_parts crti.o crtn.o"
+	if test "${ac_cv_sizeof_long_double}" = 16; then
+		tmake_file="${tmake_file} mips/t-tpbit"
+	fi
 	;;
 mips64vr-*-elf* | mips64vrel-*-elf*)
 	tmake_file="$tmake_file mips/t-elf mips/t-vr mips/t-crtstuff"


Re: [PATCH] Basic support for MIPS r5900

2013-06-23 Thread Richard Sandiford
"Jürgen Urban"  writes:
> Hello Richard,
>
>> >> Does it still work with those changes, as below?  If so, I'll check it in.
>> >
>> > I tested it. It is still working. So the patch is OK, please check it in.
>>
>> OK, I've applied this and the config.gcc patch.
>
> Thanks.
>
> In the native PS2SDK (i.e. no Linux) I detected that there are undefined
> references to `__fixtfsi', `__floatsitf', `__subtf3', `__multf3',
> __extenddftf2', `__lttf2' and `__gttf2'. These are the functions for
> handling "long double".
> There is a fix needed for this in libgcc. I attached 2 patches to this
> e-mail. There should be only one of the patches used to fix this.
> The first one fixes the problem for all mips systems. The second one
> fixes this only for r5900. I think it is a general problem. I assume the
> undefined references could appear on all mips64 systems which are not
> Linux. So the first patch should be applied.

The second patch is right.  Not all targets have 128-bit long doubles,
so t-tpbit is intentionally an opt-in rather than opt-out thing.

E.g. mips*-sde-elf and mips*-mti-elf both use:

#undef LONG_DOUBLE_TYPE_SIZE
#define LONG_DOUBLE_TYPE_SIZE 64

to get a form of n32 in which long doubles are the same as doubles.

Do you want to stick with 128-bit long doubles for PS2, or would you
prefer to do what SDE does?

Thanks,
Richard


[Patch, Fortran] PR52413 - Incorrect behavior of FRACTION when applied to a constant

2013-06-23 Thread Dominique Dhumieres
This patch packages the Steven G. Kargl's patch when MPFR 3.1.0 or newer 
is available and fixes the original code for older versions using the 
FX Coudert's machinery (see PR for details).

Tested on powerpc-apple-darwin9 and x86_64-apple-darwin10 without 
regression.

OK for the trunk? If yes, could someone commit it for me?

Since this is a wrong-code issue, I think the light version of the patch 
should be applied to 4.7 and 4.8. If this is accepted I'll do the testing 
and the packaging.

Dominique


2013-06-23  Steven G. Kargl  
Francois-Xavier Coudert  
Dominique d'Humieres  

PR fortran/52413
* simplify.c: Fix the sign of negative values in gfc_simplify_fraction.

2013-06-23  Francois-Xavier Coudert  
Dominique d'Humieres  

PR fortran/52413
* gfortran.dg/fraction.f90: New.


--- ../_clean/gcc/fortran/simplify.c2013-06-08 21:50:33.0 +0200
+++ gcc/fortran/simplify.c  2013-06-23 17:19:55.0 +0200
@@ -2342,16 +2342,26 @@ gfc_expr *
 gfc_simplify_fraction (gfc_expr *x)
 {
   gfc_expr *result;
+
+#if MPFR_VERSION < MPFR_VERSION_NUM(3,1,0)
   mpfr_t absv, exp, pow2;
+#else
+  mpfr_exp_t e;
+#endif
 
   if (x->expr_type != EXPR_CONSTANT)
 return NULL;
 
   result = gfc_get_constant_expr (BT_REAL, x->ts.kind, &x->where);
 
+#if MPFR_VERSION < MPFR_VERSION_NUM(3,1,0)
+
+  /* MPFR versions before 3.1.0 do not include mpfr_frexp.  
+ TODO: remove the kludge when MPFR 3.1.0 or newer will be required */
+
   if (mpfr_sgn (x->value.real) == 0)
 {
-  mpfr_set_ui (result->value.real, 0, GFC_RND_MODE);
+  mpfr_set (result->value.real, x->value.real, GFC_RND_MODE);
   return result;
 }
 
@@ -2368,10 +2378,16 @@ gfc_simplify_fraction (gfc_expr *x)
 
   mpfr_ui_pow (pow2, 2, exp, GFC_RND_MODE);
 
-  mpfr_div (result->value.real, absv, pow2, GFC_RND_MODE);
+  mpfr_div (result->value.real, x->value.real, pow2, GFC_RND_MODE);
 
   mpfr_clears (exp, absv, pow2, NULL);
 
+#else
+
+  mpfr_frexp (&e, result->value.real, x->value.real, GFC_RND_MODE);
+
+#endif
+
   return range_check (result, "FRACTION");
 }
 
--- ../_clean/gcc/testsuite/gfortran.dg/fraction.f901970-01-01 
01:00:00.0 +0100
+++ gcc/testsuite/gfortran.dg/fraction.f90  2013-06-23 22:06:00.0 
+0200
@@ -0,0 +1,15 @@
+! { dg-do run }
+!
+! Test for pr52413
+!
+
+program test_frac
+
+  real :: y
+  y=fraction (-2.0) 
+  if (fraction (-2.0) /= -0.5) call abort ()
+  if (fraction (-0.0) /= 0.0) call abort ()
+  if (sign(1.0, fraction(-0.0)) /= -1.0) call abort ()
+  if (fraction (-2.0_8) /=  -0.5) call abort ()
+
+end program test_frac


[C++ testcase, committed] Add SFINAE testcase

2013-06-23 Thread Paolo Carlini

Hi,

I added to mainline the testcase in Comment 16 of PR51213.

Thanks,
Paolo.

/
2013-06-23  Paolo Carlini  

* g++.dg/cpp0x/sfinae47.C: New.
Index: g++.dg/cpp0x/sfinae47.C
===
--- g++.dg/cpp0x/sfinae47.C (revision 0)
+++ g++.dg/cpp0x/sfinae47.C (working copy)
@@ -0,0 +1,25 @@
+// Source: Comment 16 of PR51213
+// { dg-do compile { target c++11 } }
+
+template 
+T && declval();
+
+template 
+constexpr auto hasSize(int) -> decltype(declval().size(), bool())
+{ return true; }
+
+template 
+constexpr bool hasSize(...)
+{ return false; }
+
+struct A
+{
+  int size();
+};
+
+struct B : private A
+{
+};
+
+static_assert(hasSize(0),  "A");
+static_assert(!hasSize(0), "B");


Re: [Patch, Fortran] Print floating-point exception status after STOP/ERROR STOP

2013-06-23 Thread Gerald Pfeifer
On Sun, 23 Jun 2013, Tobias Burnus wrote:
> Gerald and Eric: Would the following work for you? (Sorry, no
> config.h.in/configure patch; I haven't build in maintainer's mode, yet.)

Yes, that looks like what I had in mind.  Thanks, Tobias!

Gerald


Re: [Patch wwwdocs] gcc-4.9 changes: mention support of the Intel Silvermont microarchitecture

2013-06-23 Thread Gerald Pfeifer
On Mon, 10 Jun 2013, Igor Zamyatin wrote:
> This patch mentions support of Silvermont architecture in the
> gcc-4.9/changes.html page.

Looks good to me; just say "the new Intel...".

Thanks,
Gerald


Re: [RS6000] libffi little-endian

2013-06-23 Thread Alan Modra
On Fri, Jun 07, 2013 at 12:12:17AM -0400, David Edelsohn wrote:
> On Thu, Jun 6, 2013 at 9:34 PM, Alan Modra  wrote:
> > Bootstrapped and regression tested powerpc64-linux.  OK to apply?
> >
> > * src/powerpc/linux64_closure.S (ffi_closure_LINUX64): Support
> > little-endian.
> > * src/powerpc/ppc_closure.S (ffi_closure_SYSV): Likewise.
> 
> This patch needs to be applied upstream in the libffi repository.
> 
> All of the handling of structs in ffi.c and ffi_darwin.c doesn't need
> any changes?  Cool.  I thought there might be a padding issue.

You were right, of course.  When we finally got around to running an
all languages bootstrap on powerpc64le, we discovered some missing
pieces in libffi.  The following adds some ffi.c changes to the
previous patch (closure.S patches are unchanged).  I haven't tackled
ffi_darwin.c.

Bootstrapped and regression tested powerpc64-linux.  This one passes
the libffi testsuite on powerpc64le-linux.  OK mainline and 4.8?

* src/powerpc/ffi.c (ffi_prep_args_SYSV): Move var declaration
before statements.
(ffi_prep_args64): Support little-endian.
(ffi_closure_helper_SYSV, ffi_closure_helper_LINUX64): Likewise.
* src/powerpc/linux64_closure.S (ffi_closure_LINUX64): Likewise.
* src/powerpc/ppc_closure.S (ffi_closure_SYSV): Likewise.

Index: libffi/src/powerpc/ffi.c
===
--- libffi/src/powerpc/ffi.c(revision 200159)
+++ libffi/src/powerpc/ffi.c(working copy)
@@ -127,6 +127,9 @@ ffi_prep_args_SYSV (extended_cif *ecif, unsigned *
 
   int i;
   ffi_type **ptr;
+#ifndef __NO_FPRS__
+  double double_tmp;
+#endif
   union {
 void **v;
 char **c;
@@ -146,7 +149,6 @@ ffi_prep_args_SYSV (extended_cif *ecif, unsigned *
   gpr_base.u = stacktop.u - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS;
   intarg_count = 0;
 #ifndef __NO_FPRS__
-  double double_tmp;
   fpr_base.d = gpr_base.d - NUM_FPR_ARG_REGISTERS;
   fparg_count = 0;
   copy_space.c = ((flags & FLAG_FP_ARGUMENTS) ? fpr_base.c : gpr_base.c);
@@ -542,11 +544,12 @@ ffi_prep_args64 (extended_cif *ecif, unsigned long
{
  char *where = next_arg.c;
 
+#ifndef __LITTLE_ENDIAN__
  /* Structures with size less than eight bytes are passed
 left-padded.  */
  if ((*ptr)->size < 8)
where += 8 - (*ptr)->size;
-
+#endif
  memcpy (where, *p_argv.c, (*ptr)->size);
  next_arg.ul += words;
  if (next_arg.ul == gpr_end.ul)
@@ -1208,6 +1211,7 @@ ffi_closure_helper_SYSV (ffi_closure *closure, voi
 
case FFI_TYPE_SINT8:
case FFI_TYPE_UINT8:
+#ifndef __LITTLE_ENDIAN__
  /* there are 8 gpr registers used to pass values */
  if (ng < 8)
{
@@ -1221,9 +1225,10 @@ ffi_closure_helper_SYSV (ffi_closure *closure, voi
  pst++;
}
  break;
-
+#endif
case FFI_TYPE_SINT16:
case FFI_TYPE_UINT16:
+#ifndef __LITTLE_ENDIAN__
  /* there are 8 gpr registers used to pass values */
  if (ng < 8)
{
@@ -1237,7 +1242,7 @@ ffi_closure_helper_SYSV (ffi_closure *closure, voi
  pst++;
}
  break;
-
+#endif
case FFI_TYPE_SINT32:
case FFI_TYPE_UINT32:
case FFI_TYPE_POINTER:
@@ -1367,22 +1372,25 @@ ffi_closure_helper_LINUX64 (ffi_closure *closure,
{
case FFI_TYPE_SINT8:
case FFI_TYPE_UINT8:
+#ifndef __LITTLE_ENDIAN__
  avalue[i] = (char *) pst + 7;
  pst++;
  break;
-
+#endif
case FFI_TYPE_SINT16:
case FFI_TYPE_UINT16:
+#ifndef __LITTLE_ENDIAN__
  avalue[i] = (char *) pst + 6;
  pst++;
  break;
-
+#endif
case FFI_TYPE_SINT32:
case FFI_TYPE_UINT32:
+#ifndef __LITTLE_ENDIAN__
  avalue[i] = (char *) pst + 4;
  pst++;
  break;
-
+#endif
case FFI_TYPE_SINT64:
case FFI_TYPE_UINT64:
case FFI_TYPE_POINTER:
@@ -1391,11 +1399,13 @@ ffi_closure_helper_LINUX64 (ffi_closure *closure,
  break;
 
case FFI_TYPE_STRUCT:
+#ifndef __LITTLE_ENDIAN__
  /* Structures with size less than eight bytes are passed
 left-padded.  */
  if (arg_types[i]->size < 8)
avalue[i] = (char *) pst + 8 - arg_types[i]->size;
  else
+#endif
avalue[i] = pst;
  pst += (arg_types[i]->size + 7) / 8;
  break;
Index: libffi/src/powerpc/linux64_closure.S
===
--- libffi/src/powerpc/linux64_closure.S(revision 200159)
+++ libffi/src/powerpc/linux64_closure.S(working copy)
@@ -132,7 +132,11 @@ ffi_closure_LINUX64:
blr
nop
 # case FFI_TYPE_INT
+#ifdef __LITTLE_ENDIAN__
+   lwa %r3, 112+0(%r1)
+#else
lwa %r3, 112+4(%r1)
+#endif
mtlr %r0
addi %

Re: [RS6000] libffi little-endian

2013-06-23 Thread David Edelsohn
On Sun, Jun 23, 2013 at 8:26 PM, Alan Modra  wrote:
> On Fri, Jun 07, 2013 at 12:12:17AM -0400, David Edelsohn wrote:
>> On Thu, Jun 6, 2013 at 9:34 PM, Alan Modra  wrote:
>> > Bootstrapped and regression tested powerpc64-linux.  OK to apply?
>> >
>> > * src/powerpc/linux64_closure.S (ffi_closure_LINUX64): Support
>> > little-endian.
>> > * src/powerpc/ppc_closure.S (ffi_closure_SYSV): Likewise.
>>
>> This patch needs to be applied upstream in the libffi repository.
>>
>> All of the handling of structs in ffi.c and ffi_darwin.c doesn't need
>> any changes?  Cool.  I thought there might be a padding issue.
>
> You were right, of course.  When we finally got around to running an
> all languages bootstrap on powerpc64le, we discovered some missing
> pieces in libffi.  The following adds some ffi.c changes to the
> previous patch (closure.S patches are unchanged).  I haven't tackled
> ffi_darwin.c.
>
> Bootstrapped and regression tested powerpc64-linux.  This one passes
> the libffi testsuite on powerpc64le-linux.  OK mainline and 4.8?
>
> * src/powerpc/ffi.c (ffi_prep_args_SYSV): Move var declaration
> before statements.
> (ffi_prep_args64): Support little-endian.
> (ffi_closure_helper_SYSV, ffi_closure_helper_LINUX64): Likewise.
> * src/powerpc/linux64_closure.S (ffi_closure_LINUX64): Likewise.
> * src/powerpc/ppc_closure.S (ffi_closure_SYSV): Likewise.

This looks okay to me and more like the changes I expected.  Assuming
Anthony accepts it upstream.

Thanks, David