This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [bootstrap-O3,fortran] silence warning in simplify_transformation_to_array
On 6 January 2017 at 12:39, Richard Biener <richard.guenther@gmail.com> wrote:
> On January 6, 2017 11:21:44 AM GMT+01:00, Jakub Jelinek <jakub@redhat.com> wrote:
>>On Fri, Jan 06, 2017 at 09:34:46AM +0100, Christophe Lyon wrote:
>>> I makes my aarch64*linux* and arm*linux* builds for fail, because:
>>> gcc/fortran/simplify.c:613: error: #pragma GCC diagnostic not allowed
>>> inside functions
>>> gcc/fortran/simplify.c:620: error: #pragma GCC diagnostic not allowed
>>> inside functions
>>> gcc/fortran/simplify.c:624: error: #pragma GCC diagnostic not allowed
>>> inside functions
>>>
>>> My host compiler is RHEL6's, that is 4.4.7....
>>>
>>> I'm not sure what current minimum gcc version is required to build
>>gcc?
>>
>>So, do we want something like (untested) following patch then, so that
>>we
>>use the pragmas only on recent GCC versions?
>
> Works for me.
>
Me too.
> Richard.
>
>>2017-01-06 Jakub Jelinek <jakub@redhat.com>
>>
>> * system.h (GCC_DIAGNOSTIC_PUSH_IGNORED, GCC_DIAGNOSTIC_POP,
>> GCC_DIAGNOSTIC_STRINGIFY): Define.
>>
>> * simplify.c (simplify_transformation_to_array): Use
>> GCC_DIAGNOSTIC_PUSH_IGNORED and GCC_DIAGNOSTIC_POP instead of
>> #pragma GCC diagnostic {push,ignored,pop}.
>>
>>--- gcc/system.h.jj 2017-01-01 12:45:36.000000000 +0100
>>+++ gcc/system.h 2017-01-06 11:14:02.576406680 +0100
>>@@ -1140,6 +1140,18 @@ helper_const_non_const_cast (const char
>> #define VALGRIND_FREELIKE_BLOCK(x,y)
>> #endif
>>
>>+/* Macros to temporarily ignore some warnings. */
>>+#if GCC_VERSION >= 6000
>>+#define GCC_DIAGNOSTIC_STRINGIFY(x) #x
>>+#define GCC_DIAGNOSTIC_PUSH_IGNORED(x) \
>>+ _Pragma ("GCC diagnostic push") \
>>+ _Pragma (GCC_DIAGNOSTIC_STRINGIFY (GCC diagnostic ignored #x))
>>+#define GCC_DIAGNOSTIC_POP _Pragma ("GCC diagnostic pop")
>>+#else
>>+#define GCC_DIAGNOSTIC_PUSH_IGNORED(x)
>>+#define GCC_DIAGNOSTIC_POP
>>+#endif
>>+
>>/* In LTO -fwhole-program build we still want to keep the debug
>>functions available
>> for debugger. Mark them as used to prevent removal. */
>> #if (GCC_VERSION > 4000)
>>--- gcc/fortran/simplify.c.jj 2017-01-06 09:23:31.000000000 +0100
>>+++ gcc/fortran/simplify.c 2017-01-06 11:15:01.003630017 +0100
>>@@ -610,18 +610,17 @@ simplify_transformation_to_array (gfc_ex
>> n++;
>> if (n < result->rank)
>> {
>>-#pragma GCC diagnostic push
>> /* If the nested loop is unrolled GFC_MAX_DIMENSIONS
>> times, we'd warn for the last iteration, because the
>> array index will have already been incremented to the
>> array sizes, and we can't tell that this must make
>> the test against result->rank false, because ranks
>> must not exceed GFC_MAX_DIMENSIONS. */
>>-#pragma GCC diagnostic ignored "-Warray-bounds"
>>+ GCC_DIAGNOSTIC_PUSH_IGNORED (-Warray-bounds)
>> count[n]++;
>> base += sstride[n];
>> dest += dstride[n];
>>-#pragma GCC diagnostic pop
>>+ GCC_DIAGNOSTIC_POP
>> }
>> else
>> done = true;
>>
>> Jakub
>
- References:
- Re: [bootstrap-O3,fortran] silence warning in simplify_transformation_to_array
- Re: [bootstrap-O3,fortran] silence warning in simplify_transformation_to_array
- Re: [bootstrap-O3,fortran] silence warning in simplify_transformation_to_array
- Re: [bootstrap-O3,fortran] silence warning in simplify_transformation_to_array
- Re: [bootstrap-O3,fortran] silence warning in simplify_transformation_to_array
- Re: [bootstrap-O3,fortran] silence warning in simplify_transformation_to_array
- Re: [bootstrap-O3,fortran] silence warning in simplify_transformation_to_array
- Re: [bootstrap-O3,fortran] silence warning in simplify_transformation_to_array
- Re: [bootstrap-O3,fortran] silence warning in simplify_transformation_to_array
- Re: [bootstrap-O3,fortran] silence warning in simplify_transformation_to_array
- Re: [bootstrap-O3,fortran] silence warning in simplify_transformation_to_array
- Re: [bootstrap-O3,fortran] silence warning in simplify_transformation_to_array