Hi Tobias!

On 2025-02-17T19:49:43+0100, Tobias Burnus <tbur...@baylibre.com> wrote:
> OpenMP/Fortran: extend 'adjust_args' clause, fixes for it and declare variant 
> [PR115271]

The OG14 "cherry-pick" of this apparently has some different code at
least in one place; trunk code:

> --- a/gcc/fortran/openmp.cc
> +++ b/gcc/fortran/openmp.cc

> @@ -6766,32 +6766,160 @@ gfc_match_omp_declare_variant (void)

> +           if (!p->expr && gfc_match ("omp_num_args") == MATCH_YES)
> +             {
> +               if (!have_range)
> +                 p->u.adj_args.range_start = need_range = true;
> +               else
> +                 need_range = false;
> +
> +               locus saved_loc2 = gfc_current_locus;
> +               gfc_gobble_whitespace ();
> +               char c = gfc_peek_ascii_char ();
> +               if (c == '+' || c == '-')
> +                 {
> +                   if (gfc_match ("+ %e", &p->expr) == MATCH_YES)
> +                     p->u.adj_args.omp_num_args_plus = true;
> +                   else if (gfc_match ("- %e", &p->expr) == MATCH_YES)
> +                     p->u.adj_args.omp_num_args_minus = true;
> +                   else if (!gfc_error_check ())
> +                     {
> +                       gfc_error ("expected constant integer expression "
> +                                  "at %C");
> +                       p->u.adj_args.error_p = true;
> +                       return MATCH_ERROR;
> +                     }
> +                   p->where = gfc_get_location_range (&saved_loc, 1,
> +                                                      &saved_loc, 1,
> +                                                      &gfc_current_locus);
> +                 }
> +               else
> +                 {
> +                   p->where = gfc_get_location_range (&saved_loc, 1,
> +                                                      &saved_loc, 1,
> +                                                      &saved_loc2);

OG14 doesn't ever use 'saved_loc2', and therefore
'error: variable ‘saved_loc2’ set but not used 
[-Werror=unused-but-set-variable]'.
Pushed to OG14 branch commit f2ab2de88082d8c52bded3725aa78610085e072c
"OpenMP/Fortran: extend 'adjust_args' clause, fixes for it and declare variant 
[PR115271]: avoid 'error: variable ‘saved_loc2’ set but not used 
[-Werror=unused-but-set-variable]'",
see attached.


Grüße
 Thomas


>From f2ab2de88082d8c52bded3725aa78610085e072c Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <tschwi...@baylibre.com>
Date: Sun, 23 Feb 2025 10:34:39 +0100
Subject: [PATCH] =?UTF-8?q?OpenMP/Fortran:=20extend=20'adjust=5Fargs'=20cl?=
 =?UTF-8?q?ause,=20fixes=20for=20it=20and=20declare=20variant=20[PR115271]?=
 =?UTF-8?q?:=20avoid=20'error:=20variable=20=E2=80=98saved=5Floc2=E2=80=99?=
 =?UTF-8?q?=20set=20but=20not=20used=20[-Werror=3Dunused-but-set-variable]?=
 =?UTF-8?q?'?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

    [...]/source-gcc/gcc/fortran/openmp.cc: In function ‘match gfc_match_omp_declare_variant()’:
    [...]/source-gcc/gcc/fortran/openmp.cc:7127:25: error: variable ‘saved_loc2’ set but not used [-Werror=unused-but-set-variable]
     7127 |                   locus saved_loc2 = gfc_current_locus;
          |                         ^~~~~~~~~~

Fix-up for OG14 commit e0246616020e95e74afa9d504c8848e6e905fab4
"OpenMP/Fortran: extend 'adjust_args' clause, fixes for it and declare variant [PR115271]".

	PR fortran/115271
	gcc/fortran/
	* openmp.cc (gfc_match_omp_declare_variant): Remove
	'locus saved_loc2'.
---
 gcc/fortran/openmp.cc | 1 -
 1 file changed, 1 deletion(-)

diff --git a/gcc/fortran/openmp.cc b/gcc/fortran/openmp.cc
index 16b255ec1062..421e5276d339 100644
--- a/gcc/fortran/openmp.cc
+++ b/gcc/fortran/openmp.cc
@@ -7124,7 +7124,6 @@ gfc_match_omp_declare_variant (void)
 		  else
 		    need_range = false;
 
-		  locus saved_loc2 = gfc_current_locus;
 		  gfc_gobble_whitespace ();
 		  char c = gfc_peek_ascii_char ();
 		  if (c == '+' || c == '-')
-- 
2.45.2

Reply via email to