[Bug fortran/118789] [15 Regression] ICE in gfc_add_modify_loc, at fortran/trans.cc:229

2025-02-27 Thread vehre at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118789

Andre Vehreschild  changed:

   What|Removed |Added

 Status|WAITING |RESOLVED
 Resolution|--- |FIXED

[Bug fortran/118789] [15 Regression] ICE in gfc_add_modify_loc, at fortran/trans.cc:229

2025-02-27 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118789

--- Comment #9 from GCC Commits  ---
The master branch has been updated by Andre Vehreschild :

https://gcc.gnu.org/g:0fc1abcc46ecc34e8d2d7ec7167656ede2cd5690

commit r15-7726-g0fc1abcc46ecc34e8d2d7ec7167656ede2cd5690
Author: Andre Vehreschild 
Date:   Tue Feb 25 17:15:47 2025 +0100

Fortran: Fix ICE on associate of pointer [PR118789]

Fix ICE when associating a pointer to void (c_ptr) by looking at the
compatibility of the type hierarchy.

PR fortran/118789

gcc/fortran/ChangeLog:

* trans-stmt.cc (trans_associate_var): Compare pointed to types
when
expr to associate is already a pointer.

gcc/testsuite/ChangeLog:

* gfortran.dg/associate_73.f90: New test.

[Bug fortran/118789] [15 Regression] ICE in gfc_add_modify_loc, at fortran/trans.cc:229

2025-02-26 Thread vehre at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118789

Andre Vehreschild  changed:

   What|Removed |Added

 CC||vehre at gcc dot gnu.org
 Status|NEW |WAITING

--- Comment #8 from Andre Vehreschild  ---
Waiting for review of
https://gcc.gnu.org/pipermail/fortran/2025-February/061788.html

[Bug fortran/118789] [15 Regression] ICE in gfc_add_modify_loc, at fortran/trans.cc:229

2025-02-16 Thread kargls at comcast dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118789

