New Swedish PO file for 'gcc' (version 8.1-b20180128)

2018-03-25 Thread Translation Project Robot
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-8.1-b20180128.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.




[patch, fortran] Simplify constants which come from parameter arrays

2018-03-25 Thread Thomas König

Hello world,

the attached patch potentially saves some space in the object file by
simplifying access to individual elements of a parameter array, which
means that the original parameter may not be needed any more.

Regression-tested. OK for trunk?

Regards

Thomas

2018-03-25  Thomas Koenig  

PR fortran/51260
* resolve.c (resolve_variable): Simplify cases where access to a
parameter array results in a single constant.

2018-03-25  Thomas Koenig  

PR fortran/51260
* gfortran.dg/parameter_array_element_3.f90: New test.
Index: resolve.c
===
--- resolve.c	(Revision 258501)
+++ resolve.c	(Arbeitskopie)
@@ -5577,6 +5577,11 @@ resolve_procedure:
   if (t && flag_coarray == GFC_FCOARRAY_LIB && gfc_is_coindexed (e))
 add_caf_get_intrinsic (e);
 
+  /* Simplify cases where access to a parameter array results in a
+ single constant.  */
+  if (e->rank == 0 && sym->as && sym->attr.flavor == FL_PARAMETER)
+gfc_simplify_expr (e, 1);
+
   return t;
 }
 
! { dg-do compile }
! PR 51260 - an unneeded parameter found its way into the
! assembly code. Original test case by Tobias Burnus.
module x
contains
  subroutine foo(i)
integer, intent(in) :: i
  end subroutine foo
end module x

program main
  use x
  integer, parameter:: unneeded_parameter (1)=(/(i,i=1,1)/)
  call foo(unneeded_parameter (1))
  print *,unneeded_parameter (1)
end program
! { dg-final { scan-assembler-times "unneeded_parameter" 0 } }


[patch fortran] PR 84924 - Erroneous error in C_F_POINTER

2018-03-25 Thread Dominique d'Humières
The attached patch allows scalar noninteroperable scalar derived type with 
-std=f2003 and -std=f2008.

Regstrapped on x86_64-apple-darwin17. OK for trunk?

Regards,

Dominique

2018-03-25  Seth Johnson 
Dominique d'Humieres  

PR fortran/84924
* check.c (gfc_check_c_f_pointer): Allow scalar noninteroperable
scalar derived type with -std=f2003 and -std=f2008.

2018-03-25  Seth Johnson 
Dominique d'Humieres  

PR fortran/84924
* gfortran.dg/scalar_pointer_1.f90: New test.



patch-84924
Description: Binary data


Re: [patch fortran] PR 84924 - Erroneous error in C_F_POINTER

2018-03-25 Thread Thomas König

Hi Dominique,


The attached patch allows scalar noninteroperable scalar derived type with 
-std=f2003 and -std=f2008.

Regstrapped on x86_64-apple-darwin17. OK for trunk?


OK.

Regards

Thomas


Re: [patch fortran] PR 84924 - Erroneous error in C_F_POINTER

2018-03-25 Thread Dominique d'Humières
Thanks for the quick review. Committed as revision r258843.

Dominique

> Le 25 mars 2018 à 13:20, Thomas König  a écrit :
> 
> Hi Dominique,
> 
>> The attached patch allows scalar noninteroperable scalar derived type with 
>> -std=f2003 and -std=f2008.
>> Regstrapped on x86_64-apple-darwin17. OK for trunk?
> 
> OK.
> 
> Regards
> 
>   Thomas



[Patch, fortran] PR84931 - Expansion of array constructor with constant implied-do-object goes sideways

2018-03-25 Thread Paul Richard Thomas
Thomas already committed a fix for the original problem (revisions
258641, 258666 & 258667).

However, I found another testcase that still failed - that of multiple
array constructors with iterators, within an array constructor without
an iterator. The attached fixes this and streamlines the implicated
chunk of code. Thomas's testcase is appropriately updated.

