[Patch, fortran] PR115700 -[12/13 regression] Bogus warning for associate with assumed-length character array

2024-11-01 Thread Paul Richard Thomas
Hi All,

After pushing the patch to fix comment 5 of this PR, I noticed that I had
not taken account of the commented out tests in associate_69.f90. The fix
is trivial, being a minor tweak to yesterday's patch, and has been pushed
as r15-4835- after regtesting. The testcases associate_69.f90 and
associate_70.f90 have been modified accordingly.

Regards

Paul


Re: *PING* [PATCH 0/7] fortran: Inline MINLOC/MAXLOC with DIM [PR90608]

2024-11-01 Thread Mikael Morin

Le 30/10/2024 à 23:00, Harald Anlauf a écrit :


given that Jakub changed lots of whitespace in r15-4624-g50332a4fdd3243,
you may want to rebase your patches onto HEAD of trunk.

May I also suggest to attach the patches instead of mailing them inline?


Hello,

I checked with today's master, didn't see any whitespace issue.  Have 
you encountered any, trying to apply the patches?


My workflow was:
 * save the seven e-mails to an empty directory.
 * git am --scissors /path/to/dir/*
And the seven patches are applied in order without error.

Mikael


Re: [patch, Fortran] Fix -mod(unsigned, unsigned)

2024-11-01 Thread Steve Kargl
On Fri, Nov 01, 2024 at 10:00:29AM +0100, Thomas Koenig wrote:
> 
> during testing, I noticed that parameters of the form
> - mod(u1,u2) were rejected with an unknown type. The fix
> is straightforward, but required an adjustment to another
> test case.
> 
> Regression-tested.  OK for trunk?
> 

Yes.  Thanks for the patch.

-- 
Steve


[patch, Fortran] Fix -mod(unsigned, unsigned)

2024-11-01 Thread Thomas Koenig

Hello world,

during testing, I noticed that parameters of the form
- mod(u1,u2) were rejected with an unknown type. The fix
is straightforward, but required an adjustment to another
test case.

Regression-tested.  OK for trunk?

gcc/fortran/ChangeLog:

* resolve.cc (resolve_operator): Also handle BT_UNSIGNED.

gcc/testsuite/ChangeLog:

* gfortran.dg/unsigned_38.f90: Add -pedantic and adjust error
message.
* gfortran.dg/unsigned_40.f90: New test.diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc
index 565d4aa5fe9..535fa08b13b 100644
--- a/gcc/fortran/resolve.cc
+++ b/gcc/fortran/resolve.cc
@@ -4253,7 +4253,8 @@ resolve_operator (gfc_expr *e)
 case INTRINSIC_UMINUS:
   if (op1->ts.type == BT_INTEGER
 	  || op1->ts.type == BT_REAL
-	  || op1->ts.type == BT_COMPLEX)
+	  || op1->ts.type == BT_COMPLEX
+	  || op1->ts.type == BT_UNSIGNED)
 	{
 	  e->ts = op1->ts;
 	  break;
diff --git a/gcc/testsuite/gfortran.dg/unsigned_38.f90 b/gcc/testsuite/gfortran.dg/unsigned_38.f90
index d549483b269..ac1cfb33aac 100644
--- a/gcc/testsuite/gfortran.dg/unsigned_38.f90
+++ b/gcc/testsuite/gfortran.dg/unsigned_38.f90
@@ -1,6 +1,6 @@
 ! { dg-do compile }
-! { dg-options "-funsigned" }
+! { dg-options "-funsigned -pedantic" }
 program main
   unsigned, parameter :: u = 7u
-  print *,mod(-(u+1u),u) ! { dg-error "Operand of unary numeric operator" }
+  print *,mod(-(u+1u),u) ! { dg-error "Negation of unsigned expression" }
 end program main
diff --git a/gcc/testsuite/gfortran.dg/unsigned_40.f90 b/gcc/testsuite/gfortran.dg/unsigned_40.f90
new file mode 100644
index 000..129fc883f17
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/unsigned_40.f90
@@ -0,0 +1,19 @@
+! { dg-do run }
+! { dg-options "-funsigned" }
+program memain
+  use iso_fortran_env, only : uint8
+  call test1
+  call test2
+contains
+  subroutine test1
+unsigned(uint8) :: nface, nmax
+nface = 12u_1
+nmax = - mod(-nface+1u,nface)
+if (nmax /= 251u_1) error stop 1
+  end subroutine test1
+  subroutine test2
+unsigned(uint8), parameter :: nface = 12u_1
+unsigned(uint8), parameter :: nmax = - mod(-nface+1u,nface)
+if (nmax /= 251u_1) error stop 11
+  end subroutine test2
+end program memain