--- Comment #7 from kargls at comcast dot net ---
(In reply to Jerry DeLisle from comment #6)
> Steve have you had a closer look at this one?

I did watch f951 in gdb with the code in comment #3, but I could not
find where to avoid an ICE.  The simple non-bind(c) code that looks
like comment #3 compiles without a problem:

  module fckit_C_interop_module

implicit none

type foo
  integer i
end type foo

CONTAINS

subroutine bar(cptr)
   type(foo), value :: cptr
   associate(unused => cptr)
   end associate
end
  end module

I haven't had time to read F2023 standard to check if there are
any (special) requirements for a bind(c) variable as a selector.

[Bug fortran/118789] [15 Regression] ICE in gfc_add_modify_loc, at fortran/trans.cc:229

2025-02-16 Thread jvdelisle at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118789

Jerry DeLisle  changed:

   What|Removed |Added

 CC||jvdelisle at gcc dot gnu.org

--- Comment #6 from Jerry DeLisle  ---
Steve have you had a closer look at this one?

[Bug fortran/118789] [15 Regression] ICE in gfc_add_modify_loc, at fortran/trans.cc:229

2025-02-10 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118789

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P4

[Bug fortran/118789] [15 Regression] ICE in gfc_add_modify_loc, at fortran/trans.cc:229

2025-02-09 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118789

Andrew Pinski  changed:

   What|Removed |Added

 CC||pinskia at gcc dot gnu.org

--- Comment #5 from Andrew Pinski  ---
This blocks trying to build atlas-ecmwf .

[Bug fortran/118789] [15 Regression] ICE in gfc_add_modify_loc, at fortran/trans.cc:229

2025-02-07 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118789

Andrew Pinski  changed:

   What|Removed |Added

   Target Milestone|--- |15.0

[Bug fortran/118789] [15 Regression] ICE in gfc_add_modify_loc, at fortran/trans.cc:229

2025-02-07 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118789

Andrew Pinski  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Ever confirmed|0   |1
   Last reconfirmed||2025-02-07

--- Comment #4 from Andrew Pinski  ---
.

[Bug fortran/118789] [15 Regression] ICE in gfc_add_modify_loc, at fortran/trans.cc:229

2025-02-07 Thread kargls at comcast dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118789

kargls at comcast dot net changed:

   What|Removed |Added

 CC||kargls at comcast dot net

--- Comment #3 from kargls at comcast dot net ---
Reduced testcase.

module fckit_C_interop_module

   implicit none

   CONTAINS

   subroutine fckit_c_nodelete(cptr) bind(c)
  use, intrinsic :: iso_c_binding
  type(c_ptr), value :: cptr
  associate( unused_ => cptr ); end associate
   end subroutine

end module

[Bug fortran/118789] [15 Regression] ICE in gfc_add_modify_loc, at fortran/trans.cc:229

2025-02-07 Thread sjames at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118789

--- Comment #2 from Sam James  ---
Created attachment 60416
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=60416&action=edit
fckit_C_interop.F90.fii.xz

```
$ gfortran -c fckit_C_interop.F90.fii
/tmp/fckit/src/fckit/module/fckit_C_interop.F90:80:31:

   80 |   FCKIT_SUPPRESS_UNUSED(cptr)
  |   1
internal compiler error: in gfc_add_modify_loc, at fortran/trans.cc:229
0x5f8d713e03e0 internal_error(char const*, ...)
   
/usr/src/debug/sys-devel/gcc-15.0./gcc-15.0./gcc/diagnostic-global-context.cc:517
0x5f8d713e057b fancy_abort(char const*, int, char const*)
   
/usr/src/debug/sys-devel/gcc-15.0./gcc-15.0./gcc/diagnostic.cc:1722
0x5f8d709a0746 gfc_add_modify_loc(unsigned long, stmtblock_t*, tree_node*,
tree_node*)
   
/usr/src/debug/sys-devel/gcc-15.0./gcc-15.0./gcc/fortran/trans.cc:229
0x5f8d709a0746 gfc_add_modify(stmtblock_t*, tree_node*, tree_node*)
   
/usr/src/debug/sys-devel/gcc-15.0./gcc-15.0./gcc/fortran/trans.cc:241
0x5f8d721f826d trans_associate_var
   
/usr/src/debug/sys-devel/gcc-15.0./gcc-15.0./gcc/fortran/trans-stmt.cc:2294
0x5f8d721fa3bf gfc_trans_block_construct(gfc_code*)
   
/usr/src/debug/sys-devel/gcc-15.0./gcc-15.0./gcc/fortran/trans-stmt.cc:2478
0x5f8d720b4727 trans_code
   
/usr/src/debug/sys-devel/gcc-15.0./gcc-15.0./gcc/fortran/trans.cc:2434
0x5f8d72139095 gfc_trans_code(gfc_code*)
   
/usr/src/debug/sys-devel/gcc-15.0./gcc-15.0./gcc/fortran/trans.cc:2698
0x5f8d72139095 gfc_generate_function_code(gfc_namespace*)
   
/usr/src/debug/sys-devel/gcc-15.0./gcc-15.0./gcc/fortran/trans-decl.cc:8087
0x5f8d720c8591 gfc_generate_module_code(gfc_namespace*)
   
/usr/src/debug/sys-devel/gcc-15.0./gcc-15.0./gcc/fortran/trans.cc:2765
0x5f8d7202b015 translate_all_program_units
   
/usr/src/debug/sys-devel/gcc-15.0./gcc-15.0./gcc/fortran/parse.cc:7365
0x5f8d7202b015 gfc_parse_file()
   
/usr/src/debug/sys-devel/gcc-15.0./gcc-15.0./gcc/fortran/parse.cc:7695
0x5f8d720c7f80 gfc_be_parse_file
   
/usr/src/debug/sys-devel/gcc-15.0./gcc-15.0./gcc/fortran/f95-lang.cc:241
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.
```

[Bug fortran/118789] [15 Regression] ICE in gfc_add_modify_loc, at fortran/trans.cc:229

2025-02-07 Thread sjames at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118789

Sam James  changed:

   What|Removed |Added

 CC||sjames at gcc dot gnu.org

--- Comment #1 from Sam James  ---
```
cd /tmp
git clone https://github.com/ecmwf/fckit
FFLAGS="-O2" CFLAGS="-O2" CXXFLAGS="-O2" cmake -B build -S .
make -C build
```

```
cd /tmp/fckit/build/src/fckit && /usr/bin/gfortran -Dfckit_EXPORTS
-I/tmp/fckit/build/src/fckit -I/tmp/fckit/src -I/tmp/fckit/build/src
-I/tmp/fckit/build/module -O2 -flto=jobserver -O2 -g -DNDEBUG -J../../module
-fPIC -fdiagnostics-color=always -c
/tmp/fckit/src/fckit/module/fckit_C_interop.F90 -o
CMakeFiles/fckit.dir/module/fckit_C_interop.F90.o
/tmp/fckit/src/fckit/module/fckit_C_interop.F90:80:31:

   80 |   FCKIT_SUPPRESS_UNUSED(cptr)
  |   1
internal compiler error: in gfc_add_modify_loc, at fortran/trans.cc:229
0x6420295e93e0 internal_error(char const*, ...)
   
/usr/src/debug/sys-devel/gcc-15.0./gcc-15.0./gcc/diagnostic-global-context.cc:517
0x6420295e957b fancy_abort(char const*, int, char const*)
   
/usr/src/debug/sys-devel/gcc-15.0./gcc-15.0./gcc/diagnostic.cc:1722
0x642028ba9746 gfc_add_modify_loc(unsigned long, stmtblock_t*, tree_node*,
tree_node*)
   
/usr/src/debug/sys-devel/gcc-15.0./gcc-15.0./gcc/fortran/trans.cc:229
0x642028ba9746 gfc_add_modify(stmtblock_t*, tree_node*, tree_node*)
   
/usr/src/debug/sys-devel/gcc-15.0./gcc-15.0./gcc/fortran/trans.cc:241
0x64202a40126d trans_associate_var
   
/usr/src/debug/sys-devel/gcc-15.0./gcc-15.0./gcc/fortran/trans-stmt.cc:2294
0x64202a4033bf gfc_trans_block_construct(gfc_code*)
   
/usr/src/debug/sys-devel/gcc-15.0./gcc-15.0./gcc/fortran/trans-stmt.cc:2478
0x64202a2bd727 trans_code
   
/usr/src/debug/sys-devel/gcc-15.0./gcc-15.0./gcc/fortran/trans.cc:2434
0x64202a342095 gfc_trans_code(gfc_code*)
   
/usr/src/debug/sys-devel/gcc-15.0./gcc-15.0./gcc/fortran/trans.cc:2698
0x64202a342095 gfc_generate_function_code(gfc_namespace*)
   
/usr/src/debug/sys-devel/gcc-15.0./gcc-15.0./gcc/fortran/trans-decl.cc:8087
0x64202a2d1591 gfc_generate_module_code(gfc_namespace*)
   
/usr/src/debug/sys-devel/gcc-15.0./gcc-15.0./gcc/fortran/trans.cc:2765
0x64202a234015 translate_all_program_units
   
/usr/src/debug/sys-devel/gcc-15.0./gcc-15.0./gcc/fortran/parse.cc:7365
0x64202a234015 gfc_parse_file()
   
/usr/src/debug/sys-devel/gcc-15.0./gcc-15.0./gcc/fortran/parse.cc:7695
0x64202a2d0f80 gfc_be_parse_file
   
/usr/src/debug/sys-devel/gcc-15.0./gcc-15.0./gcc/fortran/f95-lang.cc:241
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.
make[2]: *** [src/fckit/CMakeFiles/fckit.dir/build.make:131:
src/fckit/CMakeFiles/fckit.dir/module/fckit_C_interop.F90.o] Error 1
make[2]: Leaving directory '/tmp/fckit/build'
make[1]: *** [CMakeFiles/Makefile2:1207: src/fckit/CMakeFiles/fckit.dir/all]
Error 2
make: *** [Makefile:166: all] Error 2
```