Bootstraps and regtests on FC27/x86_64 - OK for trunk, 7- and 6-branches?

Please note that I am not in a position to do any commits until Wednesday.

Paul

2018-03-25  Paul Thomas  

PR fortran/84931
* simplify.c (gfc_convert_constant): Handle case of array
constructors within an array that has no iterator and improve
the conciseness of this section of code.

2018-03-25  Paul Thomas  

PR fortran/84931
* gfortran.dg/array_constructor_52.f90: Add new test.
Index: gcc/fortran/simplify.c
===
*** gcc/fortran/simplify.c	(revision 258835)
--- gcc/fortran/simplify.c	(working copy)
*** gfc_simplify_xor (gfc_expr *x, gfc_expr
*** 7879,7886 
  gfc_expr *
  gfc_convert_constant (gfc_expr *e, bt type, int kind)
  {
!   gfc_expr *g, *result, *(*f) (gfc_expr *, int);
!   gfc_constructor *c;
  
switch (e->ts.type)
  {
--- 7879,7886 
  gfc_expr *
  gfc_convert_constant (gfc_expr *e, bt type, int kind)
  {
!   gfc_expr *result, *(*f) (gfc_expr *, int);
!   gfc_constructor *c, *t;
  
switch (e->ts.type)
  {
*** gfc_convert_constant (gfc_expr *e, bt ty
*** 8017,8047 
  	  gfc_expr *tmp;
  	  if (c->iterator == NULL)
  	{
  	  tmp = f (c->expr, kind);
! 	  if (tmp == NULL)
  		{
  		  gfc_free_expr (result);
  		  return NULL;
  		}
  
! 	  gfc_constructor_append_expr (&result->value.constructor,
  	   tmp, &c->where);
! 	}
! 	  else
! 	{
! 	  gfc_constructor *n;
! 	  g = gfc_convert_constant (c->expr, type, kind);
! 	  if (g == NULL || g == &gfc_bad_expr)
! 	{
! 		  gfc_free_expr (result);
! 		  return g;
! 		}
! 	  n = gfc_constructor_get ();
! 	  n->expr = g;
! 	  n->iterator = gfc_copy_iterator (c->iterator);
! 	  n->where = c->where;
! 	  gfc_constructor_append (&result->value.constructor, n);
! 	}
  	}
  
break;
--- 8017,8040 
  	  gfc_expr *tmp;
  	  if (c->iterator == NULL)
  	{
+ 	  if (c->expr->expr_type == EXPR_ARRAY)
+ 		tmp = gfc_convert_constant (c->expr, type, kind);
+ 	  else
  		tmp = f (c->expr, kind);
! 	}
! 	  else
! 	tmp = gfc_convert_constant (c->expr, type, kind);
! 
! 	  if (tmp == NULL || tmp == &gfc_bad_expr)
  	{
  	  gfc_free_expr (result);
  	  return NULL;
  	}
  
! 	  t = gfc_constructor_append_expr (&result->value.constructor,
  	   tmp, &c->where);
! 	  if (c->iterator)
! 	t->iterator = gfc_copy_iterator (c->iterator);
  	}
  
break;
Index: gcc/testsuite/gfortran.dg/array_constructor_52.f90
===
*** gcc/testsuite/gfortran.dg/array_constructor_52.f90	(revision 258835)
--- gcc/testsuite/gfortran.dg/array_constructor_52.f90	(working copy)
***
*** 3,11 
  ! handled correctly.
  program test
 implicit none
!integer, parameter :: n = 2**16
 real, dimension(n) :: y
 integer :: i
!y = (/ (1, i=1, n) /)
!if (y(2) /= 1) stop 1
  end program test
--- 3,21 
  ! handled correctly.
  program test
 implicit none
!integer, parameter :: n = 2**16 + 1
 real, dimension(n) :: y
+real, dimension(2*n) :: z
 integer :: i
! 
!y = [(1, i=1, n) ]  ! This was the original problem
!if (int(y(2)) /= 1) stop 1
! 
!y = [33, (1, i=1, n-1) ]! Check that something more complicated works
!if (int(y(3)) /= 1) stop 2
! 
!z = [[(1, i=1, n) ],[(2, i=1, n) ]] ! Failed with first version of the fix
! 
!if (int(z(2)) /= 1) stop 3
!if (int(z(n+1)) /= 2) stop 4
  end program test


[C++ Patch] Fix confusing diagnostics for invalid overrides

2018-03-25 Thread Volker Reichelt

Hi,

when overriding a virtual function fails, the C++ front-end usually
emits two errors: one for the override that fails and one for the
function that is overridden. The second error is confusing and
should be replaced by a note to be in line with other diagnostics.

The attached patch just does that: It replaces the error/error pattern
by an error/inform pattern in search.c (check_final_overrider). And it
replaces the affected dg-error marks in the testsuite by dg-message.

Bootstrapped and regtested on x86_64-pc-linux-gnu.
OK for trunk?

Regards,
Volker


2018-03-25  Volker Reichelt 

    * search.c (check_final_overrider): Use inform instead of error
    for the diagnostics of the overridden functions.

Index: gcc/cp/search.c
===
--- gcc/cp/search.c    (revision 258835)
+++ gcc/cp/search.c    (working copy)
@@ -1918,12 +1918,14 @@
   if (fail == 1)
 {
   error ("invalid covariant return type for %q+#D", overrider);
-      error ("  overriding %q+#D", basefn);
+      inform (DECL_SOURCE_LOCATION (basefn),
+          "  overriding %q+#D", basefn);
 }
   else
 {
   error ("conflicting return type specified for %q+#D", overrider);
-      error ("  overriding %q+#D", basefn);
+      inform (DECL_SOURCE_LOCATION (basefn),
+          "  overriding %q+#D", basefn);
 }
   DECL_INVALID_OVERRIDER_P (overrider) = 1;
   return 0;
@@ -1938,7 +1940,7 @@
   if (!comp_except_specs (base_throw, over_throw, ce_derived))
 {
   error ("looser throw specifier for %q+#F", overrider);
-  error ("  overriding %q+#F", basefn);
+  inform (DECL_SOURCE_LOCATION (basefn), "  overriding %q+#F", basefn);
   DECL_INVALID_OVERRIDER_P (overrider) = 1;
   return 0;
 }
@@ -1950,7 +1952,7 @@
   && !tx_safe_fn_type_p (over_type))
 {
   error ("conflicting type attributes specified for %q+#D", 
overrider);

-  error ("  overriding %q+#D", basefn);
+  inform (DECL_SOURCE_LOCATION (basefn), "  overriding %q+#D", basefn);
   DECL_INVALID_OVERRIDER_P (overrider) = 1;
   return 0;
 }
@@ -1975,13 +1977,15 @@
   if (DECL_DELETED_FN (overrider))
 {
   error ("deleted function %q+D", overrider);
-      error ("overriding non-deleted function %q+D", basefn);
+      inform (DECL_SOURCE_LOCATION (basefn),
+          "overriding non-deleted function %q+D", basefn);
   maybe_explain_implicit_delete (overrider);
 }
   else
 {
   error ("non-deleted function %q+D", overrider);
-      error ("overriding deleted function %q+D", basefn);
+      inform (DECL_SOURCE_LOCATION (basefn),
+          "overriding deleted function %q+D", basefn);
 }
   return 0;
 }
@@ -1988,7 +1992,8 @@
   if (DECL_FINAL_P (basefn))
 {
   error ("virtual function %q+D", overrider);
-  error ("overriding final function %q+D", basefn);
+  inform (DECL_SOURCE_LOCATION (basefn),
+      "overriding final function %q+D", basefn);
   return 0;
 }
   return 1;
===

2018-03-25  Volker Reichelt 

    * g++.dg/cpp0x/defaulted2.C: Use dg-message instead of dg-error
    for the diagnostics of overridden functions.
    * g++.dg/cpp0x/implicit1.C: Likewise.
    * g++.dg/cpp0x/override1.C: Likewise.
    * g++.dg/eh/shadow1.C: Likewise.
    * g++.dg/inherit/covariant12.C: Likewise.
    * g++.dg/inherit/covariant14.C: Likewise.
    * g++.dg/inherit/covariant15.C: Likewise.
    * g++.dg/inherit/covariant16.C: Likewise.
    * g++.dg/inherit/crash3.C: Likewise.
    * g++.dg/inherit/error2.C: Likewise.
    * g++.dg/template/crash100.C: Likewise.
    * g++.old-deja/g++.eh/spec6.C: Likewise.
    * g++.old-deja/g++.mike/p811.C: Likewise.
    * g++.old-deja/g++.other/virtual11.C: Likewise.
    * g++.old-deja/g++.other/virtual4.C: Likewise.

Index: gcc/testsuite/g++.dg/cpp0x/defaulted2.C
===
--- gcc/testsuite/g++.dg/cpp0x/defaulted2.C    (revision 258835)
+++ gcc/testsuite/g++.dg/cpp0x/defaulted2.C    (working copy)
@@ -25,7 +25,7 @@

 struct C
 {
-  virtual void f() = delete;    // { dg-error "overriding deleted" }
+  virtual void f() = delete;    // { dg-message "overriding deleted" }
 };

 struct D: public C
Index: gcc/testsuite/g++.dg/cpp0x/implicit1.C
===
--- gcc/testsuite/g++.dg/cpp0x/implicit1.C    (revision 258835)
+++ gcc/testsuite/g++.dg/cpp0x/implicit1.C    (working copy)
@@ -7,7 +7,7 @@
 {
   void operator delete (void *); // { dg-message "private" }
 public:
-  virtual ~C();            // { dg-error "overriding" }
+  virtual ~C();            // { dg-message "overriding" }
 };

 struct D: C { };        // { dg-error "deleted" }
@@ -20,7 +20,7 @@

 struct F
 {
-  virtual ~F();            // { dg-error "overriding" }
+  virtual ~F();            // { dg-message "overriding" }
 };


[patch, libgomp testsuite] Replace non-standard call abort by STOP n

2018-03-25 Thread Thomas Koenig

[This is take two, the first one was rejected due to size].

Hello world,

the does what the ChangeLog and the Subject say.  Regression-tested
on x86_64-pc-linux-gnu.

OK for trunk?

Regards

Thomas



2018-03-25  Thomas Koenig  

PR fortran/84381
* testsuite/libgomp.fortran/aligned1.f03: Replace non-standard
call abort by STOP n.
* testsuite/libgomp.fortran/alloc-comp-1.f90: Likewise.
* testsuite/libgomp.fortran/alloc-comp-2.f90: Likewise.
* testsuite/libgomp.fortran/alloc-comp-3.f90: Likewise.
* testsuite/libgomp.fortran/allocatable1.f90: Likewise.
* testsuite/libgomp.fortran/allocatable10.f90: Likewise.
* testsuite/libgomp.fortran/allocatable11.f90: Likewise.
* testsuite/libgomp.fortran/allocatable12.f90: Likewise.
* testsuite/libgomp.fortran/allocatable2.f90: Likewise.
* testsuite/libgomp.fortran/allocatable3.f90: Likewise.
* testsuite/libgomp.fortran/allocatable4.f90: Likewise.
* testsuite/libgomp.fortran/allocatable5.f90: Likewise.
* testsuite/libgomp.fortran/allocatable6.f90: Likewise.
* testsuite/libgomp.fortran/allocatable7.f90: Likewise.
* testsuite/libgomp.fortran/allocatable8.f90: Likewise.
* testsuite/libgomp.fortran/allocatable9.f90: Likewise.
* testsuite/libgomp.fortran/appendix-a/a.18.1.f90: Likewise.
* testsuite/libgomp.fortran/appendix-a/a.19.1.f90: Likewise.
* testsuite/libgomp.fortran/associate1.f90: Likewise.
* testsuite/libgomp.fortran/associate2.f90: Likewise.
* testsuite/libgomp.fortran/associate3.f90: Likewise.
* testsuite/libgomp.fortran/cancel-do-1.f90: Likewise.
* testsuite/libgomp.fortran/cancel-do-2.f90: Likewise.
* testsuite/libgomp.fortran/cancel-parallel-1.f90: Likewise.
* testsuite/libgomp.fortran/cancel-sections-1.f90: Likewise.
* testsuite/libgomp.fortran/cancel-taskgroup-2.f90: Likewise.
* testsuite/libgomp.fortran/character1.f90: Likewise.
* testsuite/libgomp.fortran/character2.f90: Likewise.
* testsuite/libgomp.fortran/collapse1.f90: Likewise.
* testsuite/libgomp.fortran/collapse2.f90: Likewise.
* testsuite/libgomp.fortran/collapse3.f90: Likewise.
* testsuite/libgomp.fortran/collapse4.f90: Likewise.
* testsuite/libgomp.fortran/crayptr1.f90: Likewise.
* testsuite/libgomp.fortran/crayptr2.f90: Likewise.
* testsuite/libgomp.fortran/crayptr3.f90: Likewise.
* testsuite/libgomp.fortran/declare-simd-1.f90: Likewise.
* testsuite/libgomp.fortran/declare-simd-3.f90: Likewise.
* testsuite/libgomp.fortran/declare-target-2.f90: Likewise.
* testsuite/libgomp.fortran/depend-1.f90: Likewise.
* testsuite/libgomp.fortran/depend-2.f90: Likewise.
* testsuite/libgomp.fortran/depend-3.f90: Likewise.
* testsuite/libgomp.fortran/do1.f90: Likewise.
* testsuite/libgomp.fortran/do2.f90: Likewise.
* testsuite/libgomp.fortran/doacross1.f90: Likewise.
* testsuite/libgomp.fortran/doacross2.f90: Likewise.
* testsuite/libgomp.fortran/doacross3.f90: Likewise.
* testsuite/libgomp.fortran/examples-4/array_sections-3.f90: Likewise.
* testsuite/libgomp.fortran/examples-4/array_sections-4.f90: Likewise.
* testsuite/libgomp.fortran/examples-4/async_target-1.f90: Likewise.
* testsuite/libgomp.fortran/examples-4/async_target-2.f90: Likewise.
* testsuite/libgomp.fortran/examples-4/declare_target-1.f90: Likewise.
* testsuite/libgomp.fortran/examples-4/declare_target-2.f90: Likewise.
* testsuite/libgomp.fortran/examples-4/declare_target-3.f90: Likewise.
* testsuite/libgomp.fortran/examples-4/declare_target-4.f90: Likewise.
* testsuite/libgomp.fortran/examples-4/declare_target-5.f90: Likewise.
* testsuite/libgomp.fortran/examples-4/device-1.f90: Likewise.
* testsuite/libgomp.fortran/examples-4/device-2.f90: Likewise.
* testsuite/libgomp.fortran/examples-4/device-3.f90: Likewise.
* testsuite/libgomp.fortran/examples-4/simd-1.f90: Likewise.
* testsuite/libgomp.fortran/examples-4/simd-2.f90: Likewise.
* testsuite/libgomp.fortran/examples-4/simd-3.f90: Likewise.
* testsuite/libgomp.fortran/examples-4/simd-4.f90: Likewise.
* testsuite/libgomp.fortran/examples-4/simd-5.f90: Likewise.
* testsuite/libgomp.fortran/examples-4/simd-6.f90: Likewise.
* testsuite/libgomp.fortran/examples-4/simd-7.f90: Likewise.
* testsuite/libgomp.fortran/examples-4/simd-8.f90: Likewise.
* testsuite/libgomp.fortran/examples-4/target-1.f90: Likewise.
* testsuite/libgomp.fortran/examples-4/target-2.f90: Likewise.
* testsuite/libgomp.fortran/examples-4/target-3.f90: Likewise.
* testsuite/libgomp.fortran/examples-4/target-4.f90: Likewise.
* testsuite/libgomp.fortran/exa

Re: [patch, libgomp testsuite] Replace non-standard call abort by STOP n

2018-03-25 Thread Dominique d'Humières
Hi Thomas,

The ChangeLog looks strange, but otherwise the patch applies and get rid of the 
abort.

Looks good to me.

Thanks for the work,

Dominique



[patch, fortran] Fix character parameter arrays as formats

2018-03-25 Thread Thomas Koenig

Hello world,

the attached pach fixes the PR by creating one single big string
from a parameter array.

OK for trunk?

Regards

Thomas

2018-03-25  Thomas Koenig  

PR fortran/66709
* io.c: Include constructor.h.
(resolve_tag_format): For a constant character array, concatenate
into a single character expression.

2018-03-25  Thomas Koenig  

PR fortran/66709
* gfortran.dg/parameter_array_format.f90: New test.
Index: io.c
===
--- io.c	(Revision 258845)
+++ io.c	(Arbeitskopie)
@@ -25,6 +25,7 @@
 #include "gfortran.h"
 #include "match.h"
 #include "parse.h"
+#include "constructor.h"
 
 gfc_st_label
 format_asterisk = {0, NULL, NULL, -1, ST_LABEL_FORMAT, ST_LABEL_FORMAT, NULL,
@@ -1606,7 +1607,7 @@
 /* Resolution of the FORMAT tag, to be called from resolve_tag.  */
 
 static bool
-resolve_tag_format (const gfc_expr *e)
+resolve_tag_format (gfc_expr *e)
 {
   if (e->expr_type == EXPR_CONSTANT
   && (e->ts.type != BT_CHARACTER
@@ -1617,6 +1618,47 @@
   return false;
 }
 
+  /* Concatenate a constant character array into a single character
+ expression.  */
+
+  if ((e->expr_type == EXPR_ARRAY || e->rank > 0)
+  && e->ts.type == BT_CHARACTER
+  && gfc_is_constant_expr (e))
+{
+  if (e->expr_type == EXPR_VARIABLE
+	  && e->symtree->n.sym->attr.flavor == FL_PARAMETER)
+	gfc_simplify_expr (e, 1);
+
+  if (e->expr_type == EXPR_ARRAY)
+	{
+	  gfc_constructor *c;
+	  gfc_charlen_t n, len;
+	  gfc_expr *r;
+	  gfc_char_t *dest, *src;
+
+	  n = 0;
+	  c = gfc_constructor_first (e->value.constructor);
+	  len = c->expr->value.character.length;
+	  
+	  for ( ; c; c = gfc_constructor_next (c))
+	n += len;
+
+	  r = gfc_get_character_expr (e->ts.kind, &e->where, NULL, n);
+	  dest = r->value.character.string;
+
+	  for (c = gfc_constructor_first (e->value.constructor);
+	 c; c = gfc_constructor_next (c))
+	{
+	  src = c->expr->value.character.string;
+	  for (gfc_charlen_t i = 0 ; i < len; i++)
+		*dest++ = *src++;
+	}
+
+	  gfc_replace_expr (e, r);
+	  return true;
+	}
+}
+
   /* If e's rank is zero and e is not an element of an array, it should be
  of integer or character type.  The integer variable should be
  ASSIGNED.  */
! { dg-do  run }
! PR fortran/66709
! Check that parameter formats are handled correctly.
! Original test case by Gerhard Steinmetz.
program main
  character(len=2), dimension(9), parameter :: f = ['("','He','ll','lo',', ','wo','rl','d!','")']
  character(len=2), dimension(9) :: g = ['("','He','ll','lo',', ','wo','rl','d!','")']
  character (len=20) :: line
  write (unit=line,fmt=f)
  if (line /= "Helllo, world!") STOP 1
  line = " "
  write (unit=line,fmt=g)
  if (line /= "Helllo, world!") STOP 2
end program main


Re: [Patch, fortran] PR84931 - Expansion of array constructor with constant implied-do-object goes sideways

2018-03-25 Thread Thomas König

Hi Paul,


Bootstraps and regtests on FC27/x86_64 - OK for trunk, 7- and 6-branches?


OK, and thanks for catching these extra cases!

In general, I think we should not modifying original test case unless
it is necessary, so I would prefer if you could add the extra tests
to a separate test case.

Regards

Thomas


Re: [C++ Patch] Fix confusing diagnostics for invalid overrides

2018-03-25 Thread Paolo Carlini
Hi Volker

> On 25 Mar 2018, at 16:18, Volker Reichelt  wrote:
> 
> Hi,
> 
> when overriding a virtual function fails, the C++ front-end usually
> emits two errors: one for the override that fails and one for the
> function that is overridden. The second error is confusing and
> should be replaced by a note to be in line with other diagnostics.
> 
> The attached patch just does that: It replaces the error/error pattern
> by an error/inform pattern in search.c (check_final_overrider). And it
> replaces the affected dg-error marks in the testsuite by dg-message.

Since you are correctly using DECL_SOURCE_LOCATION, I would recommend removing 
the ‘+’ modifiers, which in that case are redundant anyway and are known be a 
little cryptic and even causing tricky bugs together with warnings.

Cheers,
Paolo


Re: [patch, fortran] Fix character parameter arrays as formats

2018-03-25 Thread Jerry DeLisle

On 03/25/2018 09:11 AM, Thomas Koenig wrote:

Hello world,

the attached pach fixes the PR by creating one single big string
from a parameter array.

OK for trunk?


Nice, you put it right where I thought it should go in resolution.

Yes, OK,

Thanks

Jerry


Re: [C++ Patch] Fix confusing diagnostics for invalid overrides

2018-03-25 Thread Paolo Carlini


... oh, please also double check that with 'F' you don't need the general 
location_of instead of D_S_L, which normally goes with 'D' - I don't have my 
machines at hand to do it myself, sorry.

Paolo


Re: [C++ Patch] Fix confusing diagnostics for invalid overrides

2018-03-25 Thread Paolo Carlini

On 25/03/2018 21:08, Paolo Carlini wrote:

... oh, please also double check that with 'F' you don't need the general 
location_of instead of D_S_L, which normally goes with 'D' - I don't have my 
machines at hand to do it myself, sorry.

Just checked, DECL_SOURCE_LOCATION is fine.

Paolo.


Re: [C++ Patch] Fix confusing diagnostics for invalid overrides

2018-03-25 Thread Volker Reichelt

On 03/25/2018 08:48 PM, Paolo Carlini wrote:

Hi Volker


On 25 Mar 2018, at 16:18, Volker Reichelt  wrote:

Hi,

when overriding a virtual function fails, the C++ front-end usually
emits two errors: one for the override that fails and one for the
function that is overridden. The second error is confusing and
should be replaced by a note to be in line with other diagnostics.

The attached patch just does that: It replaces the error/error pattern
by an error/inform pattern in search.c (check_final_overrider). And it
replaces the affected dg-error marks in the testsuite by dg-message.

Since you are correctly using DECL_SOURCE_LOCATION, I would recommend removing 
the ‘+’ modifiers, which in that case are redundant anyway and are known be a 
little cryptic and even causing tricky bugs together with warnings.

Cheers,
Paolo

Thanks, Paolo.
Below is an updated patch without the redundant "+" modifiers.

On 03/26/2018 12:33 AM, Paolo Carlini wrote:

On 25/03/2018 21:08, Paolo Carlini wrote:
... oh, please also double check that with 'F' you don't need the 
general location_of instead of D_S_L, which normally goes with 'D' - 
I don't have my machines at hand to do it myself, sorry.

Just checked, DECL_SOURCE_LOCATION is fine.

Paolo.


I also checked that DECL_SOURCE_LOCATION with %qF is OK.
In all the other places in the C++ frontend where %q#F or %qF is
used, DECL_SOURCE_LOCATION() is used for the corresponding argument:

  call.c (joust)
  decl.c (wrapup_namespace_globals)
  decl.c (check_redeclaration_exception_specification)
  method.c (maybe_explain_implicit_delete)

I also checked the output for that specific case manually.

Bootstrapped and regtested on x86_64-pc-linux-gnu.
OK for trunk?

Regards,
Volker


2018-03-25  Volker Reichelt  

    * search.c (check_final_overrider): Use inform instead of error
    for the diagnostics of the overridden functions.

Index: gcc/cp/search.c
===
--- gcc/cp/search.c    (revision 258835)
+++ gcc/cp/search.c    (working copy)
@@ -1918,12 +1918,12 @@
   if (fail == 1)
 {
   error ("invalid covariant return type for %q+#D", overrider);
-      error ("  overriding %q+#D", basefn);
+      inform (DECL_SOURCE_LOCATION (basefn), "  overriding %q#D", basefn);
 }
   else
 {
   error ("conflicting return type specified for %q+#D", overrider);
-      error ("  overriding %q+#D", basefn);
+      inform (DECL_SOURCE_LOCATION (basefn), "  overriding %q#D", basefn);
 }
   DECL_INVALID_OVERRIDER_P (overrider) = 1;
   return 0;
@@ -1938,7 +1938,7 @@
   if (!comp_except_specs (base_throw, over_throw, ce_derived))
 {
   error ("looser throw specifier for %q+#F", overrider);
-  error ("  overriding %q+#F", basefn);
+  inform (DECL_SOURCE_LOCATION (basefn), "  overriding %q#F", basefn);
   DECL_INVALID_OVERRIDER_P (overrider) = 1;
   return 0;
 }
@@ -1950,7 +1950,7 @@
   && !tx_safe_fn_type_p (over_type))
 {
   error ("conflicting type attributes specified for %q+#D", 
overrider);

-  error ("  overriding %q+#D", basefn);
+  inform (DECL_SOURCE_LOCATION (basefn), "  overriding %q#D", basefn);
   DECL_INVALID_OVERRIDER_P (overrider) = 1;
   return 0;
 }
@@ -1975,13 +1975,15 @@
   if (DECL_DELETED_FN (overrider))
 {
   error ("deleted function %q+D", overrider);
-      error ("overriding non-deleted function %q+D", basefn);
+      inform (DECL_SOURCE_LOCATION (basefn),
+          "overriding non-deleted function %qD", basefn);
   maybe_explain_implicit_delete (overrider);
 }
   else
 {
   error ("non-deleted function %q+D", overrider);
-      error ("overriding deleted function %q+D", basefn);
+      inform (DECL_SOURCE_LOCATION (basefn),
+          "overriding deleted function %qD", basefn);
 }
   return 0;
 }
@@ -1988,7 +1990,8 @@
   if (DECL_FINAL_P (basefn))
 {
   error ("virtual function %q+D", overrider);
-  error ("overriding final function %q+D", basefn);
+  inform (DECL_SOURCE_LOCATION (basefn),
+      "overriding final function %qD", basefn);
   return 0;
 }
   return 1;
===

2018-03-25  Volker Reichelt  

    * g++.dg/cpp0x/defaulted2.C: Use dg-message instead of dg-error
    for the diagnostics of overridden functions.
    * g++.dg/cpp0x/implicit1.C: Likewise.
    * g++.dg/cpp0x/override1.C: Likewise.
    * g++.dg/eh/shadow1.C: Likewise.
    * g++.dg/inherit/covariant12.C: Likewise.
    * g++.dg/inherit/covariant14.C: Likewise.
    * g++.dg/inherit/covariant15.C: Likewise.
    * g++.dg/inherit/covariant16.C: Likewise.
    * g++.dg/inherit/crash3.C: Likewise.
    * g++.dg/inherit/error2.C: Likewise.
    * g++.dg/template/crash100.C: Likewise.
    * g++.old-deja/g++.eh/spec6.C: Likewise.
    * g++.old-deja/g++.mike/p811.C: Likewise.
    * g++.old-deja/g++.other/virtual11.C: Likewise.