[Bug fortran/104649] ICE in gfc_match_formal_arglist, at fortran/decl.cc:6733 since r6-1958-g4668d6f9c00d4767

2023-10-27 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104649

anlauf at gcc dot gnu.org changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED
   Target Milestone|--- |14.0

--- Comment #8 from anlauf at gcc dot gnu.org ---
Fixed in gcc-14.  Closing.

Thanks for the report!

[Bug fortran/104649] ICE in gfc_match_formal_arglist, at fortran/decl.cc:6733 since r6-1958-g4668d6f9c00d4767

2023-10-27 Thread sgk at troutmask dot apl.washington.edu via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104649

--- Comment #7 from Steve Kargl  ---
On Fri, Oct 27, 2023 at 05:18:02PM +, cvs-commit at gcc dot gnu.org wrote:
> 
> 
> commit r14-4983-gc6430d3e6d3279c7e4be9d189031a17bb3dec347
> Author: Harald Anlauf 
> Date:   Thu Oct 26 22:32:35 2023 +0200
> 

Thanks for taking care of this issue.  Sorry about missing
the second case, and good catch.

[Bug fortran/104649] ICE in gfc_match_formal_arglist, at fortran/decl.cc:6733 since r6-1958-g4668d6f9c00d4767

2023-10-27 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104649

--- Comment #6 from CVS Commits  ---
The master branch has been updated by Harald Anlauf :

https://gcc.gnu.org/g:c6430d3e6d3279c7e4be9d189031a17bb3dec347

commit r14-4983-gc6430d3e6d3279c7e4be9d189031a17bb3dec347
Author: Harald Anlauf 
Date:   Thu Oct 26 22:32:35 2023 +0200

Fortran: diagnostics of MODULE PROCEDURE declaration conflicts [PR104649]

gcc/fortran/ChangeLog:

PR fortran/104649
* decl.cc (gfc_match_formal_arglist): Handle conflicting
declarations
of a MODULE PROCEDURE when one of the declarations is an alternate
return.

gcc/testsuite/ChangeLog:

PR fortran/104649
* gfortran.dg/pr104649.f90: New test.

Co-authored-by: Steven G. Kargl 

[Bug fortran/104649] ICE in gfc_match_formal_arglist, at fortran/decl.cc:6733 since r6-1958-g4668d6f9c00d4767

2023-10-26 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104649

anlauf at gcc dot gnu.org changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |anlauf at gcc dot 
gnu.org

--- Comment #5 from anlauf at gcc dot gnu.org ---
Submitted: https://gcc.gnu.org/pipermail/fortran/2023-October/059872.html

[Bug fortran/104649] ICE in gfc_match_formal_arglist, at fortran/decl.cc:6733 since r6-1958-g4668d6f9c00d4767

2023-10-24 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104649

anlauf at gcc dot gnu.org changed:

   What|Removed |Added

 CC||anlauf at gcc dot gnu.org

--- Comment #4 from anlauf at gcc dot gnu.org ---
Created attachment 56194
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56194=edit
Extension of Steve's patch

The logic needs to take care of 3 situations instead of only 2.
Steve's patch was almost technically correct...

Not sure if the error messages need more tweaking.

[Bug fortran/104649] ICE in gfc_match_formal_arglist, at fortran/decl.cc:6733 since r6-1958-g4668d6f9c00d4767

2023-07-09 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104649

--- Comment #3 from Paul Thomas  ---
(In reply to kargl from comment #2)
> Null pointer dereference.
> 
> 
> diff --git a/gcc/fortran/decl.cc b/gcc/fortran/decl.cc
> index bd586e75008..8e2cd511c4d 100644
> --- a/gcc/fortran/decl.cc
> +++ b/gcc/fortran/decl.cc
> @@ -6730,12 +6730,20 @@ ok:
> || (p->next == NULL && q->next != NULL))
>   arg_count_mismatch = true;
> else if ((p->sym == NULL && q->sym == NULL)
> - || strcmp (p->sym->name, q->sym->name) == 0)
> + || (p->sym && q->sym
> + && strcmp (p->sym->name, q->sym->name) == 0))
>   continue;
> else
> - gfc_error_now ("Mismatch in MODULE PROCEDURE formal "
> -"argument names (%s/%s) at %C",
> -p->sym->name, q->sym->name);
> + {
> +   if (q->sym)
> + gfc_error_now ("Mismatch in MODULE PROCEDURE formal "
> + "argument names (%qs/%qs) at %C",
> + p->sym->name, q->sym->name);
> +   else
> + gfc_error_now ("Mismatch in MODULE PROCEDURE formal argument "
> + "name, %qs, and alternate return at %C",
> + p->sym->name);
> + }
>   }
>  
>if (arg_count_mismatch)

The second testcase still segfaults and everything is so optimised away that I
cannot figure out why.

Paul

[Bug fortran/104649] ICE in gfc_match_formal_arglist, at fortran/decl.cc:6733 since r6-1958-g4668d6f9c00d4767

2022-05-17 Thread kargl at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104649

kargl at gcc dot gnu.org changed:

   What|Removed |Added

 CC||kargl at gcc dot gnu.org
   Priority|P3  |P4

--- Comment #2 from kargl at gcc dot gnu.org ---
Null pointer dereference.


diff --git a/gcc/fortran/decl.cc b/gcc/fortran/decl.cc
index bd586e75008..8e2cd511c4d 100644
--- a/gcc/fortran/decl.cc
+++ b/gcc/fortran/decl.cc
@@ -6730,12 +6730,20 @@ ok:
  || (p->next == NULL && q->next != NULL))
arg_count_mismatch = true;
  else if ((p->sym == NULL && q->sym == NULL)
-   || strcmp (p->sym->name, q->sym->name) == 0)
+   || (p->sym && q->sym
+   && strcmp (p->sym->name, q->sym->name) == 0))
continue;
  else
-   gfc_error_now ("Mismatch in MODULE PROCEDURE formal "
-  "argument names (%s/%s) at %C",
-  p->sym->name, q->sym->name);
+   {
+ if (q->sym)
+   gfc_error_now ("Mismatch in MODULE PROCEDURE formal "
+   "argument names (%qs/%qs) at %C",
+   p->sym->name, q->sym->name);
+ else
+   gfc_error_now ("Mismatch in MODULE PROCEDURE formal argument "
+   "name, %qs, and alternate return at %C",
+   p->sym->name);
+   }
}

   if (arg_count_mismatch)

[Bug fortran/104649] ICE in gfc_match_formal_arglist, at fortran/decl.cc:6733 since r6-1958-g4668d6f9c00d4767

2022-02-24 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104649

Martin Liška  changed:

   What|Removed |Added

Summary|ICE in  |ICE in
   |gfc_match_formal_arglist,   |gfc_match_formal_arglist,
   |at fortran/decl.cc:6733 |at fortran/decl.cc:6733
   ||since
   ||r6-1958-g4668d6f9c00d4767
 CC||marxin at gcc dot gnu.org,
   ||pault at gcc dot gnu.org
 Status|UNCONFIRMED |NEW
 Ever confirmed|0   |1
   Last reconfirmed||2022-02-24

--- Comment #1 from Martin Liška  ---
Started with r6-1958-g4668d6f9c00d4767.