This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, Fortran] PR64771 - Fix coarray ICE


Jakub Jelinek <jakub@redhat.com> writes:

>> The problem is (as so often) that <algorithm> was included *before*
>> config.h.  Moving it after the other includes allows interface.c to
>> compile without warnings.
>
> Why don't you use MAX macro instead of std::max as everywhere else
> in the gcc sources?

No idea, ask Tobias :-)  Anyway, the original patch would most likely
have worked: system.h already includes <algorithm>.

This one compiles just as well, of course.

	Rainer


2015-01-27  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* interface.c: Remove <algorithm>.
	(check_dummy_characteristics): Use MAX instead of std::max.

# HG changeset patch
# Parent a742f8ce2a00e481ddf92dbecaf8d1ee01448911
Avoid std::max

diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -63,8 +63,6 @@ along with GCC; see the file COPYING3.  
    formal argument list points to symbols within the same namespace as
    the program unit name.  */
 
-#include <algorithm>  /* For std::max.  */
-
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
@@ -1215,7 +1213,7 @@ check_dummy_characteristics (gfc_symbol 
 	}
 
       if (s1->as->type == AS_EXPLICIT)
-	for (i = 0; i < s1->as->rank + std::max(0, s1->as->corank-1); i++)
+	for (i = 0; i < s1->as->rank + MAX (0, s1->as->corank-1); i++)
 	  {
 	    shape1 = gfc_subtract (gfc_copy_expr (s1->as->upper[i]),
 				  gfc_copy_expr (s1->as->lower[i]));
-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]