This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, Fortran] PR64771 - Fix coarray ICE
- From: Rainer Orth <ro at CeBiTec dot Uni-Bielefeld dot DE>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>, Tobias Burnus <burnus at net-b dot de>, gcc-patches <gcc-patches at gcc dot gnu dot org>, gfortran <fortran at gcc dot gnu dot org>, Alessandro Fanfarillo <fanfarillo dot gcc at gmail dot com>
- Date: Tue, 27 Jan 2015 17:09:55 +0100
- Subject: Re: [Patch, Fortran] PR64771 - Fix coarray ICE
- Authentication-results: sourceware.org; auth=none
- References: <54C3D2A0 dot 5090905 at net-b dot de> <20150124201153 dot GA83897 at troutmask dot apl dot washington dot edu> <ydd7fw8l1d6 dot fsf at lokon dot CeBiTec dot Uni-Bielefeld dot DE> <20150127145851 dot GH1746 at tucnak dot redhat dot com>
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